/* ============================================================
   The Docket — Design System
   Editorial · Warm · Quiet
   Palette draws from khardori.com (navy + gold) like The Cookbook
   ============================================================ */

:root {
  /* Palette — Slate Blue + Antique Gold (editorial, cool blue + warm gold) */
  --bg:        #F4F1EA;
  --bg-soft:   #ECE6D5;
  --surface:   #FFFFFF;
  --surface-2: #FBF7EA;
  --ink:       #1A1F2A;
  --ink-2:     #3A4252;
  --muted:     #6A6E7A;
  --muted-2:   #9CA0AB;
  --line:      #DEDACD;
  --line-2:    #CBC5B0;
  --navy:      #3D5670;          /* "navy" is now slate blue (kept var name for compat) */
  --navy-d:    #2C405A;
  --gold:      #A47E3B;          /* antique gold */
  --gold-d:    #836329;
  --gold-soft: #C0A37A;
  --accent:    #3D5670;

  /* Sidebar accent families */
  --gold-bg:   #F2EBDB;
  --blue-bg:   #E9EEF4;
  --blue-fg:   #6B89A5;
  --gray-bg:   #EDEAE0;
  --gray-fg:   #8B8478;
  --gray-line: #DCD7C6;

  /* Status colors */
  --urgent:    #B65644;
  --warn:      #B89125;

  /* Typography */
  --serif:  "Fraunces", "Old Standard TT", "Iowan Old Style", Georgia, serif;
  --sans:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px;

  /* Radius */
  --r-1: 6px; --r-2: 12px; --r-3: 20px;

  /* Shadow */
  --shadow-1: 0 1px 2px rgba(27,23,20,.04), 0 4px 12px rgba(27,23,20,.04);
  --shadow-2: 0 4px 16px rgba(27,23,20,.06), 0 12px 40px rgba(27,23,20,.08);
}

/* Dark mode — slate-blue ground, antique gold accent for legibility */
body.theme-dark {
  --bg:        #1A1F2A;
  --bg-soft:   #232936;
  --surface:   #2C3340;
  --surface-2: #353C4A;
  --ink:       #EAE6D8;
  --ink-2:     #CFC9BA;
  --muted:     #8E94A1;
  --muted-2:   #5F6471;
  --line:      #353B49;
  --line-2:    #444B5B;
  --navy:      #EAE6D8;
  --gold:      #C0986A;
  --gold-d:    #A47E3B;
  --accent:    #C0986A;
  --gold-bg:   #2B3140;
  --blue-bg:   #232B3B;
  --blue-fg:   #93B1D0;
  --gray-bg:   #292E39;
  --gray-fg:   #B0AC9F;
  --gray-line: #353B49;
}
@media (prefers-color-scheme: dark) {
  body:not(.theme-light) {
    --bg:        #1A1F2A;
    --bg-soft:   #232936;
    --surface:   #2C3340;
    --surface-2: #353C4A;
    --ink:       #EAE6D8;
    --ink-2:     #CFC9BA;
    --muted:     #8E94A1;
    --muted-2:   #5F6471;
    --line:      #353B49;
    --line-2:    #444B5B;
    --navy:      #EAE6D8;
    --gold:      #C0986A;
    --gold-d:    #A47E3B;
    --accent:    #C0986A;
    --gold-bg:   #2B3140;
    --blue-bg:   #232B3B;
    --blue-fg:   #93B1D0;
    --gray-bg:   #292E39;
    --gray-fg:   #B0AC9F;
    --gray-line: #353B49;
  }
}

/* Reset */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Tappable utility (lessons from Cookbook) ── */
.tappable, button, .iconbtn, .util-link, .commentary-item, .media-item, .archive-item, .filter-chip {
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0,0,0,.05);
  touch-action: manipulation;
  user-select: none;
}

/* ── View management ── */
.view { display: none; min-height: 100dvh; }
.view.active { display: block; }

