/* norman — Warm Minimal design system
   Two complete colour worlds (light sand / dark espresso). Flat. No shadows. No gradients. */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=Hanken+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ─────────── Tokens ─────────── */
.app[data-theme="light"] {
  --bg:        #f7f5f0;
  --sidebar:   #ede9e1;
  --card:      #fdfbf7;
  --card-2:    #f1ede4;
  --text:      #2a2119;
  --text-dim:  #7c7164;
  --text-faint:#a99d8c;
  --label:     #6c6051;
  --border:    #e4ded1;
  --border-2:  #d6cdbc;
  --accent:    #7c5c3e;
  --accent-ink:#6b4e33;
  --accent-soft: rgba(124,92,62,0.085);
  --accent-line: rgba(124,92,62,0.22);
  --danger:    #a8543a;
  --danger-soft: rgba(168,84,58,0.075);
  --on-accent: #fbf7f1;
}
.app[data-theme="dark"] {
  --bg:        #1c1814;
  --sidebar:   #140f0b;
  --card:      #241d16;
  --card-2:    #2c241b;
  --text:      #efe7da;
  --text-dim:  #a89b88;
  --text-faint:#776b5a;
  --label:     #bdae97;
  --border:    #322a20;
  --border-2:  #41372a;
  --accent:    #c49a6c;
  --accent-ink:#d4ac80;
  --accent-soft: rgba(196,154,108,0.12);
  --accent-line: rgba(196,154,108,0.30);
  --danger:    #cf8266;
  --danger-soft: rgba(207,130,102,0.13);
  --on-accent: #1c1814;
}

/* calendar hues — muted, equal chroma, readable on both worlds */
.app {
  --cal-pers: var(--accent);
  --cal-work: oklch(0.64 0.075 248);
  --cal-fam:  oklch(0.66 0.072 152);
  --cal-heal: oklch(0.66 0.075 24);
  --cal-soc:  oklch(0.65 0.075 318);
}

/* ─────────── Reset / base ─────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
.app { min-height: 100vh; position: relative; }
[x-cloak] { display: none !important; }
.app {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}
.app button { font-family: inherit; cursor: pointer; }
.serif { font-family: 'Newsreader', Georgia, serif; }
.mono  { font-family: 'IBM Plex Mono', monospace; }
::selection { background: var(--accent-soft); }

/* ─────────── App shell (desktop) ─────────── */
.app.desktop { display: flex; min-height: 100vh; position: relative; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 26px 16px 18px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 1;
}
.brand {
  display: flex; align-items: baseline; gap: 9px;
  padding: 4px 10px 22px;
}
.brand-mark {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; align-self: center;
}
.brand-name {
  font-family: 'Newsreader', serif; font-size: 25px; font-weight: 500;
  letter-spacing: -0.01em; color: var(--text);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 11px; border-radius: 9px;
  color: var(--text-dim); font-size: 14.5px; font-weight: 500;
  background: none; border: none; text-align: left; width: 100%;
  /* transition `color` only — the active/hover background uses var(--accent*),
     which must NOT be transitioned: a var()-based background behind a
     transition sticks on its old value when the accent changes at runtime. */
  transition: color .15s;
}
.nav-item:hover { background: var(--accent-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-item.active .ico { color: var(--accent); }
.nav-item .ico { color: var(--text-faint); flex-shrink: 0; }
.nav-item.active { font-weight: 600; }
.nav-count {
  margin-left: auto; font-size: 11.5px; font-family: 'IBM Plex Mono', monospace;
  color: var(--text-faint);
}
.nav-item.active .nav-count { color: var(--accent); }

.sidebar-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: stretch; gap: 5px;
}
.sidebar-foot-row { display: flex; align-items: stretch; gap: 6px; }
.sidebar-foot-row .theme-pill { flex: 1; }
.sidebar-foot-row .icon-btn { flex-shrink: 0; border: 1px solid var(--border-2); border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--text-dim); text-decoration: none; padding: 0 11px; }
.sidebar-foot-row .icon-btn:hover { color: var(--text); border-color: var(--accent-line); }
.theme-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: 9px; width: 100%;
  background: none; border: 1px solid var(--border-2); color: var(--text-dim);
  font-size: 12.5px; font-weight: 500;
}
.theme-pill:hover { color: var(--text); border-color: var(--accent-line); }
.theme-pill .ico { color: var(--accent); }
.theme-pill small { margin-left: auto; color: var(--text-faint); font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; }

/* ─────────── Main column ─────────── */
.main { flex: 1; min-width: 0; position: relative; z-index: 1; }
.main-inner { max-width: 1320px; margin: 0 auto; padding: 40px 56px 64px; }
.mobile .main-inner { padding: 0 18px 28px; max-width: none; }

.page-head { margin-bottom: 26px; }
.page-title { font-family: 'Newsreader', serif; font-size: 30px; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
.page-sub { color: var(--text-dim); font-size: 14px; margin-top: 3px; }

/* ─────────── Dashboard top ─────────── */
.dash-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; margin-bottom: 30px; }
.clock { font-family: 'Newsreader', Georgia, serif; font-weight: 400; font-size: 84px; line-height: 0.92; letter-spacing: -0.03em; color: var(--text); font-variant-numeric: tabular-nums; }
.clock .sec { color: var(--text-faint); }
.clock-sub { margin-top: 12px; display: flex; align-items: center; gap: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; }
.clock-sub .day { color: var(--accent-ink); font-weight: 500; }
.clock-sub .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); }
.clock-sub .date { color: var(--text-dim); }

