/* ═══════════════════════════════════════════════════════════════
   AI Chief of Staff — Design System
   Neville Brody. Editorial. Type as structure. Geometric grotesque.
   High contrast. Electric accent. Weight tension. No decoration.
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  /* Text hierarchy */
  --text: #0d0d0d; --secondary: #5a5a5a; --tertiary: #8a8a8a;
  --text-done: #c0bdb6; --text-faint: #d0cdc6;
  /* Surfaces */
  --bg: #f8f7f4; --bg-alt: #f1f0ec; --border: #dcdad5;
  /* Semantic */
  --interactive: #0055e0; --attention: #d63c3c; --attention-bg: rgba(214, 60, 60, 0.06);
  --done: #1a6b41; --warn: #c96c00; --warn-bg: rgba(201, 108, 0, .12);
  /* Accent (deep forest green — editorial signal) */
  --accent: #0e4a2e; --accent-light: rgba(14, 74, 46, 0.10); --accent-bg: #eef7f2;
  /* Seed (warm brown — unlinked/orphan items, next, seedlings) */
  --seed: #b06a20; --seed-light: rgba(176, 106, 32, 0.10);
  /* Slip (single color) */
  --slip-1: #c96c00; --slip-1-bg: rgba(201, 108, 0, 0.06);
  /* Shape — 3 stops */
  --radius: 2px; --radius-md: 6px; --radius-full: 999px;
  /* Spacing scale — 4px base */
  --space-1: 2px; --space-2: 4px; --space-4: 8px; --space-6: 12px;
  --space-8: 16px; --space-12: 24px; --space-16: 32px; --space-24: 48px;
  /* Typography */
  --font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: 'Oswald', var(--font);
  --font-mono: "SF Mono", "Fira Code", monospace;
  /* Brody type scale — 6 stops. Weight contrast over size contrast. */
  --text-nano:  9px;    /* sub-micro labels, weekly[data-size="1"], tiny check glyphs */
  --text-micro: 10px;   /* badges, uppercase labels, section heads */
  --text-small: 12px;   /* secondary text, meta, form labels */
  --text-body: 14px;    /* body copy, primary content, row labels */
  --text-no-zoom: 16px; /* iOS WKWebView auto-zooms inputs <16px on focus.
                           Use this token for input/textarea/select inside
                           the native shell to prevent zoom-on-tap. */
  --text-title: 18px;   /* page titles, headings */
  --text-display: 40px; /* stat numbers, chart values, big numbers */
  /* Inverse text (always white, for colored button backgrounds) */
  --text-inverse: #fff;
  /* Muted text (fallback for undefined --text-muted references) */
  --text-muted: #888;
  /* (triage/capture badges now use accent/attention) */
  /* Calendar weekend cues — color temperature shift, not a fill */
  --text-weekend: #4a4a52;
  --tertiary-weekend: #9a9aa2;
  --bg-weekend: #f5f3ee;
  /* Danger (chart off-target, delete hover) */
  --danger: #c94c3b;
  --danger-hover: #e55;
  /* Shadows & overlays (light mode) */
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-up: 0 -6px 32px rgba(0,0,0,0.06);
  --shadow-overlay: 0 16px 50px rgba(0,0,0,0.15);
  --overlay: rgba(0,0,0,0.4);
  --overlay-light: rgba(0,0,0,0.3);
  --overlay-heavy: rgba(0,0,0,0.7);
  /* Semantic tints (semi-transparent fills behind text/icons) */
  --tint-done-bg:        rgba(26, 107, 65, 0.10);
  --tint-done-bg-soft:   rgba(26, 107, 65, 0.08);
  --tint-interactive-bg: rgba(0, 85, 224, 0.07);
  /* Surface layers */
  --surface-2: rgba(0,0,0,0.03);
}
/* Dark mode — single source of truth. System preference detection in <head> sets data-theme. */
[data-theme="dark"] {
  --text: #f0ede8; --secondary: #c4c1bb; --tertiary: #9a978f;
  --text-done: #2e2c29; --text-faint: #252320;
  --bg: #0d0d0d; --bg-alt: #141414; --border: #1c1c1c;
  --interactive: #4d94ff; --attention: #fc8181; --attention-bg: rgba(252, 129, 129, 0.08);
  --done: #7a9b7e; --warn: #f59e0b; --warn-bg: rgba(245, 158, 11, .10);
  --accent: #7a9b7e; --accent-light: rgba(122, 155, 126, 0.16); --accent-bg: #141a14;
  --seed: #e0a050; --seed-light: rgba(224, 160, 80, 0.10);
  --slip-1: #f59e0b; --slip-1-bg: rgba(245, 158, 11, 0.08);
  --text-inverse: #fff;
  --text-muted: #555;
  /* Calendar weekend cues (dark) */
  --text-weekend: #b6b3ad;
  --tertiary-weekend: #5a5a5a;
  --bg-weekend: #131210;
  --danger: #f87171; --danger-hover: #fb7185;
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-up: 0 -6px 32px rgba(0,0,0,0.6);
  --shadow-overlay: 0 16px 50px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
  --overlay: rgba(0,0,0,0.7);
  --overlay-light: rgba(0,0,0,0.5);
  --overlay-heavy: rgba(0,0,0,0.9);
  --surface-2: rgba(255,255,255,0.04);
  /* Semantic tints — dark variants (--accent / --done is #7a9b7e in dark) */
  --tint-done-bg:        rgba(122, 155, 126, 0.16);
  --tint-done-bg-soft:   rgba(122, 155, 126, 0.10);
  --tint-interactive-bg: rgba(77, 148, 255, 0.10);
}

/* ═══════════════════════════════════════════════════════════════
   Atoms — indivisible, stateless visual primitives
   Named by behavior, not location. BEM-ish: .atom--modifier .atom.is-state
   ═══════════════════════════════════════════════════════════════ */

/* ── .check — completion indicator ── */
.check {
  flex-shrink: 0; width: 18px; height: 18px;
  border: 1.5px solid var(--tertiary); border-radius: 50%;
  background: transparent; cursor: pointer; position: relative;
  transition: all 200ms ease; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--text-small); color: transparent;
  -webkit-tap-highlight-color: transparent;
}
.check::after {
  content: '\2713'; position: static; border: none;
  transform: none; width: auto; height: auto;
  opacity: 0; transition: opacity 0.1s;
}
.check:hover { border-color: var(--accent); background: var(--accent-light); }
.check.is-done {
  background: var(--accent-light); border-color: var(--accent); color: var(--accent);
}
.check.is-done::after { opacity: 1; }
.check.is-done:hover { opacity: 0.7; }

/* One check. Empty or filled. .check--sm for checklists and inline use. */
.check--sm { width: 14px; height: 14px; font-size: var(--text-micro); }

/* ── .dot — status indicator circle ── */
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
  transition: all 0.2s ease;
}
.dot--sm { width: 6px; height: 6px; }
.dot--goal-1, .dot--goal-2, .dot--goal-3 { background: var(--accent); }
.dot--seed { background: var(--seed); }
.dot--doing { background: var(--accent); }
.dot--next { background: var(--seed); }
.dot--backlog { background: var(--border); border: 1px solid var(--tertiary); }
.dot--done { background: var(--tertiary); }
.dot.is-done { background: var(--accent); border-color: var(--accent); }
.dot.is-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.dot.is-today.is-done { background: var(--accent); }
/* Dot matrix: habit-dot baseline (border + fill) */
.dot--matrix {
  background: var(--bg-alt); border: 1px solid var(--border);
}
.dot--matrix.is-done { background: var(--accent); border-color: var(--accent); }
.dot--matrix.is-today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.dot--matrix.is-today.is-done { background: var(--accent); }
@media (max-width: 520px) { .dot--matrix.hide-mobile { display: none; } }

.dots { display: inline-flex; gap: 3px; align-items: center; flex-shrink: 0; }
.dots--topo { margin-right: 3px; }

/* ── .dot--highlighted — topology dot highlight state (topo-highlight Stimulus controller).
   Uses paired selectors so box-shadow color matches the dot's goal color.
   JS sets class, CSS provides the visual — no inline styles needed. ── */
.dot--goal-1.dot--highlighted,
.dot--goal-2.dot--highlighted,
.dot--goal-3.dot--highlighted { box-shadow: 0 0 0 3px var(--accent-light); }
.dot--seed.dot--highlighted   { box-shadow: 0 0 0 3px var(--seed-light); }
.dot--highlighted { transform: scale(1.4); } /* .dot already has transition: all 0.2s ease */

/* ── .badge — inline label ── */
.badge {
  font-size: var(--text-small); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 1px 5px; border-radius: 3px;
  display: inline-block; white-space: nowrap;
}
.badge--doing { background: var(--accent-light); color: var(--accent); }
.badge--next { background: var(--seed-light); color: var(--seed); }
.badge--backlog { background: var(--bg-alt); color: var(--tertiary); }
.badge--slip-1, .badge--slip-2, .badge--slip-3 { background: var(--slip-1-bg); color: var(--slip-1); }
.badge--overdue { color: var(--attention); font-family: var(--font-mono); font-weight: 600; background: none; padding: 0; }
.badge--today { color: var(--warn); font-weight: 500; background: none; padding: 0; }
.badge--stage { background: var(--bg-alt); color: var(--tertiary); font-size: var(--text-micro); }
.badge--deadline { color: var(--secondary); font-family: var(--font-mono); background: none; padding: 0; }
.badge--start {
  color: var(--attention); border: 1px solid var(--attention);
  font-size: var(--text-micro); font-weight: 700; letter-spacing: 0.06em;
}

/* ── .tag — categorization pill ── */
.tag {
  font-size: var(--text-small); color: var(--secondary); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: var(--radius-full); display: inline-block;
}
.tag--sm { font-size: var(--text-small); padding: 1px 6px; }

/* ── .section-head — group label ── */
.section-head {
  font-size: var(--text-micro); font-weight: 700;
  letter-spacing: 0.30em; text-transform: uppercase;
  color: var(--accent);
  display: flex; align-items: baseline;
  justify-content: space-between;
  padding: 12px 0 5px;
}
.section-head.is-done { color: var(--tertiary); }
.section-head--attention { color: var(--attention); }
.section-head--attention .section-head__label { color: var(--attention); }
.section-head__label { /* inherits from .section-head */ }
.section-head__label.is-done { color: var(--tertiary); }
.section-head__meta {
  font-size: var(--text-small); color: var(--tertiary);
  font-weight: 400; letter-spacing: normal; text-transform: none;
}
.section-head.is-done .section-head__meta { color: var(--text-done); }

/* ── .empty — nothing-here message ── */
.empty-msg { font-size: var(--text-small); color: var(--tertiary); padding: 8px 0; }
.empty-msg--page { text-align: center; padding: 48px 24px; }
.empty-msg--warning { color: var(--attention); }

/* ── .streak — streak counter ── */
.streak-num { font-size: var(--text-small); font-weight: 600; font-family: var(--font-mono); }
.streak-num.is-active { color: var(--accent); }
.streak-num.is-broken { color: var(--tertiary); }


/* ═══════════════════════════════════════════════════════════════
   Molecules — atoms combined into functional units
   ═══════════════════════════════════════════════════════════════ */

/* ── .row — universal list item ── */
.row {
  display: flex; align-items: center;
  padding: 8px 0; cursor: pointer;
  transition: all 300ms ease; user-select: none;
  gap: 8px; position: relative;
}
.row:active { background: var(--bg-alt); }

.row__label {
  font-size: var(--text-body); font-weight: 500; color: var(--text);
  line-height: 1.3; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.row__label.is-done {
  text-decoration: line-through; color: var(--text-done);
}

.row__meta {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; margin-left: auto; white-space: nowrap;
  font-size: var(--text-small); color: var(--tertiary);
  max-width: 50%; overflow: hidden; text-overflow: ellipsis;
}
.row__meta.is-done { color: var(--text-done); }

.row__detail {
  font-size: var(--text-small); color: var(--secondary);
  padding: 0 0 3px 26px; letter-spacing: 0.01em;
  line-height: 13px; margin-top: -7px;
}
.row__detail.is-done { color: var(--text-done); }

/* .row-item: the expandable wrapper (row + detail + expansion) */
.row-item { position: relative; }
.row-item.dragging { opacity: 0.3; }
.row-item.dragging > * { pointer-events: none; }
.row-item.drag-above { box-shadow: inset 0 2px 0 var(--interactive); }
.row-item.drag-below { box-shadow: inset 0 -2px 0 var(--interactive); }

/* iOS reserves the gesture on draggable elements and silently eats taps.
   On coarse pointers, opt the row out of native drag + long-press menu. */
@media (pointer: coarse) {
  .row-item[draggable="true"] { -webkit-user-drag: none; }
  .row-item { -webkit-touch-callout: none; user-select: none; }
}

/* ── .drag-handle — sortable grip ── */
.drag-handle {
  width: 20px; flex-shrink: 0; cursor: grab;
  color: var(--tertiary); text-align: center;
  font-size: var(--text-small); user-select: none; line-height: 1;
}
.drag-handle:active { cursor: grabbing; }

/* ── .dot-matrix — horizontal strip of habit dots ── */
.dot-matrix { display: inline-flex; gap: 1px; align-items: center; flex-shrink: 0; }
.dot-matrix-header {
  display: flex; align-items: center; gap: 8px; padding: 0 0 2px;
}
.dot-matrix-header__spacer { width: 20px; flex-shrink: 0; } /* aligns with drag handle */
.dot-matrix-header__label { flex: 1; } /* aligns with row label */
.dot-matrix-header__dots { display: inline-flex; gap: 1px; align-items: center; flex-shrink: 0; }
.dot-matrix-header__check { width: 48px; flex-shrink: 0; } /* aligns with check/streak column */
.dot-matrix-header__dots span {
  width: 8px; text-align: center;
  font-size: var(--text-micro); font-weight: 400; color: var(--tertiary);
}

/* Responsive dot-matrix: hide older dots at smaller widths */
.drawer-list-wrap { container-type: inline-size; }
@container (max-width: 680px) { .de-25, .de-26, .de-27, .de-28, .de-29 { display: none; } }
@container (max-width: 580px) { .de-20, .de-21, .de-22, .de-23, .de-24 { display: none; } }
@container (max-width: 480px) { .de-15, .de-16, .de-17, .de-18, .de-19 { display: none; } }
@container (max-width: 380px) { .de-10, .de-11, .de-12, .de-13, .de-14 { display: none; } }
@container (max-width: 320px) { .de-7, .de-8, .de-9 { display: none; } }

/* ── .expansion — animated reveal ── */
.expansion {
  max-height: 0; overflow: hidden;
  transition: max-height 400ms ease, opacity 200ms ease;
  opacity: 0; padding: 0 8px 0 26px;
}
.row-item.expanded > .expansion {
  max-height: 1400px; opacity: 1;
  padding-top: 8px; padding-bottom: 8px;
}
/* Goal-box variant: expansion inside .goal-box instead of .row-item */
.expansion--goal { padding: 0; }
.goal-box.expanded > .goal-box-left > .expansion--goal {
  max-height: 800px; opacity: 1;
  padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border);
}

/* ── .section — grouped list ── */
.section-group { margin-bottom: 16px; }

/* ═══════════════════════════════════════════════════════════════
   Utilities — single-purpose classes replacing inline styles
   ═══════════════════════════════════════════════════════════════ */

/* Layout */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap-gap { display: flex; gap: 8px; flex-wrap: wrap; }

/* Page header pattern (title + subtitle + optional button) */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-header h1 { margin: 0; }
.page-subtitle { font-size: var(--text-body); color: var(--secondary); margin-top: 4px; margin-bottom: 32px; }
/* .page-title — h1 equivalent as a CSS class (for views that need the same level without the element semantics) */
.page-title { font-size: var(--text-title); font-weight: 500; letter-spacing: -0.02em; line-height: 1.3; margin: 0; }

/* Spacing */
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-40 { margin-top: 40px; }
.mt-60 { margin-top: 60px; }
.mt-80 { margin-top: 80px; }
.pt-6 { padding-top: 6px; }
.pt-8 { padding-top: 8px; }
.pb-8 { padding-bottom: 8px; }
/* Typography utilities */
.text-center { text-align: center; }
.text-secondary { color: var(--secondary); }
.text-done { color: var(--done); }
.text-accent { color: var(--accent); }
.fw-500 { font-weight: 500; }
/* Visual state */
.is-disabled { cursor: default; opacity: 0.4; }
/* Component modifiers */
.actions--flush { border-top: none; padding-top: 16px; }
.textarea--tall { min-height: 48px; }
.form-centered { max-width: 320px; margin: 0 auto; }
.content-narrow { max-width: 400px; margin: 40px auto; }
.form-group--flush { margin-top: 0; }
.inline-rating--spaced { gap: 12px; }
/* Preview card title (shared _preview partial) */
.preview-title { font-weight: 500; margin: 4px 0; }
/* Small close/remove button variant */
.btn-xs { padding: 4px 8px; }

/* State modifiers for slip/cold/capture cards */
.is-dropped { opacity: 0.4; text-decoration: line-through; }
.is-faded { opacity: 0.6; }
.is-dimmed { opacity: 0.5; }
.is-replaced { background: var(--accent-light); border-radius: var(--radius-md); margin-top: 4px; }

/* Borders */
.no-border-top { border-top: none; padding-top: 0; }


/* Triage/followup card container */
.triage-card { padding: 12px 0; border-bottom: 1px solid var(--border); }
.triage-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Full-width form submit — slip/recommit actions */
.btn-full { width: 100%; }

/* Link that looks like plain text */
.link-plain { color: var(--secondary); text-decoration: none; }
.link-plain:hover { color: var(--text); }

/* Font weight utility */
.fw-normal { font-weight: 400; }

/* Row variants */
.row--timed { padding-left: 4px; }
.row--timed .row__label { color: var(--accent); font-weight: 500; }
.slot-time { font-family: var(--font-mono); font-size: var(--text-small); color: var(--text-muted); }
.slot-location { font-size: var(--text-small); color: var(--tertiary); }
.row--top { align-items: flex-start; }       /* for multiline content */
.row__body { flex: 1; min-width: 0; }        /* flex child wrapping label+meta in a link */
.row__label--wrap { white-space: normal; }   /* allow label to wrap */

/* .inline-rating — defined in the Discovery section below (canonical definition) */

/* ── Topbar toggles — 32px visual, 44px hit area (Apple HIG) ── */
.theme-toggle, .viewport-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; color: var(--secondary); font-size: var(--text-body);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  position: relative; padding: 0;
}
.theme-toggle::after, .viewport-toggle::after {
  content: ''; position: absolute; inset: -6px;
}
.theme-toggle:hover, .viewport-toggle:hover { color: var(--text); border-color: var(--text); }
/* Hide viewport toggle on actual phones — always phone mode there */
@media (max-width: 480px) {
  .viewport-toggle { display: none; }
}

/* ── Account toggle — circular initial-bubble linking to /account ── */
.account-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-full);
  cursor: pointer; color: var(--secondary);
  font-size: var(--text-small); font-weight: 600; font-family: var(--font);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  position: relative; padding: 0;
}
.account-toggle::after { content: ''; position: absolute; inset: -6px; }
.account-toggle:hover { color: var(--text); border-color: var(--text); background: var(--bg-alt); }

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }
body {
  font-family: var(--font);
  font-size: var(--text-body); line-height: 1.6; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: var(--interactive); text-decoration: none; }
a:hover { color: var(--text); }

/* ── Top Bar ── */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--bg-alt);
  border-bottom: none;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px;
  padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.menu-btn {
  background: none; border: none; cursor: pointer; color: var(--secondary);
  padding: 4px; display: flex; align-items: center;
}
.menu-btn:hover { color: var(--text); }

.app-name {
  font-size: var(--text-body); font-weight: 500; color: var(--text);
  letter-spacing: -0.01em; text-decoration: none;
}
.app-name:hover { color: var(--text); }