/* ── Login ── */
.login {
  max-width: 360px;
  margin: 0 auto;
  padding: 18vh var(--s-5) var(--s-6);
}
.login__brand {
  text-align: center;
  margin-bottom: var(--s-7);
}
.brand__name {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--navy);
}
.login__title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  margin: 0 0 var(--s-2);
  color: var(--ink);
}
.login__sub {
  color: var(--muted);
  margin: 0 0 var(--s-5);
  font-size: 15px;
}
.login__form { display: flex; flex-direction: column; gap: var(--s-3); }
.login__form input {
  font-family: var(--sans);
  font-size: 18px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.login__form input:focus { border-color: var(--gold); }
.login__btn {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: var(--s-3) var(--s-4);
  background: var(--navy);
  color: #FAF6EE;
  border: none;
  border-radius: var(--r-1);
}
.login__btn:hover { background: var(--navy-d); }
.login__error {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--urgent);
  margin-top: var(--s-2);
}

/* ── Top bar ── */
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  position: sticky;
  top: 0;
  z-index: 10;
  transform: translateZ(0);
}
.topbar__inner {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  min-width: 0;
}
.brand__date {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__nav { display: flex; gap: var(--s-1); }

.iconbtn {
  background: none;
  border: none;
  color: var(--ink);
  padding: var(--s-2);
  border-radius: var(--r-1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.iconbtn:hover { background: var(--bg-soft); }
.iconbtn.active { color: var(--gold); }

/* ── Search bar ── */
.searchbar {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.searchbar input {
  flex: 1;
  font-family: var(--sans);
  font-size: 15px;
  padding: var(--s-2) 0;
  border: none;
  background: transparent;
  color: var(--ink);
  outline: none;
}
.searchclose {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  padding: 0 var(--s-2);
}

/* ── Main pane ── */
.main {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-4) var(--s-8);
}
.pane { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.loader, .empty {
  text-align: center;
  color: var(--muted);
  padding: var(--s-7) var(--s-4);
  font-family: var(--sans);
  font-size: 14px;
}

/* ── Today view: digest layout ── */
.today-header {
  margin-bottom: var(--s-5);
}
.today-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s-2);
}
.today-headline {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
  font-weight: 500;
  margin: 0;
  color: var(--ink);
}

/* Gold box: Editor's Summary, Story Angles */
.box-gold {
  background: var(--gold-bg);
  border-left: 4px solid var(--gold);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-5);
  border-radius: 0 var(--r-1) var(--r-1) 0;
}
.box-gold ul { margin: 0; padding-left: var(--s-4); }
.box-gold li { margin-bottom: var(--s-2); }
.box-gold li:last-child { margin-bottom: 0; }

.box-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-d);
  margin-bottom: var(--s-3);
}

/* Section header */
.section-header {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  padding-bottom: var(--s-2);
  margin: var(--s-6) 0 var(--s-4);
}

/* Story */
.story {
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
}
.story:last-child { border-bottom: none; }
.story.urgent { padding-left: var(--s-3); border-left: 3px solid var(--urgent); }
.story.questionable { padding-left: var(--s-3); border-left: 3px solid var(--warn); }

.story h3 {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  margin: 0 0 var(--s-1);
}
.story h3 a { color: var(--ink); }
.story h3 a:hover { color: var(--gold-d); text-decoration: none; }

.story-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: var(--s-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.meta-sep { color: var(--line-2); }

.badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
}
.badge--single { background: #fff3cd; color: #856404; }
.badge--stale  { background: #f0f0f0; color: #aaa; }
.badge--paywall { background: #f5f5f5; color: #999; }

.story-body p { margin: 0 0 var(--s-3); }
.story-body ul { margin: var(--s-2) 0 var(--s-3) var(--s-5); padding: 0; }
.story-body li { margin-bottom: var(--s-1); }
.story-body strong { font-weight: 700; }
.story-body em { font-style: italic; }
.story-body blockquote {
  border-left: 2px solid var(--blue-fg);
  margin: var(--s-3) 0;
  padding: var(--s-1) 0 var(--s-1) var(--s-4);
  font-style: italic;
  color: var(--ink-2);
}

.bottom-line {
  background: var(--surface-2);
  border-left: 2px solid var(--gold);
  padding: var(--s-3) var(--s-4);
  margin-top: var(--s-3);
}
.bottom-line-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: var(--s-1);
}
.bottom-line ul { margin: 0; padding-left: var(--s-4); list-style: none; }
.bottom-line li {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: var(--s-1);
  color: var(--ink-2);
}

/* Sidebar boxes (blue family: What to Watch, Court Calendar, Filings, Polling) */
.box-blue {
  background: var(--blue-bg);
  border-left: 4px solid var(--blue-fg);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-5) 0;
  border-radius: 0 var(--r-1) var(--r-1) 0;
}
.box-blue .box-label { color: var(--blue-fg); }

/* Sidebar boxes (gray family: Commentary, Media, Truth Social, Personal) */
.box-gray {
  background: var(--gray-bg);
  border-left: 4px solid var(--gray-fg);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-5) 0;
  border-radius: 0 var(--r-1) var(--r-1) 0;
}
.box-gray .box-label { color: var(--gray-fg); }

