:root {
  color-scheme: light;
  --paper: #f5f5f7;
  --sheet: #fff;
  --ink: #1d1d1f;
  --muted: #64646d;
  --rule: #e7e7ec;
  --accent: #0066cc;
  --soft: #e9f2fd;
  --warn: #a42b23;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100svh; }
a { color: inherit; text-underline-offset: .22em; }
button, input, select, textarea { font: inherit; color: inherit; }
button, input, select, textarea { min-height: 42px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); padding: 8px 12px; }
button { cursor: pointer; white-space: normal; }
button:hover { border-color: var(--accent); }
button:disabled { cursor: wait; opacity: .64; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input[type=checkbox] { margin: 0; min-height: 0; width: 19px; height: 19px; accent-color: var(--accent); flex: none; }
textarea { min-height: 124px; resize: vertical; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(48px, 7vw, 80px); font-weight: 700; line-height: 1.1; letter-spacing: -.045em; }
h2 { font-size: 23px; letter-spacing: -.025em; }
h3 { font-size: 16px; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ghost { background: transparent; border-color: transparent; }
.danger { color: var(--warn); }
.muted, small { color: var(--muted); }
.login { width: min(420px, calc(100% - 40px)); margin: max(48px, 16vh) auto 40px; border-top: 1px solid var(--rule); padding: 28px 0; }
.login h1 { margin: 22px 0 40px; }
form { display: grid; gap: 14px; }
label.field, .login label { display: grid; gap: 5px; font-size: 14px; font-weight: 600; }
.field :is(input,textarea,select) { width: 100%; min-width: 0; font-weight: 400; }
.stamp { display: block; width: 28px; height: 28px; border-radius: 8px; }
.sitebar { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(1080px, calc(100% - 80px)); margin: auto; min-height: 66px; border-bottom: 1px solid var(--rule); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; font-size: 18px; text-decoration: none; white-space: nowrap; }
.sitebar nav { display: flex; align-items: stretch; gap: clamp(8px, 3vw, 34px); align-self: stretch; }
.sitebar nav a { display: grid; place-items: center; padding: 0 5px; text-decoration: none; border-bottom: 2px solid transparent; font-size: 14px; white-space: nowrap; }
.sitebar nav a[aria-current] { border-color: var(--accent); font-weight: 700; }
.capture { display: inline-flex; align-items: center; gap: 4px; }
.capture b { font-size: 20px; line-height: 1; }
#view { width: min(1080px, calc(100% - 80px)); margin: 0 auto; padding: 37px 0 80px; }
.page-title { margin: 0 0 26px; display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.page-title time { display: block; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 22px; padding: clamp(16px, 2.5vw, 26px); min-width: 0; }
.panel h2 { margin-bottom: 12px; }
.next { background: #eef4fd; border-color: #e1eafe; }
.next a { display: inline-block; margin-top: 8px; color: var(--accent); }
.next p { margin-top: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; border-top: 1px solid var(--rule); min-height: 57px; }
.task > label { display: grid; place-items: center; min-height: 44px; width: 30px; cursor: pointer; }
.task-title { text-align: left; padding-inline: 4px; overflow-wrap: anywhere; }
.task-title small { display: block; font-size: 12px; }
.task[data-done=true] .task-title { color: var(--muted); text-decoration: line-through; }
.priority { color: var(--accent); }
.event { display: flex; width: 100%; gap: 9px; text-align: left; align-items: start; margin: 5px 0; background: var(--soft); white-space: normal; overflow-wrap: anywhere; }
.event:hover { background: #e1efff; }
.event time { font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
.day-rhythm { margin-bottom: 14px; }
.note-text { white-space: pre-wrap; }
.entry { padding: 14px 0; border-top: 1px solid var(--rule); }
.entry:first-of-type { margin-top: 8px; }
.entry-meta { color: var(--muted); font-size: 13px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input { flex: 1; min-width: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); border-left: 1px solid var(--rule); border-top: 1px solid var(--rule); }
.day { min-width: 0; min-height: 116px; border: 1px solid var(--rule); border-width: 0 1px 1px 0; background: var(--sheet); padding: 8px; }
.day.rest { background: #f0f3fb; }
.day.holiday { background: #e9f5ef; }
.day.makeup { background: #fbf0e2; }
.day.outside { opacity: .64; }
.day.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.day:has(.event) { min-height: 150px; }
.day-button { min-height: 34px; width: 100%; text-align: left; padding: 4px; }
.calendar.month .day { min-height: 76px; }
.calendar.month .day p { font-size: 11px; margin: 4px; }
.day .event { flex-direction: column; gap: 1px; font-size: 12px; padding: 5px; }
.week-labels { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); text-align: center; color: var(--muted); margin: 16px 0 6px; font-size: 13px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
#editor { background: var(--sheet); color: var(--ink); width: min(600px, calc(100% - 24px)); max-height: 92svh; border: 1px solid var(--rule); border-radius: 14px; padding: 22px; }
#editor::backdrop { background: #1d1d1f77; }
.dialog-header { margin-bottom: 15px; }
.dialog-header h2 { font-size: 23px; letter-spacing: -.025em; }
.dialog-header button { font-size: 20px; }
fieldset { margin: 0; border: 1px solid var(--rule); border-radius: 8px; min-width: 0; }
fieldset legend { color: var(--muted); }
.pick { display: flex; gap: 8px; align-items: start; padding: 7px 0; overflow-wrap: anywhere; }
#notice { position: fixed; z-index: 5; bottom: 18px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 16px; background: var(--ink); color: white; }
@media (max-width: 800px) {
  .sitebar, #view { width: calc(100% - 36px); }
  .sitebar { display: grid; gap: 0; min-height: auto; grid-template-columns: minmax(0, 1fr); }
  .brand { min-height: 56px; }
  .sitebar nav { justify-content: space-between; gap: 0; min-height: 42px; }
  .sitebar nav a { padding: 0 7px; }
  .capture { position: fixed; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 3; min-height: 52px; padding: 10px 16px; box-shadow: 0 6px 18px #0002; }
  #view { padding-top: 24px; }
  .today-grid, .settings-grid { grid-template-columns: 1fr; }
  .page-title { align-items: start; flex-direction: column; }
  .day { padding: 2px; min-height: 58px; }
  .day:has(.event) { min-height: 58px; }
  .day .event { display: none; }
  .calendar.month .day { min-height: 58px; }
  .calendar .day-button { text-align: center; }
  #notice { bottom: 77px; }
}
.mobile-count { display: none; }
@media (max-width: 800px) {
  .mobile-count { display: block; text-align: center; color: var(--accent); font-size: 11px; }
}
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
#notice button { color: white; }
@media (max-width: 800px) { .board-grid { grid-template-columns: 1fr; } }
.event.busy { color: var(--muted); background: #f0f0f3; border: 1px dashed var(--rule); border-radius: 10px; padding: 8px 12px; }
@media (max-width: 800px) { .day .event.busy { display: none; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.subtle { border-color: transparent; border-radius: 999px; color: var(--accent); background: #edf4ff; font-size: 13px; font-weight: 600; }
.subtle:hover { background: #dfedff; border-color: transparent; }
.today-title { margin-bottom: 24px; }
.today-stats { display: flex; gap: 24px; padding-bottom: 4px; align-self: end; }
.today-stats div { display: grid; gap: 1px; min-width: 68px; }
.today-stats div + div { border-left: 1px solid var(--rule); padding-left: 23px; }
.today-stats strong { font-variant-numeric: tabular-nums; font-size: 34px; line-height: 1.05; letter-spacing: -.05em; }
.today-stats span, .timezone { color: var(--muted); font-size: 12px; }
.timeline-panel { margin-bottom: 16px; }
.timeline-panel h2, .chat-header h2, .today-tasks .row h2 { margin: 0; }
.time-axis { padding: 0 10px; margin-top: 18px; }
.time-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.time-scale span { width: 20px; text-align: center; }
.time-scale span:first-child { margin-left: -10px; }
.time-scale span:last-child { margin-right: -10px; }
.time-track { position: relative; isolation: isolate; height: 30px; margin-top: 8px; border-radius: 9px; background: #f0f0f4; }
.time-track::after { position: absolute; z-index: 1; inset: 0; content: ''; background: repeating-linear-gradient(to right, #d0d0dc 0 1px, transparent 1px 12.5%); border-radius: inherit; pointer-events: none; }
.work-interval, .event-interval { position: absolute; border-radius: 5px; }
.work-interval { inset-block: 0; background: #dce9ff; }
.event-interval { inset-block: 5px; background: #4696f0; z-index: 2; }
.busy-interval { background: #adaeb8; }
.now-marker { position: absolute; top: -4px; bottom: -7px; z-index: 3; width: 2px; background: #0066cc; transform: translateX(-50%); }
.now-marker span { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); background: #0066cc; color: #fff; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.now-marker.is-start span { transform: none; }
.now-marker.is-end span { transform: translateX(-100%); }
.timeline-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 12px; margin-top: 34px; }
.timeline-meta span { display: inline-flex; gap: 6px; align-items: center; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.work-dot, .rest-dot { background: #a4c3ef; }
.plan-dot { background: #4696f0; }
.busy-dot { background: #adaeb8; }
.holiday-dot { background: #72b593; }
.makeup-dot { background: #d69c54; }
.timeline-events { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.timeline-events .event { width: auto; align-items: center; }
.chat-panel { display: flex; flex-direction: column; min-height: 328px; }
.chat-header { padding-bottom: 11px; }
.chat-header .ghost { color: var(--accent); font-size: 13px; }
.chat-history { min-height: 140px; max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 3px 2px 12px; }
.chat-intro { display: grid; gap: 7px; padding: 8px 0 3px; }
.chat-intro p { font-size: 19px; font-weight: 650; letter-spacing: -.025em; }
.chat-mark { color: var(--accent); font-size: 24px; line-height: 1; }
.chat-intro button { font-size: 13px; min-height: 36px; border-radius: 999px; margin-top: 5px; }
.chat-message { padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; max-width: 92%; font-size: 14px; }
.chat-message.user { align-self: end; background: #e9f2ff; }
.chat-message.assistant { align-self: start; background: #f3f3f6; }
.chat-form { margin-top: auto; gap: 8px; }
.chat-composer { display: flex; align-items: center; padding: 4px 6px 4px 13px; border: 1px solid var(--rule); border-radius: 16px; background: var(--paper); }
.chat-composer:focus-within { outline: 2px solid #1674d2; outline-offset: 1px; }
.chat-form textarea { flex: 1; min-width: 0; min-height: 47px; max-height: 100px; border: 0; outline: 0; background: none; padding: 11px 6px 6px 0; font-size: 15px; resize: vertical; }
.chat-form textarea:focus-visible { outline: none; }
.chat-send { width: 42px; height: 42px; border-radius: 50%; flex: none; font-size: 21px; line-height: 1; }
.chat-context, .chat-error { font-size: 12px; color: var(--muted); }
.chat-error { color: var(--warn); }
.today-tasks .task-list, .today-tasks .row + .muted { margin-top: 12px; }
.calendar-legend { margin-top: 15px; }
.day-label { display: block; padding-inline: 4px; font-size: 11px; font-weight: 650; color: #334e79; overflow-wrap: anywhere; }
.day.holiday .day-label { color: #215b3e; }
.day.makeup .day-label { color: #7a4d17; }
@media (max-width: 800px) {
  .sitebar { position: static; }
  .today-title { flex-direction: row; align-items: end; gap: 10px; }
  .today-stats { gap: 8px; }
  .today-stats div { min-width: 0; }
  .today-stats div + div { padding-left: 8px; }
  .today-stats strong { font-size: 25px; }
  .today-stats span { font-size: 11px; }
  .timeline-panel .timezone { display: none; }
  .time-scale { font-size: 10px; }
  .day-label { text-align: center; padding: 0; font-size: 10px; }
  .chat-panel { min-height: 0; }
}