/* ── Filter Bar — domain + date nav + mode + type dropdowns ── */
.time-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-2) var(--space-8);
  background: var(--bg); border-bottom: 1px solid var(--border);
  position: sticky; top: calc(48px + env(safe-area-inset-top)); z-index: 9;
  gap: var(--space-4);
}
.time-bar__left, .time-bar__right {
  display: flex; align-items: center; gap: var(--space-3);
}
.time-bar__nav {
  display: flex; align-items: center; gap: var(--space-4);
}
.time-bar__arrow {
  font-size: var(--text-title); font-weight: 300; color: var(--tertiary); text-decoration: none;
  line-height: 1; padding: 0 2px;
}
.time-bar__arrow:hover { color: var(--text); }
.time-bar__date {
  display: flex; align-items: baseline; gap: 6px;
}
.time-bar__label {
  font-size: var(--text-micro); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--secondary);
}
.time-bar__primary {
  font-size: var(--text-title); font-weight: 700;
  letter-spacing: -0.02em; color: var(--text); line-height: 1;
}
.time-bar__today {
  font-size: var(--text-micro); font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--interactive); text-decoration: none;
  margin-left: var(--space-4); padding-left: var(--space-4);
  border-left: 1px solid var(--border);
}
.time-bar__today:hover { color: var(--text); }
.time-bar__today--hidden { display: none; }
.time-bar__badge {
  font-size: var(--text-micro); font-weight: 700; color: var(--text-inverse);
  background: var(--attention); border-radius: var(--radius-full);
  padding: 0 5px; margin-left: 3px; min-width: 16px;
  display: inline-block; text-align: center; line-height: 16px;
}

/* ── Nav Select — Neville Brody editorial dropdowns ── */
.nav-select { position: relative; }
.nav-select + .nav-select { margin-left: var(--space-4); padding-left: var(--space-4);
  border-left: 1px solid var(--border);
}
.nav-select__btn {
  background: none; border: none; border-radius: 0;
  padding: 2px 0; cursor: pointer;
  font-size: var(--text-micro); font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--secondary);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.nav-select__btn:hover { color: var(--text); }
.nav-select__chevron { font-size: var(--text-small); color: var(--tertiary); line-height: 1; }
.nav-select__backdrop {
  display: none; position: fixed; inset: 0; z-index: 49;
}
.nav-select.open .nav-select__backdrop { display: block; }
.nav-select__dropdown {
  display: none; position: absolute; top: calc(100% + 8px);
  right: 0; background: var(--bg); border: 1px solid var(--border);
  border-radius: 0; padding: var(--space-2) 0;
  min-width: 160px; z-index: 50;
  max-height: 320px; overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.nav-select.open .nav-select__dropdown { display: flex; flex-direction: column; }
.nav-select__option {
  font-size: var(--text-micro); font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--secondary); text-decoration: none;
  padding: var(--space-2) var(--space-6); white-space: nowrap;
}
.nav-select__option:hover { color: var(--text); background: var(--surface-2); }
.nav-select__option.is-active { color: var(--text); font-weight: 600; }
/* ── Active filter indicator — accent color when non-default selected ── */
.nav-select--filtered > .nav-select__btn { color: var(--accent); }
.nav-select--filtered > .nav-select__btn .nav-select__chevron { color: var(--accent); }
/* nav-select button reset (client-side filter options) */
.nav-select__option[data-type-filter-opt],
.nav-select__option[data-track-filter-opt] {
  background: none; border: none; cursor: pointer; text-align: left; width: 100%;
}
.nav-select__option[data-type-filter-opt].is-active,
.nav-select__option[data-track-filter-opt].is-active {
  color: var(--accent); font-weight: 600;
}
.nav-select__option[data-type-filter-opt].is-active::before,
.nav-select__option[data-track-filter-opt].is-active::before {
  content: "\2713\00a0";
}
/* ── Multi-select filter — JS-driven hide ── */
.is-hidden { display: none !important; }

/* ── Mobile time-bar — wrap filters to second row ── */
@media (max-width: 480px) {
  .time-bar {
    flex-wrap: wrap;
    padding: var(--space-1) var(--space-4);
    gap: 0;
  }
  .time-bar__left { width: 100%; }
  .time-bar__right {
    width: 100%;
    padding: var(--space-1) 0;
  }
  .topbar-inner { padding: 0 12px; height: 36px; }
  .time-bar { top: calc(36px + env(safe-area-inset-top)); }
  .app-name { font-size: var(--text-small); }
  /* Fix dropdown positioning — right:0 sends them off-screen when left-aligned */
  .nav-select__dropdown { right: auto; left: 0; max-width: calc(100vw - 16px); }
  /* Shrink date hero — 56px is enormous on 393px screen */
  .date-hero__num { font-size: 36px; }
  .date-hero { gap: 10px; }
  /* Compact sequence time labels */
  .brief-schedule .sequence-head__read { gap: 8px; }
  .seq-time-range { min-width: 0; font-size: var(--text-micro); letter-spacing: 0.08em; }
  .seq-name { font-size: var(--text-micro); }
}

/* ── Week Grid (7-col) ── */
.week-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: var(--border);
}