.book-widget { display: flex; gap: 14px; align-items: stretch; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); min-width: 248px; }
.book-cover { border-radius: 4px; overflow: hidden; flex-shrink: 0; position: relative; }
.book-widget .book-cover { width: 58px; height: 84px; }
.bw-meta { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.bw-label { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; white-space: nowrap; }
.bw-title { font-family: 'Newsreader', serif; font-size: 17px; font-weight: 500; line-height: 1.2; }
.bw-author { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.bw-progress { margin-top: 9px; display: flex; align-items: center; gap: 8px; }
.bw-bar { flex: 1; height: 3px; border-radius: 2px; background: var(--card-2); overflow: hidden; }
.bw-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.bw-pct { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text-faint); }

/* book cover placeholder fill */
.cover-fill { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 8px; }
.cover-fill .ct { font-family: 'Newsreader', serif; font-weight: 500; line-height: 1.12; }
.cover-fill .ca { font-family: 'IBM Plex Mono', monospace; opacity: 0.72; letter-spacing: 0.04em; }

/* ─────────── Capture ─────────── */
.capture { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--card); margin-bottom: 22px; transition: border-color .15s; }
.capture:focus-within { border-color: var(--accent-line); }
.capture .spark { color: var(--accent); flex-shrink: 0; display: flex; align-items: center; }
.capture input { flex: 1; border: none; background: none; outline: none; color: var(--text); font-size: 15px; font-family: inherit; }
.capture input::placeholder { color: var(--text-faint); }
.capture .kbd { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text-faint); border: 1px solid var(--border-2); border-radius: 5px; padding: 2px 6px; }
.capture-notice { font-size: 13px; color: var(--text-dim); margin: -10px 0 22px 4px; }

/* ─────────── Chips ─────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border-2); background: none; color: var(--text-dim); font-size: 13px; font-weight: 500; transition: color .15s, border-color .15s; }
.chip:hover { color: var(--text); border-color: var(--accent-line); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; }
.chip-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; opacity: 0.7; }

/* ─────────── Card grid ─────────── */
.grid { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
.grid.layout-asym { grid-template-columns: 1.4fr 1fr; }
.dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1040px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.card { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 20px 20px 8px; display: flex; flex-direction: column; }
.card.span-2 { grid-column: 1 / -1; }
.card.accent-overdue { border-color: color-mix(in oklab, var(--danger) 34%, var(--border)); background: var(--danger-soft); box-shadow: inset 3px 0 0 color-mix(in oklab, var(--danger) 62%, transparent); }
/* over a photo the 7.5% tint vanishes — give it a real tinted surface,
   a stronger border and keep the danger left-rail so it holds its rank */
.app.has-bg .card.accent-overdue {
  background: color-mix(in oklab, var(--danger) 15%, var(--card));
  border-color: color-mix(in oklab, var(--danger) 55%, transparent);
  box-shadow: inset 0 1px 0 var(--ring-hi), inset 3px 0 0 var(--danger), 0 2px 12px var(--ring-lo);
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title { font-family: 'Newsreader', serif; font-size: 18px; font-weight: 500; }
.card-icn { color: var(--accent); display: flex; }
.card.accent-overdue .card-icn { color: var(--danger); }
.card-count { margin-left: auto; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--text-faint); }
.card-empty { color: var(--text-faint); font-size: 13.5px; padding: 6px 0 18px; font-style: italic; font-family: 'Newsreader', serif; }

/* task rows */
.task { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; }
.task ~ .task { border-top: 1px solid var(--border); }
.check { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--border-2); flex-shrink: 0; margin-top: 3px; background: none; display: flex; align-items: center; justify-content: center; color: transparent; transition: border-color .15s, color .15s; }
.check:hover { border-color: var(--accent); }
.task.done .check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.task-main { flex: 1; min-width: 0; }
.task-title { display: inline-block; max-width: 100%; text-align: left; background: none; border: none; padding: 0; font-family: inherit; font-size: 14.5px; color: var(--text); cursor: pointer; border-bottom: 1px solid transparent; transition: color .14s, border-color .14s; }
.task-title:hover { color: var(--accent-ink); border-bottom-color: var(--accent-line); }
.task.done .task-title { color: var(--text-faint); text-decoration: line-through; }
.task.done .task-title:hover { color: var(--text-dim); }
.task-meta { display: flex; align-items: center; gap: 9px; margin-top: 4px; font-size: 11.5px; color: var(--text-dim); }
.task-proj { display: inline-flex; align-items: center; gap: 5px; }
.task-proj .swatch { width: 7px; height: 7px; border-radius: 50%; }
.task-due { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-faint); }
.task-due.over { color: var(--danger); }
.star { margin-left: 8px; color: var(--text-faint); background: none; border: none; padding: 0; flex-shrink: 0; display: flex; }
.star.on { color: var(--accent); }