/* Sidebar list items (commentary, media, etc.) */
.sidebar-item {
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--gray-line);
}
.sidebar-item:last-child { border-bottom: none; padding-bottom: 0; }
.sidebar-item a {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.sidebar-item .sidebar-meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Watch / Calendar items */
.watch-item, .cal-item {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: var(--s-3);
}
.watch-item:last-child, .cal-item:last-child { margin-bottom: 0; }
.watch-date, .cal-date {
  font-weight: 700;
  color: var(--ink);
}
.watch-pointer {
  display: block;
  font-size: 12px;
  color: var(--blue-fg);
  margin-top: 2px;
}

/* ── Archive view ── */
.archive-header {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s-3);
}
.archive-list { display: flex; flex-direction: column; gap: var(--s-2); }
.archive-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--s-3) var(--s-4);
  display: block;
  color: var(--ink);
  text-decoration: none;
}
.archive-item:hover { border-color: var(--gold); text-decoration: none; }
.archive-date {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-d);
  margin-bottom: 4px;
}
.archive-headline {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.3;
  font-weight: 500;
  margin: 0 0 var(--s-1);
  color: var(--ink);
}
.archive-stats {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
}

/* ── Footer ── */
.appfoot {
  max-width: 760px;
  margin: var(--s-6) auto 0;
  padding: var(--s-4) var(--s-4) calc(var(--s-5) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  gap: var(--s-3);
  align-items: center;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
.util-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: var(--muted);
  padding: 0;
}
.util-link:hover { color: var(--gold-d); }
.util-sep { color: var(--line-2); }

/* ============================================================
   To Do view
   ============================================================ */
.todos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-4);
}
.todos-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  margin: 0;
  color: var(--ink);
}
.todos-count {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.todo-add-form {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}
.todo-add-input {
  flex: 1;
  font-family: var(--sans);
  font-size: 15px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.todo-add-input:focus { border-color: var(--gold); }
.todo-add-category {
  font-family: var(--sans);
  font-size: 14px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
}
.todo-add-btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: var(--s-2) var(--s-4);
  background: var(--navy);
  color: #FAF6EE;
  border: none;
  border-radius: var(--r-1);
}

.todo-category {
  margin-bottom: var(--s-6);
}
.todo-category-header {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-d);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-3);
}
.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.todo-item {
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}
.todo-item:last-child { border-bottom: none; }
.todo-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}
.todo-children {
  list-style: none;
  margin: var(--s-2) 0 0 36px;
  padding: 0;
  border-left: 2px solid var(--line);
  padding-left: var(--s-3);
}
.todo-children.empty-droppable {
  min-height: 8px;
  border-left: none;
  margin-left: 36px;
  padding: 0;
}
.todo-drag, .idea-drag {
  font-family: var(--sans);
  color: var(--muted-2);
  cursor: grab;
  user-select: none;
  padding: 2px 4px;
  font-size: 14px;
  letter-spacing: -2px;
  flex-shrink: 0;
}
.todo-drag:active, .idea-drag:active { cursor: grabbing; }

/* Sortable visual states */
.sortable-ghost {
  opacity: 0.4;
  background: var(--bg-soft);
}
.sortable-chosen { cursor: grabbing; }
.sortable-drag {
  opacity: 0.95;
  box-shadow: var(--shadow-2);
}
.empty-droppable {
  min-height: 12px;
}
.todo-item.done .todo-text { color: var(--muted-2); text-decoration: line-through; }
.todo-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1.5px solid var(--line-2);
  border-radius: 4px;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.todo-check.checked {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}