/* ── Month Grid (7-col) ── */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--bg);
}
.month-grid__dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.month-grid__dow > span {
  padding: var(--space-4);
  font-family: var(--font);
  font-weight: 700;
  font-size: var(--text-micro);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tertiary);
  border-right: 1px solid var(--border);
}
.month-grid__dow > .is-weekend {
  background: var(--bg-weekend);
  color: var(--secondary);
}
.day-col {
  background: var(--bg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4);
  min-height: 124px; min-width: 0; overflow: hidden;
  display: flex; flex-direction: column;
  gap: var(--space-2);
}
.day-col.is-weekend { background: var(--bg-weekend); }
.day-col.is-outside .day-col__num { color: var(--text-faint); }
.day-col.is-outside .time-row__label,
.day-col.is-outside .time-row__time { color: var(--text-faint); }
.day-col__head {
  display: flex; align-items: baseline;
  justify-content: flex-start;
  padding: 0 0 3px;
}
.day-col__name {
  font-size: var(--text-micro); font-weight: 600; color: var(--tertiary);
  letter-spacing: 0.06em;
}
.day-col__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  font-feature-settings: "tnum"; font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.day-col.is-today .day-col__num { color: var(--accent); font-weight: 700; }
.day-col.is-today .day-col__head {
  border-bottom: 1px solid var(--accent);
}
.day-col__body {
  display: flex; flex-direction: column; gap: 1px; min-height: 0;
}
.day-col__empty {
  color: var(--text-faint);
  font-family: var(--font);
  font-size: var(--text-micro);
  padding: var(--space-1) 0;
}
.day-col__more {
  padding: var(--space-1) 0 0;
  font-family: var(--font);
  font-weight: 400;
  font-size: var(--text-micro);
  color: var(--tertiary);
  font-feature-settings: "tnum"; font-variant-numeric: tabular-nums;
}
.time-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: baseline;
  column-gap: var(--space-2);
  padding: 1px 0;
  line-height: 1.3;
  cursor: pointer;
}
.time-row__time {
  font-family: var(--font);
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--tertiary);
  font-feature-settings: "tnum"; font-variant-numeric: tabular-nums;
}
.time-row__label {
  font-family: var(--font);
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.time-row.time-row--band .time-row__time,
.time-row.time-row--band .time-row__label {
  font-family: var(--font);
  font-size: var(--text-small);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}
.time-row.time-row--band .time-row__time { color: var(--tertiary); }
.time-row.time-row--band .time-row__label { color: var(--text); }
.time-row[data-state="done"] .time-row__time,
.time-row[data-state="done"] .time-row__label {
  color: var(--text-done);
}
.time-row--band {
  /* fallback for bare <div class="time-row--band"> in drawers (no inner spans):
     keep the typographic band landmark even without the grid. */
  font-family: var(--font);
  font-weight: 700;
  font-size: var(--text-small);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
  padding: var(--space-2) 0 var(--space-1);
}

/* ── Month Grid: mobile dot-summary ── */
@media (max-width: 480px) {
  .day-col { padding: var(--space-2); min-height: 0; }
  .day-col__head { margin-bottom: var(--space-1); gap: var(--space-1); }
  .day-col__name { display: none; }
  .day-col__num { font-size: var(--text-body); font-weight: 700; }
  .day-col.is-today .day-col__num { color: var(--accent); }
  .day-col__body { flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .day-col__empty { display: none; }
  .time-row { width: 6px; height: 6px; overflow: hidden; padding: 0; gap: 0; }
  .time-row__time, .time-row__label { display: none; }
  .time-row::before {
    content: '';
    display: block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.8;
  }
  .time-row--band { display: none; }
  .time-row--band + .time-row { margin: 0; }
  .month-grid .day-col { cursor: pointer; }
}

/* ── Topbar Menu (collapsible nav) ── */
.topbar-menu { position: relative; }
.topbar-menu-btn {
  background: none; border: none; cursor: pointer;
  color: var(--secondary); font-size: var(--text-body);
  padding: 6px 12px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 4px;
}
.topbar-menu-btn:hover { color: var(--text); background: var(--bg-alt); }
.topbar-menu-chevron { transition: transform 0.15s; }
.topbar-menu.open .topbar-menu-chevron { transform: rotate(180deg); }

.topbar-menu-backdrop {
  display: none; position: fixed; inset: 0; z-index: 9;
}
.topbar-menu.open .topbar-menu-backdrop { display: block; }

.topbar-menu-dropdown {
  display: none; position: absolute; top: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px;
  min-width: 140px; z-index: 10;
  box-shadow: var(--shadow-md);
}
.topbar-menu.open .topbar-menu-dropdown { display: flex; flex-direction: column; }

.topbar-menu-dropdown a {
  font-size: var(--text-body); color: var(--secondary); text-decoration: none;
  padding: 6px 12px; border-radius: var(--radius);
}
.topbar-menu-dropdown a:hover { color: var(--text); background: var(--bg-alt); }
.topbar-menu-dropdown a.active { color: var(--text); font-weight: 500; }


.back {
  color: var(--secondary); text-decoration: none; font-size: var(--text-body);
  display: flex; align-items: center; gap: 4px;
}
.back:hover { color: var(--text); }
.back svg { flex-shrink: 0; }


/* ── Main ── */
main { max-width: 640px; margin: 0 auto; padding: 48px 24px 96px; }
main.wide { max-width: 960px; }
/* Week + Month calendar views break out of the reading-width cap.
   Triggered by `content_for :body_class, "brief-wide"` on those views. */
body.brief-wide main { max-width: none; padding-left: var(--space-16); padding-right: var(--space-16); }

/* ── Typography ── */
h1 { font-size: var(--text-title); font-weight: 500; letter-spacing: -0.02em; line-height: 1.3; }
h2 { font-size: var(--text-body); font-weight: 500; }
.meta { font-size: var(--text-small); color: var(--secondary); }


/* ── Sections ── */
.section { margin-bottom: 40px; }

.card-section { margin-bottom: 32px; }
.card-section-title {
  font-size: var(--text-small); font-weight: 500; color: var(--tertiary);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.card-section-body { font-size: var(--text-body); line-height: 1.7; padding-top: 12px; }

/* ── Card Header ── */
.card-header { margin-bottom: 32px; }
.card-type-line { font-size: var(--text-small); color: var(--secondary); margin-bottom: 8px; }
.card-type-line .overdue { color: var(--attention); font-weight: 500; }
.card-type-line .expiry { color: var(--attention); font-weight: 500; }
.card-title { font-size: var(--text-title); font-weight: 500; letter-spacing: -0.02em; line-height: 1.3; }
.card-created { font-size: var(--text-small); color: var(--tertiary); margin-top: 8px; }
.card-body { font-size: var(--text-body); line-height: 1.7; color: var(--text); margin-bottom: 32px; }


/* ── Streak (inline on Today page) ── */
.streak {
  font-size: var(--text-small); color: var(--secondary); font-weight: 500;
  white-space: nowrap; flex-shrink: 0; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.streak.lost { color: var(--tertiary); }

/* ── AI Badge ── */
.ai-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--text-small); color: var(--tertiary);
}
.ai-new-badge {
  font-size: var(--text-small); color: var(--interactive); font-weight: 500;
}

/* ── Field Rows ── */
.card-fields { margin-bottom: 32px; }
.field-row {
  display: flex; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.field-row:last-child { border-bottom: none; }
.field-label {
  width: 100px; flex-shrink: 0;
  font-size: var(--text-small); font-weight: 500; color: var(--tertiary);
  text-transform: uppercase; letter-spacing: 0.05em; padding-top: 1px;
}
.field-value { font-size: var(--text-body); }
.field-value.overdue { color: var(--attention); font-weight: 500; }
.field-value.empty { color: var(--tertiary); font-style: italic; }
.field-value .expiry { color: var(--attention); }

/* ── Linked Items ── */
.linked-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.linked-item:last-child { border-bottom: none; }
.linked-item:hover .linked-title { color: var(--interactive); }
.linked-title { font-size: var(--text-body); flex: 1; transition: color 0.1s; }
.linked-meta { font-size: var(--text-small); color: var(--secondary); white-space: nowrap; }
.linked-meta .overdue { color: var(--attention); }

/* ── Tags ── */
.tags { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 12px; }
.tag {
  font-size: var(--text-small); color: var(--secondary); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: var(--radius-full);
}

/* ── Buttons ── */
.btn {
  font-size: var(--text-body); font-family: inherit; font-weight: 500;
  padding: 8px 20px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  transition: all 0.1s; text-decoration: none; display: inline-block;
}
.btn:hover { border-color: var(--secondary); color: var(--text); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { opacity: 0.85; color: var(--bg); }
.btn-danger { color: var(--attention); border-color: var(--attention); }
.btn-danger:hover { background: var(--attention); color: var(--text-inverse); }
.btn-done { background: var(--done); color: var(--text-inverse); border-color: var(--done); }
.btn-done:hover { opacity: 0.85; }
.btn-sm { padding: 4px 12px; font-size: var(--text-small); }
.actions { display: flex; gap: 12px; margin-bottom: 32px; padding-top: 24px; border-top: 1px solid var(--border); }

/* ── Goals ── */
.goal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.goal-box {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 14px; cursor: grab; transition: border-color 0.15s;
  display: flex; align-items: center; gap: 12px; min-height: 72px;
  text-decoration: none; color: inherit;
  position: relative; overflow: hidden;
}
.goal-box:hover { border-color: var(--tertiary); }
.goal-box.dragging { opacity: 0.3; }
.goal-box.drag-above { box-shadow: inset 0 2px 0 var(--interactive); }
.goal-box.drag-below { box-shadow: inset 0 -2px 0 var(--interactive); }
.goal-box-left { flex: 1; min-width: 0; }
.goal-box-title { font-size: var(--text-body); font-weight: 500; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-box-meta { font-size: var(--text-small); color: var(--secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-box-sub { font-size: var(--text-small); color: var(--tertiary); margin-top: 3px; }
.goal-box-right { flex-shrink: 0; text-align: center; min-width: 48px; }
.goal-box-number { font-size: var(--text-display); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; color: var(--text); }
.goal-box-number.overdue { color: var(--attention); }
.goal-box-unit { font-size: var(--text-small); color: var(--tertiary); margin-top: 2px; }




/* Streak grid (card detail view) — columns set inline per card */
.streak-grid {
  display: grid;
  grid-template-rows: repeat(7, 6px);
  grid-auto-flow: column;
  gap: 4px; width: fit-content; max-width: 100%; overflow-x: auto;
}
.streak-grid i { display: block; border-radius: 50%; font-style: normal; background: var(--text); opacity: 0.07; }
.streak-grid .done { background: var(--text); opacity: 1; }
.streak-grid .missed { background: var(--text); opacity: 0.12; }
.streak-grid .today { background: var(--text); opacity: 1; }
.streak-grid.weekly {
  grid-template-rows: 6px;
  grid-template-columns: repeat(52, 6px);
  grid-auto-flow: row;
}

/* Streak numbers (card detail) */
.streak-row {
  display: flex; gap: 48px; margin-bottom: 32px;
  padding: 20px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.streak-num--display { font-size: var(--text-display); font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.streak-label { font-size: var(--text-small); color: var(--secondary); margin-top: 4px; }
.streak-section { margin-bottom: 32px; }
.streak-section-title {
  font-size: var(--text-small); font-weight: 500; color: var(--tertiary);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 12px;
}



/* ── Review Stats (Weekly Review) ── */
.stats {
  display: flex; gap: 32px; padding: 16px 0; margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.stat-value { font-size: var(--text-title); font-weight: 500; }
.stat-label { font-size: var(--text-small); color: var(--secondary); margin-top: 2px; }

/* ── Review Items ── */
.review-item {
  padding: 10px 0; border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
}
.review-item:last-child { border-bottom: none; }
.review-item-title { font-size: var(--text-body); font-weight: 400; }
.review-item-meta { font-size: var(--text-small); color: var(--secondary); margin-top: 2px; }
.review-item-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── .goal-item — goal summary row (weekly review) ── */
.goal-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.goal-item:last-child { border-bottom: none; }
.goal-name { font-size: var(--text-body); font-weight: 500; color: var(--text); }
.goal-detail { font-size: var(--text-small); color: var(--secondary); margin-top: 2px; }

.action-link {
  font-size: var(--text-small); color: var(--interactive); text-decoration: none;
  cursor: pointer; background: none; border: none; font-family: inherit;
}
.action-link:hover { text-decoration: underline; }
.action-link.muted { color: var(--tertiary); }

/* Review progress */

.empty { font-size: var(--text-body); color: var(--tertiary); font-style: italic; padding: 12px 0; }

/* ── Drawer Header ── */
.drawer-header { margin-bottom: 32px; }
.drawer-title { font-size: var(--text-title); font-weight: 500; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.drawer-edit { color: var(--tertiary); display: inline-flex; align-items: center; opacity: 0.6; transition: opacity 0.15s; }
.drawer-edit:hover { opacity: 1; color: var(--accent); }
.drawer-desc { font-size: var(--text-body); color: var(--secondary); margin-top: 4px; }

/* ── Forms ── */
form label {
  display: block; font-size: var(--text-small); font-weight: 500; color: var(--tertiary);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-top: 16px; margin-bottom: 6px;
}
form input[type="text"], form input[type="email"], form input[type="password"],
form input[type="date"], form input[type="number"],
form textarea, form select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: var(--text-body); font-family: inherit; line-height: 1.6;
  background: var(--bg); color: var(--text); outline: none;
}
form input:focus, form textarea:focus, form select:focus { border-color: var(--interactive); }
form textarea { min-height: 80px; resize: vertical; }
.form-hint { font-size: var(--text-small); color: var(--tertiary); margin: 4px 0 0; line-height: 1.5; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--border); }
th {
  font-size: var(--text-small); font-weight: 500; color: var(--tertiary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
td { font-size: var(--text-body); }

/* ── Flash Messages ── */
.flash { padding: 12px 16px; font-size: var(--text-body); border-bottom: 1px solid var(--border); }
.flash-notice { color: var(--done); }
.flash-alert { color: var(--attention); }

/* ── App sidebar — collapsible left nav (prototype 11) ──
   Web-only collapsible sidebar with the panel-left toggle
   icon. Collapses to 0 width and shows a fixed floating
   toggle at top-left. Hidden on the Hotwire Native shell
   and on auth-less pages. Body class .is-sidebar-collapsed
   drives the transition.

   Tokens scoped on body so only this block uses them. */

body {
  --app-sidebar-width: 240px;
  --app-sidebar-shadow-toggle: 0 1px 3px rgba(0,0,0,.08);
  --app-sidebar-shadow-float-hover: 0 2px 6px rgba(0,0,0,.10);
  --app-sidebar-shadow-active-item: 0 1px 4px rgba(0,0,0,.05);
  --app-sidebar-shadow-overlay: 0 12px 32px rgba(0,0,0,.18);
}

body.has-app-sidebar {
  display: grid;
  grid-template-columns: var(--app-sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 320ms cubic-bezier(0.32, 0.72, 0, 1);
}
body.has-app-sidebar.is-sidebar-collapsed { grid-template-columns: 0 1fr; }

.app-sidebar {
  background: var(--bg-alt);
  border-right: 0.5px solid var(--border);
  display: flex; flex-direction: column;
  padding: 14px 12px;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
  padding-top: max(14px, env(safe-area-inset-top));
}
body.is-sidebar-collapsed .app-sidebar { padding-left: 0; padding-right: 0; }

.app-sidebar__head {
  display: flex; align-items: center;
  padding: 4px 6px 14px;
  gap: 10px;
}
.app-sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
  text-decoration: none; color: inherit;
}
.app-sidebar__logo {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--accent); color: var(--text-inverse);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--text-body);
  flex-shrink: 0;
}
.app-sidebar__name {
  font-family: var(--font-display);
  font-size: var(--text-title); font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-sidebar__toggle {
  width: 30px; height: 30px;
  border-radius: 6px; border: 0;
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 180ms, color 180ms;
  flex-shrink: 0;
}
.app-sidebar__toggle:hover { background: var(--border); color: var(--text); }
.app-sidebar__toggle svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.app-sidebar__nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none;
  font-size: var(--text-body); font-weight: 500;
  white-space: nowrap;
  transition: background 180ms;
}
.app-sidebar__nav-item:hover { background: var(--border); }
.app-sidebar__nav-item.is-active { background: var(--bg); color: var(--accent); box-shadow: var(--app-sidebar-shadow-active-item); }
.app-sidebar__nav-item svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.app-sidebar__divider { height: 1px; background: var(--border); margin: 10px 4px; opacity: .6; border: 0; }

.app-sidebar__section-head {
  font-size: var(--text-micro); font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--tertiary);
  padding: 4px 10px 6px;
}

.app-sidebar__drawer {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px; border-radius: 6px;
  font-size: var(--text-small); color: var(--text);
  text-decoration: none;
  white-space: nowrap; overflow: hidden;
}
.app-sidebar__drawer:hover { background: var(--border); }
.app-sidebar__drawer.is-active { background: var(--accent-bg); color: var(--accent); }
.app-sidebar__drawer-tag {
  width: 4px; height: 16px; border-radius: 2px;
  background: var(--c, var(--tertiary));
  flex-shrink: 0;
}
.app-sidebar__drawer-name { overflow: hidden; text-overflow: ellipsis; }

.app-sidebar__new {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 6px;
  font-size: var(--text-small); color: var(--tertiary);
  text-decoration: none;
  margin-top: 4px;
  letter-spacing: 0.04em;
}
.app-sidebar__new:hover { color: var(--text); background: var(--border); }
.app-sidebar__new-plus { width: 12px; height: 12px; position: relative; flex-shrink: 0; }
.app-sidebar__new-plus::before, .app-sidebar__new-plus::after { content: ''; position: absolute; background: currentColor; }
.app-sidebar__new-plus::before { left: 0; right: 0; top: 50%; height: 1.5px; margin-top: -.75px; }
.app-sidebar__new-plus::after { top: 0; bottom: 0; left: 50%; width: 1.5px; margin-left: -.75px; }

/* Floating toggle when collapsed — fixed top-left of viewport */
.app-sidebar-float-toggle {
  position: fixed;
  top: max(14px, calc(env(safe-area-inset-top) + 8px));
  left: max(14px, env(safe-area-inset-left));
  width: 34px; height: 34px;
  border-radius: 7px; border: 0;
  background: var(--bg);
  color: var(--secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--app-sidebar-shadow-toggle), inset 0 0 0 0.5px var(--border);
  opacity: 0; pointer-events: none;
  transform: translateX(-4px);
  transition: opacity 200ms, transform 200ms;
  z-index: 30;
}
body.is-sidebar-collapsed .app-sidebar-float-toggle {
  opacity: 1; pointer-events: auto;
  transform: translateX(0);
}
.app-sidebar-float-toggle:hover { color: var(--text); background: var(--bg-alt); box-shadow: var(--app-sidebar-shadow-float-hover), inset 0 0 0 0.5px var(--border); }
.app-sidebar-float-toggle svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Hide existing topbar's app-name when sidebar is open (sidebar shows the brand) */
body.has-app-sidebar:not(.is-sidebar-collapsed) .topbar .app-name { display: none; }

/* On the Hotwire Native shell, no sidebar */
body.is-native.has-app-sidebar { display: block; }
body.is-native .app-sidebar, body.is-native .app-sidebar-float-toggle { display: none; }

/* Responsive — on narrow viewports, sidebar collapses into a slide-over.
   We keep the same DOM but switch to position:fixed so it overlays. */
@media (max-width: 768px) {
  /* Drop the grid entirely at narrow widths. The sidebar overlays
     via position:fixed, so any leftover grid track for it would
     either squash app-shell into a 0-width column or stack it onto
     a second row (which is exactly what the brief views were
     doing — content jumping below an invisible sidebar slot).
     `display: block` lets app-shell flow full-width; the sidebar
     floats over it when the user opens it. */
  body.has-app-sidebar { display: block; }
  body.has-app-sidebar .app-sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: var(--app-sidebar-width);
    z-index: 40;
    box-shadow: var(--app-sidebar-shadow-overlay);
    transform: translateX(-100%);
    transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1);
  }
  body.has-app-sidebar:not(.is-sidebar-collapsed) .app-sidebar { transform: translateX(0); }
  body.has-app-sidebar.is-sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
  body.has-app-sidebar:not(.is-sidebar-collapsed) .topbar .app-name { display: inline; }
}

/* ── Drawers · index (drawer-face design, prototype 16) ──
   Each drawer is a wood-toned (cool grey) drawer face with a
   thin color stripe across the top, name + goal printed on
   the face, and a charcoal pull bar centered at the bottom.
   On tap/hover the drawer slides forward like opening it. */

body.drawers-mode {
  --drawers-wood: #f1f0ed;
  --drawers-wood-edge: #d4d3d0;
  --drawers-wood-inset: #e8e7e4;
  --drawers-pull: #3a3a3a;
  --drawers-shadow-base:  0 1px 3px rgba(0,0,0,.06);
  --drawers-shadow-hover: 0 4px 10px rgba(0,0,0,.10);
  --drawers-shadow-active:0 6px 14px rgba(0,0,0,.14);
  --drawers-pull-shine:   inset 0 1px 0 rgba(255,255,255,.20);
  --drawers-pull-drop:    0 1px 2px rgba(0,0,0,.20);
}
html.dark body.drawers-mode {
  --drawers-wood: #1c1c1c;
  --drawers-wood-edge: #2a2a2a;
  --drawers-wood-inset: #252525;
  --drawers-pull: #c8c8c8;
  --drawers-shadow-base:  0 1px 3px rgba(0,0,0,.4);
  --drawers-shadow-hover: 0 4px 10px rgba(0,0,0,.5);
  --drawers-shadow-active:0 6px 14px rgba(0,0,0,.6);
  --drawers-pull-shine:   inset 0 1px 0 rgba(255,255,255,.30);
  --drawers-pull-drop:    0 1px 2px rgba(0,0,0,.55);
}

body.drawers-mode main { max-width: 920px; }

.drawers-head { padding: 4px 0 18px; }
.drawers-head h1 {
  font-family: var(--font-display, var(--font));
  font-size: 32px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0;
}

.drawer-cabinet {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 12px;
  padding-bottom: 28px;
}
@media (min-width: 640px) {
  .drawer-cabinet { grid-template-columns: repeat(3, 1fr); gap: 18px 16px; }
}

.drawer-face {
  aspect-ratio: 5 / 3;
  background: linear-gradient(180deg, var(--drawers-wood-inset) 0%, var(--drawers-wood) 100%);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  z-index: 1;
  text-decoration: none; color: inherit;
  transition:
    transform 320ms cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 320ms cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow:
    inset 0 0 0 1px var(--drawers-wood-edge),
    inset 0 -2px 0 var(--drawers-wood-edge),
    var(--drawers-shadow-base);
  overflow: hidden;
}
.drawer-face:hover {
  transform: translateY(4px);
  z-index: 10;
  box-shadow:
    inset 0 0 0 1px var(--drawers-wood-edge),
    inset 0 -2px 0 var(--drawers-wood-edge),
    var(--drawers-shadow-hover);
}
.drawer-face:active {
  transform: translateY(7px);
  transition-duration: 180ms;
  box-shadow:
    inset 0 0 0 1px var(--drawers-wood-edge),
    inset 0 -2px 0 var(--drawers-wood-edge),
    var(--drawers-shadow-active);
}

.drawer-face__stripe {
  height: 4px;
  background: var(--drawer-color);
}
.drawer-face__text {
  padding: 12px 14px 8px;
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.drawer-face__name {
  font-family: var(--font-display, var(--font));
  font-size: var(--text-title); font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--text);
  line-height: 1.1;
  word-break: break-word;
}
.drawer-face__goal {
  font-family: var(--font);
  font-size: var(--text-small); font-weight: 500;
  color: var(--secondary);
  letter-spacing: 0.01em;
  line-height: 1.3;
  word-break: break-word;
}
.drawer-face__goal.is-empty { color: var(--tertiary); font-style: italic; }

.drawer-face__pull {
  display: flex; justify-content: center;
  padding-bottom: 12px;
}
.drawer-face__pull-bar {
  width: 38%; height: 5px;
  border-radius: 3px;
  background: var(--drawers-pull);
  box-shadow: var(--drawers-pull-shine), var(--drawers-pull-drop);
}

.drawer-face.is-new {
  background: transparent;
  border: 1.5px dashed var(--border);
  box-shadow: none;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 8px;
  color: var(--tertiary);
}
.drawer-face.is-new:hover { transform: none; box-shadow: none; }
.drawer-face.is-new:active { transform: scale(.98); box-shadow: none; }
.drawer-face__plus {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-alt); position: relative;
}
.drawer-face__plus::before, .drawer-face__plus::after {
  content: ''; position: absolute; background: currentColor;
}
.drawer-face__plus::before { left: 10px; right: 10px; top: 50%; height: 2px; margin-top: -1px; }
.drawer-face__plus::after { top: 10px; bottom: 10px; left: 50%; width: 2px; margin-left: -1px; }
.drawer-face__new-label {
  font-family: var(--font);
  font-size: var(--text-small); font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.drawers-archived { margin-top: 40px; }
.drawers-archived__title {
  font-size: var(--text-small); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--secondary); margin-bottom: 12px;
}

/* ── Nested Forms ── */
.nested-row {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.nested-row:last-child { border-bottom: none; }

/* ── Tag Input ── */
/* (tag-pills removed — unreferenced) */
.tag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--text-small); color: var(--secondary); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: var(--radius-full); background: var(--bg-alt); margin-right: 4px;
}
.tag-pill-remove {
  background: none; border: none; cursor: pointer; font-size: var(--text-body);
  color: var(--tertiary); padding: 0 2px; line-height: 1;
}
.tag-pill-remove:hover { color: var(--attention); }
.tag-suggestions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tag-suggestion {
  font-size: var(--text-small); padding: 2px 10px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--bg);
  cursor: pointer; color: var(--secondary); font-family: inherit;
}
.tag-suggestion:hover { border-color: var(--interactive); color: var(--interactive); }

/* ── Link Search ── */
.link-search { display: none; }
.link-search.open, [data-controller="link-search"].open .link-search { display: block; }
[data-controller="link-search"]:not(.open) .link-search-input,
[data-controller="link-search"]:not(.open) .link-search-results { display: none; }
.link-search-input { margin-bottom: 4px; }
.link-search-results { max-height: 240px; overflow-y: auto; }
.link-search-item {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  padding: 8px 0; border: none; background: none; cursor: pointer;
  text-align: left; font-family: inherit; font-size: var(--text-body); color: inherit;
  border-bottom: 1px solid var(--border);
}
.link-search-item:hover .item-title { color: var(--interactive); }




/* ── Capability Styles ── */
.capability { margin-top: 8px; }

/* ── Checklist ── */
.checklist { display: flex; flex-direction: column; gap: 2px; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
/* checklist uses shared .check — reset wrapping form */
.checklist-item form { all: unset; display: contents; }
/* checklist uses .check--sm variant */
.checklist-item--done .checklist-title {
  text-decoration: line-through;
  color: var(--tertiary);
}
.checklist-title { font-size: var(--text-body); }
.checklist-progress {
  font-size: var(--text-small);
  color: var(--tertiary);
  margin-top: 8px;
}
.checklist-form-items { display: flex; flex-direction: column; gap: 4px; }
.checklist-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.checklist-form-row input[type="text"] { flex: 1; }

/* ── Discovery ── */
.badge--verified {
  font-size: var(--text-small); font-weight: 500; color: var(--done);
  border: 1px solid var(--done); padding: 1px 8px;
  border-radius: var(--radius-full); display: inline-block;
}
.badge--unverified {
  font-size: var(--text-small); font-weight: 500; color: var(--tertiary);
  border: 1px solid var(--border); padding: 1px 8px;
  border-radius: var(--radius-full); display: inline-block;
}
.badge-pearl {
  font-size: var(--text-small); font-weight: 600; color: var(--done);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.inline-rating {
  display: flex; gap: 4px; align-items: center; flex-shrink: 0;
}
.inline-rating select {
  width: 48px; padding: 2px 4px; font-size: var(--text-small);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
}
.inline-rating label {
  font-size: var(--text-small); color: var(--tertiary); margin: 0;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── Daily Brief ── */

.daily-brief {
  max-width: 640px;
  margin: 0 auto;
  transition: max-width 0.2s ease;
}
/* Viewport toggle — desktop mode widens all page containers */
[data-viewport="desktop"] main { max-width: 960px; }
[data-viewport="desktop"] .daily-brief {
  max-width: 960px;
  padding: 0 24px;
}
/* Phone mode — constrain everything to phone width */
[data-viewport="phone"] main { max-width: 640px; }
[data-viewport="phone"] main.wide { max-width: 640px; }
[data-viewport="phone"] .daily-brief { max-width: 640px; }

/* Masthead — Appleton style: date first, then title */
.brief-masthead {
  padding: 28px 0 8px;
}
.brief-date {
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--secondary);
  letter-spacing: 0.02em;
}
.brief-title {
  font-size: var(--text-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 2px;
  line-height: 1.3;
  text-transform: none;
}

/* Section */
.brief-section {
  padding-bottom: 4px;
  margin-top: 0;
}



/* Goal picker — inline picker (Today view + expansion card orphan notice) */
.goal-picker-wrap { flex-shrink: 0; }
.goal-picker-tag {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: var(--text-small); color: var(--accent); font-weight: 400; opacity: 0.7;
}
.goal-picker-tag:hover { opacity: 1; }
.goal-picker-trigger--empty {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: var(--text-small); color: var(--secondary); font-weight: 400; opacity: 0.5;
  font-style: italic;
}
.goal-picker-trigger--empty:hover { opacity: 0.8; color: var(--accent); }
.goal-picker {
  display: flex; flex-direction: column; gap: 2px;
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: var(--bg); padding: 4px 0;
}
.goal-picker[hidden] { display: none; }
.goal-picker-option {
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 10px; cursor: pointer; text-align: left;
  transition: border-color 0.15s, background 0.15s; font-size: var(--text-small);
}
.goal-picker-option:hover { border-color: var(--accent); background: var(--bg-alt); }
.goal-picker-option--current { border-color: var(--accent); background: var(--bg-alt); }
.goal-picker-name { font-size: var(--text-small); }
.goal-picker-option--none { border-style: dashed; }
.goal-picker-option--none .goal-picker-name { color: var(--secondary); }

/* Checkboxes — circular, matching Appleton prototype */

/* Measurement row — log control, inline sparkline, status dot */
.measurement-log-form {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 18px;
  position: relative;
}
form.measurement-log-form input.measurement-log-input {
  width: 1.2cm;
  height: 18px;
  padding: 0 2px;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--text-small);
  font-family: inherit;
  text-align: right;
  appearance: textfield;
  -moz-appearance: textfield;
  transition: border-color 0.15s;
}
form.measurement-log-form input.measurement-log-input::-webkit-outer-spin-button,
form.measurement-log-form input.measurement-log-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
form.measurement-log-form input.measurement-log-input::placeholder { color: var(--tertiary); font-size: var(--text-small); }
form.measurement-log-form input.measurement-log-input:focus { outline: none; border-bottom-color: var(--accent); }
form.measurement-log-form input.measurement-log-input--done {
  border-bottom-color: var(--accent);
  color: var(--text-done);
}
.measurement-log-submit {
  position: absolute; right: -16px; top: 0;
  width: 14px; height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--tertiary);
  cursor: pointer;
  font-size: var(--text-body);
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s;
}
.measurement-log-submit:hover { color: var(--accent); }

.brief-row--measurement .row__label {
  flex: 1 1 auto;
  min-width: 0;
}

/* Inline reading after measurement label — inherits label font+color */
.brief-reading { font-variant-numeric: tabular-nums; }



/* ── Brief schedule layout — Raskin spacing: predictable grid, hairline breaks ── */
.brief-schedule { font-family: var(--font); }
.brief-schedule .section-head { padding: 0 0 var(--space-6); }
.brief-schedule .sequence-head__read { display: flex; align-items: baseline; gap: 16px; }
.brief-schedule .row__label { font-weight: 400; font-family: var(--font); font-size: var(--text-small); letter-spacing: 0.01em; }
.seq-time-range { display: inline-block; min-width: 101px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.brief-schedule .row { padding: 4px 0; }
.brief-schedule .row .check { font: inherit; margin-right: 10px; flex-shrink: 0; width: 16px; height: 16px; }
/* Measurement rows replace the checkbox with a numeric value field (.measurement-log-form
   wraps an <input type=number>). Same left-anchor role, different shape — keep flush left. */
.brief-schedule .row .measurement-log-form { margin-right: 10px; }
/* Reserve a predictable streak column on the right so badges line up across rows. */
.brief-schedule .row__meta { min-width: 56px; justify-content: flex-end; }
/* Section break — hairline + breath between every adjacent section. */
.brief-schedule .brief-section + .brief-section {
  margin-top: var(--space-12);
  padding-top: var(--space-12);
  border-top: 1px solid var(--border);
}

/* ── Date hero — editorial date display in time bar (day, week, month) ── */
.date-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}
.date-hero__num {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: var(--text);
  flex-shrink: 0;
}
.date-hero__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.date-hero__top {
  display: block;
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
}
.date-hero__top--plain {
  letter-spacing: normal;
  text-transform: none;
}
.date-hero__sub {
  display: block;
  font-size: var(--text-micro);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
  line-height: 1.2;
}

/* ── Sequence edit icon — pencil visible on hover ── */
.seq-edit-icon {
  background: none; border: none; cursor: pointer; line-height: 1;
  font-size: var(--text-small); color: var(--tertiary);
  padding: 2px 4px; flex-shrink: 0;
  opacity: 0; transition: opacity 150ms ease;
}
.sequence-section:hover .seq-edit-icon { opacity: 1; }
.sequence-section[data-edit-mode="true"] .seq-edit-icon { opacity: 1; color: var(--accent); }

/* Monochrome brief — section heads and sequence names use text color, not accent */
.brief .section-head { color: var(--text); }
.brief .seq-name { color: var(--text); }
.brief .section-head.is-done { color: var(--tertiary); }
/* Brody schedule — section heads match top bar typography */
.brief-schedule .section-head { font-size: var(--text-small); font-family: var(--font); letter-spacing: 0.14em; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════
   Brief chrome — Firtman-PWA topbar (V2)
   Hero (date_hero) + chip-bar accordion at top, ribbon at bottom.
   Active only when body has .brief-mode (brief day/week/month).
   ═══════════════════════════════════════════════════════════════ */

/* Topbar stays on brief modes — theme toggle + account button must
   be reachable from every page. The brief-chrome's date hero and
   chip-bar still render, just below the topbar. */

/* Reserve bottom space so content clears the ribbon (56px) AND the FAB (48px stacked above). */
body.brief-mode main { padding-bottom: calc(56px + 48px + env(safe-area-inset-bottom) + var(--space-12)); }

/* Tighten the top breathing space. Default `main` has padding-top: 48px
   (rule near line 821), which on /drawers reads as "the right amount" —
   there's only a thin .time-bar above main. On /brief/day, /brief/week,
   /brief/month, the .brief-chrome already paints the date hero (24px
   top padding + ~56px tall number + 8px bottom padding) plus a chip
   bar with its own borders directly above main, so an extra 48px on
   top of that stacks into a visibly too-tall header strip. 8px keeps a
   minimal breathing line below the chip-bar's bottom border without
   doubling the padding. */
body.brief-mode main { padding-top: var(--space-4); }

/* Lift the floating capture button above the bottom ribbon so it doesn't overlap. */
body.brief-mode .fab { bottom: calc(56px + env(safe-area-inset-bottom) + var(--space-8) + var(--space-2)); }

/* Hero block — already styled via .date-hero; container element from time_bar */
.brief-chrome {
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 0;
  background: var(--bg);
}
.brief-chrome .date-hero { padding: var(--space-12) var(--space-12) var(--space-4); }

/* Native shell: the iOS nav bar already supplies the safe-area buffer
   above the WebView, so .brief-chrome's `padding-top:
   env(safe-area-inset-top)` and the date-hero's 24px top padding stack
   beneath the nav bar as a tall blank strip — the masthead reads as
   floating mid-screen instead of sitting right below the nav bar.
   Drawers don't carry this double-inset, which is why they feel right.
   Zero the safe-area pad and tighten the date-hero's top breathing
   room so the masthead ("04 MON / TODAY MAY · WK 19" on day,
   "19 Week MAY 04 – MAY 10 · 2026" on week) snaps up under the nav
   bar. The masthead itself stays visible — the user reads it here,
   not in the small native title. Both `body.is-native` (server-
   rendered from the Rails UA check) and the bridge-set
   `[data-hotwire-native="true"]` selectors are listed so the rule
   fires regardless of which signal the shell carries. */
body.is-native .brief-chrome,
[data-hotwire-native="true"] .brief-chrome {
  padding-top: 0 !important;
}
body.is-native .brief-chrome .date-hero,
[data-hotwire-native="true"] .brief-chrome .date-hero {
  padding-top: var(--space-4) !important;
}

/* Chip bar — labels with hairline rules above and below, vertical hairlines between */
.brief-chip-bar {
  display: flex; align-items: stretch;
  padding: 0 var(--space-12);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.brief-chip-bar .brief-chip-seg + .brief-chip-seg { border-left: 1px solid var(--border); }
.brief-chip-seg {
  flex: 1 1 auto;
  min-height: 2.75rem;        /* ~44pt — Apple HIG, scales with iOS Dynamic Type */
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font);
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--secondary);    /* affordance: tappable, not active */
  background: transparent; border: none; padding: 0 var(--space-2);
  cursor: pointer; position: relative;
  touch-action: manipulation;
}
.brief-chip-seg--gear { flex: 0 0 2.75rem; font-size: 1rem; letter-spacing: 0; }
.brief-chip-seg::after {
  content: ""; position: absolute;
  left: var(--space-4); right: var(--space-4); bottom: -1px;
  height: 2px; background: transparent;
  transition: background 150ms ease;
}
.brief-chip-seg.is-open { color: var(--text); }
.brief-chip-seg.is-open::after { background: var(--text); }

/* Accordion panel — grid-template-rows transition, smooth on iOS */
.brief-acc-panel {
  display: grid; grid-template-rows: 0fr;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: grid-template-rows 280ms cubic-bezier(0.32, 0.72, 0, 1), border-color 280ms;
}
.brief-acc-panel.is-open { grid-template-rows: 1fr; border-bottom-color: var(--border); }
.brief-acc-panel__inner-wrap { overflow: hidden; }
.brief-acc-panel__inner { padding: var(--space-4) var(--space-12) var(--space-6); }

.brief-acc-opt {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-2); min-height: 2.75rem;
  font-family: var(--font); font-size: 0.875rem; font-weight: 400;
  color: var(--text); text-decoration: none;
  background: transparent; border: none; border-bottom: 1px solid var(--bg-alt);
  width: 100%; cursor: pointer; text-align: left;
  touch-action: manipulation;
}
.brief-acc-opt:last-child { border-bottom: none; }
.brief-acc-opt.is-active { font-weight: 700; }
.brief-acc-opt.is-active::after { content: "✓"; color: var(--text); font-weight: 700; }
.brief-acc-opt[data-type-filter-opt].is-active { font-weight: 700; color: var(--accent); }
.brief-acc-opt[data-type-filter-opt].is-active::after { content: "−"; color: var(--accent); font-weight: 700; }
.brief-acc-opt__badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  background: var(--attention); color: var(--text-inverse);
  font-size: var(--text-micro); font-weight: 700; border-radius: 9px;
  margin-left: var(--space-2);
}
.brief-acc-opt__hint { color: var(--tertiary); font-size: var(--text-small); }
.brief-acc-opt--danger { color: var(--attention); }
.brief-acc-opt-form { display: contents; }

/* Bottom ribbon — fixed full-bleed, env-aware safe-area handling */
.brief-ribbon {
  position: fixed; left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom) + var(--space-4));
  display: grid; grid-template-columns: 56px 1fr 56px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.brief-ribbon__cell {
  height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text); text-decoration: none;
  border: none; border-right: 1px solid var(--border);
  cursor: pointer; touch-action: manipulation;
}
.brief-ribbon__cell:last-child { border-right: none; }
.brief-ribbon__cell:active { background: var(--bg-alt); }
.brief-ribbon__arrow { font-size: 24px; }
.brief-ribbon__today {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
}
.brief-ribbon__num {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; line-height: 1;
  color: var(--text);
  font-feature-settings: "tnum"; font-variant-numeric: tabular-nums;
}
.brief-ribbon__meta {
  font-size: var(--text-micro); font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--secondary);
}
.brief-ribbon__today--is-today .brief-ribbon__meta { color: var(--accent); }