/* event rows */
.event { display: flex; align-items: stretch; gap: 12px; padding: 10px 0; width: 100%; background: none; border: none; text-align: left; font-family: inherit; border-radius: 0; transition: opacity .15s; }
.event[style*="pointer"]:hover { opacity: 0.66; }
.event ~ .event { border-top: 1px solid var(--border); }
.event.past { opacity: 0.45; }
.event.past .event-title { color: var(--text-dim); }
.event-bar { width: 3px; border-radius: 2px; flex-shrink: 0; }
.event-time { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--text-dim); width: 84px; flex-shrink: 0; padding-top: 1px; }
.event-title { font-size: 14px; color: var(--text); }
.card .event-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-cal { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.card-foot { margin-top: auto; padding: 12px 0 12px; }
.card-link { background: none; border: none; color: var(--accent); font-size: 12.5px; font-weight: 600; padding: 0; display: inline-flex; align-items: center; gap: 5px; }
.card-link:hover { gap: 8px; }

/* links widget */
.links-row { display: flex; align-items: center; gap: 13px; padding: 12px 0; }
.links-row ~ .links-row { border-top: 1px solid var(--border); }
.link-fav { width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: 'Newsreader', serif; font-size: 14px; color: var(--on-accent); font-weight: 600; }
.link-main { flex: 1; min-width: 0; }
.link-title { font-size: 13.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-meta { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
.link-when { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text-faint); flex-shrink: 0; }

/* ─────────── Section accent (bold variant) ─────────── */
.app[data-accent="bold"] .chip:not(.active) { border-color: var(--accent-line); color: var(--accent-ink); }
.app[data-accent="bold"] .card-head { padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--accent-line); }
.app[data-accent="bold"] .card-title { color: var(--accent-ink); }
.app[data-accent="bold"] .capture { border-color: var(--accent-line); }
.app[data-accent="bold"] .nav-item.active { background: var(--accent); color: var(--on-accent); }
.app[data-accent="bold"] .nav-item.active .ico,
.app[data-accent="bold"] .nav-item.active .nav-count { color: var(--on-accent); }
.app[data-accent="bold"] .page-title { color: var(--accent-ink); }

/* ─────────── Generic toolbar / search ─────────── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--card); flex: 1; min-width: 200px; }
.search input { border: none; background: none; outline: none; flex: 1; color: var(--text); font-size: 14px; font-family: inherit; }
.search input::placeholder { color: var(--text-faint); }
.search .ico { color: var(--text-faint); }
.seg { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--card-2); }
.seg button { border: none; background: none; padding: 6px 13px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: none; }
.app[data-accent="bold"] .seg button.on { color: var(--accent-ink); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; flex-wrap: wrap; }
.tab { border: none; background: none; padding: 10px 4px; margin-right: 18px; font-size: 14px; font-weight: 500; color: var(--label); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab .tcount { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-faint); }
.tab.on .tcount { color: var(--accent); }

/* full task list */
.list { border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; }
.list .task { padding: 14px 18px; }
.list-group-head { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--label); padding: 18px 2px 9px; }

/* books grid */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 22px 20px; }
.mobile .books-grid { grid-template-columns: 1fr 1fr; gap: 18px 14px; }
.book-card { display: flex; flex-direction: column; gap: 10px; }
.book-card .book-cover { width: 100%; aspect-ratio: 2/3; height: auto; box-shadow: none; border: 1px solid var(--border); }
.book-card .bc-title { font-family: 'Newsreader', serif; font-size: 15px; font-weight: 500; line-height: 1.2; }
.book-card .bc-author { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.book-card .bc-prog { margin-top: 4px; display: flex; align-items: center; gap: 7px; }
.book-card .bw-bar { height: 3px; }

/* calendar */
.cal { border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.cal-month { font-family: 'Newsreader', serif; font-size: 22px; font-weight: 500; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-2); background: none; color: var(--text-dim); display: flex; align-items: center; justify-content: center; }
.cal-nav button:hover { color: var(--text); border-color: var(--accent-line); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7,1fr); padding: 14px 14px 0; }
.cal-weekdays span { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--label); text-align: left; padding-left: 5px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; padding: 8px 14px 14px; }
.mobile .cal-head { padding: 14px 12px; }
.mobile .cal-weekdays { padding: 10px 8px 0; }
.mobile .cal-weekdays span { padding-left: 2px; font-size: 10px; }
.mobile .cal-grid { gap: 3px; padding: 6px 8px 10px; }
.mobile .cal-num { font-size: 11px; }
.cal-cell { min-height: 124px; padding: 9px 7px; border-radius: 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow: hidden; }
.mobile .cal-cell { min-height: 64px; padding: 6px 3px; }
.cal-cell.dim { opacity: 0.4; }
.cal-cell.today { background: var(--accent-soft); }
.cal-num { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: var(--text-dim); margin-bottom: 1px; }
.cal-cell.today .cal-num { color: var(--accent-ink); font-weight: 600; }
.cal-ev { font-size: 11px; padding: 3px 7px; border-radius: 6px; width: 100%; min-width: 0; box-sizing: border-box; text-align: left; background: var(--card-2); border: none; font-family: inherit; display: flex; align-items: baseline; gap: 5px; transition: background .15s; overflow: hidden; }
.cal-ev:hover { background: var(--accent-soft); }
.cal-ev .ed { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; align-self: center; }
.cal-ev-t { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--text-dim); flex-shrink: 0; }
.cal-ev-n { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mobile .cal-ev-n { display: none; }
.mobile .cal-ev { padding: 2px 4px; justify-content: center; }
.cal-more { font-size: 10.5px; color: var(--text-faint); padding-left: 7px; }

/* day view (agenda) */
.agenda { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 8px 18px; }
.agenda .event { padding: 14px 0; }

/* links page */
.coll-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 14px; }
.coll-dot { width: 10px; height: 10px; border-radius: 3px; }
.coll-name { font-family: 'Newsreader', serif; font-size: 17px; font-weight: 500; }
.coll-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-faint); }
.link-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mobile .link-cards { grid-template-columns: 1fr; }
.link-card { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 11px; background: var(--card); min-width: 0; }
.link-card:hover { border-color: var(--accent-line); }