.todo-check svg { display: block; }
.todo-text {
  flex: 1;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  word-wrap: break-word;
  outline: none;
}
.todo-text[contenteditable="true"] {
  background: var(--surface-2);
  padding: 4px 6px;
  border-radius: 4px;
  margin: -4px -6px;
}
.todo-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.todo-item:hover .todo-actions { opacity: 1; }
.todo-action {
  background: none;
  border: none;
  color: var(--muted-2);
  font-family: var(--sans);
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
}
.todo-action:hover { color: var(--ink); }
.todo-action.danger:hover { color: var(--urgent); }

/* ============================================================
   Ideas view
   ============================================================ */
.ideas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-4);
  gap: var(--s-3);
  flex-wrap: wrap;
}
.ideas-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  margin: 0;
}
.ideas-new-btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: var(--s-2) var(--s-3);
  background: var(--navy);
  color: #FAF6EE;
  border: none;
  border-radius: var(--r-1);
}

.ideas-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.filter-chip {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
}
.filter-chip.active {
  background: var(--navy);
  color: #FAF6EE;
  border-color: var(--navy);
}

.idea-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.idea-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: var(--s-3) var(--s-4);
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
}
.idea-card:hover { border-color: var(--gold); }
.idea-card-body { flex: 1; min-width: 0; }
.idea-children {
  margin: var(--s-2) 0 0 var(--s-5);
  border-left: 2px solid var(--line);
  padding-left: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.idea-children.empty-droppable {
  min-height: 8px;
  border-left: none;
  margin-left: var(--s-5);
  padding: 0;
}
.idea-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.idea-card-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  margin: 0;
  line-height: 1.3;
  flex: 1;
}
.idea-status {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-confirmed { background: #e8f0e2; color: #4a7c3a; }
.status-tentative { background: #fbf3df; color: #7e6018; }
.status-backlog   { background: #ececec; color: #666; }
.status-published { background: #e3e9f3; color: #3a6b9a; }
.status-dropped   { background: #f5dada; color: #884747; }

.idea-card-preview {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0 0 var(--s-2);
}
.idea-card-meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
}
.idea-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-2);
}
.idea-card-actions {
  display: flex;
  gap: 2px;
}
.idea-card-wrap {
  margin-bottom: var(--s-3);
}

/* Idea detail */
.idea-detail-back {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  padding: 0;
  margin-bottom: var(--s-4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.idea-detail-back:hover { color: var(--ink); }
.idea-title-input {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  color: var(--ink);
  margin-bottom: var(--s-3);
  padding: 0;
}
.idea-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
  margin-bottom: var(--s-4);
  font-family: var(--sans);
  font-size: 13px;
}
.idea-status-select, .idea-tags-input {
  font-family: var(--sans);
  font-size: 13px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
}
.idea-body-editor {
  width: 100%;
  min-height: 360px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
  outline: none;
}
.idea-body-editor:focus { border-color: var(--gold); }
.idea-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--s-4);
}
.idea-save {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: var(--s-2) var(--s-4);
  background: var(--navy);
  color: #FAF6EE;
  border: none;
  border-radius: var(--r-1);
}
.idea-save.dirty { background: var(--gold); }
.idea-delete {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-1);
}
.idea-delete:hover { color: var(--urgent); border-color: var(--urgent); }
.idea-save-status {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   Story-level Save button, Saved view
   ============================================================ */
.story-actions {
  display: flex;
  gap: 6px;
  margin-bottom: var(--s-3);
}
.story-save-btn {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.story-save-btn:hover { color: var(--gold-d); border-color: var(--gold); }
.story-save-btn.saved { color: var(--gold-d); border-color: var(--gold); background: var(--gold-bg); }
.story-pitch-btn {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
}
.story-pitch-btn:hover { color: var(--navy); border-color: var(--navy); }

.saved-empty {
  text-align: center;
  color: var(--muted);
  padding: var(--s-7) var(--s-4);
}

/* ============================================================
   Per-section collapsible header
   ============================================================ */
.section-header.collapsible {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-header.collapsible::after {
  content: "▼";
  font-size: 9px;
  color: var(--muted-2);
  margin-left: 8px;
  transition: transform 0.15s;
}
.section-header.collapsed::after { transform: rotate(-90deg); }
.section-stories[hidden] { display: none; }

/* ============================================================
   Bottom Line — pulled out more visually
   ============================================================ */
.bottom-line {
  background: var(--gold-bg);
  border-left: 3px solid var(--gold);
  padding: var(--s-3) var(--s-4);
  margin-top: var(--s-4);
  border-radius: 0 var(--r-1) var(--r-1) 0;
}
.bottom-line-label {
  color: var(--gold-d);
  font-weight: 700;
  letter-spacing: 0.1em;
}
.bottom-line li { color: var(--ink); }

/* ============================================================
   Markdown rendering in idea bodies
   ============================================================ */
.md-render {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
}
.md-render p { margin: 0 0 var(--s-3); }
.md-render p:last-child { margin-bottom: 0; }
.md-render h1, .md-render h2, .md-render h3 {
  font-family: var(--serif);
  font-weight: 600;
  margin: var(--s-4) 0 var(--s-2);
  color: var(--ink);
}
.md-render h1 { font-size: 22px; }
.md-render h2 { font-size: 18px; }
.md-render h3 { font-size: 16px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.md-render ul, .md-render ol { margin: var(--s-2) 0 var(--s-3) var(--s-5); }
.md-render li { margin-bottom: 4px; }
.md-render a { color: var(--gold-d); text-decoration: underline; }
.md-render blockquote {
  border-left: 3px solid var(--blue-fg);
  margin: var(--s-3) 0;
  padding: var(--s-1) 0 var(--s-1) var(--s-4);
  color: var(--ink-2);
  font-style: italic;
}
.md-render code {
  background: var(--bg-soft);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 90%;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.md-render strong { font-weight: 700; }
.md-render em { font-style: italic; }

.idea-edit-toggle {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  color: var(--muted);
}
.idea-edit-toggle.active { background: var(--gold); color: #fff; border-color: var(--gold); }
.idea-mode-row { margin-bottom: var(--s-3); display: flex; gap: 6px; }

/* ============================================================
   Pitch outline modal
   ============================================================ */
.pitch-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
}
.pitch-modal-body {
  background: var(--bg);
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: var(--r-2);
  padding: var(--s-5);
  box-shadow: var(--shadow-2);
}
.pitch-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--s-4);
}
.pitch-modal-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  margin: 0;
}
.pitch-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
}
.pitch-modal-actions { display: flex; gap: 8px; margin-top: var(--s-4); justify-content: flex-end; }

/* ============================================================
   Bottom tab bar (phone widths only)
   ============================================================ */
.bottombar { display: none; }
@media (max-width: 640px) {
  .topbar__nav { display: none; }     /* hide topbar icons on phone */
  .bottombar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 50;
    justify-content: space-around;
  }
  .bottombar-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    font-family: var(--sans);
    font-size: 10px;
    cursor: pointer;
  }
  .bottombar-btn span { line-height: 1; }
  .bottombar-btn.active { color: var(--gold-d); }
  /* leave space for the bar so content doesn't get covered */
  .main { padding-bottom: 80px; }
  .appfoot { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   iPad / desktop two-pane (landscape >= 1100px)
   Archive list stays in a left rail; today/archive content on right.
   Only applied in archive + saved views via .pane--archive class.
   ============================================================ */
@media (min-width: 1100px) and (orientation: landscape) {
  .main { max-width: 1100px; padding-left: var(--s-5); padding-right: var(--s-5); }
  /* No major layout split for v1 -- iPad gets wider single column, more comfortable */
}

/* ============================================================
   Universal search results
   ============================================================ */
.search-results-group {
  margin-bottom: var(--s-5);
}
.search-results-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin-bottom: var(--s-3);
}
.search-result {
  display: block;
  padding: var(--s-2) 0;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-soft); }
.search-result-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 2px;
}
.search-result-meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
}
.search-empty-group {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted-2);
  font-style: italic;
}

/* ── Toast ── */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--s-5) + env(safe-area-inset-bottom));
  background: var(--navy);
  color: #FAF6EE;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-1);
  font-family: var(--sans);
  font-size: 14px;
  box-shadow: var(--shadow-2);
  z-index: 100;
  animation: toastIn .25s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%); }
}