.brief-progress {
  padding: 16px 0 0;
}
.brief-progress-track {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}
.brief-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transition: width 400ms ease;
}

/* ═══════════════════════════════════════════════════════════
   Creation Surface — Card creation from Today View
   Appleton palette from prototype v2-redesign
   ═══════════════════════════════════════════════════════════ */


/* FAB */
.fab {
  position: fixed; bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px)); right: max(24px, env(safe-area-inset-right)); z-index: 75;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: var(--text-inverse); border: none;
  font-size: var(--text-display); font-weight: 300; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px var(--accent-light);
  transition: all 300ms ease;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .fab { box-shadow: var(--shadow-md); }
.fab:hover { transform: scale(1.06); }
.fab--open { transform: rotate(45deg); background: var(--tertiary); box-shadow: none; }

/* Backdrop */
.creation-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: var(--overlay-light);
  opacity: 0; pointer-events: none;
  transition: opacity 300ms ease;
}
[data-theme="dark"] .creation-backdrop { background: var(--overlay); }
.creation-backdrop--visible { opacity: 1; pointer-events: auto; }

/* Surface — full-width on mobile, ≤480px-centered on desktop */
.creation-surface {
  position: fixed; bottom: 0; left: 50%; z-index: 70;
  width: 100%; max-width: 480px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-up);
  transform: translateX(-50%) translateY(100%);
  transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Capture Surface · statusbar prototype ─────────────────
   New iPhone-Notes-style layout. Class prefix `cs-` to avoid
   collisions with the legacy `.field`, `.type-pill`, etc.
─────────────────────────────────────────────────────────── */
.creation-surface form#creation_form { padding: 0; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.cs-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px 8px; }
.cs-topbar .cs-cancel, .cs-topbar .cs-save {
  font-family: var(--font); font-size: 14px; font-weight: 500;
  background: transparent; border: 0; padding: 6px 4px; cursor: pointer;
  color: var(--secondary);
}
.cs-topbar .cs-save { color: var(--accent); font-weight: 600; }
.cs-topbar .cs-crumb { font-family: var(--font-mono); font-size: 11px; color: var(--tertiary); letter-spacing: 0.06em; text-transform: uppercase; }

.cs-content-area {
  flex: 1; overflow-y: auto;
  padding: 4px 22px 12px;
  min-height: 200px;
}
.cs-content-area::-webkit-scrollbar { display: none; }
.cs-title {
  width: 100%;
  font-family: var(--font); font-size: 19px; font-weight: 700;
  letter-spacing: -0.005em; line-height: 1.2;
  color: var(--text); background: transparent;
  border: 0; outline: 0; padding: 5px 0 3px;
}
.cs-title::placeholder { color: var(--tertiary); }
.cs-desc {
  width: 100%;
  font-family: var(--font); font-size: 14px; font-weight: 400;
  line-height: 1.55; color: var(--text);
  background: transparent; border: 0; outline: 0;
  padding: 4px 0 6px; resize: none; min-height: 28px;
}
.cs-desc::placeholder { color: var(--tertiary); }

/* Checklist — drag-orderable rows */
.cs-checklist { display: flex; flex-direction: column; }
.cs-cl-item { display: flex; align-items: center; gap: 11px; padding: 3px 0; min-height: 24px; }
.cs-cl-item--done .cs-cl-input { color: var(--tertiary); text-decoration: line-through; }
.cs-cl-item--drag { opacity: 0.4; }
.cs-cl-grip { width: 14px; cursor: grab; opacity: 0; font-size: 13px; color: var(--tertiary); user-select: none; transition: opacity 120ms; }
.cs-cl-item:hover .cs-cl-grip { opacity: 0.6; }
.cs-cl-check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border); flex-shrink: 0; cursor: pointer; }
.cs-cl-item--done .cs-cl-check { background: var(--done); border-color: var(--done); }
.cs-cl-item--done .cs-cl-check::after { content:''; display: block; width: 6px; height: 3px; border-left: 1.5px solid white; border-bottom: 1.5px solid white; transform: rotate(-45deg); margin: 5px 0 0 3px; }
.cs-cl-input { flex: 1; background: transparent; border: 0; outline: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); padding: 0; }
.cs-cl-del { width: 18px; height: 18px; border-radius: 50%; border: 0; background: transparent; color: var(--tertiary); cursor: pointer; opacity: 0; font-size: 14px; line-height: 1; padding: 0; transition: opacity 120ms, color 140ms; }
.cs-cl-item:hover .cs-cl-del { opacity: 1; }
.cs-cl-del:hover { color: var(--warn); background: var(--bg-alt); }

.cs-checklist-add {
  font-family: var(--font); font-size: 12px; font-weight: 500;
  color: var(--tertiary); background: transparent; border: 0;
  cursor: pointer; padding: 6px 0; text-align: left;
}
.cs-checklist-add:hover { color: var(--accent); }

/* Type panel — slides up above statusbar when type !== Note */
.cs-tpanel {
  max-height: 0; overflow: hidden;
  transition: max-height 320ms cubic-bezier(0.32, 0.72, 0, 1);
  background: transparent;
  flex-shrink: 0;
}
.cs-tpanel[data-open] { max-height: 360px; }
.cs-tpanel .cs-tlines {
  padding: 14px 22px 8px;
  border-top: 0.5px solid var(--separator);
}
.cs-tline { display: flex; align-items: center; min-height: 24px; padding: 3px 0; cursor: pointer; gap: 11px; }
.cs-tline:hover .cs-v { color: var(--accent); }
.cs-tline .cs-v { font-size: 14px; line-height: 1.5; color: var(--text); font-weight: 500; flex: 1; transition: color 140ms; }
.cs-tline .cs-v--empty { color: var(--tertiary); font-weight: 400; font-style: italic; }
.cs-tline--text { cursor: text; }
.cs-tline--text:hover .cs-vinput::placeholder { color: var(--accent); }
.cs-tline .cs-vinput { flex: 1; background: transparent; border: 0; outline: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); font-weight: 500; padding: 0; }
.cs-tline .cs-vinput::placeholder { color: var(--tertiary); font-style: italic; font-weight: 400; transition: color 140ms; }

/* Statusbar — borderless, segmented. Wraps to two rows on narrow
   viewports (stats on top, type icons on bottom). Single row at ≥520px. */
.cs-statusbar {
  display: flex; align-items: center;
  flex-wrap: wrap; row-gap: 4px;
  padding: 6px 8px; min-height: 48px;
  background: var(--bg);
  border-top: 0.5px solid var(--separator);
  flex-shrink: 0; gap: 2px;
}
.cs-statusbar .cs-stat {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 7px; cursor: pointer; border-radius: 6px;
  transition: background 140ms;
  min-width: 0;
}
.cs-statusbar .cs-stat:hover { background: var(--bg-alt); }
.cs-statusbar .cs-stat-ic { width: 13px; height: 13px; flex-shrink: 0; color: var(--secondary); stroke: currentColor; stroke-width: 1.6; fill: none; }
.cs-statusbar .cs-stat-v { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.cs-statusbar .cs-stat-v--empty { color: var(--tertiary); font-weight: 500; font-style: italic; }
/* Mobile: spacer forces a full-row break, putting type icons on row 2 */
.cs-statusbar .cs-spacer { flex: 0 0 100%; height: 0; }
.cs-statusbar .cs-tbtn {
  width: 34px; height: 34px; border-radius: 7px;
  background: transparent; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary); transition: all 140ms;
  position: relative; flex-shrink: 0;
}
.cs-statusbar .cs-tbtn:hover { background: var(--bg-alt); color: var(--text); }
.cs-statusbar .cs-tbtn--on { background: var(--accent); color: white; }
.cs-statusbar .cs-tbtn svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* Type icons row — when wrapped to row 2, push them to start (left-aligned) */
@media (max-width: 519px) {
  .cs-statusbar { padding-bottom: 8px; }
  .cs-statusbar .cs-tbtn:first-of-type { margin-left: 0; }
}
/* Wider screens: single row, spacer takes remaining space (types right) */
@media (min-width: 520px) {
  .cs-statusbar { flex-wrap: nowrap; padding: 0 12px; height: 48px; }
  .cs-statusbar .cs-spacer { flex: 1 1 auto; height: auto; }
  .cs-statusbar .cs-tbtn { width: 36px; height: 36px; }
  .cs-statusbar .cs-stat { padding: 5px 10px; gap: 6px; }
  .cs-statusbar .cs-stat-ic { width: 14px; height: 14px; }
  .cs-statusbar .cs-stat-v { max-width: none; }
}

/* ── Footer · capture surface ─────────────────────────────────
   <footer class="cs-footer"> sits at the bottom of the create-card
   page (outside the form, inside the creation-surface flex column).
   Left half: 4 detail stats (Drawer/Tags/Parent/Link). Right half:
   7 card-type icons. Single row on web desktop & wide tablet; two
   rows (stats top, icons bottom) on phone-width viewports.
   Works the same on web desktop, web mobile, and Hotwire Native
   iPhone — only the safe-area inset and touch-target sizing change. */
.cs-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 min(1cm, 4%); /* shrinks below 1cm on narrow viewports so the footer never overflows */
  padding: 6px 12px;
  background: var(--bg);
  border-top: 0.5px solid var(--separator);
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}
.cs-footer-left,
.cs-footer-right {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.cs-footer-left { flex: 1 1 auto; min-width: 0; }
.cs-footer-right { flex: 0 0 auto; }

/* Stat segments — same visual language as the old statusbar
   (icon + label, hover highlight, empty-italic state). */
.cs-footer .cs-stat {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; cursor: pointer; border-radius: 6px;
  transition: background 140ms;
  min-width: 0;
}
.cs-footer .cs-stat:hover { background: var(--bg-alt); }
.cs-footer .cs-stat-ic {
  width: 14px; height: 14px; flex-shrink: 0;
  color: var(--secondary);
  stroke: currentColor; stroke-width: 1.6; fill: none;
}
.cs-footer .cs-stat-v {
  font-size: var(--text-small); font-weight: 600;
  color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.cs-footer .cs-stat-v--empty {
  color: var(--tertiary); font-weight: 500; font-style: italic;
}

/* Type icon buttons — same visual language as the old typebar. */
.cs-footer .cs-tbtn {
  width: 36px; height: 36px; border-radius: 7px;
  background: transparent; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary); transition: all 140ms;
  flex-shrink: 0;
}
/* Hover affordance only on devices with real hover (desktop with a
   mouse). iOS WebView retains the :hover state for the just-tapped
   element until the next tap elsewhere, which made the active button
   appear grey on tap and only flip to green after tapping somewhere
   else. The `(hover: hover)` gate keeps the hover affordance for
   mouse users without poisoning touch. */
@media (hover: hover) {
  .cs-footer .cs-tbtn:hover { background: var(--bg-alt); color: var(--text); }
}
/* Belt-and-suspenders: even if a UA fires `:hover` on a touch device,
   `--on` must win. Bare `.cs-tbtn--on` is 2 classes; `.cs-tbtn:hover`
   is 3, so we repeat the rule on `--on:hover` at matching specificity
   and add `!important` to short-circuit any later override. */
.cs-footer .cs-tbtn--on,
.cs-footer .cs-tbtn--on:hover {
  background: var(--accent) !important;
  color: var(--text-inverse) !important;
}
.cs-footer .cs-tbtn svg {
  width: 17px; height: 17px;
  stroke: currentColor; stroke-width: 1.6; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Phone-width: stack to two rows so 11 controls don't crowd a 320px row.
   Stats wrap to the top, type icons to the bottom (full-width row each). */
@media (max-width: 519px) {
  .cs-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }
  .cs-footer-left,
  .cs-footer-right {
    width: 100%;
    flex-wrap: wrap;
  }
  .cs-footer-right {
    justify-content: space-between;     /* spread icons across the row */
  }
  /* Bigger touch targets per iOS HIG (44×44 minimum). */
  .cs-footer .cs-tbtn {
    flex: 1 1 0;
    width: auto; height: 44px;
    border-radius: 8px;
  }
  .cs-footer .cs-tbtn svg { width: 19px; height: 19px; }
  .cs-footer .cs-stat { padding: 6px 8px; min-height: 32px; }
}

/* Native iPhone shell: the iOS UITabBar (Today / Calendar / Capture /
   Drawers) is NOT part of env(safe-area-inset-bottom) — that inset
   only covers the home-indicator strip (~34pt), not the tab bar
   chrome (~49pt) above it. Without extra bottom space the cs-footer
   sits flush with the screen bottom and the type-icon row gets
   covered by the tab bar. Reserve the tab-bar height + the home
   indicator so the footer floats clear above it. */
body.is-native .cs-footer,
[data-hotwire-native="true"] .cs-footer {
  padding-bottom: calc(56px + max(6px, env(safe-area-inset-bottom)));
}

/* Floating picker overlay (used by stats AND type-fields).
   Clamped to viewport with safe margins so it never overflows iPhone. */
.cs-picker {
  position: fixed; z-index: 80;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  min-width: 220px;
  max-width: calc(100vw - 24px);
  box-shadow: var(--shadow-overlay);
}
.cs-picker[hidden] { display: none; }
.cs-picker-h { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--tertiary); font-weight: 700; padding: 0 4px 6px; }
.cs-picker-pills { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px; }
.cs-picker-pills--multi .cs-pill--day { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.cs-pill { padding: 5px 10px; border-radius: 999px; background: var(--bg-alt); font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--text); border: 0; cursor: pointer; }
.cs-pill--on { background: var(--accent); color: white; }
.cs-pill--done { background: var(--accent); color: white; padding: 6px 14px; border-radius: 999px; }
.cs-picker-input { width: 100%; padding: 6px 10px; border: 0.5px solid var(--border); border-radius: 6px; background: var(--bg); font-family: var(--font); font-size: 13px; color: var(--text); margin-top: 4px; }
.cs-tag-chips { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 4px; }
.cs-tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 9px; border-radius: 999px; background: var(--accent); color: white; font-size: 11px; font-weight: 600; }
.cs-tag-chip .cs-x { cursor: pointer; opacity: 0.7; }
.cs-link-results { max-height: 200px; overflow-y: auto; margin-top: 4px; }
.cs-link-row { padding: 6px 8px; cursor: pointer; border-radius: 6px; font-size: 13px; }
.cs-link-row:hover { background: var(--bg-alt); }

/* Errors */
#creation_surface_errors:not(:empty) { padding: 8px 18px; color: var(--warn); font-size: 13px; }
[data-theme="dark"] .creation-surface { box-shadow: var(--shadow-up); }
.creation-surface.creation-surface--open { transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* Drag handle — iOS bottom sheet affordance */
.creation-surface::before {
  content: '';
  display: block;
  width: 36px; height: 5px;
  background: var(--tertiary);
  border-radius: 3px;
  margin: 8px auto 0;
  opacity: 0.4;
}
/* Header */
.creation-header {
  padding: 10px 20px 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.creation-title {
  font-size: var(--text-small); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
}

/* Maturity */
.creation-maturity { display: flex; align-items: center; gap: 4px; }
.maturity-dots { display: flex; gap: 4px; }
.maturity-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-faint);
  transition: all 400ms ease;
}
.maturity-dot--filled { background: var(--accent); transform: scale(1.15); }
.maturity-label {
  font-size: var(--text-small); font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--tertiary); margin-left: 4px;
  transition: color 400ms ease;
}

/* Form body (scrollable) */
.creation-surface form {
  padding: 2px 20px 12px;
  overflow-y: auto; flex: 1; min-height: 0;
  overscroll-behavior-y: contain;
}
/* Override global form styles within creation surface */
.creation-surface form input[type="text"],
.creation-surface form input[type="date"],
.creation-surface form input[type="number"],
.creation-surface form textarea,
.creation-surface form select {
  padding: 2px 0; border: none; border-radius: 0;
  background: transparent; line-height: 1.4;
}
.creation-surface form textarea { min-height: 32px; }
.creation-surface form input:focus,
.creation-surface form textarea:focus,
.creation-surface form select:focus {
  border-color: transparent;
}

/* Name input */
.name-input {
  width: 100%; border: none; background: transparent;
  font-family: var(--font); font-size: var(--text-body); font-weight: 600;
  color: var(--text); padding: 6px 0;
  outline: none; border-bottom: 2px solid var(--seed);
  transition: border-color 400ms ease; margin-bottom: 4px;
}
.name-input::placeholder { color: var(--tertiary); font-weight: 400; }
.name-input:focus { border-color: transparent; border-bottom-color: var(--seed); }
.name-input--rooting, .name-input--rooting:focus { border-bottom-color: var(--accent); }