/* settings */
.settings { display: grid; grid-template-columns: 200px 1fr; gap: 36px; align-items: start; }
.mobile .settings { grid-template-columns: 1fr; gap: 20px; }
.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 40px; }
.mobile .set-nav { flex-direction: row; flex-wrap: wrap; position: static; }
.set-nav button { text-align: left; border: none; background: none; padding: 8px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--text-dim); }
.set-nav button.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.set-section { margin-bottom: 34px; }
.set-section h3 { font-family: 'Newsreader', serif; font-weight: 500; font-size: 19px; margin: 0 0 4px; }
.set-section .sh-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 15px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: none; }
.set-row .sr-main { flex: 1; }
.set-row .sr-label { font-size: 14px; font-weight: 500; }
.set-row .sr-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.toggle { width: 42px; height: 25px; border-radius: 999px; border: none; background: var(--border-2); position: relative; flex-shrink: 0; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--card); transition: left .18s; }
.toggle.on { background: var(--accent); }
.toggle.on i { left: 20px; background: var(--on-accent); }
.select-pill { padding: 7px 12px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--card); color: var(--text); font-size: 13px; font-family: inherit; }
.swatch-row { display: flex; gap: 8px; }
.swatch-opt { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; padding: 0; cursor: pointer; -webkit-appearance: none; appearance: none; outline: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); transition: transform .12s, border-color .12s; }
.swatch-opt:hover { transform: translateY(-1px); }
.swatch-opt.on { border-color: var(--text); }
/* custom-colour swatch: rainbow hint when no custom colour is active, holds a
   hidden native colour input that opens the OS picker on click */
.swatch-custom { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  background: conic-gradient(from 90deg, #c0504a, #c79a3e, #6f8f4e, #46707a, #5a5a8c, #8a4f74, #c0504a); }
.swatch-custom.on { background: none; }
.swatch-custom input[type="color"] { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; border: none; padding: 0; cursor: pointer; }

/* ─────────── Primary button ─────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-size: 13.5px; font-weight: 600; font-family: inherit; white-space: nowrap; }
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { background: none; color: var(--text-dim); border-color: var(--border-2); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--text); border-color: var(--accent-line); }

/* ─────────── Modal ─────────── */
.modal-scrim { position: fixed; inset: 0; background: rgba(20,15,11,0.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 24px; }
.modal { width: 460px; max-width: 100%; max-height: 90vh; overflow-y: auto; background: var(--card); border: 1px solid var(--border-2); border-radius: 16px; padding: 24px 24px 20px; }
.modal-scrim.spotlight-scrim { background: rgba(20,15,11,0.55); backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%); }
.modal.spotlight { width: 760px; padding: 22px; }
.modal.spotlight .capture { border: none; padding: 0; gap: 16px; background: transparent; }
.modal.spotlight .capture .spark { font-size: 22px; }
.modal.spotlight .capture .spark svg { width: 26px; height: 26px; }
.modal.spotlight .capture input { font-size: 22px; padding: 6px 0; }
.modal.spotlight .capture .kbd { font-size: 12px; padding: 4px 9px; }
.modal.spotlight .capture-notice { margin: 14px 0 0 0; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.modal-head h2 { font-family: 'Newsreader', serif; font-weight: 500; font-size: 22px; margin: 0; }
.modal-head .mh-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.modal-x { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-2); background: none; color: var(--text-dim); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.modal-x:hover { color: var(--text); border-color: var(--accent-line); }
.field { margin-bottom: 16px; }
.field-hint { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }
.field > label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-dim); margin-bottom: 7px; text-transform: uppercase; font-family: 'IBM Plex Mono', monospace; }
.field input[type="text"], .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 9px; background: var(--bg); color: var(--text); font-size: 14.5px; font-family: inherit; outline: none; }
.field input[type="text"]:focus, .field textarea:focus { border-color: var(--accent-line); }
.field input::placeholder { color: var(--text-faint); }
.field .seg { width: 100%; flex-wrap: wrap; }
.field .seg button { flex: 1; white-space: nowrap; }
.cover-preview { display: flex; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); margin-bottom: 18px; }
.cover-preview .book-cover { width: 54px; height: 80px; flex-shrink: 0; }
.cover-preview .cp-meta { min-width: 0; }
.cover-preview .cp-t { font-family: 'Newsreader', serif; font-size: 16px; font-weight: 500; }
.cover-preview .cp-a { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }
.range { width: 100%; accent-color: var(--accent); }
.range-val { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--text-faint); margin-left: 8px; }
.star-pick { display: flex; gap: 4px; }
.star-pick button { border: none; background: none; padding: 2px; color: var(--text-faint); }
.star-pick button.on { color: var(--accent); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ─────────── Mobile shell ─────────── */
.m-topbar { display: flex; align-items: center; gap: 12px; padding: 8px 2px 16px; }
.m-burger { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--card); color: var(--text); display: flex; align-items: center; justify-content: center; }
.m-title { font-family: 'Newsreader', serif; font-size: 20px; font-weight: 500; }
.m-spacer { flex: 1; }
.m-screen { height: 100%; overflow-y: auto; overflow-x: hidden; background: var(--bg); padding: 56px 0 40px; }
/* Prevent iOS Safari from auto-zooming the page when a form field is
   focused — it only does this when the field's font-size is below 16px. */
