:root {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --ink: #25312b;
  --muted: #75827a;
  --line: #e2e9e4;
  --accent: #246c5d;
  --accent-soft: #e7f1ed;
  --shadow: 0 8px 24px #30483a10;
}

body { background: #f4f7f5; color: var(--ink); }
.app-shell { grid-template-columns: 236px minmax(420px, 1fr) 318px; gap: 0; background: #f4f7f5; }
.sidebar { background: #fbfcfb; border-color: #e2e9e4; padding: 18px 13px 14px; }
.brand { font-family: 'DM Sans', sans-serif; font-size: 20px; }
.brand-mark { background: linear-gradient(140deg, #246c5d, #55a588); border-radius: 8px; }
.workspace-switcher { background: #f0f5f1; border: 1px solid #e2e9e4; }
.nav-item { border-radius: 8px; }
.nav-item.active { color: #205c4e; background: #e8f2ec; box-shadow: inset 3px 0 #3b8a70; }
.nav-item:hover, .folder-row:hover { background: #eff5f1; }
.folder-row.active { color: #205c4e; background: #e8f2ec; }
.folder-dot, .dot-coral, .dot-blue, .dot-green, .dot-violet { box-shadow: 0 0 0 3px #fff; }
.main-area { background: #f7f9f7; min-width: 0; }
.topbar { background: #fbfcfb; border-bottom: 1px solid #e2e9e4; }
.topbar { position: relative; }
.topbar-actions { margin-left: auto; }
.search-trigger { position: absolute; left: 50%; transform: translateX(-50%); width: min(42vw, 510px); background: #fff; border: 1px solid #e2e9e4; border-radius: 9px; box-shadow: 0 2px 8px #30483a0a; }
.icon-button:hover, .help-button:hover { background: #e8f2ec; color: #205c4e; }
.dashboard, .notes-view { max-width: none; padding: 28px clamp(22px, 2.5vw, 38px) 96px; }
.dashboard { overflow-y: auto; }
.welcome-row { margin-bottom: 25px; }
.welcome-row h1, .notes-heading h1 { color: #25312b; }
.eyebrow { color: #718078; }
.daily-card, .focus-card, .stats-card, .note-card, .favorite-card {
  border: 1px solid #e2e9e4;
  border-radius: 11px;
  box-shadow: 0 5px 16px #5875b20c;
}
.daily-card { background: linear-gradient(135deg, #fff 0%, #f1f5ff 100%); }
.daily-card:after { background: #ffc77d; }
.focus-card { background: linear-gradient(145deg, #edf5ef, #f7faf7); color: #25312b; }
.focus-card p, .focus-head, .focus-card .task-progress small { color: #718078; }
.stats-card { background: #fff; }
.recent-item { border-bottom-color: #e2e9e4; }
.recent-item:hover { background: #f0f5f1; }
.section-title-row h2 { color: #25312b; }
.favorite-card { background: #fff; }
.notes-grid { gap: 12px; }
.note-card { background: color-mix(in srgb, var(--note-color, #fff) 18%, #fff); }
.editor-view { background: #f7f9f7; }
.editor-toolbar { background: #f7f9f7; border-bottom-color: #e2e9e4; }
.editor-paper { max-width: 980px; min-height: calc(100dvh - 160px); margin: 14px auto 36px; padding: 32px clamp(26px, 4vw, 58px); border: 1px solid #e2e9e4; border-radius: 11px; background: #fff; box-shadow: 0 8px 24px #30483a0a; }
.editor-formatbar { border-color: #e2e9e4; border-radius: 8px; background: #fbfcfb; }
.editor-formatbar button { color: #52675c; }
.context-panel { background: #fbfcfb; border-left: 1px solid #e2e9e4; padding: 18px 13px 20px; overflow-y: auto; }
.panel-tabs { border-bottom-color: #e2e9e4; }
.panel-tab { color: #718078; }
.panel-tab.active { color: #246c5d; border-bottom-color: #3b8a70; }
.panel-content { min-width: 0; }
.detail-row, .backlink-card { border-color: #e2e9e4; }
.toast { background: #24314f; }

.schedule-panel { display: grid; gap: 12px; }
.agenda-card { min-width: 0; padding: 13px; border: 1px solid #e2e9e4; border-radius: 11px; background: #fff; box-shadow: 0 4px 12px #30483a08; }
.agenda-card-heading { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 9px; }
.agenda-card-heading h2 { min-width: 0; flex: 1; margin: 0; color: #25312b; font-size: 13px; font-weight: 650; line-height: 1.35; }
.agenda-link { flex: 0 0 auto; padding: 3px 0; border: 0; background: transparent; color: #246c5d; font-size: 11px; font-weight: 600; }
.agenda-link:hover { color: #164b40; text-decoration: underline; }
.agenda-reminder { display: flex; width: 100%; align-items: flex-start; gap: 9px; padding: 8px 0; border: 0; border-top: 1px solid #edf1ee; background: transparent; color: #34443a; text-align: left; cursor: pointer; }
.agenda-reminder:hover strong { color: #246c5d; }
.agenda-reminder-dot { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 4px; border-radius: 50%; background: #d69a51; }
.agenda-reminder-dot.task { background: #4b9273; }
.agenda-reminder strong, .agenda-reminder small { display: block; overflow-wrap: anywhere; }
.agenda-reminder strong { font-size: 12px; font-weight: 600; line-height: 1.35; }
.agenda-reminder small { margin-top: 3px; color: #78857d; font-size: 10px; line-height: 1.35; }
.agenda-empty { margin: 0; padding: 5px 0 1px; color: #7b8980; font-size: 11px; line-height: 1.45; }
.agenda-calendar-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; color: #34443a; font-size: 12px; }
.agenda-calendar-heading span { display: flex; gap: 3px; }
.agenda-calendar-heading button { display: grid; width: 27px; height: 27px; place-items: center; padding: 0; border: 1px solid #e6ece7; border-radius: 7px; background: #fff; color: #53685c; font-size: 17px; line-height: 1; }
.agenda-calendar-heading button:hover { border-color: #cbded1; background: #f4f8f5; }
.agenda-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.agenda-weekday { display: grid; height: 23px; place-items: center; color: #88948d; font-size: 9px; font-weight: 600; }
.agenda-calendar-blank { aspect-ratio: 1; }
.agenda-calendar-day { position: relative; display: grid; min-width: 0; aspect-ratio: 1; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #4b5b51; font-size: 11px; }
.agenda-calendar-day:hover { background: #edf5ef; }
.agenda-calendar-day.today { color: #246c5d; font-weight: 700; }
.agenda-calendar-day.selected { background: #246c5d; color: #fff; }
.agenda-calendar-day.has-event:not(.selected):after, .agenda-calendar-day.has-task:not(.selected):after { position: absolute; bottom: 3px; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: #d69a51; content: ''; }
.agenda-calendar-day.has-task:not(.selected):after { background: #4b9273; }
.agenda-task-count { flex: 0 0 auto; color: #78857d; font-size: 10px; font-variant-numeric: tabular-nums; }
.agenda-task { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-top: 1px solid #edf1ee; color: #34443a; cursor: pointer; }
.agenda-task input { width: 15px; height: 15px; flex: 0 0 15px; margin: 1px 0 0; accent-color: #246c5d; }
.agenda-task span { min-width: 0; overflow-wrap: anywhere; font-size: 11px; line-height: 1.4; }
.agenda-task small { display: block; margin-top: 3px; color: #78857d; font-size: 10px; }
.agenda-task.done span { color: #89948d; text-decoration: line-through; }
.agenda-capture-icon { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 7px; background: #e8f2ec; color: #246c5d; font-size: 17px; line-height: 1; }
.agenda-capture { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #e2e9e4; border-radius: 8px; background: #f8faf8; color: #7b8980; text-align: left; font-size: 11px; }
.agenda-capture:hover { border-color: #cbded1; background: #f3f8f4; color: #52675c; }
.agenda-capture-card > small { display: block; margin-top: 7px; color: #89948d; font-size: 9px; }
.panel-export { min-height: 38px; padding: 7px 10px; border: 1px solid #e2e9e4; border-radius: 7px; background: #fff; color: #35483e; cursor: pointer; }
.reference-board .main-area { display: grid; grid-template-columns: minmax(270px, 34%) minmax(0,1fr); grid-template-rows: 56px minmax(0,1fr); min-height: 0; }
.reference-board .topbar { grid-column: 1 / -1; grid-row: 1; }
.reference-board #dashboard-view, .reference-board #calendar-view { display: none !important; }
.reference-board #notes-view, .reference-board #notes-view.hidden { display: flex !important; grid-column: 1; grid-row: 2; min-width: 0; min-height: 0; max-width: none; overflow: hidden; flex-direction: column; padding: 13px 11px 82px; border-right: 1px solid #dce6fa; }
.reference-board .notes-heading { gap: 9px; padding-bottom: 10px; }
.reference-board .notes-heading .eyebrow, .reference-board .notes-heading p { display: none; }
.reference-board .notes-heading h1 { margin: 0; font: 600 18px/1.25 'DM Sans', sans-serif; }
.reference-board .notes-heading .primary-button { min-height: 34px; padding: 0 10px; font-size: 11px; }
.reference-board .template-open { min-height: 32px; padding: 0 8px; font-size: 10px; }
.reference-board .notes-toolbar { gap: 6px; padding: 5px 0 9px; }
.reference-board .filter-pills { min-width: 0; overflow-x: auto; }
.reference-board .filter-pill { min-height: 30px; padding: 0 7px; font-size: 10px; white-space: nowrap; }
.reference-board #notes-grid, .reference-board #notes-grid.list-mode { display: flex !important; min-height: 0; flex: 1; flex-direction: column; gap: 7px; overflow-y: auto; padding: 2px 2px 8px; }
.reference-board .note-card { min-height: 96px; padding: 11px; border-left: 3px solid var(--note-color, transparent); }
.reference-board .note-card-title { margin-bottom: 5px; font: 600 13px/1.35 'DM Sans', sans-serif; }
.reference-board .note-card-desc { height: auto; max-height: 34px; margin: 0 0 7px; font: 11px/1.45 'DM Sans', sans-serif; }
.reference-board .note-card-foot { gap: 6px; font-size: 9px; }
.reference-board .editor-view, .reference-board .editor-view:not(.hidden) { display: block !important; grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; overflow-y: auto; padding: 0 15px 75px; }
.reference-board .editor-toolbar { position: sticky; z-index: 2; top: 0; min-height: 48px; }
.reference-board .editor-paper { width: 100%; max-width: none; min-height: calc(100% - 60px); margin: 8px auto 16px; padding: 22px clamp(16px,2vw,30px); border-radius: 9px; }
.reference-board .note-title-input { font-size: 32px; }
@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 218px minmax(360px,1fr) 286px; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 205px minmax(0,1fr); }
  .context-panel { position: fixed; z-index: 6; right: 12px; bottom: 72px; display: block; width: min(330px, calc(100vw - 230px)); max-height: min(52vh, 500px); border: 1px solid #e2e9e4; border-radius: 12px; box-shadow: 0 8px 26px #30483a16; }
  .search-trigger { width: min(38vw, 400px); }
  .reference-board .main-area { grid-template-columns: minmax(250px,34%) minmax(0,1fr); }
  .reference-board .editor-view, .reference-board .editor-view:not(.hidden) { padding-right: 9px; padding-left: 9px; }
}
@media (max-width: 650px) {
  .app-shell { display: flex; height: auto; min-height: 100dvh; flex-direction: column; overflow: visible; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .main-area { flex: 0 0 auto; min-height: 0; overflow: visible; }
  .context-panel { position: static; flex: 0 0 auto; width: auto; max-height: none; margin: 12px 12px 18px; padding: 10px; overflow: visible; border: 1px solid #e2e9e4; border-radius: 14px; box-shadow: 0 4px 14px #30483a0c; }
  .context-panel .panel-tabs, .context-panel .panel-content { display: none !important; }
  .agenda-card { padding: 11px; }
  .agenda-card-heading { margin-bottom: 7px; }
  .agenda-calendar-grid { gap: 2px; }
  .agenda-weekday { height: 20px; }
  .breadcrumbs { min-width: 0; flex: 1 1 auto; overflow: hidden; white-space: nowrap; }
  .topbar-actions { min-width: 0; flex: 0 0 auto; gap: 4px; }
  .search-trigger { position: static; left: auto; transform: none; width: 38px; }
  .topbar-actions { position: static; }
  .dashboard { padding-bottom: 90px; }
  .editor-view { padding-bottom: 80px; }
  .editor-paper { margin-bottom: 16px; }
  .reference-board .main-area { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: 56px minmax(0,1fr); }
  .reference-board #notes-view, .reference-board #notes-view.hidden { display: none !important; }
  .reference-board .editor-view, .reference-board .editor-view:not(.hidden) { grid-column: 1; grid-row: 2; width: 100%; max-width: 100%; min-width: 0; padding: 0 10px 80px; }
}

button:not(.icon-button) { font-size: 14px; }
button.nav-item { font-size: 17px; line-height: 1.3; }

.welcome-row h1,
.notes-heading h1,
.calendar-view h1,
.auth-story-copy h1,
.auth-form h2,
.note-title-input { font-size: 40px; }
.reference-board .notes-heading h1,
.reference-board .note-title-input { font-size: 40px; }

@media (max-width: 650px) {
  .nav-item { flex: 0 0 76px; min-width: 76px; font-size: 12px; }
  .main-area { padding-bottom: 64px; }
  .dashboard, .notes-view { padding-bottom: 28px; }
  .editor-view, .reference-board .editor-view:not(.hidden) { padding-bottom: 25px; }
  .welcome-row h1, .notes-heading h1, .calendar-view h1 { font-size: 29px; }
  .auth-story-copy h1 { font-size: 38px; }
  .auth-form h2 { font-size: 32px; }
  .note-title-input, .reference-board .note-title-input { font-size: 32px; }
  .reference-board .notes-heading h1 { font-size: 18px; }
  .reference-board .notes-heading .primary-button { font-size: 12px; }
  .filter-pill, .reference-board .filter-pill { min-height: 34px; padding: 0 9px; font-size: 11px; }
  button.nav-item { font-size: 12px; }
  .context-panel { scroll-behavior: smooth; }
  .quick-capture { bottom: calc(76px + env(safe-area-inset-bottom)); }
}