/* Type selector */
.type-selector {
  display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 0 4px;
  border-bottom: 1px solid var(--border); margin-bottom: 0;
}
.type-pill {
  padding: 3px 8px; border-radius: 12px;
  border: 1px solid var(--border); font-size: var(--text-small);
  font-weight: 500; color: var(--secondary);
  background: transparent; cursor: pointer;
  transition: all 200ms ease; font-family: var(--font);
}
.type-pill:hover { border-color: var(--accent); color: var(--accent); }
.type-pill--active,
.type-pill--active:hover {
  background: var(--accent); color: var(--text-inverse); border-color: var(--accent);
}

/* ── Fields — inline icon + label + value rows ── */
.field {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  transition: all 300ms ease;
}
.field:last-child { border-bottom: none; }
.field-icon {
  width: 18px; text-align: center;
  font-size: var(--text-small); color: var(--tertiary);
  flex-shrink: 0; transition: color 300ms;
}
.field-icon.active { color: var(--accent); }
.field-lbl {
  font-size: var(--text-small); font-weight: 600;
  color: var(--secondary);
  width: 64px; flex-shrink: 0;
}
.field-val { flex: 1; min-width: 0; }
.field-input, .field-val input, .field-val textarea, .field-val select {
  width: 100%; border: none; background: transparent;
  font-family: var(--font); font-size: var(--text-body);
  color: var(--text); padding: 2px 0; outline: none;
}
.field-input::placeholder, .field-val input::placeholder { color: var(--tertiary); }
.field-input--small { width: 100px; border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; font-size: var(--text-small); }
.field-val textarea { resize: vertical; min-height: 32px; line-height: 1.4; }
.field-val textarea::placeholder { color: var(--tertiary); }
/* Date inputs: color scheme follows theme */
.field-val input[type="date"] { color-scheme: light; }
[data-theme="dark"] .field-val input[type="date"] { color-scheme: dark; }

/* Domain trigger */
.domain-trigger {
  border: none; background: transparent;
  font-family: var(--font); font-size: var(--text-body);
  color: var(--tertiary); cursor: pointer;
  padding: 2px 0; text-align: left; width: 100%;
}
.domain-trigger.has-value {
  color: var(--accent); font-weight: 600;
}

/* Domain pills (hidden by default, shown on trigger click) */
.dom-pills {
  display: none; flex-wrap: wrap; gap: 5px; padding: 6px 0 6px 92px;
  border-bottom: 1px solid var(--border);
}
.dom-pills.open { display: flex; }
.dom-pill {
  padding: 4px 9px; border-radius: 16px;
  border: 1px solid var(--border); font-size: var(--text-small);
  font-weight: 500; color: var(--secondary);
  background: transparent; cursor: pointer;
  transition: all 200ms ease; font-family: var(--font);
}
.dom-pill:hover { border-color: var(--accent); color: var(--accent); }
.dom-pill--active {
  background: var(--accent); color: var(--text-inverse); border-color: var(--accent);
}

/* Type fields container */
.type-fields { margin-bottom: 0; }

/* Effort / duration / reversibility pill buttons */
.eff-wrap { display: flex; gap: 5px; flex-wrap: wrap; }
.btn-choice {
  padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--border); background: transparent;
  font-family: var(--font-mono); font-size: var(--text-small);
  color: var(--secondary); cursor: pointer;
  transition: all 200ms ease;
}
.btn-choice:hover { border-color: var(--accent); }
.btn-choice--active, .btn-choice.sel {
  background: var(--accent-light); border-color: var(--accent);
  color: var(--accent); font-weight: 600;
}
/* Radio-styled btn-choice — visually identical to .btn-choice (mono font, same padding) */
.btn-choice--radio { cursor: pointer; display: inline-flex; align-items: center; margin: 0; }
.btn-choice--radio:has(input:checked) {
  background: var(--accent-light); border-color: var(--accent);
  color: var(--accent); font-weight: 600;
}

/* Weekly days / monthly day (sub-selectors under Schedule) */
.weekly-days {
  display: flex; gap: 3px; padding: 6px 0 0 0; flex-wrap: wrap;
}
.weekly-days[hidden] { display: none; }
.btn-choice--compact {
  padding: 3px 0; min-width: 22px; text-align: center;
}
.monthly-day, .freq-interval { padding: 6px 0 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.monthly-day[hidden], .freq-interval[hidden] { display: none; }
.monthly-day .field-input, .freq-interval .field-input { width: 70px; flex: 0 0 auto; }
.field-inline-lbl { font-size: var(--text-small); color: var(--text-muted); }

/* Decision options */
.options-list { display: flex; flex-direction: column; gap: 4px; }
.add-link {
  background: none; border: none; color: var(--tertiary);
  font-size: var(--text-small); cursor: pointer; padding: 4px 0;
  font-family: var(--font); text-align: left;
}
.add-link:hover { color: var(--secondary); }

/* Checklist (toggle-to-show) */
.field-checklist { padding: 6px 0; }
.cl-toggle {
  font-size: var(--text-small); color: var(--tertiary);
  background: none; border: none; cursor: pointer;
  font-family: var(--font); padding: 4px 0;
  transition: color 200ms ease;
}
.cl-toggle:hover { color: var(--secondary); }
.cl-items { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.cl-items:empty { display: none; }
.cl-input-wrap {
  display: flex; align-items: center; gap: 6px; margin-top: 4px;
}
.cl-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--tertiary); flex-shrink: 0;
}
.cl-input {
  flex: 1; border: none; background: transparent;
  font-family: var(--font); font-size: var(--text-small);
  color: var(--text); padding: 3px 0; outline: none;
}
.cl-input::placeholder { color: var(--tertiary); }
.checklist-row {
  display: flex; gap: 6px; align-items: center;
  font-size: var(--text-small); color: var(--text);
}
.checklist-bullet {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--tertiary); flex-shrink: 0;
  display: inline-block; font-size: 0;
}
.cl-remove {
  all: unset; cursor: pointer; flex-shrink: 0;
  font-size: var(--text-body); color: var(--tertiary);
  width: 18px; text-align: center; line-height: 1;
}
.cl-remove:hover { color: var(--attention); }
.cl-input--row {
  flex: 1; border: none; background: transparent;
  font-family: var(--font); font-size: var(--text-small);
  color: var(--text); padding: 3px 0; outline: none;
}

/* Tags (inline in gf row) */
.tag-input-wrap {
  display: flex; flex-wrap: wrap; align-items: center;
}
/* margin-right merged into .tag-pill base */
.tag-inline-input {
  border: none; background: transparent;
  font-family: var(--font); font-size: var(--text-body);
  color: var(--text); padding: 2px 0; outline: none;
  min-width: 60px; flex: 1;
}
.tag-inline-input::placeholder { color: var(--tertiary); }
.tag-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: 10px;
  background: var(--accent-light); color: var(--accent);
  font-size: var(--text-small); font-weight: 500; border: none;
}
.tag-remove {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: var(--text-small); padding: 0;
  opacity: 0.6;
}
.tag-remove:hover { opacity: 1; }

/* "Link to" picker — dropdown of card matches under the inline input.
   Uses tag-pill / tag-input-wrap pattern for the input field; results
   panel is a small flyout below. */
.link-results {
  margin-top: 4px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg);
  max-height: 240px; overflow-y: auto;
}
.link-result {
  display: grid; grid-template-columns: 56px 1fr auto;
  gap: 8px; align-items: baseline;
  width: 100%; text-align: left;
  padding: 6px 10px;
  border: none; background: transparent; color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.link-result:last-child { border-bottom: none; }
.link-result:hover, .link-result.is-active { background: var(--accent-light); }
.link-result.is-already-linked { opacity: 0.4; cursor: default; }
.link-result.is-already-linked:hover { background: transparent; }
.link-result__type {
  font-size: var(--text-nano); text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--tertiary); font-weight: 700;
}
.link-result__title { font-size: var(--text-small); color: var(--text); }
.link-result__drawer { font-size: var(--text-micro); color: var(--tertiary); }

/* Brief preview */
.brief-preview {
  padding: 0 20px 8px;
}
.preview-label {
  font-size: var(--text-small); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--tertiary); margin-bottom: 4px;
}
.preview-card {
  padding: 6px 10px; border-radius: var(--radius-md);
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  font-size: var(--text-small);
}
.preview-slot {
  font-size: var(--text-small); font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.preview-detail {
  font-size: var(--text-small); color: var(--secondary); margin-top: 1px;
}

/* Plant button */
.plant-foot {
  padding: 10px 20px calc(max(24px, env(safe-area-inset-bottom)) + 12px);
  border-top: 1px solid var(--border);
}
.plant-button {
  width: 100%; padding: 10px;
  border-radius: var(--radius-md); border: none;
  background: var(--text-faint); color: var(--tertiary);
  font-family: var(--font); font-size: var(--text-body); font-weight: 600;
  cursor: not-allowed; transition: all 400ms ease;
}
.plant-button:not(:disabled) {
  background: var(--accent); color: var(--text-inverse); cursor: pointer;
}
.plant-button:not(:disabled):hover { filter: brightness(1.1); }

/* Toast */
.toasts { position: fixed; bottom: max(80px, calc(env(safe-area-inset-bottom) + 56px)); left: 50%; transform: translateX(-50%); z-index: 80; }
.toast {
  background: var(--accent); color: var(--text-inverse);
  padding: 8px 20px; border-radius: var(--radius-md);
  font-size: var(--text-small); font-weight: 600;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Errors */
.creation-errors { margin-bottom: 12px; }
.creation-error { font-size: var(--text-small); color: var(--attention); margin: 2px 0; }

/* ══════════════════════════════════════════════════════════════
   DRAWER V2 — Composite design (Appleton base)
   Goal color spectrum, topology dots, expansion cards, task list
   ══════════════════════════════════════════════════════════════ */


.goal-box::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.goal-box::before { background: var(--accent); }
.goal-box:hover { border-color: var(--accent); }

.goal-box-why { font-size: var(--text-small); color: var(--secondary); margin-top: 3px; line-height: 1.4; }

.goal-links { display: flex; gap: 4px; margin-top: 6px; }
.goal-link-badge {
  font-size: var(--text-small); font-family: "SF Mono", monospace;
  padding: 1px 5px; border-radius: 3px;
  background: var(--bg-alt); color: var(--secondary); border: 1px solid var(--border);
}

.goal-box.expanded { cursor: default; }

/* ─── Shared expansion card (full inline detail) ─── */
.expansion-card {
  position: relative;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px 24px;
  animation: expansion-unfurl 200ms ease forwards;
}
@keyframes expansion-unfurl {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header — Brody: heavy rule closes the header block */
.exp-header { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--text); }
.exp-type-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--text-micro); color: var(--tertiary); margin-bottom: 6px;
}
.exp-type-badge {
  font-size: var(--text-micro); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 1px 4px; border-radius: 2px;
}
.exp-type-routine { background: var(--accent-light); color: var(--accent); }
.exp-type-task { background: var(--seed-light); color: var(--seed); }
.exp-type-goal { background: var(--accent-light); color: var(--accent); }
.exp-type-note { background: var(--bg-alt); color: var(--tertiary); border: 1px solid var(--border); }
.exp-type-decision { background: var(--bg-alt); color: var(--tertiary); border: 1px solid var(--border); }
.exp-type-measurement { background: var(--accent-light); color: var(--accent); }
.exp-type-slot { background: var(--seed-light); color: var(--seed); }
.exp-type-timeblock { background: var(--seed-light); color: var(--seed); }
.exp-priority { font-weight: 500; color: var(--tertiary); }
.exp-status { opacity: 0.6; }
/* Title (10/10) — Oswald display, editorial scale, tight tracking */
.exp-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  color: var(--text); line-height: 1.15; letter-spacing: -0.02em;
}
.exp-title-reading {
  font-variant-numeric: tabular-nums;
}
.exp-context-line {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--text-micro); color: var(--tertiary); margin-top: 6px;
}
/* Drawer (1/10) — ghost */
.exp-drawer-name { font-weight: 400; color: var(--tertiary); }
.exp-context-sep { color: var(--border); }
/* Goal (4/10) — visible but quiet */
.exp-goal-name { color: var(--accent); font-weight: 500; }

/* Measurement chart in expansion card */
.exp-chart-wrap {
  background: var(--bg-alt); border-radius: var(--radius-md);
  padding: 12px 16px;
}
.exp-chart-wrap .strip-chart { height: auto; flex: none; }

/* Labeled body fields (8/10) — Brody micro labels + body values, inline */
.exp-body-fields { display: flex; flex-direction: column; gap: 4px; }
.exp-body-field { display: flex; align-items: baseline; gap: 6px; }
.exp-body-field > span:last-child { font-size: var(--text-small); line-height: 1.4; color: var(--secondary); }
.exp-body-field .expansion-section-label { margin-bottom: 0; display: inline; }

/* Body text (8/10) — full contrast, generous breathing */
.exp-body {
  font-size: var(--text-body); line-height: 1.6; color: var(--text);
  margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.expansion-section + .exp-body { margin-top: 14px; }
.exp-body p { margin: 0 0 4px; }

/* Sections — Brody ruled rhythm between blocks */
.expansion-section { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
/* Last section before actions — no bottom border (heavy actions rule takes over) */
.expansion-section:not(:has(~ .expansion-section)) { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.expansion-section-label {
  font-size: var(--text-micro); font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--tertiary); margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}

/* Fields grid — dense 2-col */
.expansion-field-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 16px; }
@media (max-width: 600px) { .expansion-field-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 400px) { .expansion-field-grid { grid-template-columns: 1fr; } }
.expansion-field-label {
  font-size: var(--text-micro); font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--tertiary); margin-bottom: 1px;
}
.expansion-field-value { font-size: var(--text-small); color: var(--text); line-height: 1.4; }

/* Decision options */
.exp-decision-option {
  padding: 6px 10px; margin-bottom: 4px; border-radius: 4px;
  border: 1px solid var(--border); font-size: var(--text-small);
}
.exp-decision-chosen { border-color: var(--accent); background: var(--accent-light); }
.exp-option-name { font-weight: 500; margin-bottom: 2px; }
.exp-option-pro { color: var(--accent); font-size: var(--text-small); }
.exp-option-con { color: var(--attention); font-size: var(--text-small); }

/* Checklist (10/10) — promoted to full presence */
.exp-checklist-progress {
  font-size: var(--text-small); font-weight: 500; color: var(--secondary);
  font-family: var(--font-mono); letter-spacing: 0; text-transform: none;
}
.exp-checklist { margin-top: 4px; }
.checklist-item--compact { padding: 4px 0; }
.checklist-title--sm { font-size: var(--text-body); }

/* Streak numbers (1/10) — pinned top-right, clear of close button */
.exp-streak-nums {
  position: absolute; top: 20px; right: 24px;
  display: flex; gap: 5px; align-items: baseline;
  font-size: var(--text-small); font-weight: 600; font-family: var(--font-mono);
}
.card-overlay > .expansion-card > .exp-streak-nums { top: 28px; right: 56px; }
.exp-streak-current { color: var(--accent); }
.exp-streak-sep { color: var(--border); font-weight: 300; }
.exp-streak-best { color: var(--secondary); }

.exp-year-grid {
  display: grid;
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  gap: 2px; width: 100%;
}
.exp-year-grid i {
  display: block; width: 100%; aspect-ratio: 1;
  border-radius: 1px; font-style: normal;
  background: var(--text); opacity: 0.06;
}
.exp-year-grid .done { opacity: 0.85; }
.exp-year-grid .today { opacity: 1; }
.exp-year-labels {
  display: flex; justify-content: space-between;
  font-size: var(--text-small); color: var(--tertiary); margin-top: 3px;
  width: fit-content; min-width: 100%;
}

/* Tags */
.exp-tags { display: flex; gap: 4px; flex-wrap: wrap; }
/* exp-tags uses .tag--sm variant on each tag */

/* Linked items */
.expansion-linked-item {
  font-size: var(--text-small); color: var(--secondary);
  display: flex; align-items: center; gap: 6px; padding: 2px 0;
}
/* ── .link-type — type badge in goal expansion (base + color modifiers) ── */
.link-type { font-size: var(--text-micro); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 5px; border-radius: var(--radius); display: inline-block; flex-shrink: 0; }
.link-type-routine { background: var(--accent-light); color: var(--accent); }
.link-type-task { background: var(--seed-light); color: var(--seed); }
.link-type-note { background: var(--bg-alt); color: var(--tertiary); border: 1px solid var(--border); }
.link-type-decision { background: var(--bg-alt); color: var(--tertiary); border: 1px solid var(--border); }
.link-type-goal { background: var(--accent-light); color: var(--accent); }
.link-type-measurement { background: var(--accent-light); color: var(--accent); }
.link-type-slot { background: var(--seed-light); color: var(--seed); }
.link-type-timeblock { background: var(--seed-light); color: var(--seed); }

/* ── .expansion-linked-list — ul wrapper for linked items inside expansion card ── */
.expansion-linked-list { list-style: none; margin: 0; padding: 0; }
/* ── .expansion-actions — action bar at bottom of goal expansion card ── */
.expansion-actions { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* Actions bar (7/10) — Brody heavy rule closes the card */
.exp-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; padding-top: 12px; border-top: 2px solid var(--text);
}
.exp-actions-left { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.exp-log-form {
  display: flex; align-items: center; gap: 6px;
}
form input.exp-log-input {
  font-size: var(--text-small); font-family: inherit; font-weight: 500;
  color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 12px; width: 80px; line-height: normal;
  text-align: right; appearance: textfield; -moz-appearance: textfield;
}
form input.exp-log-input::-webkit-outer-spin-button,
form input.exp-log-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
form input.exp-log-input::placeholder { color: var(--tertiary); }
form input.exp-log-input:focus { outline: none; border-color: var(--accent); }
.btn-card-primary {
  font-size: var(--text-small); font-weight: 700; color: var(--bg);
  background: var(--text); border: none; border-radius: 4px;
  padding: 6px 16px; cursor: pointer; font-family: inherit;
  letter-spacing: 0.02em;
}
.btn-card-primary:hover { opacity: 0.85; }
.btn-card {
  font-size: var(--text-small); font-weight: 500; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 5px 14px; cursor: pointer;
  font-family: inherit; text-decoration: none;
}
.btn-card:hover { border-color: var(--text); color: var(--text); }
/* Created (1/10) — ghost */
.exp-created { font-size: var(--text-micro); color: var(--tertiary); }

/* Orphan notice */
.expansion-orphan-notice {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 4px;
  background: var(--seed-light); border: 1px dashed var(--seed);
  font-size: var(--text-small); color: var(--seed);
}

/* ─── Card overlay (full-page expansion for daily brief) ─── */
.card-overlay {
  position: fixed; inset: 0; z-index: 900;
  overflow-y: auto; overscroll-behavior-y: contain;
  background: var(--bg);
  padding: max(64px, calc(env(safe-area-inset-top) + 32px)) max(16px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex; justify-content: center; align-items: flex-start;
  opacity: 0; transition: opacity 150ms ease;
}
.card-overlay.is-visible { opacity: 1; }

.card-overlay > .expansion-card {
  position: relative;
  width: 100%; max-width: 560px;
  padding: 28px 32px;
  box-shadow: var(--shadow-overlay);
  border: 1px solid var(--border);
}
/* Overlay: title gets even more room */
.card-overlay > .expansion-card .exp-title { font-size: 26px; }
[data-theme="dark"] .card-overlay > .expansion-card {
  background: var(--bg-alt);
  /* --shadow-overlay is theme-aware (dark variant adds inset border) */
}

/* Bigger sparkline chart inside expansion / overlay */
.expansion-card .strip-chart { height: auto; }
.expansion-card .strip-chart svg { width: 100%; height: 80px; }
.card-overlay > .expansion-card .strip-chart svg { height: 120px; }

.card-overlay-close {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--tertiary);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
}
.card-overlay-close:hover { color: var(--text); background: var(--bg-alt); }

body.card-overlay-open { overflow: hidden; }

/* ─── Dead CSS removed: .routine-maturity, .routine-name-cell, .routine-table-wrap containers,
       .routine-expansion, .habit-dot, .streak-badge, .task-list-v2, .task-row, .task-status-dot,
       .task-stage-label — all migrated to .row molecule + .dot/.badge/.streak-num atoms ─── */


/* ─── Simple list v2 (decisions, notes) ─── */
.simple-list-v2 { list-style: none; }

/* ─── Pinned section (measurements, other pinnable types) ─── */
.pinned-section { margin-bottom: 32px; }
.pinned-list .pinned-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  padding: 10px 14px;
  margin-bottom: 6px;
}
.pinned-list .pinned-item:hover { background: var(--bg); margin-bottom: 6px; padding: 10px 14px; }
.pinned-list .pinned-item:last-child { margin-bottom: 0; border-bottom: 1px solid var(--border); }
.pinned-glyph { font-size: var(--text-small); opacity: .7; }