.mobile input, .mobile select, .mobile textarea { font-size: 16px !important; }
.pull-indicator { display: flex; align-items: center; justify-content: center; overflow: hidden; transition: height .15s; color: var(--text-dim); }
.pull-spinner { display: flex; transition: color .15s, transform .15s; }
.pull-spinner.ready { color: var(--text); transform: rotate(180deg); }
.pull-spinner.spin { animation: pull-spin .7s linear infinite; color: var(--text); }
@keyframes pull-spin { to { transform: rotate(360deg); } }
.m-screen .dash-top { flex-direction: column; gap: 22px; align-items: stretch; }
.mobile .clock { font-size: 62px; }
.mobile .book-widget { min-width: 0; }
.mobile .grid { grid-template-columns: 1fr; }
.mobile .grid.layout-asym { grid-template-columns: 1fr; }
.mobile .dash-grid { grid-template-columns: minmax(0, 1fr); }
/* mobile page-heads with a search collapse to a stacked layout */
.mobile .page-head { flex-wrap: wrap; }
.mobile .page-head .search { min-width: 0 !important; width: 100%; flex: 1 1 100% !important; }

/* mobile drawer */
.drawer-scrim { position: absolute; inset: 0; background: rgba(20,15,11,0.42); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .22s; }
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: absolute; top: 0; bottom: 0; left: 0; width: 76%; max-width: 300px; background: var(--sidebar); border-right: 1px solid var(--border); z-index: 81; transform: translateX(-100%); transition: transform .24s cubic-bezier(.4,0,.2,1); padding: 58px 14px 20px; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }

/* utility */
.hairline { height: 1px; background: var(--border); border: none; margin: 0; }
.stat-row { display: flex; gap: 28px; margin: 2px 0 26px; }
.stat { }
.stat .sv { font-family: 'Newsreader', serif; font-size: 26px; font-weight: 500; }
.stat .sl { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-top: 1px; }

/* ═══════════ Background image layer ═══════════ */
.appbg {
  position: fixed; inset: 0; z-index: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  pointer-events: none;
}
.m-root .appbg { border-radius: inherit; }
/* legibility wash — a faint warm scrim over the photo so contrast is
   guaranteed regardless of which image the user picks (paints above the
   photo at z-0, below all content at z-1) */
.appbg-scrim {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--scrim);
}
.m-root .appbg-scrim { border-radius: inherit; }

/* ── Background-image mode = frosted glass that keeps its own colour ──
   Higher surface opacity + stronger blur preserve the cream/espresso
   identity; borders are promoted to definition rings (a warm hairline
   plus a light top-edge and soft drop) that read on ANY photo. */
.app.has-bg[data-theme="light"] {
  --card:    rgba(252,250,246,0.88);
  --card-2:  rgba(240,236,227,0.84);
  --sidebar: rgba(236,232,224,0.84);
  --bg:      rgba(247,245,240,0.30);
  --border:      rgba(74,58,40,0.26);
  --border-2:    rgba(74,58,40,0.40);
  --accent-line: rgba(124,92,62,0.46);
  --ring-hi: rgba(255,254,250,0.85);
  --ring-lo: rgba(34,24,14,0.14);
  --scrim:   rgba(247,245,240,0.30);
}
.app.has-bg[data-theme="dark"] {
  --card:    rgba(34,27,20,0.84);
  --card-2:  rgba(44,36,27,0.80);
  --sidebar: rgba(18,13,9,0.84);
  --bg:      rgba(28,24,20,0.30);
  --border:      rgba(0,0,0,0.42);
  --border-2:    rgba(0,0,0,0.56);
  --accent-line: rgba(196,154,108,0.52);
  --ring-hi: rgba(255,238,214,0.10);
  --ring-lo: rgba(0,0,0,0.42);
  --scrim:   rgba(18,13,9,0.34);
}
.app.has-bg.desktop { background: transparent; }
.app.has-bg .sidebar,
.app.has-bg .card,
.app.has-bg .list,
.app.has-bg .cal,
.app.has-bg .agenda,
.app.has-bg .capture,
.app.has-bg .book-widget,
.app.has-bg .search,
.app.has-bg .link-card,
.app.has-bg .quote-card,
.app.has-bg .bf-preview,
.app.has-bg .bg-preview,
.app.has-bg .seg,
.app.has-bg .quote-add textarea,
.app.has-bg .td-meta,
.app.has-bg .tf-flags,
.app.has-bg .td-raw,
.app.has-bg .m-burger {
  -webkit-backdrop-filter: blur(10px) saturate(128%);
  backdrop-filter: blur(10px) saturate(128%);
}
/* definition rings: a light top edge + soft drop so every surface keeps
   crisp edges over a busy photo (this is what brings the category and
   card outlines back) */
