:root {
  --bg: #f5f7fa; --surface: #fff; --text: #202934; --muted: #657181;
  --line: #dfe5ec; --accent: #526b83; --soft: #e9eff5; --danger: #a64238;
  --danger-soft: #fbefec; --accent-strong: #40566d; --accent-pale: #eef3f8;
  --status-warm: #8a6b45; --status-cool: #637f9c;
  --motion-fast: 110ms; --motion-enter: 140ms; --motion-ease: cubic-bezier(.2,.7,.2,1);
  font-family: "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg); font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.65; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; opacity: .55; }
button, a, summary { touch-action: manipulation; }
button:active:not(:disabled) { transform: translateY(1px); }
button, a, summary, input, select, textarea {
  transition: background-color var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #dce7dd; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.4; font-weight: 600; letter-spacing: -.6px; }
h2 { font-size: 20px; font-weight: 500; }
h3 { font-size: 16px; font-weight: 500; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 200px; background: white; padding: 12px; z-index: 99; }
.skip-link:focus { top: 8px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 184px; background: #edf1f5; border-right: 1px solid var(--line); padding: 28px 16px 20px; display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; justify-content: center; }
.brand-mark { width: 56px; height: 56px; flex-shrink: 0; object-fit: cover; border-radius: 50%; }
.nav-caption { padding: 36px 12px 10px; font-size: 11px; color: var(--muted); letter-spacing: 1.5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; width: 100%; padding: 8px 12px; border-radius: 6px; text-align: left; color: var(--muted); margin: 4px 0; white-space: nowrap; }
.nav-item:hover { background: #e5ebf1; color: var(--text); }
.nav-item.active { background: #dce6f0; color: #3f5973; font-weight: 500; }
.nav-count { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.sidebar-bottom { margin-top: auto; padding-top: 32px; }
.sidebar-bottom p { font-size: 11px; line-height: 1.9; color: var(--muted); padding: 20px 8px 0; }
.local-dot { display: inline-block; width: 5px; height: 5px; background: var(--accent); border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.local-hint { padding-left: 12px; }
main { margin-left: 184px; padding: 0 48px 24px; min-height: 100dvh; display: flex; flex-direction: column; }
.page-header { display: grid; grid-template-columns: minmax(170px,1fr) minmax(320px,520px) minmax(170px,1fr); align-items: center; gap: 20px; padding: 24px 0 18px; }
.page-heading { min-width: 0; }
.page-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.eyebrow { font-size: 11px; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.primary, .secondary, .danger-button { min-height: 36px; border-radius: 8px; padding: 7px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; font-size: 13px; border: 1px solid transparent; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-strong); }
.secondary { background: var(--surface); border-color: var(--line); }
.secondary:hover { border-color: #9aabba; background: #f8fafc; }
.danger-button { color: var(--danger); background: var(--danger-soft); }
.danger-button:hover { background: #f5e0db; }
button kbd { margin-left: 12px; opacity: .75; border: 1px solid #ffffff50; background: transparent; color: inherit; }
kbd { font: 11px/1.6 monospace; border: 1px solid var(--line); min-width: 20px; text-align: center; border-radius: 4px; color: var(--muted); }
.text-button, .icon-button { display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-height: 36px; border-radius: 6px; color: var(--muted); padding: 6px 8px; font-size: 12px; }
.text-button:hover, .icon-button:hover { background: var(--soft); color: var(--text); }
.icon-button { width: 36px; padding: 6px; flex-shrink: 0; }
.search-bar { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.search { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: var(--surface); }
.search input { border: 0; outline: none; background: transparent; width: 100%; min-width: 0; font-size: 13px; padding: 8px 0; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px #526b8315; }
#content { flex: 1; min-width: 0; width: 100%; max-width: 1480px; margin: 0 auto; }
.section { margin-bottom: 22px; }
.section-title { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; min-height: 28px; }
.section-title h2 { font-size: 16px; font-weight: 500; }
.section-title .text-button { margin-left: auto; }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; background: #e8edf3; border-radius: 4px; padding: 0 6px; }
.section-caption { font-size: 12px; color: var(--muted); margin-left: auto; }
.task-list { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.task-row { display: flex; align-items: center; min-height: 84px; padding: 16px 20px; gap: 16px; position: relative; min-width: 0; }
.task-row + .task-row { border-top: 1px solid #edf1f5; }
.task-row:hover { background: #fafbfd; }
.task-check { width: 22px; height: 22px; border: 1px solid #9aaaba; border-radius: 50%; display: grid; place-items: center; padding: 0; flex-shrink: 0; }
.task-check:hover { background: var(--soft); border-color: var(--accent); }
.task-check svg { width: 14px; height: 14px; }
.task-check.checked { background: var(--accent); border-color: var(--accent); color: white; }
.task-time { width: 50px; flex: 0 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.task-content { text-align: left; flex: 1; min-width: 0; padding: 0; border-radius: 3px; }
.task-title { display: block; font-size: 15px; font-weight: 400; overflow-wrap: anywhere; }
.task-note { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.tag + .tag:before { content: "·"; margin-right: 4px; }
.priority { color: var(--status-warm); }
.overdue-text { color: var(--danger); }
.status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status:before { content: ""; width: 5px; height: 5px; border: 1px solid currentColor; display: inline-block; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.status.doing { color: var(--status-warm); }
.status.doing:before { background: var(--status-warm); }
.status.done { color: var(--status-cool); }
.completed .task-title { text-decoration: line-through; color: var(--muted); }
.row-menu { position: relative; flex-shrink: 0; }
.row-menu summary { list-style: none; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; border-radius: 6px; color: var(--muted); }
summary::-webkit-details-marker { display: none; }
.row-menu summary:hover, .row-menu[open] summary { background: var(--soft); }
.menu-panel { position: absolute; right: 0; top: 34px; width: 174px; max-height: calc(100dvh - 112px); overflow-y: auto; background: white; padding: 5px; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px #24282418; z-index: 20; }
.menu-panel button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; font-size: 12px; text-align: left; border-radius: 5px; }
.menu-panel button:hover { background: var(--soft); }
.menu-panel .danger { color: var(--danger); }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 5px; }
.collapse-section > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--muted); list-style: none; }
.collapse-section > summary:before { content: "›"; width: 12px; }
.collapse-section[open] > summary:before { transform: rotate(90deg); }
.empty { padding: 30px 24px; text-align: center; color: var(--muted); }
.empty-symbol { margin: 0 auto 14px; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 5px; }
.empty p { font-size: 12px; max-width: 420px; margin: 0 auto 16px; }
.section-overdue { border-left: 2px solid #b9a98f; padding-left: 18px; }
.board { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; align-items: start; }
.board-column { min-width: 0; border-top: 2px solid #aab9c8; }
.board-column[data-status="doing"] { border-color: #bba47e; }
.board-column[data-status="done"] { border-color: #7d9ab7; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 10px 0; }
.column-head h2 { font-size: 14px; }
.column-head .icon-button { margin-left: auto; }
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 160px; padding-bottom: 0; }
.board-more { min-height: 36px; border: 1px dashed var(--line); border-radius: 8px; color: var(--accent); }
.board-more:hover { background: var(--soft); }
.board .task-row { flex-wrap: wrap; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 16px; gap: 10px; align-items: flex-start; }
.board .task-row .task-content { flex-basis: calc(100% - 44px); }
.board .task-row .task-time { width: auto; margin-left: 32px; }
.board .task-row .row-menu { margin-left: auto; }
.board .task-row .task-note { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.board .task-row .status { display: none; }
.board .task-check { margin-top: 2px; }
@media (min-width: 960px) {
  .board .task-row { min-height: 66px; padding: 8px 10px; gap: 4px 8px; }
  .board .task-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .board .task-row .task-note { display: none; }
  .board .task-meta { margin-top: 2px; }
  .board .task-row .task-time { position: absolute; right: 42px; bottom: 8px; font-size: 11px; }
  .board .task-row .row-menu { position: absolute; right: 6px; bottom: 0; }
  .board .task-row .task-content { padding-right: 26px; }
  .board .task-meta { padding-right: 95px; }
}
.board-column.over .column-body { background: var(--soft); border-radius: 8px; outline: 1px dashed var(--accent); }
.dragging { opacity: .5; }
.inline-hint { font-size: 12px; color: var(--muted); padding: 10px 0 16px; }
.page-footer { padding-top: 24px; margin-top: 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); display: flex; justify-content: flex-start; gap: 16px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.segments { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.segments button { padding: 6px 12px; min-height: 34px; border-radius: 6px; font-size: 12px; color: var(--muted); }
.segments button:hover { background: #e7edf3; }
.segments button.active { background: #dfe8f1; color: #3f5973; }
select, input[type="date"], input[type="time"] { min-height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: white; max-width: 100%; }
.bookmark-list { border-top: 1px solid var(--line); }
.bookmark-row { display: flex; align-items: center; gap: 18px; padding: 16px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.bookmark-letter { display: grid; place-items: center; width: 40px; height: 40px; background: #e8eef4; color: var(--accent); font-size: 17px; flex-shrink: 0; border-radius: 8px; }
.bookmark-main { flex: 1; min-width: 0; }
.bookmark-title { font-size: 15px; overflow-wrap: anywhere; }
.bookmark-title:hover { text-decoration: underline; text-underline-offset: 4px; }
.bookmark-host { color: var(--muted); font-size: 11px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.bookmark-summary { color: var(--muted); font-size: 12px; margin-top: 5px; overflow-wrap: anywhere; }
.bookmark-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; color: var(--muted); font-size: 11px; }
.pin-label { color: var(--accent); }
.calendar-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.calendar-head h2 { font-size: 16px; }
.calendar-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.calendar-controls .segments { margin-left: auto; }
.date-picker { position: relative; }
.date-picker > summary { list-style: none; cursor: pointer; padding: 6px 0; display: flex; gap: 8px; align-items: center; }
.date-picker-panel { position: absolute; top: 42px; left: 0; background: white; padding: 16px; z-index: 15; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px #24282412; }
.calendar-wrap { border: 1px solid var(--line); background: white; border-radius: 8px; overflow: auto; max-height: 660px; }
.time-calendar { min-width: 680px; }
.time-calendar.day { min-width: 280px; }
.time-header, .all-day { display: grid; grid-template-columns: 52px repeat(var(--days),minmax(0,1fr)); }
.time-header { position: sticky; top: 0; background: white; z-index: 5; border-bottom: 1px solid var(--line); }
.day-header { text-align: center; padding: 9px 4px; font-size: 11px; color: var(--muted); border-left: 1px solid #edf1f5; }
.day-header strong { display: block; font-size: 18px; font-weight: 500; color: var(--text); }
.day-header.is-today { background: var(--accent-pale); color: var(--accent); }
.day-header.is-today strong { color: var(--accent); }
.all-day { border-bottom: 1px solid var(--line); }
.all-day > div { padding: 6px 4px; min-height: 36px; border-left: 1px solid #edf1f5; }
.all-day > span { font-size: 10px; padding: 8px; color: var(--muted); }
.time-body { display: grid; grid-template-columns: 52px repeat(var(--days),minmax(0,1fr)); height: 1244px; }
.time-axis, .time-day { position: relative; background: repeating-linear-gradient(to bottom,transparent 0,transparent 47px,#edf1f5 47px,#edf1f5 48px); }
.time-axis span { position: absolute; right: 8px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.time-day { border-left: 1px solid #edf1f5; }
.time-day.today { background-color: #fafcff; }
.calendar-event { position: absolute; height: 42px; padding: 4px 6px; background: #e7eef5; border-left: 2px solid #7893ae; border-radius: 3px; font-size: 11px; text-align: left; overflow: hidden; }
.calendar-event .event-time { display: block; font-size: 10px; color: #526b83; }
.calendar-event .event-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-event.completed .event-title { text-decoration: line-through; }
.calendar-event:hover { background: #dce8f2; }
.all-day-event { display: block; width: 100%; position: static; height: auto; margin: 2px 0; padding: 4px; text-align: left; font-size: 11px; background: #edf2f7; border-radius: 3px; overflow-wrap: anywhere; }
.month-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.month-weekday { text-align: center; padding: 12px 0; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.month-cell { min-height: 108px; padding: 8px; border-right: 1px solid #edf1f5; border-bottom: 1px solid #edf1f5; min-width: 0; }
.month-cell.other { background: #f7f9fb; color: var(--muted); }
.month-cell.today { background: var(--accent-pale); }
.month-date { font-size: 12px; margin-bottom: 6px; }
.month-cell .all-day-event { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-inputs { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; color: var(--muted); font-size: 12px; }
.range-inputs label { display: flex; align-items: center; gap: 6px; }
.notice { padding: 12px 16px; margin-top: 20px; border-radius: 8px; color: #703e2c; background: #f8eadc; font-size: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.notice button { text-decoration: underline; text-underline-offset: 3px; }
dialog { border: 1px solid var(--line); padding: 0; color: var(--text); background: var(--surface); box-shadow: 0 24px 80px #20282025; }
dialog::backdrop { background: #222b233b; backdrop-filter: blur(2px); }
.editor { position: fixed; inset: 12px 12px 12px auto; margin: 0; width: 480px; max-width: calc(100vw - 24px); max-height: none; height: calc(100dvh - 24px); border-radius: 12px; }
.editor[open] { animation: enter-panel var(--motion-enter) var(--motion-ease); }
.editor form { height: 100%; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px; gap: 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.panel-body { padding: 28px; overflow-y: auto; min-height: 0; flex: 1; }
.panel-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 28px; border-top: 1px solid var(--line); background: white; flex-shrink: 0; }
.field { display: block; margin-bottom: 20px; min-width: 0; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.field input:not([type="checkbox"]), .field textarea, .field select { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; outline: none; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px #526b8315; }
.field input[name="title"] { font-size: 17px; background: white; }
.field textarea { resize: vertical; min-height: 100px; }
.field small { display: block; font-size: 11px; color: var(--muted); margin-top: 7px; }
.grid-two { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.more-fields > summary { font-size: 13px; color: var(--accent); cursor: pointer; padding: 12px 0 20px; }
.check-label { display: flex; align-items: center; gap: 10px; font-size: 13px; margin: 12px 0; }
.check-label input { accent-color: var(--accent); width: 16px; height: 16px; }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 6px; padding: 10px 14px; font-size: 12px; overflow-wrap: anywhere; }
.editor > form > .form-error { margin: 0 28px 16px; }
.confirm-dialog { width: 420px; max-width: calc(100vw - 32px); border-radius: 12px; margin: auto; }
.confirm-body { padding: 28px; }
.confirm-body h2 { margin: 12px 0; }
.confirm-body p { font-size: 13px; color: var(--muted); white-space: pre-line; }
.confirm-icon { color: var(--accent); }
.utility-dialog { width: 590px; max-width: calc(100vw - 32px); max-height: 90dvh; border-radius: 12px; margin: auto; }
.utility-dialog[open] { display: flex; flex-direction: column; }
.body-note { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.backup-card { display: flex; align-items: center; gap: 14px; padding: 22px 0; border-top: 1px solid var(--line); }
.backup-card > div { flex: 1; }
.backup-card h3 { font-size: 14px; margin-bottom: 4px; }
.backup-card p, .recovery-tools p { font-size: 12px; color: var(--muted); }
.import-preview, .recovery-tools { padding: 16px; background: #f2f6fa; border: 1px solid var(--line); border-radius: 8px; margin-top: 16px; }
.import-preview p { font-size: 13px; margin: 8px 0 16px; }
.recovery-tools button { margin-top: 12px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 16px; }
.inline-form input, .category-row input { flex: 1; min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: white; }
.category-row { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.category-row .count { flex-shrink: 0; }
#toast { position: fixed; bottom: 28px; left: calc(50% + 92px); transform: translateX(-50%); background: #33475d; color: white; padding: 12px 20px; border-radius: 8px; box-shadow: 0 8px 24px #202c3a22; max-width: min(480px,calc(100vw - 32px)); z-index: 100; font-size: 13px; }
#toast.error { background: #883e32; }
.flash { animation: flash-task 1.6s ease-out; }
.row-menu[open] .menu-panel { animation: reveal-menu var(--motion-fast) var(--motion-ease); }
@keyframes reveal-menu { from { opacity: .6; translate: 0 -2px; } to { opacity: 1; translate: 0 0; } }
@keyframes flash-task { from { background: #dce8f2; } to { background: white; } }
@keyframes enter-panel { from { transform: translateX(12px); opacity: .5; } to { transform: translateX(0); opacity: 1; } }
@media (min-width: 1700px) { main { padding-left: max(48px,calc((100vw - 1640px)/2)); padding-right: max(48px,calc((100vw - 1640px)/2)); } }
@media (max-width: 1199px) {
  .sidebar { width: 152px; padding-left: 12px; padding-right: 12px; }
  main { margin-left: 152px; padding-left: 28px; padding-right: 28px; }
  .sidebar-bottom p { padding-left: 4px; font-size: 10px; }
  .board { gap: 12px; }
  .board .task-row { padding: 12px; }
  .task-row { gap: 12px; padding: 16px; }
  .bookmark-meta { flex-direction: column; gap: 4px; align-items: flex-end; }
  #toast { left: calc(50% + 76px); }
}
@media (min-width: 768px) and (max-width: 959px) {
  .sidebar { width: 80px; padding-left: 12px; padding-right: 12px; }
  .nav-caption, .nav-item > span:not([data-icon]), .sidebar-bottom p { display: none; }
  #navigation { margin-top: 40px; }
  .nav-item { justify-content: center; padding: 10px; min-height: 44px; }
  main { margin-left: 80px; padding-left: 24px; padding-right: 24px; }
  .page-header { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "heading actions" "search search"; gap: 14px 12px; }
  .page-heading { grid-area: heading; }
  .page-actions { grid-area: actions; }
  .search-bar { grid-area: search; }
  .column-head { flex-wrap: wrap; gap: 6px; }
  .column-head .text-button { order: 4; padding: 0 4px; }
  #toast { left: calc(50% + 40px); }
}
@media (max-width: 767px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .sidebar { inset: auto 0 0; width: 100%; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: #f5f7fa; }
  .brand, .nav-caption, .sidebar-bottom { display: none; }
  #navigation { display: grid; grid-template-columns: repeat(var(--module-count,4),minmax(52px,1fr)); gap: 8px; overflow-x: auto; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 11px; min-height: 52px; margin: 0; padding: 6px 0; }
  .nav-count { display: none; }
  main { margin-left: 0; padding: 0 20px 20px; min-height: calc(100dvh - 76px); }
  .page-header { grid-template-columns: 1fr auto; grid-template-areas: "heading actions" "search search"; gap: 14px 12px; padding: 18px 0 14px; align-items: center; }
  .page-heading { grid-area: heading; }
  .page-actions { grid-area: actions; }
  .search-bar { grid-area: search; }
  .mobile-backup { display: inline-flex !important; }
  .page-header .primary { padding: 10px 12px; }
  .page-header kbd { display: none; }
  .eyebrow { font-size: 10px; }
  .search-scope { display: none; }
  .search-bar { padding-bottom: 0; }
  .search { flex: 1; min-width: 0; }
  .search input { min-height: 44px; }
  .primary, .secondary, .icon-button, .text-button, .danger-button, .segments button, select { min-height: 44px; }
  .icon-button { width: 44px; }
  .task-row { padding: 12px; gap: 8px; flex-wrap: wrap; }
  .task-check { width: 44px; height: 44px; border: 0; position: relative; background: none !important; }
  .task-check:before { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #8ba0b5; }
  .task-check.checked:before { background: var(--accent); }
  .task-check svg { position: relative; z-index: 1; }
  .task-row .task-content { flex-basis: calc(100% - 60px); }
  .task-row .task-time { margin-left: 52px; width: auto; font-size: 11px; }
  .task-row .status { font-size: 11px; }
  .task-row .row-menu { margin-left: auto; }
  .task-title { font-size: 14px; }
  .row-menu summary { width: 44px; height: 44px; }
  .menu-panel { top: 44px; }
  .menu-panel button { min-height: 44px; }
  .section-caption { display: none; }
  .section-overdue { padding-left: 10px; }
  .section { margin-bottom: 20px; }
  .board { grid-template-columns: 1fr; gap: 24px; }
  .column-body { min-height: 0; padding-bottom: 0; }
  .board .task-row .task-time { margin-left: 54px; }
  .board .task-row .task-content { flex-basis: calc(100% - 64px); }
  .board .task-row { align-items: center; }
  .bookmark-row { gap: 12px; padding: 18px 0; flex-wrap: wrap; }
  .bookmark-letter { width: 34px; height: 34px; align-self: flex-start; }
  .bookmark-main { flex-basis: calc(100% - 52px); }
  .bookmark-meta { margin-left: 46px; flex-direction: row; flex-wrap: wrap; }
  .bookmark-row .row-menu { margin-left: auto; }
  .toolbar select { max-width: 55%; }
  .calendar-controls .segments { margin-left: 0; width: 100%; }
  .calendar-controls .segments button { padding: 6px 10px; }
  .calendar-head { width: 100%; }
  .calendar-head .date-picker { margin-right: auto; }
  .calendar-wrap { max-height: 560px; }
  .month-cell { min-height: 96px; padding: 3px; }
  .month-cell .all-day-event { font-size: 10px; }
  .month-date { min-width: 36px; min-height: 44px; }
  .range-inputs { gap: 6px; }
  .range-inputs input { max-width: 130px; }
  .editor { inset: 0; width: 100%; max-width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .panel-head, .panel-body { padding: 20px; }
  .panel-foot { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); }
  .editor > form > .form-error { margin: 0 20px 12px; }
  .field input, .field textarea, .field select { font-size: 16px; }
  .utility-dialog { max-height: calc(100dvh - 32px); }
  .backup-card { flex-wrap: wrap; gap: 12px; }
  .backup-card > div { flex-basis: calc(100% - 32px); }
  .backup-card > button { margin-left: 30px; }
  .category-row { flex-wrap: wrap; }
  .category-row input { flex-basis: 60%; }
  #toast { left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); width: max-content; }
  .page-footer { margin-top: 8px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* The calendar owns its scroll area; the page shell stays in the viewport. */
body[data-active-view="calendar"] main { height: 100dvh; min-height: 0; }
body[data-active-view="calendar"] #content { min-height: 0; display: flex; flex-direction: column; }
body[data-active-view="calendar"] .page-footer { padding-top: 10px; margin-top: 12px; flex-shrink: 0; }
.calendar-shell { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.calendar-shell .calendar-controls { flex-shrink: 0; justify-content: space-between; }
.calendar-shell .calendar-head { min-width: 0; }
.calendar-shell .date-picker-panel { z-index: 30; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; color: var(--muted); font-size: 11px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.calendar-legend i { width: 7px; height: 7px; border-radius: 50%; }
.calendar-help { margin-left: auto; }
.calendar-more { position: relative; }
.calendar-more > summary { cursor: pointer; list-style: none; }
.calendar-more > button { position: absolute; top: 40px; right: 0; z-index: 30; box-shadow: 0 6px 18px #20293418; }
#calendarResults { flex: 1; min-height: 0; background: var(--surface); border-radius: 8px; overflow: hidden; }
.fc { --fc-border-color: #e5eaf0; --fc-today-bg-color: #edf3fb; --fc-neutral-bg-color: #f7f9fc; --fc-page-bg-color: #fff; --fc-now-indicator-color: #b65347; font-size: 12px; }
.fc .fc-col-header-cell-cushion { padding: 12px 4px; font-weight: 500; }
.fc .fc-timegrid-slot { height: 26px; }
.fc .fc-timegrid-slot-label-cushion { font-size: 11px; color: var(--muted); }
.fc .fc-scrollgrid { border-radius: 8px; }
.fc .fc-event { border-radius: 4px; cursor: pointer; }
.calendar-event-content { padding: 3px 5px; overflow: hidden; }
.calendar-event-content strong { display: block; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event-content small { display: block; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc .calendar-completed { opacity: .65; }
.calendar-completed strong { text-decoration: line-through; }
.fc .fc-daygrid-event .calendar-event-content { display: flex; gap: 6px; min-width: 0; }
.fc .fc-daygrid-event .calendar-event-content small { flex-shrink: 0; }
.fc .fc-popover { max-width: calc(100vw - 40px); z-index: 35; }
.fc .fc-daygrid-more-link { color: var(--accent); }
.fc .fc-event:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 767px) {
  body[data-active-view="calendar"] main { height: calc(100dvh - 76px - env(safe-area-inset-bottom)); }
  .calendar-shell .calendar-controls { gap: 6px; margin-bottom: 8px; }
  .calendar-shell .calendar-head { gap: 2px; }
  .calendar-head h2 { font-size: 13px; }
  .calendar-shell .date-picker { order: -1; width: 100%; }
  .calendar-legend { gap: 6px 10px; margin-bottom: 8px; }
  .calendar-help { display: none !important; }
  .fc .fc-col-header-cell-cushion { padding: 6px 1px; font-size: 10px; }
  .fc .fc-timegrid-axis { width: 35px; }
  .calendar-event-content { padding: 2px; }
  .fc .fc-daygrid-event .calendar-event-content small { display: none; }
}