/* ─── Pinned vitals ribbon (Measurement trajectory strips) ─── */
.ribbon.pinned-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  overflow: hidden;
  list-style: none;
  padding: 0;
  margin: 0;
}
.ribbon .strip {
  padding: 14px 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 128px;
  min-width: 0;
}
.ribbon .strip:last-child { border-right: none; border-bottom: none; }
.ribbon .strip:hover { background: var(--bg); }
.strip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.strip-lbl { font-size: var(--text-small); text-transform: uppercase; letter-spacing: .08em; color: var(--tertiary); font-weight: 600; }
.strip-dir { font-size: var(--text-small); color: var(--secondary); }
.strip-dir .arrow { color: var(--accent); font-weight: 600; margin-right: 2px; }
.strip-chart { flex: 0 0 44px; position: relative; height: 44px; }
.strip-chart svg { width: 100%; height: 100%; display: block; }
.target-band { fill: var(--accent-light); stroke: none; }
.target-band.off { fill: var(--warn-bg); }
.spark { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.spark.off { stroke: var(--warn); }
.strip-chart svg { cursor: crosshair; }
.spark-tooltip {
  position: absolute; top: -26px; padding: 3px 8px;
  font-size: var(--text-micro); font-weight: 600; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  white-space: nowrap; pointer-events: none; z-index: 2;
}
.strip-empty { font-size: var(--text-small); color: var(--tertiary); display: flex; align-items: center; height: 100%; }
.strip-val { display: flex; align-items: baseline; gap: 6px; }
.strip-val .n { font-size: var(--text-display); font-weight: 300; color: var(--accent); }
.strip-val .u { font-size: var(--text-small); color: var(--tertiary); }
.strip-val .ok { margin-left: auto; font-size: var(--text-small); color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.strip-val .ok.off { color: var(--warn); }
.ribbon .strip .expansion { grid-column: 1 / -1; }


/* Measurement latest value + target */
.measurement-latest {
  font-size: var(--text-small);
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.measurement-latest strong { color: var(--text); font-weight: 500; }
.measurement-target { color: var(--tertiary); }

/* ─── Unplanted (compact light orange box) ─── */
.unplanted {
  margin-top: 32px; padding: 10px 14px;
  background: var(--seed-light); border-radius: var(--radius-md);
  font-size: var(--text-small); color: var(--secondary); line-height: 1.7;
}
.unplanted-label {
  font-size: var(--text-small); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--seed); margin-right: 6px;
}
.unplanted-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--seed); margin-right: 3px; vertical-align: middle;
}
.unplanted-group { margin-right: 10px; }
.unplanted-type { font-weight: 600; color: var(--seed); }

/* ─── Section divider ─── */
.section-divider { height: 1px; background: var(--border); margin: 20px 0; }
.paused-routines { opacity: 0.55; transition: opacity 0.2s ease; }
.paused-routines:hover { opacity: 0.9; }
.paused-routines-label { font-size: var(--text-small); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 8px; }


/* ─── Drawer color swatch ─── */
.drawer-color-swatch {
  width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; display: inline-block;
}


/* ── Responsive ── */
@media (max-width: 768px) {
  main { padding: 24px 16px max(96px, calc(env(safe-area-inset-bottom) + 80px)); }
}

/* ── Day sequence editing ── */
.brief-edit-toggle {
  background: none; border: none; padding: 0 0 0 8px;
  color: var(--text-muted); cursor: pointer;
  font-size: var(--text-small); line-height: 1;
}
.brief-edit-toggle:hover { color: var(--accent); }
.brief-edit-toggle--on { color: var(--accent); }

/* Read mode (default): show only the read label, hide all edit affordances. */
.sequence-head__edit { display: none; }
.sequence-section--empty { display: none; }
.sequence-add { display: none; }

/* Time range + sequence name — Brody editorial */
.seq-time-range { font-size: var(--text-small); color: var(--text); letter-spacing: 0.14em; text-transform: uppercase; font-family: var(--font); font-weight: 700; font-variant-numeric: tabular-nums; }
.seq-name { color: var(--text); font-size: var(--text-small); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-family: var(--font); }

/* Edit mode: hide read label, show edit forms, reveal empty sequences. */
[data-edit-mode] .sequence-head__read { display: none; }
[data-edit-mode] .sequence-head__edit {
  display: flex; align-items: center; gap: 6px; flex: 0 1 auto; flex-wrap: nowrap;
}
[data-edit-mode] .sequence-head { flex-wrap: wrap; gap: 6px 10px; }
.sequence-head__edit .seq-name-input { width: 140px; min-width: 0; }
.sequence-head__edit .seq-time-input { width: 90px; }
[data-edit-mode] .sequence-section--empty { display: block; opacity: 0.6; }
[data-edit-mode] .sequence-add { display: block; }

.seq-name-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text); padding: 4px 8px; border-radius: 4px;
  font-family: var(--font); font-size: var(--text-small); min-width: 100px;
}
.seq-time-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text); padding: 4px 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: var(--text-small);
}
.seq-dash { color: var(--text-muted); font-size: var(--text-small); }
.seq-save {
  background: var(--accent); color: var(--text-inverse); border: none;
  padding: 4px 10px; border-radius: 4px; font-size: var(--text-small);
  font-weight: 600; cursor: pointer; text-transform: uppercase;
  letter-spacing: 0.1em;
}
.seq-delete-form { display: inline; margin: 0; }
.seq-delete {
  background: none; border: none; color: var(--text-muted);
  font-size: var(--text-body); cursor: pointer; padding: 0 6px; line-height: 1;
}
.seq-delete:hover { color: var(--danger-hover); }
.seq-plus {
  color: var(--accent); font-size: var(--text-body); font-weight: 700;
  padding-right: 4px;
}

.sequence-section--drag-over {
  background: var(--accent-light);
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
}
/* Sequence drag states — on .row-item (superset of old .brief-item) */
.row-item--drop-above { box-shadow: inset 0 2px 0 0 var(--accent); }
.row-item--drop-below { box-shadow: inset 0 -2px 0 0 var(--accent); }
.sequence-empty {
  font-size: var(--text-small); color: var(--text-muted);
  padding: 8px 0; font-style: italic;
}

/* Sequence picker chips inside a routine expansion */
.exp-sequence-picker {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.exp-sequence-picker form { margin: 0; display: inline; }
.exp-seq-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text); padding: 3px 8px; border-radius: 3px;
  font-size: var(--text-small); cursor: pointer;
}
.exp-seq-chip--current {
  background: var(--accent-light); border-color: var(--accent);
  color: var(--accent); font-weight: 600;
}

/* ─── Touch-primary devices: all interactive targets ≥ 44×44 ─── */
@media (pointer: coarse) {
  /* Checkbox — invisible ::before expands tap area without enlarging the visual circle */
  .check {
    position: relative;
  }
  .check::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 44px; height: 44px;
    transform: translate(-50%, -50%);
  }
  /* Topbar buttons */
  .menu-btn,
  .topbar button,
  .fab {
    min-width: 44px;
    min-height: 44px;
  }
  /* Nav arrows (‹ ›) */
  .time-bar__arrow {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  /* Filter dropdown buttons */
  .nav-select__btn {
    min-height: 44px;
  }
  /* Creation surface pill buttons — effort, duration, type, frequency */
  .btn-choice,
  .btn-choice--radio,
  .type-pill {
    min-height: 44px;
    padding: 10px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .btn-choice--compact {
    min-width: 44px;
    min-height: 44px;
  }
  /* Card overlay close button */
  .card-overlay-close {
    width: 44px;
    height: 44px;
  }
  /* Weekly view nav and size buttons */
  .weekly__navbtn,
  .weekly__size-btn {
    min-height: 44px;
  }
}

/* ───────────────────────────────────────────────────────────────
   WEEKLY VIEW — Müller-Brockmann cut
   Single source of truth. Tokens from :root above.
   Scoped to .weekly so it can't leak into calendar or today.
   ─────────────────────────────────────────────────────────────── */
.weekly {
  max-width: none;
  margin: 0;
  padding: 0 12px 96px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum","kern";
}
.weekly *, .weekly *::before, .weekly *::after { box-sizing: border-box; }

.weekly__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  padding-bottom: 14px;
}
.weekly__title {
  margin: 0;
  font-size: var(--text-body); font-weight: 400; line-height: 1;
  text-transform: uppercase; letter-spacing: .18em;
  color: var(--text);
  white-space: nowrap;
}
.weekly__wk { font-weight: 900; letter-spacing: .04em; font-size: var(--text-body); }
.weekly__range { color: var(--secondary); margin-left: 14px; }

.weekly__nav { display: flex; gap: 0; align-items: stretch; }
.weekly__navbtn {
  all: unset; cursor: pointer;
  font-family: var(--font);
  font-size: var(--text-small); font-weight: 400;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--text);
  padding: 6px 14px;
  border-left: 1px solid var(--border);
  line-height: 1;
  display: inline-flex; align-items: center;
}
.weekly__nav .weekly__navbtn:first-child { border-left: none; }
.weekly__navbtn:hover { color: var(--attention); }
.weekly__navbtn--now { color: var(--attention); font-weight: 900; }

.weekly__ribbon { height: 1px; background: var(--text); margin-bottom: 32px; }

.weekly__size {
  display: flex; gap: 0; align-items: baseline;
  margin-left: auto;
}
.weekly__size-btn {
  all: unset; cursor: pointer;
  font-family: var(--font);
  font-size: var(--text-small); font-weight: 400;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--text);
  padding: 0 10px;
  border-left: 1px solid var(--border);
  line-height: 1;
  display: inline-flex; align-items: center;
}
.weekly__size-btn:first-child { border-left: none; }
.weekly__size-btn:hover { color: var(--attention); }

/* Font-size steps applied to .weekly */
.weekly[data-size="1"] .weekly__e-t { font-size: var(--text-nano); }
.weekly[data-size="1"] .weekly__e-l { font-size: var(--text-nano); }
.weekly[data-size="1"] .weekly__e--band .weekly__e-l { font-size: var(--text-nano); }
.weekly[data-size="2"] .weekly__e-t { font-size: var(--text-micro); }
.weekly[data-size="2"] .weekly__e-l { font-size: var(--text-micro); }
.weekly[data-size="2"] .weekly__e--band .weekly__e-l { font-size: var(--text-micro); }
.weekly[data-size="3"] .weekly__e-t { font-size: var(--text-micro); }
.weekly[data-size="3"] .weekly__e-l { font-size: var(--text-small); }
.weekly[data-size="3"] .weekly__e--band .weekly__e-l { font-size: var(--text-micro); }
.weekly[data-size="4"] .weekly__e-t { font-size: var(--text-small); }
.weekly[data-size="4"] .weekly__e-l { font-size: var(--text-body); }
.weekly[data-size="4"] .weekly__e--band .weekly__e-l { font-size: var(--text-small); }
.weekly[data-size="5"] .weekly__e-t { font-size: var(--text-small); }
.weekly[data-size="5"] .weekly__e-l { font-size: var(--text-body); }
.weekly[data-size="5"] .weekly__e--band .weekly__e-l { font-size: var(--text-body); }

.weekly__tracks {
  display: flex;
  gap: 0;
  align-items: baseline;
  padding: 14px 0;
  margin-top: -19px;
}

.weekly__empty-all {
  padding: 24px 0;
  font-size: var(--text-small); font-weight: 800;
  text-transform: uppercase; letter-spacing: .24em;
  color: var(--secondary);
}
.weekly__empty-link {
  all: unset; cursor: pointer;
  color: var(--text);
  border-bottom: 1px solid var(--text);
  margin-left: 6px;
}
.weekly__empty-link:hover { color: var(--attention); border-color: var(--attention); }
.weekly__menu-item:hover .weekly__trk-box { border-color: var(--attention); }
.weekly__menu-item[aria-pressed="true"]:hover .weekly__trk-box { background: var(--attention); border-color: var(--attention); }
.weekly__trk-box {
  width: 12px; height: 12px;
  border: 1px solid var(--text);
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
}
.weekly__trk[aria-pressed="true"] .weekly__trk-box { background: var(--text); }
.weekly__trk[aria-pressed="true"] .weekly__trk-box::after {
  content: ""; position: absolute;
  left: 3px; top: 0;
  width: 4px; height: 8px;
  border-right: 1.5px solid var(--bg);
  border-bottom: 1.5px solid var(--bg);
  transform: rotate(45deg);
}
.weekly__trk[aria-pressed="false"] { color: var(--secondary); }
.weekly__trk:hover { color: var(--attention); }
.weekly__trk:hover .weekly__trk-box { border-color: var(--attention); }
.weekly__trk[aria-pressed="true"]:hover .weekly__trk-box { background: var(--attention); border-color: var(--attention); }

.weekly__week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  column-gap: var(--space-16);
  row-gap: 0;
}
.weekly__day {
  padding: 0 var(--space-2);
  min-width: 0;
  position: relative;
}
.weekly__dh {
  display: flex;
  align-items: baseline;
  gap: var(--space-6);
  padding: var(--space-2) 0 var(--space-8);
  margin-bottom: var(--space-8);
}
.weekly__dh-name {
  font-family: var(--font);
  font-size: var(--text-micro); font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--tertiary);
  flex: 0 0 auto;
}
.weekly__dh-num {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 700; line-height: 1;
  color: var(--text);
  font-feature-settings: "tnum"; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.weekly__day.is-weekend .weekly__dh-name,
.weekly__day.is-weekend .weekly__dh-num,
.weekly__day.is-weekend .weekly__e-t,
.weekly__day.is-weekend .weekly__e-l { color: var(--text-weekend); }
.weekly__day.is-weekend .weekly__band-head .weekly__e-t { color: var(--tertiary-weekend); }
.weekly__day.is-past .weekly__dh-num { color: var(--secondary); font-weight: 700; }
.weekly__day.is-past .weekly__dh-name { color: var(--text-faint); }
.weekly__day.is-today .weekly__dh {
  box-shadow: inset 0 -1px 0 0 var(--text);
}
.weekly__day.is-today .weekly__dh-num { color: var(--text); font-weight: 700; }
.weekly__day.is-today .weekly__dh-name { color: var(--text); font-weight: 700; }

/* Matas spacing: flex rows so time auto-sizes (no portrait overflow);
   routines get an accent-dot prefix instead of an empty 38px column. */
.weekly__e {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 2px 0;
  line-height: 1.35;
  cursor: pointer;
}
/* Inline .expansion is a third child of .weekly__e in the ERB partials but
   is unused in week view (card-overlay modal handles expansion). Hide it so
   it doesn't compete with the label for horizontal space inside the flex row. */
.weekly__e > .expansion { display: none; }
.weekly__e-t {
  font-family: var(--font);
  font-size: var(--text-small); font-weight: 400;
  color: var(--tertiary);
  font-feature-settings: "tnum"; font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.weekly__e-l {
  font-family: var(--font);
  font-size: var(--text-small); font-weight: 400;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}
/* Slot rows render with the same visual as band heads (08:00 MORNING).
   No dotted accent border, no italic — just a hairline below and the same
   uppercase letterspaced label typography. */
.weekly__e[data-type~="slot"] {
  padding: var(--space-4) 0 var(--space-2);
  margin: 0 0 var(--space-2);
  border-bottom: 1px solid var(--border);
}
.weekly__e[data-type~="slot"] .weekly__e-l {
  font-family: var(--font);
  font-weight: 700;
  font-size: var(--text-micro);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
  font-style: normal;
}
.weekly__e[data-type~="slot"] .weekly__e-t {
  font-size: var(--text-micro);
  letter-spacing: .14em;
  color: var(--text);
  font-weight: 700;
}
.weekly__e[data-state="done"] .weekly__e-t,
.weekly__e[data-state="done"] .weekly__e-l {
  color: var(--text-done);
  font-weight: 400;
  text-decoration: none;
}
.weekly__e.is-hidden { display: none; }
.weekly__band.is-hidden { display: none; }

.weekly__band {
  display: block;
  margin-bottom: var(--space-12);
}
.weekly__band + .weekly__band { margin-top: var(--space-6); }
.weekly__band-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-4) 0 var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.weekly__band-head .weekly__e-t {
  font-size: var(--text-micro);
  letter-spacing: .14em;
  color: var(--text);
  font-weight: 700;
}
.weekly__band-head .weekly__e-l {
  font-family: var(--font);
  font-weight: 700;
  font-size: var(--text-micro);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text);
}
/* Match slot-row sizing — both section headers stay at micro regardless of
   data-size scale, otherwise band-head e-l grows while slot e-l doesn't. */
.weekly[data-size] .weekly__band-head .weekly__e-t,
.weekly[data-size] .weekly__band-head .weekly__e-l { font-size: var(--text-micro); }
/* Routines (band rows + unscheduled): accent dot replaces empty time column */
.weekly__e--band,
.weekly__e--notime {
  padding: var(--space-1) 0;
  gap: 0.5em;
}
.weekly__e--band > .weekly__e-t,
.weekly__e--notime > .weekly__e-t { display: none; }
.weekly__e--band::before,
.weekly__e--notime::before {
  content: "·";
  color: var(--accent);
  font-weight: 700;
  flex: 0 0 auto;
  width: 0.5em;
  text-align: center;
}
.weekly__e--band[data-state="done"]::before,
.weekly__e--notime[data-state="done"]::before { color: var(--text-done); }
.weekly__e--band .weekly__e-l {
  font-size: var(--text-small);
  font-weight: 400;
}
/* Past day: dim ALL content (band heads, slots, routines, measurements, dots). */
.weekly__day.is-past .weekly__e-t,
.weekly__day.is-past .weekly__e-l,
.weekly__day.is-past .weekly__band-head .weekly__e-t,
.weekly__day.is-past .weekly__band-head .weekly__e-l,
.weekly__day.is-past .weekly__e[data-type~="slot"] .weekly__e-t,
.weekly__day.is-past .weekly__e[data-type~="slot"] .weekly__e-l { color: var(--tertiary); }
.weekly__day.is-past .weekly__e--band::before,
.weekly__day.is-past .weekly__e--notime::before { color: var(--tertiary); }

.weekly__empty {
  font-family: var(--font);
  font-size: var(--text-micro); color: var(--text-faint);
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: var(--space-4) 0;
}

/* ── Landscape phone — tighten weekly grid for readability ── */
@media (max-width: 1000px) and (orientation: landscape) {
  /* Camera notch clearance — min 56px each side covers Safari (where env()
     returns 0 even in landscape) AND PWA standalone (where env() ≈ 44px).
     User reported "no padding at all" with 32px min, suggesting Safari path. */
  body.brief-wide main {
    padding-left: max(56px, env(safe-area-inset-left));
    padding-right: max(56px, env(safe-area-inset-right));
  }
  .brief-chrome,
  .brief-ribbon {
    padding-left: max(56px, env(safe-area-inset-left));
    padding-right: max(56px, env(safe-area-inset-right));
  }
  .weekly { padding: 12px 0 48px; overflow-x: hidden; }
  .weekly__week {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    column-gap: var(--space-8);
  }
  .weekly__day { padding: var(--space-4) var(--space-1) 0; min-height: 0; }
  /* Day-header: MON at left edge, number at right edge — fills the column
     so adjacent column content sits visually next to each other instead of
     leaving a "between days" void. */
  .weekly__dh {
    display: flex; width: 100%;
    align-items: baseline; justify-content: space-between;
    padding: var(--space-1) 0 var(--space-4);
    margin-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
  }
  .weekly__dh-num { font-size: var(--text-title); }   /* 18px */
  /* Allow labels to wrap to multiple lines instead of ellipsifying to "V…" */
  .weekly__e-l,
  .weekly__band-head .weekly__e-l {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.2;
  }
  /* Tighter band-head layout when label wraps; slot rows wrap the same way
     so 00:00 VAPPUAATTO breaks across two lines like 08:00 MORNING. */
  .weekly__band-head,
  .weekly__e[data-type~="slot"] { gap: var(--space-1); flex-wrap: wrap; }
  .weekly__head { padding-bottom: 8px; }
  .weekly__ribbon { margin-bottom: 12px; }
  .weekly__tracks { padding: 6px 0; margin-top: -8px; }
  .topbar-inner { padding: 0 12px; height: 36px; }
}