.app.has-bg .sidebar,
.app.has-bg .card,
.app.has-bg .list,
.app.has-bg .cal,
.app.has-bg .agenda,
.app.has-bg .capture,
.app.has-bg .book-widget,
.app.has-bg .search,
.app.has-bg .link-card,
.app.has-bg .quote-card,
.app.has-bg .td-meta,
.app.has-bg .tf-flags,
.app.has-bg .bf-preview {
  box-shadow: inset 0 1px 0 var(--ring-hi), 0 2px 12px var(--ring-lo);
}
/* spotlight stays a single frosted surface — the inner .capture must not
   add its own translucent layer/blur/ring on top of the modal's */
.app.has-bg .modal.spotlight .capture {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}
/* category chips: give them a real frosted surface so the outline reads */
.app.has-bg .chip:not(.active) {
  background: var(--card);
  -webkit-backdrop-filter: blur(8px) saturate(125%);
  backdrop-filter: blur(8px) saturate(125%);
  box-shadow: inset 0 1px 0 var(--ring-hi);
}
.app.has-bg .m-screen { background: transparent; }

/* ═══════════ Event detail (read-only) ═══════════ */
.event-modal { width: 420px; }
.ev-stripe { width: 4px; border-radius: 3px; flex-shrink: 0; align-self: stretch; }
.ev-detail { display: flex; flex-direction: column; gap: 13px; padding: 4px 0 6px; }
.ev-line { display: flex; align-items: flex-start; gap: 11px; font-size: 14px; color: var(--text); }
.ev-ico { color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.ev-note { margin-top: 4px; padding: 13px 15px; border-radius: 11px; background: var(--card-2); border: 1px solid var(--border); font-family: 'Newsreader', serif; font-size: 14.5px; line-height: 1.5; color: var(--text); }
.ev-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }

/* ═══════════ Book cover image ═══════════ */
.book-cover.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ═══════════ Books — year headings ═══════════ */
.year-group { margin-bottom: 30px; }
.year-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 16px; }
.year-num { font-family: 'Newsreader', serif; font-size: 21px; font-weight: 500; color: var(--accent-ink); }
.year-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--label); white-space: nowrap; }
.year-line { flex: 1; height: 1px; background: var(--border); }
.book-card { display: flex; flex-direction: column; gap: 10px; background: none; border: none; padding: 0; text-align: left; font-family: inherit; }
.book-card { cursor: pointer; }
.book-card .book-cover { transition: transform .15s; }
.book-card:hover .book-cover { transform: translateY(-3px); }
.bc-quotes { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 11px; color: var(--text-faint); }

/* ═══════════ Back link ═══════════ */
.back-link { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; padding: 4px 0; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.back-link:hover { color: var(--accent-ink); }

/* ═══════════ New-book page ═══════════ */
.book-form { display: grid; grid-template-columns: 200px 1fr; gap: 36px; align-items: start; }
.mobile .book-form { grid-template-columns: 1fr; gap: 22px; }
.bf-preview { display: flex; flex-direction: column; gap: 14px; align-items: center; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); position: sticky; top: 40px; }
.mobile .bf-preview { position: static; flex-direction: row; align-items: center; gap: 18px; }
.bf-preview .book-cover { width: 118px; height: 177px; flex-shrink: 0; border: 1px solid var(--border); }
.bf-pv-meta { text-align: center; min-width: 0; }
.mobile .bf-pv-meta { text-align: left; }
.bf-pv-t { font-family: 'Newsreader', serif; font-size: 17px; font-weight: 500; line-height: 1.2; }
.bf-pv-a { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.bf-pv-status { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-top: 9px; }
.bf-fields { max-width: 480px; }
.book-form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.cover-img-input { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 9px; background: var(--bg); }
.cover-img-input .cii-ico { color: var(--text-faint); flex-shrink: 0; }
.cover-img-input input { flex: 1; border: none; background: none; outline: none; color: var(--text); font-size: 14px; font-family: inherit; }
.cover-img-input input::placeholder { color: var(--text-faint); }
.field .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* ═══════════ Book detail ═══════════ */
.book-detail { max-width: 760px; }
.bd-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bd-actions { display: flex; align-items: center; gap: 8px; }
.btn.sm { padding: 7px 13px; font-size: 12.5px; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--card); color: var(--text-dim); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--text); border-color: var(--accent-line); }
.icon-btn.danger:hover { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, transparent); }
.bd-head { display: flex; gap: 26px; align-items: flex-start; margin: 16px 0 30px; }
.mobile .bd-head { gap: 18px; flex-wrap: wrap; }
.bd-cover .book-cover { width: 132px; height: 198px; border: 1px solid var(--border); flex-shrink: 0; }
.mobile .bd-cover .book-cover { width: 104px; height: 156px; }
.bd-meta { padding-top: 6px; min-width: 0; flex: 1; }
.bd-status { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.bd-title { font-family: 'Newsreader', serif; font-size: 32px; font-weight: 500; letter-spacing: -0.01em; margin: 0; line-height: 1.12; }
.bd-author { font-size: 15px; color: var(--text-dim); margin-top: 5px; }
.bd-status-pick { margin-top: 18px; }
.bsp-label { display: block; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.seg-wrap { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg-wrap button { white-space: nowrap; }
.status-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.status-chip { white-space: nowrap; border: 1px solid var(--border-2); background: var(--card); color: var(--text-dim); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; font-family: inherit; }
.status-chip:hover { border-color: var(--accent-line); color: var(--text); }
.status-chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.bd-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.bd-section-head .card-icn { color: var(--accent); }

/* quotes */
.quote-add { border: 1px solid var(--border-2); border-radius: 13px; background: var(--card); padding: 14px; margin-bottom: 22px; }
.quote-add textarea { width: 100%; border: none; background: none; outline: none; resize: vertical; color: var(--text); font-family: 'Newsreader', serif; font-size: 16px; line-height: 1.5; min-height: 48px; }
.quote-add textarea::placeholder { color: var(--text-faint); font-style: italic; }
.quote-add-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.qa-page { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--bg); }
.qa-page .mono { font-size: 12px; color: var(--text-faint); }
.qa-page input { width: 44px; border: none; background: none; outline: none; color: var(--text); font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.quote-list { display: flex; flex-direction: column; gap: 12px; }
.quote-card { position: relative; display: flex; gap: 14px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 13px; background: var(--card); }
.quote-mark { font-family: 'Newsreader', serif; font-size: 40px; line-height: 0.8; color: var(--accent-line); flex-shrink: 0; }
.quote-body { flex: 1; min-width: 0; }
.quote-text { font-size: 17px; line-height: 1.5; color: var(--text); }
.quote-page { font-size: 11px; color: var(--text-faint); margin-top: 8px; letter-spacing: 0.04em; }
.quote-del { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--text-faint); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; }
.quote-card:hover .quote-del { opacity: 1; }
.quote-del:hover { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 30%, transparent); }

/* ═══════════ Links — categories + tags ═══════════ */
.coll-bar { margin-bottom: 22px; }
.link-row1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.link-row1 .link-title { flex: 1; min-width: 0; }
.link-pin { color: var(--accent); display: inline-flex; flex-shrink: 0; }
.link-go { color: var(--text-faint); flex-shrink: 0; align-self: center; display: flex; }
.link-card { align-items: flex-start; }
.link-card .link-fav { margin-top: 1px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--text-dim); background: var(--card-2); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px; }

