/* Daybook — a quiet place for today's work and thoughts. */
:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --surface: #fffefa;
  --ink: #25443a;
  --text: #303d36;
  --muted: #7a8277;
  --line: #e5e7dd;
  --green-soft: #e9eee4;
  --green-hover: #1d382f;
  --accent: #b16f49;
  --accent-soft: #f5eadd;
  --danger: #a0493c;
  --shadow: 0 4px 24px #25443a05;
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--paper); }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--paper); line-height: 1.65; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button, input, textarea { color: inherit; }
button { border: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
button, a, input, textarea, select { outline-offset: 4px; }
:focus-visible { outline: 3px solid #b16f49a6; }
input, textarea { min-width: 0; }
input::placeholder, textarea::placeholder { color: #979d91; opacity: 1; }
input, textarea { caret-color: var(--ink); }
textarea { resize: vertical; }
a { color: var(--ink); text-underline-offset: 3px; }
svg { display: block; width: 20px; height: 20px; flex-shrink: 0; }
button svg { margin: auto; }
h1, h2, h3, p { margin-top: 0; }
[hidden], .hidden { display: none !important; }
.mobile-only { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { display: grid; grid-template-columns: 206px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 38px 22px 24px; border-right: 1px solid var(--line); background: #f0f2e9; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 12px; color: var(--ink); font-size: 21px; font-weight: 700; letter-spacing: -.6px; text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--ink); color: #fffdf4; }
.brand img { display: block; flex-shrink: 0; border-radius: 11px; }
.brand > span { min-width: 0; }
.brand small, .brand-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 400; letter-spacing: 0; line-height: 1.7; }
.sidebar nav { display: grid; gap: 8px; margin-top: 55px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 11px 15px; border-radius: 12px; background: transparent; color: #748171; text-align: left; text-decoration: none; font-weight: 500; transition: background .16s, color .16s; }
.nav-item svg { width: 19px; height: 19px; margin: 0; }
.nav-item:hover { color: var(--ink); background: #e6ebdf; }
.nav-item.is-active { color: var(--ink); background: #e1e8d9; font-weight: 650; }
.sidebar-footer { margin-top: auto; padding: 32px 7px 0; color: #8a9283; font-size: 10px; line-height: 1.9; }
.sidebar-footer .status-dot { margin-right: 6px; vertical-align: middle; }
.sidebar-footer small { font-size: 9px; }
.sidebar-footer p { margin: 0 0 10px; }
.sidebar-footer .footer-rule { width: 24px; height: 1px; margin-bottom: 17px; background: #c8d0be; }
.sidebar-footer button { padding: 0; background: transparent; color: inherit; text-align: left; }

.main { min-width: 0; padding: 35px clamp(24px, 4.2vw, 68px) 52px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; max-width: 1180px; margin: 0 auto 34px; }
.page-eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 10px; font-weight: 650; letter-spacing: 2.2px; text-transform: uppercase; }
.page-title { margin: 0; color: var(--ink); font-size: 25px; font-weight: 650; letter-spacing: -.8px; line-height: 1.45; }
.topbar-actions { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.topbar-actions > span { white-space: nowrap; }
#offline-indicator { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { display: inline-block; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #8aa177; }
#offline-indicator.is-offline, #offline-indicator .is-offline { color: var(--accent); }
#offline-indicator.is-offline .status-dot { background: var(--accent); }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 310px); gap: 34px; max-width: 1180px; margin: 0 auto; align-items: start; }
.task-panel, .reflection-panel { min-width: 0; }
.date-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 26px; }
.date-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; padding: 10px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: #687963; }
.icon-button:hover { border-color: var(--line); background: var(--surface); }
#date-picker { width: 137px; min-height: 44px; padding: 7px 5px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; }
#date-picker::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .5; }
.today-button { min-height: 44px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 12px; white-space: nowrap; }
.today-button:hover { background: var(--green-soft); }
.day-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 25px; }
.day-heading > div { min-width: 0; }
.day-heading .day-subtitle { margin-bottom: 6px; }
.day-heading .day-title { margin-bottom: 0; }
.day-badge { flex-shrink: 0; align-self: flex-end; margin-bottom: 7px; padding: 5px 9px; border-radius: 7px; background: #edf1e5; color: #8a957c; font-size: 10px; white-space: nowrap; }
.day-title { margin: 0 0 9px; color: var(--ink); font-size: clamp(27px, 2.5vw, 35px); font-weight: 600; letter-spacing: -1px; line-height: 1.4; }
.day-title span { color: var(--accent); }
.day-subtitle { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.progress-track { height: 4px; overflow: hidden; margin-bottom: 24px; border-radius: 99px; background: #e4e9dc; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: #80916d; transition: width .3s ease; }
.progress-caption { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.progress-caption strong { color: var(--ink); font-weight: 600; }
.task-composer { display: flex; align-items: center; gap: 10px; min-height: 62px; padding: 8px 9px 8px 19px; border: 1px solid #d8dfcf; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); transition: border-color .16s; }
.task-composer:focus-within { border-color: #8b9e7b; }
#task-form { margin-bottom: 27px; }
#task-title { flex: 1; width: 100%; min-height: 44px; padding: 8px 0; border: 0; background: transparent; font-size: 13px; outline-offset: 1px; }
.composer-icon { color: #a4ad98; }
.add-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex-shrink: 0; min-width: 74px; min-height: 44px; padding: 10px 15px; border-radius: 10px; background: var(--ink); color: #fffefa; font-size: 12px; font-weight: 550; }
.add-button:hover { background: var(--green-hover); }
.add-button svg { width: 16px; height: 16px; margin: 0; }
.section-label { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; color: #78816f; font-size: 10px; font-weight: 600; letter-spacing: 1.8px; text-transform: uppercase; }
.section-label span, .section-label .count { font-size: 10px; letter-spacing: 0; }
#task-list { display: grid; gap: 10px; }
.task-card { min-width: 0; overflow: hidden; border: 1px solid #e2e6da; border-radius: 14px; background: var(--surface); box-shadow: 0 2px 10px #25443a02; transition: border-color .16s, background .16s; }
.task-card:hover { border-color: #cfd8c4; }
.task-row { display: flex; align-items: center; gap: 3px; min-height: 77px; padding: 11px 10px 11px 8px; }
.check-button { position: relative; display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: transparent; font-size: 0; }
.check-button::before { content: ""; position: absolute; inset: 11px; border: 1.5px solid #becab3; border-radius: 7px; background: transparent; transition: background .15s, border-color .15s; }
.check-button:hover::before { border-color: #779469; background: #f0f4e8; }
.check-button[aria-pressed="true"]::before { border-color: #80916d; background: #80916d; }
.check-button[aria-pressed="true"]::after { content: "✓"; position: relative; color: white; font-family: sans-serif; font-size: 14px; font-weight: 650; line-height: 1; }
.check-button svg { display: none; }
.task-content { flex: 1; min-width: 0; padding: 3px 5px; }
.task-title { display: block; margin: 0; color: #344535; font-size: 13px; font-weight: 550; line-height: 1.65; overflow-wrap: anywhere; white-space: pre-wrap; }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; color: #969b8f; font-size: 10px; line-height: 1.6; }
.task-meta .tag { padding: 0 6px; border-radius: 4px; background: #f0f2e9; color: #7b876e; }
.task-meta .carried-tag { background: var(--accent-soft); color: var(--accent); }
.note-toggle, .task-menu { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 9px; border-radius: 10px; background: transparent; color: #929b88; font-size: 11px; }
.note-toggle svg { width: 17px; height: 17px; margin: 0; }
.note-toggle:hover, .note-toggle[aria-expanded="true"], .task-menu:hover { background: var(--green-soft); color: var(--ink); }
.note-count { font-size: 10px; line-height: 1; }
.task-menu { font-size: 20px; letter-spacing: 1px; }
.task-menu svg { width: 17px; height: 17px; }
.task-card.is-complete { background: #f4f5ee; box-shadow: none; }
.task-card.is-complete .task-title { color: #96a08d; text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: #aab39e; }
.task-card.is-complete .task-meta { color: #a0a699; }
.completed-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 27px 0 12px; color: #88927d; font-size: 11px; font-weight: 500; letter-spacing: .5px; }
.completed-heading button { min-height: 44px; padding: 8px; background: transparent; color: inherit; font-size: 11px; }
.task-notes { padding: 4px 19px 17px 56px; border-top: 1px solid #edf0e6; background: #fafbf5; }
.note-entry { position: relative; margin: 13px 0; padding: 0 0 12px; border-bottom: 1px solid #e8ecdf; }
.note-entry:last-of-type { margin-bottom: 15px; }
.note-time { color: #929b85; font-size: 10px; }
.note-text { margin: 5px 0 0; color: #61705a; font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 3px; }
.note-actions button { min-width: 44px; min-height: 44px; padding: 5px 8px; border-radius: 7px; background: transparent; color: #929b85; font-size: 10px; }
.note-actions button:hover { background: #edf1e5; color: var(--ink); }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.note-form textarea { width: 100%; min-height: 75px; padding: 11px 12px; border: 1px solid #e2e7d7; border-radius: 9px; background: #fffefa; font-size: 12px; line-height: 1.8; }
.note-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.note-form-footer .help-text { margin: 0; font-size: 10px; }
.note-submit { display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex-shrink: 0; align-self: flex-end; min-height: 44px; padding: 7px 13px; border-radius: 8px; background: #e6eddd; color: var(--ink); font-size: 11px; font-weight: 550; }
.note-submit svg { width: 14px; height: 14px; margin: 0; }
.note-submit:hover { background: #dbe5cf; }
.empty-state { padding: 40px 22px; border: 1px dashed #d5ddca; border-radius: 15px; color: #8b9680; text-align: center; }
.empty-state svg { width: 30px; height: 30px; margin: 0 auto 14px; color: #a1ad92; }
.empty-state strong { display: block; margin-bottom: 6px; color: #617558; font-size: 14px; font-weight: 550; }
.empty-state h3 { margin: 0 0 8px; color: #617558; font-size: 15px; font-weight: 550; }
.empty-illustration { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 17px; border-radius: 19px; background: #edf1e5; }
.empty-illustration svg { width: 28px; height: 28px; margin: 0; }
.empty-state p { margin: 0; font-size: 12px; }
.carryover-panel { margin-top: 28px; padding: 18px 19px 5px; border: 1px solid #e9e2d5; border-radius: 14px; background: #f6f2e9; }
.carryover-panel .section-label { color: #a18a69; }
.carryover-item { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 0; border-top: 1px solid #e9e4d8; }
.carryover-item > div { flex: 1; min-width: 0; }
.carryover-title { display: block; color: #797965; font-size: 12px; overflow-wrap: anywhere; }
.carryover-date { display: block; margin-top: 2px; color: #a29d8e; font-size: 10px; }
.carryover-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex-shrink: 0; min-height: 44px; padding: 9px 12px; border: 1px solid #e1d6c4; border-radius: 8px; background: #fffaf0; color: #9a805c; font-size: 11px; }
.carryover-button svg { width: 14px; height: 14px; margin: 0; }
.carryover-button:hover { background: #efe5d5; }
.moved-section { margin-top: 25px; }
.moved-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 54px; margin-top: 8px; padding: 12px 15px; border: 1px dashed var(--line); border-radius: 10px; background: transparent; color: #969d8e; font-size: 11px; text-align: left; }
.moved-item:hover { background: #eff2e8; }
.moved-item small { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; color: #9aa389; font-size: 10px; }
.moved-item small svg { width: 13px; height: 13px; margin: 0; }
.moved-item > :first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.moved-item button { min-height: 44px; background: transparent; color: var(--accent); font-size: 11px; }

.reflection-panel { padding-top: 4px; }
.reflection-card { position: relative; padding: 26px 24px 20px; border: 1px solid #e4e3d6; border-radius: 17px; background: #f0f0e5; box-shadow: var(--shadow); }
.reflection-date { display: flex; align-items: center; gap: 7px; margin: 0 0 20px; color: #989985; font-size: 10px; font-weight: 550; letter-spacing: 1.6px; }
.reflection-date svg { width: 15px; height: 15px; }
.reflection-title { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; color: var(--ink); font-size: 18px; font-weight: 550; letter-spacing: -.5px; }
.reflection-title svg { width: 18px; height: 18px; color: #889778; }
.reflection-card > p { color: #92977f; font-size: 11px; line-height: 1.9; }
#daily-note { display: block; width: 100%; min-height: 280px; padding: 15px 0; border: 0; border-radius: 4px; background: repeating-linear-gradient(transparent, transparent 31px, #dfe2d4 31px, #dfe2d4 32px); color: #61705a; font-size: 12px; line-height: 32px; resize: vertical; }
#daily-note::placeholder { color: #a3a68f; }
.reflection-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 17px; color: #9a9e88; font-size: 10px; }
.reflection-mark { color: #a2ad8a; font-size: 22px; line-height: 1; }
.save-status { display: inline-flex; align-items: center; gap: 5px; color: #8a967a; font-size: 10px; }
.save-status svg { width: 12px; height: 12px; }
.tip-card { margin-top: 19px; padding: 19px 21px; border: 1px solid #e9e4d7; border-radius: 13px; background: #f8f3e9; color: #9d8c71; font-size: 11px; line-height: 1.95; }
.tip-card > span { display: block; margin-bottom: 9px; color: #ad8c62; }
.tip-card p { margin: 5px 0 9px; color: #8c7d63; font-size: 13px; }
.tip-card small { font-size: 10px; }
.tip-card strong, .tip-card h3 { display: flex; align-items: center; gap: 6px; margin: 0; color: #a38159; font-size: 11px; font-weight: 550; }
.tip-card svg { width: 15px; height: 15px; }
.mobile-nav { display: none; }

.history-view, .backup-view { max-width: 970px; margin: 0 auto; }
.view-intro { margin-bottom: 26px; color: var(--muted); font-size: 13px; }
.view-intro h2 { margin: 0 0 8px; color: var(--ink); font-size: 23px; font-weight: 550; letter-spacing: -.5px; }
.view-intro p { margin-bottom: 0; }
.search-field { display: flex; align-items: center; gap: 10px; margin-bottom: 25px; padding: 5px 15px; border: 1px solid #dce3d2; border-radius: 12px; background: var(--surface); color: #929e85; }
.search-field > span { flex-shrink: 0; }
.search-field svg { width: 18px; height: 18px; }
.search-field input { flex: 1; width: 100%; min-height: 44px; padding: 8px 0; border: 0; background: transparent; font-size: 13px; }
.search-field:focus-within { border-color: #99ac87; }
.history-list { display: grid; gap: 13px; }
.history-card { display: block; width: 100%; min-height: 94px; margin-bottom: 12px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; transition: border-color .15s, transform .15s; }
.history-card:hover { border-color: #b7c4a9; transform: translateY(-1px); }
.history-date { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 8px; color: var(--ink); font-size: 15px; font-weight: 550; }
.history-date small { color: #94a187; font-size: 10px; font-weight: 400; }
.history-summary { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.history-open { display: inline-flex; align-items: center; gap: 6px; margin-top: 13px; color: #8d9b7e; font-size: 10px; }
.history-open svg { width: 13px; height: 13px; margin: 0; }
.history-card .history-preview { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 9px 0 0; color: #8c9584; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.history-card > div { min-width: 0; }
.history-card > svg { color: #9ba68f; }
.backup-card { margin-bottom: 20px; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.backup-card h2, .backup-card h3, .install-card h2, .install-card h3 { margin: 0 0 10px; color: var(--ink); font-size: 17px; font-weight: 600; }
.card-icon { display: grid; place-items: center; width: 39px; height: 39px; margin-bottom: 14px; border-radius: 11px; background: #edf2e5; color: #7d946a; }
.card-icon svg { width: 20px; height: 20px; }
.backup-card p, .install-card p { color: var(--muted); font-size: 12px; line-height: 1.9; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 18px 0; border-top: 1px solid var(--line); }
.settings-row:first-child { padding-top: 0; border-top: 0; }
.settings-row:last-child { padding-bottom: 0; }
.settings-row > div { min-width: 0; }
.settings-row h3 { margin: 0 0 4px; color: #4f6347; font-size: 13px; font-weight: 550; }
.settings-row p { margin: 0; }
.action-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; min-height: 44px; padding: 11px 17px; border: 1px solid #dbe2d2; border-radius: 9px; background: #f2f5ec; color: var(--ink); font-size: 12px; font-weight: 550; text-decoration: none; }
.action-button svg { width: 16px; height: 16px; margin: 0; }
.action-button.primary { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.action-button.primary:hover { background: var(--green-hover); }
.action-button.secondary:hover, .action-button:hover { background: #e7eedd; }
.action-button.danger { border-color: #e8d5cc; background: #fbf2ec; color: var(--danger); }
.action-button.danger:hover { background: #f4e3d9; }
.backup-meta { margin: 15px 0 18px; color: #939d87; font-size: 11px; }
.install-card { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; padding: 24px 26px; border: 1px solid #dce5cf; border-radius: var(--radius); background: #edf2e5; }
.install-card .card-icon { flex-shrink: 0; margin-bottom: 0; background: #e0e9d3; }
.install-card > div:last-child { min-width: 0; }
.install-card .action-button { margin-top: 4px; }
.privacy-callout { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; padding: 17px 20px; border: 1px solid #ebe2d3; border-radius: 12px; background: #f6f0e5; color: #9a8568; font-size: 12px; line-height: 1.9; }
.privacy-callout svg { margin-top: 3px; width: 17px; height: 17px; }
.privacy-callout p { margin: 0; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.app-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); color: #a2a995; font-size: 10px; letter-spacing: 1px; }
.app-footer span { letter-spacing: 0; }
.storage-warning { max-width: 1180px; margin: 0 auto 24px; }
#today-view { max-width: 1180px; margin: 0 auto; }

.toast { position: fixed; z-index: 50; display: flex; align-items: center; gap: 18px; left: 50%; bottom: 28px; max-width: min(560px, calc(100vw - 36px)); padding: 10px 12px 10px 19px; border: 1px solid #49604c; border-radius: 12px; background: #2d493b; color: #fffdf5; box-shadow: 0 8px 30px #25443a24; transform: translateX(-50%); }
.toast-message { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.toast button { flex-shrink: 0; min-width: 44px; min-height: 44px; padding: 8px 10px; border-radius: 8px; background: #ffffff10; color: #f3d8a9; font-size: 12px; }
.toast button:hover { background: #ffffff20; }
dialog.modal { width: min(480px, calc(100vw - 32px)); max-height: min(84dvh, 760px); overflow-y: auto; padding: 0; border: 1px solid #dbe1d1; border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 20px 100px #1c322f30; }
dialog.modal::backdrop { background: #203c3260; backdrop-filter: blur(3px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 21px 12px; }
.modal-header h2 { margin: 0; color: var(--ink); font-size: 18px; font-weight: 600; }
.modal-body { padding: 5px 25px 22px; }
.modal-body p { font-size: 13px; line-height: 1.9; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding: 16px 24px 21px; border-top: 1px solid var(--line); }
.field-label { display: block; margin: 14px 0 7px; color: #697b5e; font-size: 12px; font-weight: 550; }
.modal input:not([type="checkbox"]):not([type="radio"]), .modal textarea { display: block; width: 100%; min-height: 44px; padding: 11px 12px; border: 1px solid #dbe2d1; border-radius: 9px; background: #fafbf5; font-size: 13px; }
.modal textarea { min-height: 115px; line-height: 1.8; }
.import-summary { margin: 16px 0 0; padding: 15px; border: 1px solid #e2e8d8; border-radius: 9px; background: #f0f4e9; color: #687c5b; font-size: 12px; }
.import-summary p:last-child { margin-bottom: 0; }
.help-text { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; }

@media (min-width: 1500px) {
  .app-shell { grid-template-columns: 225px minmax(0, 1fr); }
  .sidebar { padding-right: 27px; padding-left: 27px; }
  .main { padding-top: 43px; }
  .topbar { margin-bottom: 45px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 330px; gap: 44px; }
}

@media (max-width: 1120px) and (min-width: 761px) {
  .app-shell { grid-template-columns: 170px minmax(0, 1fr); }
  .sidebar { padding: 32px 14px 22px; }
  .brand { gap: 8px; padding: 0 4px; font-size: 19px; }
  .brand img { width: 31px; height: 31px; }
  .brand-mark { width: 31px; height: 31px; }
  .main { padding: 30px 26px 40px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 245px; gap: 23px; }
  .reflection-card { padding: 23px 18px 18px; }
  .task-row { padding-right: 5px; }
  .task-menu { min-width: 44px; padding: 6px; }
  .note-toggle { min-width: 44px; padding: 6px; }
}

@media (max-width: 950px) and (min-width: 761px) {
  .app-shell { grid-template-columns: 156px minmax(0, 1fr); }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .reflection-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); gap: 20px; }
  .tip-card { align-self: start; margin-top: 0; }
  #daily-note { min-height: 200px; }
}

@media (max-width: 760px) {
  :root { font-size: 14px; }
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar { display: none; }
  .main { padding: max(25px, env(safe-area-inset-top)) 22px calc(100px + env(safe-area-inset-bottom)); }
  .topbar { align-items: center; gap: 12px; margin-bottom: 25px; }
  .page-eyebrow { margin-bottom: 3px; font-size: 9px; letter-spacing: 2px; }
  .page-title { font-size: 24px; }
  .topbar-actions { gap: 4px; font-size: 10px; }
  .topbar-actions > .desktop-only { display: none !important; }
  .workspace-grid { display: block; }
  .date-toolbar { margin-bottom: 24px; }
  .date-nav { gap: 0; }
  #date-picker { width: 133px; font-size: 12px; }
  .today-button { padding-right: 13px; padding-left: 13px; }
  .day-heading { margin-bottom: 23px; }
  .day-title { margin-bottom: 8px; font-size: 30px; }
  .day-subtitle { font-size: 12px; }
  .progress-caption { margin-bottom: 8px; font-size: 10px; }
  .task-composer { padding-left: 14px; min-height: 60px; }
  #task-title { font-size: 16px; }
  #task-title::placeholder { font-size: 12px; }
  .add-button { min-width: 66px; padding: 10px 12px; }
  #task-form { margin-bottom: 25px; }
  .task-row { min-height: 76px; padding: 10px 6px 10px 5px; gap: 0; }
  .task-content { padding-left: 3px; padding-right: 3px; }
  .task-title { font-size: 13px; }
  .task-meta { font-size: 10px; }
  .note-toggle, .task-menu { min-width: 44px; padding: 9px 6px; }
  .task-notes { padding: 3px 15px 16px 49px; }
  .note-form textarea { min-height: 86px; font-size: 16px; }
  .note-form textarea::placeholder { font-size: 12px; }
  .note-form-footer { align-items: flex-start; }
  .note-form-footer .help-text { padding-top: 9px; }
  .note-submit, .note-actions button { min-height: 44px; }
  .carryover-panel { margin-top: 26px; padding: 17px 16px 4px; }
  .reflection-panel { margin-top: 30px; }
  .reflection-card { padding: 23px 21px 19px; }
  .reflection-date { margin-bottom: 17px; }
  #daily-note { min-height: 260px; font-size: 16px; }
  #daily-note::placeholder { font-size: 12px; }
  .tip-card { margin-top: 15px; }
  .mobile-nav { position: fixed; z-index: 30; right: 0; bottom: 0; left: 0; display: flex; align-items: stretch; justify-content: space-around; gap: 6px; padding: 8px max(18px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); border-top: 1px solid #e3e7da; background: #fbfcf6f5; backdrop-filter: blur(16px); }
  .mobile-nav button { display: flex; flex: 1; align-items: center; justify-content: center; flex-direction: column; gap: 4px; min-width: 0; min-height: 49px; padding: 5px; border-radius: 10px; background: transparent; color: #9aa38f; font-size: 10px; }
  .mobile-nav button svg { width: 20px; height: 20px; margin: 0; }
  .mobile-nav button.is-active, .mobile-nav button[aria-current="page"] { background: #edf2e4; color: var(--ink); }
  .desktop-only { display: none !important; }
  .mobile-only { display: initial !important; }
  .history-card { min-height: 89px; padding: 18px; }
  .history-date { font-size: 14px; }
  .history-summary { font-size: 11px; }
  .search-field input { font-size: 16px; }
  .search-field input::placeholder { font-size: 12px; }
  .backup-card, .install-card { padding: 21px 19px; }
  .install-card { gap: 12px; }
  .install-card h3 { font-size: 15px; }
  .settings-row { align-items: flex-start; flex-direction: column; gap: 13px; }
  .settings-row .action-button { align-self: flex-start; }
  .backup-actions { flex-direction: column; }
  .privacy-callout { padding: 16px; }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); gap: 12px; width: max-content; max-width: calc(100vw - 28px); padding-left: 15px; }
  dialog.modal { max-height: 85dvh; }
  .modal input:not([type="checkbox"]):not([type="radio"]), .modal textarea { font-size: 16px; }
  .modal-header { padding-right: 16px; padding-left: 21px; }
  .modal-body { padding-right: 21px; padding-left: 21px; }
  .modal-actions { padding-right: 21px; padding-left: 21px; }
}

@media (max-width: 380px) {
  .main { padding-right: 16px; padding-left: 16px; }
  .date-toolbar { gap: 5px; }
  .date-nav .icon-button { width: 44px; padding: 10px; }
  #date-picker { width: 123px; }
  .today-button { padding-right: 11px; padding-left: 11px; }
  .task-row { padding-left: 2px; padding-right: 2px; }
  .task-notes { padding-left: 18px; }
  .note-toggle { gap: 2px; }
  .note-toggle svg { width: 15px; height: 15px; }
  .task-content { padding-right: 0; }
  .task-title { font-size: 12px; }
  .day-badge { max-width: 110px; margin-bottom: 6px; padding: 5px 7px; font-size: 9px; }
  .day-title { font-size: 28px; }
  .note-form-footer .help-text { max-width: 120px; font-size: 9px; }
  .moved-item { align-items: flex-start; flex-direction: column; gap: 4px; }
  .carryover-item { gap: 6px; }
  .carryover-button { padding-right: 9px; padding-left: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .app-shell { display: block; }
  .sidebar, .mobile-nav, .topbar-actions, .date-toolbar, #task-form, .task-menu, .note-form, .note-actions, .toast, .tip-card { display: none !important; }
  .main { padding: 0; }
  .workspace-grid { display: block; }
  .reflection-panel { margin-top: 25px; }
  .task-card, .reflection-card { break-inside: avoid; box-shadow: none; }
  body, .reflection-card, .task-card { background: white; }
  #daily-note { min-height: 100px; background: none; }
}