/* ── Portrait phone — single column, match day-view typography ── */
@media (max-width: 820px) and (orientation: portrait) {
  /* Match day-view outer padding (16px sides) + respect safe-area-inset for any rotated camera */
  body.brief-wide main {
    padding-left: max(var(--space-8), env(safe-area-inset-left));
    padding-right: max(var(--space-8), env(safe-area-inset-right));
  }
  .weekly { padding: var(--space-8) 0 var(--space-12); }   /* zero horizontal padding inside — main provides the margin */
  .weekly__head { grid-template-columns: 1fr; gap: 14px; align-items: start; }
  .weekly__nav { justify-self: end; }
  .weekly__tracks { flex-wrap: wrap; gap: 18px 24px; }

  .weekly__week { grid-template-columns: 1fr; }
  .weekly__day {
    display: block;
    padding: var(--space-12) 0 var(--space-8);
    min-height: 0;
  }
  .weekly__dh {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-4);
    padding: 0 0 var(--space-2);
    margin-bottom: var(--space-2);
  }
  .weekly__dh-name { font-size: var(--text-body); }
  .weekly__dh-num { font-size: var(--text-display); }

  /* Match day-view body sizes: section heads at text-small, item labels at text-body. */
  .weekly[data-size] .weekly__e-t { font-size: var(--text-small); }
  .weekly[data-size] .weekly__e-l { font-size: var(--text-body); }
  .weekly[data-size] .weekly__e--band .weekly__e-l { font-size: var(--text-body); }

  /* Section headers larger in portrait (text-small instead of text-micro).
     Color/weight/letter-spacing already match brief/day in base rules. */
  .weekly[data-size] .weekly__band-head .weekly__e-t,
  .weekly[data-size] .weekly__band-head .weekly__e-l,
  .weekly[data-size] .weekly__e[data-type~="slot"] .weekly__e-t,
  .weekly[data-size] .weekly__e[data-type~="slot"] .weekly__e-l {
    font-size: var(--text-small);
  }

  /* Show full text — no truncation, allow wrap if needed. */
  .weekly__e-l,
  .weekly__band-head .weekly__e-l {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;
  }
}

/* ── Slip cards ── */
.slip-card { border-left: 3px solid transparent; transition: border-color 0.2s; }
.slip-card--level-1, .slip-card--level-2, .slip-card--level-3 { border-left-color: var(--attention); }

/* ── Brief badges (one-line pointers) ── */
.brief-badge { display: flex; align-items: center; gap: 6px; padding: 8px 12px; margin-bottom: 8px; border-radius: var(--radius-md); font-size: var(--text-body); font-weight: 500; text-decoration: none; cursor: pointer; position: relative; z-index: 1; transition: background 0.15s; }
.brief-badge:hover { filter: brightness(0.92); }
.brief-badge--triage { background: var(--attention-bg); color: var(--attention); }
.brief-badge--capture { background: var(--accent-light); color: var(--accent); }
.brief-badge__arrow { margin-left: auto; font-size: var(--text-body); }

/* ── Going Cold section ── */
.cold-card { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.cold-card:last-child { border-bottom: none; }
.cold-actions { display: flex; gap: 8px; margin-top: 8px; }
/* cold-actions buttons use .btn.btn-sm.btn-danger in HTML — no element-selector overrides needed */

/* ── Slip action surface (inline expand) ── */
.slip-actions { padding: 12px 14px; border-top: 1px solid var(--border); background: var(--bg-alt); }
.slip-actions__prompt { font-size: var(--text-body); color: var(--secondary); margin-bottom: 8px; }
.slip-actions__buttons { display: flex; gap: 8px; }
/* slip-actions__btn variants removed — buttons use .btn.btn-sm canonical classes in HTML.
   --do → .btn.btn-sm.btn-primary, --drop → .btn.btn-sm, --replace → .btn.btn-sm */

/* ── Recommit form (progressive disclosure) ── */
.recommit-form { margin-top: 10px; }
.recommit-form .gf { margin-bottom: 8px; }
.recommit-form .field-lbl { font-size: var(--text-small); color: var(--secondary); display: block; margin-bottom: 2px; }
.recommit-form .field-input { width: 100%; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: var(--text-body); background: var(--bg); color: var(--text); }
.recommit-form .field-input:focus { border-color: var(--accent); outline: none; }
.recommit-buffer { font-size: var(--text-small); color: var(--secondary); margin-top: 2px; }
.recommit-obstacle-history { font-size: var(--text-small); color: var(--secondary); margin-bottom: 6px; font-style: italic; }

/* ═══════════════════════════════════════════════════════════════
   Print — clean A4 output for drawer week view
   ═══════════════════════════════════════════════════════════════ */
@media print {
  .topbar, .domain-bar, .time-bar, .capture, .fab, .no-print,
  .creation-surface, .creation-backdrop { display: none !important; }
  @page { size: A4 portrait; margin: 12mm 15mm; }
  .week-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 2mm; font-size: 9pt; line-height: 1.3;
  }
  .day-col { border: 0.5pt solid var(--border); padding: 2mm; break-inside: avoid; }
  .month-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 1mm; font-size: 8pt; line-height: 1.2;
  }
}

/* ════════════════════════════════════════════════════════════════
   CONNECTED CARDS — Surface 2 of notes-as-graph.
   Renders Card#linked_cards_grouped on every card show view.
   Three groups (notes / goal / prep sessions / other) inside an
   accent-tinted region. Uniform divider between groups; first group
   has the same divider above so visual rhythm is consistent.

   Hidden entirely (partial self-skips) when a card has no links.
   ════════════════════════════════════════════════════════════════ */

.related-region {
  background: var(--accent-bg);
  border-bottom: 2px solid var(--accent);
  margin-top: var(--space-8);
}

.related-group {
  padding: var(--space-8) var(--space-8);
  border-top: 1px solid var(--border);
}
.related-group__label {
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: var(--space-4);
}

/* Note row — title + meta + 3-line body excerpt */
.related-note {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-4);
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--text);
}
.related-note:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.related-note:last-child { margin-bottom: 0; }
.related-note__title {
  font-size: var(--text-body); font-weight: 600;
  color: var(--text); margin-bottom: var(--space-2); line-height: 1.3;
}
.related-note__meta {
  font-size: var(--text-small); color: var(--tertiary);
  margin-bottom: var(--space-4);
}
.related-note__body {
  font-size: var(--text-small); color: var(--secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Goal row — title + meta + Goal badge */
.related-goal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--interactive);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-8);
  cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-8); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.related-goal:hover { border-color: var(--interactive); box-shadow: var(--shadow-sm); }
.related-goal__title { font-size: var(--text-body); font-weight: 600; }
.related-goal__meta { font-size: var(--text-small); color: var(--tertiary); margin-top: var(--space-1); }
.related-goal__badge {
  font-size: var(--text-micro); font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--interactive); background: var(--tint-interactive-bg);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius); flex-shrink: 0;
}

/* Work-session row — checklist style with done/pending state */
.work-session-list { display: flex; flex-direction: column; gap: var(--space-2); }
.work-session {
  display: flex; align-items: center; gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius);
  cursor: pointer; text-decoration: none; color: var(--text);
  transition: background 0.12s;
}
.work-session:hover { background: var(--bg-alt); }
.work-session__check {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--tertiary);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-nano);
}
.work-session__check.is-done {
  border-color: var(--done);
  background: var(--tint-done-bg);
  color: var(--done);
}
.work-session__title { font-size: var(--text-body); flex: 1; }
.work-session.is-done .work-session__title { color: var(--text-done); text-decoration: line-through; }
.work-session__when { font-size: var(--text-small); color: var(--tertiary); white-space: nowrap; }
.work-session.is-done .work-session__when { color: var(--text-faint); }
.work-session__badge-done {
  font-size: var(--text-micro); font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--done); background: var(--tint-done-bg-soft);
  padding: 1px var(--space-4); border-radius: var(--radius-full);
}

/* Other row — fallback for Tasks / Decisions / Slots / etc. */
.related-other {
  display: flex; align-items: baseline; gap: var(--space-4);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: background 0.12s;
}
.related-other:hover { background: var(--bg-alt); }
.related-other__type {
  font-size: var(--text-micro); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--tertiary); font-weight: 700;
  width: 64px; flex-shrink: 0;
}
.related-other__title { font-size: var(--text-body); flex: 1; }
.related-other__drawer { font-size: var(--text-small); color: var(--tertiary); }

/* ════════════════════════════════════════════════════════════════
   FOLLOWUPS — inline section at end of /brief/day.
   Replaces the deprecated /brief/followups dedicated page. Each row
   shows: title · ~time-ago, with two text actions on the right
   (skip + Capture). Same font + size as the brief rows above.
   ════════════════════════════════════════════════════════════════ */
.fu-list { display: block; }
.fu-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: var(--space-8);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 220ms, max-height 220ms, padding 220ms;
}
.fu-row:last-child { border-bottom: none; }
.fu-row.is-skipping {
  opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0;
  overflow: hidden; border-bottom-width: 0;
}
.fu-row__line {
  /* Same font + size as brief rows above (Backlog / today). */
  font-family: var(--font);
  font-size: var(--text-small);
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fu-row__when { color: var(--secondary); }
.fu-row__sep { color: var(--tertiary); margin: 0 var(--space-2); }

/* Skip — quiet text link, NOT button-styled */
.fu-skip-form { display: inline; margin: 0; padding: 0; }
.fu-skip {
  font-size: var(--text-small);
  color: var(--tertiary);
  background: none; border: none;
  padding: var(--space-2);
  cursor: pointer;
}
.fu-skip:hover { color: var(--secondary); }

/* Capture — strong accent text link, NOT button-styled */
.fu-capture {
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--accent);
  background: none; border: none;
  padding: var(--space-2);
  cursor: pointer;
}
.fu-capture:hover { opacity: 0.7; }
/* Capture rendered as a plain anchor (Triage's "Plan →") needs the same
   reset as the button form — strip the underline/inherited blue. */
a.fu-capture { text-decoration: none; }

/* Resolved-today row — soft-dismissed (skip / no prep). Stays visible
   for the rest of the day in dimmed text with a single "undo" link;
   disappears on next day's brief render. */
.fu-row--resolved .fu-row__line { color: var(--tertiary); }
.fu-row--resolved .fu-row__when,
.fu-row--resolved .fu-row__sep { color: var(--tertiary); }

.fu-undo-form { display: inline; margin: 0; padding: 0; }
.fu-undo {
  font-size: var(--text-small);
  color: var(--tertiary);
  background: none; border: none;
  padding: var(--space-2);
  cursor: pointer;
  /* Span both action columns since open rows have two buttons but
     resolved rows have only one. Right-aligned for consistency. */
  grid-column: 2 / span 2;
  justify-self: end;
}
.fu-undo:hover { color: var(--secondary); }

/* ═══════════════════════════════════════════════════════════════
   Hotwire Native bridge components — hide web fallbacks when the
   native shell is supplying the equivalent UI. The bridge JS sets
   data-bridge-components on the root element listing every component
   the native shell registered. Web fallbacks must remain visible in
   plain browsers, so these rules ONLY fire when the matching
   component name is present.
   ═══════════════════════════════════════════════════════════════ */

/* bridge--form: a UIBarButtonItem replaces the web submit button. */
[data-bridge-components~="form"] [data-bridge-form-target="submit"] {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════
   Capture page — /brief_cards/new
   Renders the full creation_surface partial, but flattened from a
   bottom-sheet overlay into inline page content. Same form fields
   as the Cmd+K capture surface on the web — every field the user
   is used to. Used by the center "+" tab in Hotwire Native iOS.
   ═══════════════════════════════════════════════════════════════ */

/* ── Capture · full-page mode ────────────────────────────────
   The /brief_cards/new view sets body.capture-page-body and the
   surface root carries .creation-surface--page. Together they
   convert the bottom-sheet overlay into a full-screen capture
   experience that works identically on:
     • web desktop (sidebar visible + capture fills the main column)
     • web mobile (full viewport, sidebar collapsible)
     • Hotwire Native iPhone (safe-area padded, native nav handles back)

   Sidebar stays visible and collapsible — capture is a focused task,
   but the user can still see where they are in the app and collapse
   the sidebar via the toggle if they want more horizontal room. */

/* Hide overlay machinery — FAB and backdrop aren't needed on a
   dedicated page. The native "+" tab replaces the FAB. */
.capture-page-body .fab,
.capture-page-body .creation-backdrop { display: none !important; }

/* Hide date-nav / filter chrome — the capture page doesn't need
   them. The SIDEBAR and TOPBAR (theme toggle + account button)
   stay so the user can still get to settings while writing. */
.capture-page-body .domain-bar,
.capture-page-body .time-bar { display: none !important; }

/* Body — keep grid layout from .has-app-sidebar so the sidebar
   stays in column 1. Use min-height (not strict height) + overflow
   auto so the page can grow / scroll if the viewport is too small
   to fit topbar + form + footer; otherwise the strict 100dvh +
   overflow:hidden combo would cause the whole page to clip and
   render white at narrow widths. */
.capture-page-body { overflow-x: hidden; overflow-y: auto; }
.capture-page-body.has-app-sidebar { min-height: 100dvh; }

/* The .app-shell column-flex stack — same idea: min-height (not
   exact) + no overflow:hidden, so children can grow if needed.
   Width 100% + min-width 0 prevents narrow-viewport grid cells
   from squashing the form into a 0-width column. */
.capture-page-body .app-shell {
  display: flex; flex-direction: column;
  min-height: 100dvh;
  width: 100%; min-width: 0;
}
.capture-page-body .app-shell > main {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  /* Override the global `main { max-width:640px; margin:0 auto;
     padding:48px 24px 96px }` reset (line 821) which would
     center a narrow column with vertical padding — and prevent
     the capture footer from reaching the viewport bottom and
     full column width. */
  max-width: none; padding: 0; margin: 0;
}

/* The body→block override at ≤768px now lives in the global
   @media rule (line 1213+) and applies to every has-app-sidebar
   page, not just the capture page. */

/* Page-mode surface — claims the remaining space of main. No
   position:fixed (would paint over the sidebar). No fixed height
   (parent flex distributes vertical space correctly). The
   !important guards override the bottom-sheet overlay preset
   (`.creation-surface { position: fixed; bottom: 0; left: 50%;
   transform: ... }`) still loaded for the FAB-overlay path. */
.creation-surface--page {
  position: relative !important;
  inset: auto !important;
  z-index: auto !important;
  flex: 1 1 auto;
  min-height: 0;
  width: 100% !important; max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  background: var(--bg) !important;
  border: 0 !important; border-radius: 0 !important;
  box-shadow: none !important;
  display: flex !important; flex-direction: column !important;
  transform: none !important;
  pointer-events: auto !important;
  transition: none !important;
  padding: 0 !important;
  padding-top: env(safe-area-inset-top) !important;
  padding-bottom: env(safe-area-inset-bottom) !important;
  overflow: hidden;
}
/* Drop the iOS sheet drag handle in page mode (it's an affordance
   for "you can drag this sheet down" — meaningless full-screen). */
.creation-surface--page::before { display: none !important; }

/* Inner form fills the surface; legacy padding/overflow rules from
   the overlay preset would otherwise double-scroll the body. */
.creation-surface--page form#creation_form {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  padding: 0; overflow: visible;
}

/* Topbar is sticky-at-top so Cancel/Save are always reachable. */
.creation-surface--page .cs-topbar {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  padding: 14px 18px 10px;
  border-bottom: 0.5px solid var(--separator);
}
.creation-surface--page .cs-topbar .cs-cancel,
.creation-surface--page .cs-topbar .cs-save {
  font-size: var(--text-no-zoom); /* iOS WKWebView won't auto-zoom 16px text */
  padding: 8px 4px;
  min-height: 44px;       /* iOS HIG touch target */
  display: inline-flex; align-items: center;
}

/* Content area scrolls; statusbar is sticky-at-bottom. */
.creation-surface--page .cs-content-area {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  padding: 8px 22px 16px;
  -webkit-overflow-scrolling: touch;
}
.creation-surface--page .cs-statusbar {
  position: sticky; bottom: 0; z-index: 2;
  background: var(--bg);
  padding-bottom: max(6px, env(safe-area-inset-bottom));
}

/* ── Wide-screen layout: center a 720px column in the viewport
      so desktop doesn't get a stretched-out form. ──────────── */
@media (min-width: 720px) {
  .creation-surface--page .cs-topbar,
  .creation-surface--page .cs-content-area,
  .creation-surface--page .cs-tpanel,
  .creation-surface--page .cs-statusbar {
    width: 100%;
    max-width: 720px;
    margin-left: auto; margin-right: auto;
  }
  .creation-surface--page .cs-topbar { padding-left: 24px; padding-right: 24px; }
  .creation-surface--page .cs-content-area { padding-left: 28px; padding-right: 28px; }
}

/* ── Mobile-optimized icons & touch targets (≤519px). ──────
   The cs-tbtn icon row needs 44×44 hit areas per iOS HIG.
   The cs-stat segments stay compact but use 13px font (legible
   on iPhone Mini at 320px-CSS width). ───────────────────── */
@media (max-width: 519px) {
  .creation-surface--page .cs-statusbar {
    padding: 8px 6px max(8px, env(safe-area-inset-bottom));
    gap: 4px;
    min-height: 56px;
  }
  .creation-surface--page .cs-statusbar .cs-tbtn {
    width: 44px; height: 44px;       /* iOS HIG min touch */
    border-radius: 9px;
  }
  .creation-surface--page .cs-statusbar .cs-tbtn svg {
    width: 21px; height: 21px;       /* visible at arm's length */
  }
  .creation-surface--page .cs-statusbar .cs-stat {
    padding: 7px 9px;
    min-height: 36px;
  }
  .creation-surface--page .cs-statusbar .cs-stat-ic {
    width: 15px; height: 15px;
  }
  .creation-surface--page .cs-statusbar .cs-stat-v {
    font-size: var(--text-body);  /* readable on iPhone Mini at 320 CSS px */
  }
  /* Title is the focal element on a fresh capture — bigger on phone. */
  .creation-surface--page .cs-title { font-size: 22px; }
  /* Larger tap target for checklist controls */
  .creation-surface--page .cs-cl-item { min-height: 32px; padding: 5px 0; }
  .creation-surface--page .cs-cl-check { width: 20px; height: 20px; }
  .creation-surface--page .cs-cl-del { opacity: 0.6; width: 28px; height: 28px; }
}

/* ── Hotwire Native: shell already provides nav, hide redundant
      web Cancel button (the native "Cancel" lives in the nav bar).
      Tighten the topbar's vertical padding so the lone Save button
      doesn't read as a tall blank strip below the iOS nav bar. The
      stripe stays sticky-at-top so Save is always reachable; once
      bridge--form is wired to creation_form, Save can move into the
      native nav bar and .cs-topbar can be hidden entirely. Both the
      server-rendered `body.is-native` and the bridge-set
      `[data-hotwire-native="true"]` selectors are listed so the rule
      fires regardless of which signal the shell carries. */
body.is-native .creation-surface--page,
[data-hotwire-native="true"] .creation-surface--page {
  padding-top: 0 !important;       /* iOS nav bar already supplies the
                                      safe-area buffer; the surface's
                                      env(safe-area-inset-top) doubles
                                      it and pushes the topbar down. */
}
body.is-native .creation-surface--page .cs-topbar,
[data-hotwire-native="true"] .creation-surface--page .cs-topbar {
  /* Keep web Cancel + Save on native — the iOS back arrow goes BACK
     in history, not "discard this draft," and on a modally-presented
     page there's no back arrow at all. Tighten the strip's vertical
     padding and drop its hairline so it reads as a thin action row
     directly under the iOS nav bar, not a tall blank header. */
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  border-bottom: 0 !important;
}

/* Drag-and-drop visual feedback */
.cs-cl-item--drop-above { box-shadow: inset 0 1.5px 0 var(--accent); }
.cs-cl-item--drop-below { box-shadow: inset 0 -1.5px 0 var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   Hotwire Native — graceful CSS gates per bridge component.

   The hotwire-native-bridge JS sets data-bridge-components on the
   root element listing every component the shell registered (e.g.,
   "form haptic confirm"). Each gate hides a web fallback only when
   the native counterpart is actually shipped — so users on older
   builds of the iOS app never get stranded with no UI.

   Apple Default Maximalism (2026-05-01): DateNav and Variant
   bridges deleted. Date stepping (prev/today/next) and view
   switching (day/week/month) live in the Rails page body now —
   the native nav bar stays clean (just title + gear + search).
   The CSS gates for those bridges are gone; the web ribbon and
   chip-bar are visible everywhere.
   ═══════════════════════════════════════════════════════════════ */
/* (No date-nav / variant gates — those bridges no longer exist.) */

/* ═══════════════════════════════════════════════════════════════════
   Search page — /search (top-right magnifying-glass in iOS shell).
   HTML form on top, results list below. Tokens lifted from the rest
   of the design system so density and tone match brief views.
   ═══════════════════════════════════════════════════════════════════ */
.search-page {
  padding: var(--space-8);
  max-width: 720px;
  margin: 0 auto;
}
.search-form {
  margin-bottom: var(--space-12);
}
.search-input {
  width: 100%;
  padding: 12px 14px;
  font-size: var(--text-body);
  font-family: inherit;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  -webkit-appearance: none;
  appearance: none;
}
.search-input:focus {
  outline: 0;
  border-color: var(--accent);
  background: var(--bg);
}
.search-input::placeholder { color: var(--tertiary); }

.search-empty {
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--secondary);
}
.search-empty__hint {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.5;
}