/* ═══════════ Settings — sliders + bg preview ═══════════ */
.set-slider { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.set-slider .range { flex: 1; }
.set-slider .range-val { margin-left: 0; min-width: 42px; text-align: right; }
.example-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; background: none; border: none; padding: 0; color: var(--accent); font-size: 12.5px; font-weight: 600; font-family: inherit; }
.example-link:hover { gap: 8px; }
.bg-preview { position: relative; height: 150px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); margin: 6px 0 18px; background: var(--card-2); }
.bg-preview-img { position: absolute; inset: 0; background-size: cover; background-position: center; }
.bg-preview-tag { position: absolute; left: 10px; bottom: 10px; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; background: rgba(20,15,11,0.5); padding: 3px 8px; border-radius: 6px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* ═══════════ Task detail (own page) ═══════════ */
.task-detail { max-width: 720px; }
.icon-btn.star-on { color: var(--accent); border-color: var(--accent-line); }
.muted { color: var(--text-faint); }

.td-head { display: flex; gap: 16px; align-items: flex-start; margin: 18px 0 26px; }
.td-check { width: 30px; height: 30px; border-radius: 9px; border: 1.5px solid var(--border-2); flex-shrink: 0; margin-top: 4px; background: none; color: transparent; display: flex; align-items: center; justify-content: center; transition: border-color .15s, color .15s, background .15s; }
.td-check:hover { border-color: var(--accent); }
.td-check.done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.td-head-main { flex: 1; min-width: 0; }
.td-title { font-family: 'Newsreader', serif; font-size: 30px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.14; margin: 0; color: var(--text); text-wrap: pretty; }
.td-title.done { color: var(--text-faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.td-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.td-proj { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.td-proj .swatch { width: 8px; height: 8px; border-radius: 50%; }
.td-status { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); border: 1px solid var(--border-2); border-radius: 999px; padding: 3px 10px; }
.td-status.done { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.td-star { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--accent); }

.td-meta { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 13px; background: var(--card); overflow: hidden; margin-bottom: 22px; }
.tmeta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--border); }
.tmeta:first-child { border-top: none; }
.tmeta-ico { color: var(--text-faint); display: flex; flex-shrink: 0; }
.tmeta-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); width: 110px; flex-shrink: 0; }
.tmeta-val { font-size: 14px; line-height: 1.45; color: var(--text); min-width: 0; }
.tmeta-val.accent { color: var(--danger); font-weight: 600; }

.td-sec-label { display: flex; align-items: center; gap: 7px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }
.td-sec-label svg { color: var(--text-faint); }
.td-notes { margin-bottom: 24px; }
.td-notes p { font-family: 'Newsreader', serif; font-size: 16.5px; line-height: 1.6; color: var(--text); margin: 0; white-space: pre-wrap; text-wrap: pretty; }

.td-raw { border: 1px solid var(--accent-line); border-radius: 13px; background: var(--accent-soft); padding: 16px 18px; }
.td-raw-head { display: flex; align-items: center; gap: 8px; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 10px; }
.td-raw-head .spark { display: flex; color: var(--accent); }
.td-raw-body { font-family: 'Newsreader', serif; font-style: italic; font-size: 16px; line-height: 1.55; color: var(--text); }
.td-raw-foot { font-size: 10px; letter-spacing: 0.04em; color: var(--text-faint); margin-top: 10px; }