.search-results__count {
  font-size: var(--text-micro);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tertiary);
  margin: 0 0 var(--space-4);
  padding: 0 var(--space-2);
}
.search-results__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.search-result {
  border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: none; }
.search-result__link {
  display: block;
  padding: var(--space-6) var(--space-2);
  text-decoration: none;
  color: inherit;
}
.search-result__link:hover { background: var(--bg-alt); }
.search-result__title {
  display: block;
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}
.search-result__meta {
  display: block;
  font-size: var(--text-micro);
  color: var(--tertiary);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   iOS safe-area handling inside the Hotwire Native shell.

   UIKit's translucent default nav bar lets the webview content
   extend UNDER the bar. We push content DOWN via padding-top so the
   top of pages renders BELOW the bar — readable, not faded behind
   the bar material.

   env(safe-area-inset-top) returns the safe-area inset at the top
   of the webview's viewport. With a translucent bar (UIKit default)
   that allows content beneath, this includes the bar + status bar
   height (~91pt portrait notched phone, ~32pt landscape compact).

   Bottom: tab bar height + home indicator inset.
   ═══════════════════════════════════════════════════════════════════ */
body.is-native {
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(49px + env(safe-area-inset-bottom));
}

/* ═══════════════════════════════════════════════════════════════════
   iOS auto-zoom prevention — every input/textarea/select needs
   font-size >= 16px or iOS WKWebView auto-zooms in when focused.
   The zoom then persists across Turbo navigations until the user
   pinches out, which feels broken inside an app shell.

   Apply only inside the native shell — on the web, design tokens
   (typically 14px) are correct for desktop where auto-zoom doesn't
   apply. Mobile Safari hits this bug too but is out of scope; if
   we ever care about that surface, drop the body.is-native scope.
   ═══════════════════════════════════════════════════════════════════ */
body.is-native input,
body.is-native textarea,
body.is-native select {
  font-size: var(--text-no-zoom);
}

/* ═══════════════════════════════════════════════════════════════════
   /brief/day — Matas K · pencil + calendar (final).
   One vertical rail spine running top to bottom. Each block (band,
   event, today, backlog row, followup, triage) sits as a row in a
   3-column grid: time/date gutter (left), pin on the rail (middle),
   body content (right). Past items dim to 0.8 opacity. Current band
   pin pulses. Section markers for Backlog / Followups / Triage
   match Morning/Midday/Evening band-rank typography. Long titles
   wrap. Icon buttons for capture (pencil) and plan (calendar);
   grey-pill × for skip / no prep. Scoped to body.brief-mode
   .brief-schedule so /brief/week + month stay flat.
   Mirror of pipeline/prototypes/2026-05-01-brief-day-matas-K-pencil-final.html.
   ═══════════════════════════════════════════════════════════════════ */

/* Drop the inherited Brody inter-section spacing — the rail handles
   visual rhythm now. */
body.brief-mode .brief-schedule .brief-section + .brief-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
body.brief-mode .brief-schedule .brief-section { padding-bottom: 0; margin-top: 0; }

/* The rail spine — single vertical hairline that runs the height of
   the timeline + post-day sections. Positioned in column 2 of every
   block grid (the pin column). */
body.brief-mode .brief-schedule {
  position: relative;
  font-family: var(--font);
}
body.brief-mode .brief-schedule::before {
  content: '';
  position: absolute;
  left: 60px;
  top: 30px; bottom: 30px;
  width: 2px;
  background: linear-gradient(to bottom,
    transparent 0%, var(--border) 4%, var(--border) 96%, transparent 100%);
  pointer-events: none;
}

/* ── Block · the unified row across all section types. 3-col grid:
      [60px when] · [auto pin] · [1fr body] · padding-right:22px gutter.
      The 60px gutter holds short mono labels ("08:00", "20D", "~9H")
      with room to breathe; smaller than 60 makes them rub the rail. ── */
body.brief-mode .brief-schedule .brief-section.sequence-section,
body.brief-mode .brief-schedule .brief-section.brief-block {
  display: grid;
  grid-template-columns: 60px auto 1fr;
  align-items: start;
  padding: 8px 22px 14px 0;
  margin: 0;
  background: transparent;
  position: relative;
}

/* Post-day blocks (slipped / overdue / followup / future): center
   every column on one mid-line so date/time, rail pin, checkbox or
   title, and icon buttons all line up. */
body.brief-mode .brief-schedule .brief-block.is-slipped,
body.brief-mode .brief-schedule .brief-block.is-overdue,
body.brief-mode .brief-schedule .brief-block.is-followup,
body.brief-mode .brief-schedule .brief-block.is-future {
  align-items: center;
}

/* When column · time/date gutter, mono accent. Right-aligned.
   For two-line ranges (08:00 / 13:00) the second line shows in
   tertiary as a quiet "to" line. */
body.brief-mode .brief-schedule .brief-section .when {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-align: right;
  padding: 4px 14px 0 0;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.3;
  align-self: start;
  grid-column: 1;
}
body.brief-mode .brief-schedule .brief-section .when .end {
  color: var(--tertiary);
  display: block;
  font-size: 10px;
}
body.brief-mode .brief-schedule .brief-block.is-past .when {
  color: var(--tertiary);
  opacity: var(--brief-past-fade, 0.8);
}
body.brief-mode .brief-schedule .brief-block.is-allday .when { color: var(--secondary); }
body.brief-mode .brief-schedule .brief-block.is-slipped .when,
body.brief-mode .brief-schedule .brief-block.is-overdue .when,
body.brief-mode .brief-schedule .brief-block.is-followup .when,
body.brief-mode .brief-schedule .brief-block.is-future .when {
  align-self: center;
  padding-top: 0;
}
body.brief-mode .brief-schedule .brief-block.is-overdue .when { color: var(--warn); }
body.brief-mode .brief-schedule .brief-block.is-slipped .when { color: var(--slip-1); }
/* Followups: ~9H reads accent green; the small "ago" qualifier
   inside .end stays tertiary. Same pattern as triage. */
body.brief-mode .brief-schedule .brief-block.is-followup .when { color: var(--accent); }
body.brief-mode .brief-schedule .brief-block.is-followup .when .end { color: var(--tertiary); }
/* Triage: main number ("6D") reads accent green; the small "in"
   qualifier inside .end stays tertiary as a quiet prefix. */
body.brief-mode .brief-schedule .brief-block.is-future .when { color: var(--accent); }
body.brief-mode .brief-schedule .brief-block.is-future .when .end { color: var(--tertiary); }

/* Pin · circle on the rail. 12px filled accent for bands, 12px
   hollow accent for events, smaller hollow for all-day. Slip/overdue
   pins carry the warm signal. NOW pin pulses. */
body.brief-mode .brief-schedule .brief-section .pin {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--tertiary);
  margin-left: -5px;
  margin-top: 6px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  align-self: start;
  grid-column: 2;
}
body.brief-mode .brief-schedule .brief-block.is-band .pin { background: var(--accent); border-color: var(--accent); }
body.brief-mode .brief-schedule .brief-block.is-event .pin { background: var(--bg); border: 2px solid var(--accent); }
body.brief-mode .brief-schedule .brief-block.is-allday .pin { border-color: var(--tertiary); background: var(--bg); }
body.brief-mode .brief-schedule .brief-block.is-past .pin { opacity: var(--brief-past-fade, 0.8); }
body.brief-mode .brief-schedule .brief-block.is-slipped .pin { background: var(--slip-1); border-color: var(--slip-1); }
body.brief-mode .brief-schedule .brief-block.is-overdue .pin { background: var(--warn); border-color: var(--warn); }
body.brief-mode .brief-schedule .brief-block.is-followup .pin { background: var(--bg); border: 1.5px solid var(--accent); }
body.brief-mode .brief-schedule .brief-block.is-future .pin { background: var(--bg); border: 1.5px solid var(--accent); }
body.brief-mode .brief-schedule .brief-block.is-now .pin {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light), 0 0 22px rgba(14,74,46,.7);
  animation: brief-pin-pulse 2s ease-in-out infinite;
}
@keyframes brief-pin-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
body.brief-mode .brief-schedule .brief-block.is-slipped .pin,
body.brief-mode .brief-schedule .brief-block.is-overdue .pin,
body.brief-mode .brief-schedule .brief-block.is-followup .pin,
body.brief-mode .brief-schedule .brief-block.is-future .pin {
  align-self: center;
  margin-top: 0;
}

/* Body · column 3, holds the title and (for bands) the items list. */
body.brief-mode .brief-schedule .brief-section .body {
  min-width: 0;
  padding-left: 16px;
  grid-column: 3;
}
body.brief-mode .brief-schedule .brief-block.is-past .body { opacity: var(--brief-past-fade, 0.8); }

body.brief-mode .brief-schedule .brief-section .body .label {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.1;
}
body.brief-mode .brief-schedule .brief-block.is-event .body .label {
  font-size: 15px; font-weight: 500;
  font-family: var(--font); letter-spacing: 0;
}
body.brief-mode .brief-schedule .brief-block.is-allday .body .label {
  color: var(--secondary); font-weight: 500;
  font-family: var(--font); font-size: 14px; letter-spacing: 0;
}
body.brief-mode .brief-schedule .brief-block.is-slipped .body .label,
body.brief-mode .brief-schedule .brief-block.is-overdue .body .label,
body.brief-mode .brief-schedule .brief-block.is-followup .body .label,
body.brief-mode .brief-schedule .brief-block.is-future .body .label {
  font-family: var(--font); font-size: 15px; font-weight: 500; letter-spacing: 0;
}
body.brief-mode .brief-schedule .brief-section .body .where {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--secondary);
  margin-top: 2px;
}

/* Row inline · title flexes to fill the body column, icon buttons
   stick to the right edge. Long titles wrap. The 600px page cap on
   /brief/day keeps the right-aligned buttons from drifting too far
   from the title. */
body.brief-mode .brief-schedule .row-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}
body.brief-mode .brief-schedule .row-inline .label {
  flex: 1; min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.3;
}

/* Action buttons · grey-pill dismiss × and accent primary. */
body.brief-mode .brief-schedule .acts {
  display: flex; gap: 6px; flex-shrink: 0;
}
body.brief-mode .brief-schedule .acts button,
body.brief-mode .brief-schedule .acts a {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  font: inherit;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 200ms ease, color 200ms ease, transform 220ms cubic-bezier(0.5,1.4,0.4,1);
}
body.brief-mode .brief-schedule .acts button:active,
body.brief-mode .brief-schedule .acts a:active { transform: scale(.88); }
body.brief-mode .brief-schedule .acts .dismiss {
  background: var(--bg-alt);
  color: var(--secondary);
}
body.brief-mode .brief-schedule .acts .dismiss:hover {
  background: var(--border); color: var(--attention);
}
body.brief-mode .brief-schedule .acts .primary {
  background: var(--accent); color: var(--text-inverse);
}
body.brief-mode .brief-schedule .acts .primary:hover { filter: brightness(1.1); }
body.brief-mode .brief-schedule .acts svg {
  width: 16px; height: 16px;
  stroke: currentColor; stroke-width: 1.8; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Section markers · band-rank labels for Backlog / Followups / Triage
   on the rail. Same Oswald 18px / 600 typography as Morning / Midday
   / Evening labels. */
body.brief-mode .brief-schedule .section-marker {
  display: grid;
  grid-template-columns: 60px auto 1fr;
  align-items: start;
  padding: 26px 22px 8px 0;
  position: relative;
}
body.brief-mode .brief-schedule .section-marker .when {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  color: var(--tertiary); text-align: right;
  padding: 6px 14px 0 0;
  letter-spacing: 0.18em; text-transform: uppercase;
  grid-column: 1;
}
body.brief-mode .brief-schedule .section-marker .pin {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: -5px; margin-top: 8px;
  position: relative; z-index: 2;
  flex-shrink: 0;
  grid-column: 2;
  align-self: start;
}
body.brief-mode .brief-schedule .section-marker.is-backlog .pin { background: var(--warn); }
body.brief-mode .brief-schedule .section-marker.is-followups .pin { background: var(--accent); }
body.brief-mode .brief-schedule .section-marker .label {
  padding-left: 16px;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 1.1;
  grid-column: 3;
}
body.brief-mode .brief-schedule .section-marker.is-backlog .label { color: var(--warn); }
body.brief-mode .brief-schedule .section-marker.is-followups .label { color: var(--accent); }

/* Now line · horizontal hairline crossing the rail at current time. */
body.brief-mode .brief-schedule .now-line {
  position: relative;
  height: 0;
  border-top: 1px dashed var(--accent);
  margin: 6px 22px;
  pointer-events: none;
}
body.brief-mode .brief-schedule .now-line::before {
  content: attr(data-now);
  position: absolute;
  top: -10px; left: 0;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  color: var(--accent); background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  border: 0.5px solid var(--accent-light);
}

/* Date hero with inline prev/next chevrons (replaces the bottom ribbon
   on /brief/day so the duplicate date pill in the middle goes away). */
.brief-day-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
}
.brief-day-hero .date-hero { flex: 1; min-width: 0; }
.brief-day-hero__nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}
.brief-day-hero__nav-btn {
  width: 34px; height: 34px;
  border-radius: 17px;
  background: var(--bg-alt);
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, transform 120ms ease;
}
.brief-day-hero__nav-btn:hover { background: var(--border); color: var(--text); }
.brief-day-hero__nav-btn:active { transform: scale(.88); }
.brief-day-hero__chev {
  display: inline-block;
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}
.brief-day-hero__chev--prev { transform: rotate(135deg); margin-left: 3px; }
.brief-day-hero__chev--next { transform: rotate(-45deg); margin-right: 3px; }

/* Hide the bottom ribbon on /brief/day and /brief/week — the chevrons
   live next to the date hero now and the duplicate date/wk in the
   middle is redundant. */
body.brief-mode:has(.brief-schedule) .brief-ribbon,
body.brief-mode:has(.weekly) .brief-ribbon { display: none; }
/* Reclaim the 56px the ribbon reserved + cap the day page to a
   comfortable reading column. The K rail is dense and visual;
   stretching it across a wide desktop viewport makes the buttons
   drift far from titles and the eye has to travel too much. 600px
   keeps the rhythm of phone sizing and centers in any wider
   viewport. */
body.brief-mode:has(.brief-schedule) main {
  padding-bottom: calc(48px + env(safe-area-inset-bottom) + var(--space-12));
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
body.brief-mode:has(.weekly) main {
  padding-bottom: calc(48px + env(safe-area-inset-bottom) + var(--space-12));
}

/* ── Items rendered inside .body · existing row partials still emit
   .row-item > .row > .check + .row__label + .row__meta. Style them
   as K's .item > .dot + .ttl + meta. ── */
body.brief-mode .brief-schedule .body .sequence-rows {
  display: flex; flex-direction: column;
  margin-top: 8px;
  padding: 0;
  background: transparent;
}
body.brief-mode .brief-schedule .body .row-item { background: transparent; }
body.brief-mode .brief-schedule .body .row-item.expanded > .expansion {
  /* Keep the existing reveal animation when a row is tapped open. */
}
body.brief-mode .brief-schedule .body .row {
  display: flex; align-items: center;
  gap: 14px;
  padding: 11px 0;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
body.brief-mode .brief-schedule .body .row:active { background: transparent; }
body.brief-mode .brief-schedule .body .row__label {
  font-family: var(--font);
  font-size: 15px; font-weight: 500;
  color: var(--text);
  letter-spacing: 0;
  line-height: 1.3;
  flex: 1; min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}
body.brief-mode .brief-schedule .body .row__label.is-done {
  color: var(--text-done); text-decoration: line-through; font-weight: 400;
}
body.brief-mode .brief-schedule .body .row__meta {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--attention);
  flex-shrink: 0;
}
body.brief-mode .brief-schedule .body .row__detail {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--secondary);
  padding: 0 0 6px 36px;
  margin-top: -4px;
  letter-spacing: 0;
  line-height: 1.4;
}

/* The .check button — render as K's .dot. 22px circle for binary
   tasks, 22px dashed-square for recurring routines. Fills accent +
   white tick on done. */
body.brief-mode .brief-schedule .body .check {
  width: 22px; height: 22px;
  border: 1.5px solid var(--tertiary);
  border-radius: 50%;
  background: transparent;
  margin: 0;
  flex-shrink: 0;
  position: relative;
  color: transparent;
  transition: background 200ms ease, border-color 200ms ease, transform 220ms cubic-bezier(0.5,1.4,0.4,1);
}
body.brief-mode .brief-schedule .body .check.check--recurring {
  border-style: dashed; border-radius: 5px;
}
body.brief-mode .brief-schedule .body .check::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 9px; height: 4px;
  border-left: 2px solid var(--text-inverse);
  border-bottom: 2px solid var(--text-inverse);
  transform: translate(-50%, -65%) rotate(-45deg) scale(0);
  transition: transform 200ms ease;
  opacity: 1;
}
body.brief-mode .brief-schedule .body .check.is-done {
  background: var(--accent); border-color: var(--accent);
  border-style: solid; border-radius: 50%;
}
body.brief-mode .brief-schedule .body .check.is-done::after {
  transform: translate(-50%, -65%) rotate(-45deg) scale(1);
}
body.brief-mode .brief-schedule .body .check:active { transform: scale(.9); }

/* Measurement input — keep the slim text-field shape, align with row. */
body.brief-mode .brief-schedule .body .measurement-log-form {
  margin-right: 0;
}

/* Resolved followup/triage row — tertiary + small undo. */
body.brief-mode .brief-schedule .brief-block.is-resolved .body .label {
  color: var(--tertiary);
}

/* Backlog row's overdue badge is redundant with the .when column.
   Hide the entire .row__meta on slipped/overdue/cold blocks — even
   empty .row__meta has flex layout + max-width: 50% which reserves
   space and forces titles to wrap prematurely. Slipped sessions
   no longer carry a separate slot-time meta either, so killing
   the whole meta is safe. */
body.brief-mode .brief-schedule .brief-block.is-slipped .row__meta,
body.brief-mode .brief-schedule .brief-block.is-overdue .row__meta {
  display: none;
}

/* Tighten backlog row spacing so it matches followups. Inside a
   band, .row-item lives inside .sequence-rows and the 11px top/
   bottom padding gives breathing room between adjacent routines.
   Inside a backlog block the .row-item is a direct child of .body
   — there's only one .row per block, so the inner padding stacks
   on top of the .brief-block's own 8+14px vertical padding and
   makes backlog rows visibly taller than followup/triage rows.
   Zero the inner padding when the .row-item is the body's direct
   child. */
body.brief-mode .brief-schedule .brief-block .body > .row-item > .row {
  padding: 0;
}

/* Slip-recommit / cold-actions buttons keep K's compact pill style. */
body.brief-mode .brief-schedule .slip-actions {
  background: transparent;
  border-top: 0.5px solid var(--border);
  margin-top: 8px;
  padding: 10px 0 0;
}
body.brief-mode .brief-schedule .slip-actions__buttons { gap: 6px; }
body.brief-mode .brief-schedule .slip-actions .btn {
  flex: 1;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px; font-weight: 600;
  color: var(--text);
}
body.brief-mode .brief-schedule .slip-actions .btn-primary {
  background: var(--accent); color: var(--text-inverse); border-color: var(--accent);
}
body.brief-mode .brief-schedule .slip-actions .btn-danger { color: var(--attention); }
body.brief-mode .brief-schedule .cold-actions {
  padding: 10px 0 0;
  border-top: 0.5px solid var(--border);
  margin-top: 8px;
}

/* Edit-mode bits (sequence rename / retime) — keep the visible
   affordances unobtrusive on the rail. */
body.brief-mode .brief-schedule .seq-edit-icon {
  margin-left: 8px;
  align-self: center;
}