/* ═══════════ Task form (own page) ═══════════ */
.task-form { max-width: 720px; }
.tf-title { margin: 16px 0 22px; }
.tf-body { display: flex; flex-direction: column; }
.tf-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mobile .tf-2col { grid-template-columns: 1fr; gap: 0; }
.field input[type="date"], .field input[type="time"], .field input[type="number"] { width: 100%; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 9px; background: var(--bg); color: var(--text); font-size: 14.5px; font-family: inherit; }
.field input[type="date"]:focus, .field input[type="time"]:focus, .field input[type="number"]:focus { border-color: var(--accent-line); outline: none; }
.app[data-theme="dark"] .field input[type="date"]::-webkit-calendar-picker-indicator,
.app[data-theme="dark"] .field input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.7); }
.tf-select { width: 100%; }
.tf-recur-seg { margin-bottom: 0; }
.tf-recur-detail { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13.5px; color: var(--text-dim); flex-wrap: wrap; }
.tf-num { width: 64px !important; text-align: center; }
.tf-weekdays { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tf-wd { width: 42px; height: 38px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--card); color: var(--text-dim); font-size: 12.5px; font-weight: 600; font-family: 'IBM Plex Mono', monospace; }
.tf-wd:hover { border-color: var(--accent-line); color: var(--text); }
.tf-wd.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tf-flags { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: 13px; background: var(--card); padding: 4px 16px; margin: 6px 0 4px; }
.tf-flags .set-row { border-top: 1px solid var(--border); }
.tf-flags .set-row:first-child { border-top: none; }
.tf-raw { margin-top: 18px; }

/* ═══════════ Aufgaben-Toolbar-Aktionen ═══════════ */
.th-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mobile .th-actions { flex-wrap: wrap; }
.mobile .th-actions .btn { padding: 8px 12px; font-size: 12.5px; }

/* ═══════════ Projekt-Pflege ═══════════ */
.proj-manage { max-width: 680px; }
.proj-manage .page-head { margin-top: 18px; }

.proj-card { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 18px; margin-bottom: 14px; }
.proj-card-new { border-color: var(--accent-line); background: var(--accent-soft); }

.proj-form { display: flex; flex-direction: column; gap: 14px; }
.proj-form-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.proj-name-input { flex: 1; min-width: 180px; border: 1px solid var(--border-2); background: var(--bg); color: var(--text); border-radius: 10px; padding: 10px 13px; font-size: 14.5px; font-family: inherit; outline: none; }
.proj-name-input:focus { border-color: var(--accent); }
.proj-name-input::placeholder { color: var(--text-faint); }
.proj-form-actions { display: flex; align-items: center; gap: 8px; }

.proj-swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.proj-sw { position: relative; width: 28px; height: 28px; border-radius: 50%; border: none; padding: 0; cursor: pointer; flex-shrink: 0; }
.proj-sw .proj-sw-ring { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid transparent; transition: border-color 0.12s; }
.proj-sw:hover .proj-sw-ring { border-color: var(--border-2); }
.proj-sw.on .proj-sw-ring { border-color: var(--text-dim); }

.proj-hint { font-size: 12.5px; color: var(--text-dim); }
.proj-hint.warn { color: var(--danger); }

.proj-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; }
.proj-row { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-top: 1px solid var(--border); }
.proj-row:first-child { border-top: none; }
.proj-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.proj-row-main { flex: 1; min-width: 0; }
.proj-row-name { font-size: 15px; font-weight: 500; color: var(--text); }
.proj-row-meta { font-size: 11px; color: var(--label); margin-top: 2px; letter-spacing: 0.04em; }
.proj-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn.is-disabled { opacity: 0.34; cursor: not-allowed; }
.icon-btn.is-disabled:hover { color: var(--text-dim); border-color: var(--border-2); }

.proj-confirm { display: flex; align-items: center; gap: 9px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.proj-confirm-q { font-size: 13px; color: var(--text-dim); }
.btn.danger-btn { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-btn:hover { background: color-mix(in oklab, var(--danger) 85%, #000); border-color: color-mix(in oklab, var(--danger) 85%, #000); }

.proj-note { margin-top: 16px; font-size: 11px; color: var(--text-faint); letter-spacing: 0.04em; line-height: 1.6; }

/* ═══════════ Auth (login / setup) ═══════════ */
.auth-screen { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 28px 26px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-title { font-family: 'Newsreader', serif; font-size: 24px; font-weight: 500; margin: 0 0 4px; }
.auth-sub { font-size: 13px; color: var(--text-dim); margin: 0 0 22px; }
.auth-error { font-size: 13px; color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in oklab, var(--danger) 34%, var(--border)); border-radius: 9px; padding: 9px 12px; margin-bottom: 16px; }
.auth-card .field input[type="password"] { width: 100%; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: 9px; background: var(--bg); color: var(--text); font-size: 14.5px; font-family: inherit; outline: none; }
.auth-card .field input[type="password"]:focus { border-color: var(--accent-line); }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }
.auth-remember input { accent-color: var(--accent); }
.auth-card .btn { width: 100%; justify-content: center; padding: 11px 15px; }
