/*
  HUD: the crisp look for the HUD redesign (docs/design/hud/README.md). Load it after /brand/tokens.css and
  before /app.css (public/index.html).

  Turn it on with data-ui="hud" on <html>. It then:
  - remaps the brand tokens to a cleaner palette (white base, cool hairlines, near-black ink), so the shell's
    own styles in app.css pick it up too;
  - pins the accent to garnet in every app (HUD has one accent, not a jewel per app);
  - adds the HUD pieces below, all prefixed hud-. app.css also has hud-grid; keep new names clear of it.

  Rules the pieces assume:
  - One solid accent action per view (.hud-btn--primary). Everything else is outline or quiet.
  - Status is always a word (Late, Today, Mon). Color never carries it alone.
  - Lists over card stacks: .hud-list with hairline rows, no shadows.
  - Fonts come from the brand: Inter Tight for titles, Figtree for everything else. No monospace in HUD;
    numbers use tabular figures (.hud-num).
  - Every control is at least 44px tall (--hud-tap).

  Light and dark follow the device setting, or data-theme on <html> when it is set.
*/

/* ---------- Tokens ---------- */
:root[data-ui=hud],
:root[data-ui=hud][data-theme=light]{
  --bg:#FFFFFF; --surface:#FFFFFF; --panel:#F7F7F5;
  --line:#E7E7E3; --line-strong:#C9C9C4;
  --ink:#141414; --muted:#6A6A6F; --faint:#A3A3A8;
  --brand:#7A1B36; --hero:#141414; --hero-ink:#FFFFFF; --hero-muted:#C9C9C4;
  --gold:#B88A2E; --gold-ink:#7A5A12; --gold-soft:#FAF3E2;
  --hud-neutral:#F1F1EE; --hud-scrim:rgba(20,20,20,.45);
  --hud-float:0 6px 20px rgba(0,0,0,.16);
}
:root[data-ui=hud][data-theme=dark]{
  --bg:#0F0F10; --surface:#161618; --panel:#18181A;
  --line:#2A2A2D; --line-strong:#45454A;
  --ink:#F2F2F2; --muted:#A1A1A7; --faint:#6E6E74;
  --brand:#E59AAE; --hero:#F2F2F2; --hero-ink:#0F0F10; --hero-muted:#45454A;
  --gold:#E0B75E; --gold-ink:#E9C77A; --gold-soft:#2A2416;
  --hud-neutral:#232325; --hud-scrim:rgba(0,0,0,.6);
  --hud-float:0 6px 20px rgba(0,0,0,.5);
}
@media (prefers-color-scheme: dark){
  :root[data-ui=hud]:not([data-theme]){
    --bg:#0F0F10; --surface:#161618; --panel:#18181A;
    --line:#2A2A2D; --line-strong:#45454A;
    --ink:#F2F2F2; --muted:#A1A1A7; --faint:#6E6E74;
    --brand:#E59AAE; --hero:#F2F2F2; --hero-ink:#0F0F10; --hero-muted:#45454A;
    --gold:#E0B75E; --gold-ink:#E9C77A; --gold-soft:#2A2416;
    --hud-neutral:#232325; --hud-scrim:rgba(0,0,0,.6);
    --hud-float:0 6px 20px rgba(0,0,0,.5);
  }
}

/* One accent: garnet, whatever data-accent an app sets. */
:root[data-ui=hud],
:root[data-ui=hud][data-accent]{
  --accent:#7A1B36; --on-accent:#FFFFFF; --accent-soft:#F8EEF1; --accent-soft-ink:#7A1B36;
}
:root[data-ui=hud][data-theme=dark],
:root[data-ui=hud][data-theme=dark][data-accent]{
  --accent:#E59AAE; --on-accent:#2A0E17; --accent-soft:#2A1A1F; --accent-soft-ink:#F0B5C4;
}
@media (prefers-color-scheme: dark){
  :root[data-ui=hud]:not([data-theme]),
  :root[data-ui=hud]:not([data-theme])[data-accent]{
    --accent:#E59AAE; --on-accent:#2A0E17; --accent-soft:#2A1A1F; --accent-soft-ink:#F0B5C4;
  }
}

:root[data-ui=hud]{
  --hud-tap:44px;
  --hud-radius:14px;
  --hud-radius-sm:10px;
  --hud-gap:20px;
  --hud-pad:16px;
  --hud-display:"Inter Tight",Figtree,system-ui,-apple-system,"Segoe UI",sans-serif;
  --hud-sans:Figtree,"Segoe UI Variable Text","Segoe UI",system-ui,-apple-system,sans-serif;
}

/* ---------- Base ---------- */
[data-ui=hud] body{
  background:var(--bg); color:var(--ink);
  font-family:var(--hud-sans); -webkit-font-smoothing:antialiased;
}
[data-ui=hud] :focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

.hud-num{ font-variant-numeric:tabular-nums; font-weight:600; letter-spacing:-.01em; }
.hud-num--back{ color:var(--gold-ink); }
.hud-muted{ color:var(--muted); }

/* ---------- Top bar and page intro ---------- */
.hud-bar{ display:flex; align-items:center; gap:4px; height:56px; padding:8px 12px 0 20px; box-sizing:border-box; }
.hud-logo{ font-family:var(--hud-display); font-weight:800; font-size:17px; letter-spacing:.08em; margin-right:auto; }
.hud-iconbtn{
  width:var(--hud-tap); height:var(--hud-tap); border-radius:50%; border:0; padding:0;
  background:transparent; color:var(--ink); display:inline-flex; align-items:center; justify-content:center; cursor:pointer;
}
.hud-iconbtn:hover{ background:var(--hud-neutral); }
.hud-avatar{
  width:30px; height:30px; border-radius:50%; background:var(--hud-neutral); color:var(--ink);
  display:inline-flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex:none;
}
.hud-avatar--sm{ width:20px; height:20px; font-size:10px; }

.hud-intro{ display:flex; flex-direction:column; gap:6px; padding:8px 20px 4px; }
.hud-eyebrow{ font-size:13px; font-weight:600; color:var(--muted); margin:0; }
.hud-headline{ margin:0; font-family:var(--hud-display); font-weight:700; font-size:30px; line-height:1.1; letter-spacing:-.02em; }
.hud-headline--xl{ font-size:36px; }
.hud-sub{ margin:0; font-size:15px; line-height:1.45; color:var(--muted); }
.hud-stats-inline{ display:flex; gap:16px; font-size:13px; color:var(--muted); }

.hud-body{ display:flex; flex-direction:column; gap:var(--hud-gap); padding:var(--hud-pad) var(--hud-pad) 0; }
.hud-group{ display:flex; flex-direction:column; gap:8px; }
.hud-label{ font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); margin:0; }
.hud-label--accent{ color:var(--accent); }
.hud-group-head{ display:flex; align-items:center; gap:8px; }
.hud-group-head > .hud-label{ margin-right:auto; }

/* ---------- Lists ---------- */
.hud-list{ border:1px solid var(--line); border-radius:var(--hud-radius); overflow:hidden; background:var(--surface); margin:0; padding:0; list-style:none; }
.hud-item{ display:flex; align-items:center; gap:12px; padding:14px; border-top:1px solid var(--line); }
.hud-item:first-child{ border-top:0; }
.hud-item--focus{ background:var(--panel); }
.hud-item-main{ display:flex; flex-direction:column; gap:5px; flex:1; min-width:0; }
.hud-item-tags{ display:flex; align-items:center; gap:8px; }
.hud-item-title{ font-size:16px; font-weight:600; letter-spacing:-.005em; margin:0; }
.hud-item-meta{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); }
.hud-item-meta .hud-num{ color:var(--ink); }

.hud-link{
  display:flex; align-items:center; gap:12px; min-height:52px; padding:0 14px;
  border-top:1px solid var(--line); color:var(--ink); text-decoration:none; font-size:15px;
}
.hud-link:first-child{ border-top:0; }
.hud-link:hover{ background:var(--panel); }
.hud-link > .hud-link-text{ margin-right:auto; display:flex; flex-direction:column; gap:2px; }
.hud-chev{ color:var(--muted); font-size:18px; line-height:1; }
.hud-chev::before{ content:"\203A"; }
.hud-dot{ width:6px; height:6px; border-radius:50%; background:var(--accent); flex:none; }
.hud-dot--idle{ background:transparent; border:1px solid var(--muted); box-sizing:border-box; }

/* Simple ruled rows: Coming up, form summaries. */
.hud-rows{ border-top:1px solid var(--line); }
.hud-row{ display:flex; align-items:center; gap:12px; min-height:44px; border-bottom:1px solid var(--line); font-size:15px; }
.hud-row-key{ width:56px; flex:none; font-size:13px; }
.hud-row-label{ width:96px; flex:none; font-size:13px; color:var(--muted); }
.hud-row > .hud-row-value{ margin-right:auto; font-weight:600; }

/* ---------- Status chips and source ---------- */
.hud-chip{
  display:inline-flex; align-items:center; gap:4px; height:22px; padding:0 8px; box-sizing:border-box;
  border-radius:6px; font-size:12px; font-weight:700; white-space:nowrap;
}
.hud-chip--late{ background:var(--accent); color:var(--on-accent); }
.hud-chip--today{ border:1px solid var(--accent); color:var(--accent); }
.hud-chip--soon{ background:var(--hud-neutral); color:var(--ink); }
.hud-chip--done{ background:var(--ink); color:var(--bg); }
.hud-chip--outline{ border:1px solid var(--line); color:var(--ink); font-weight:600; }
.hud-chip--was{ text-decoration:line-through; }
.hud-src{ font-size:12px; font-weight:600; color:var(--muted); }

/* ---------- Buttons ---------- */
.hud-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px; flex:none;
  height:var(--hud-tap); padding:0 16px; box-sizing:border-box;
  border:1px solid var(--line); border-radius:var(--hud-radius-sm); background:var(--bg); color:var(--ink);
  font:inherit; font-size:14px; font-weight:600; white-space:nowrap; text-decoration:none; cursor:pointer;
}
.hud-btn:hover{ border-color:var(--line-strong); }
.hud-btn--primary{ background:var(--accent); border-color:var(--accent); color:var(--on-accent); }
.hud-btn--primary:hover{ filter:brightness(1.08); border-color:var(--accent); }
.hud-btn--quiet{ background:transparent; border-color:transparent; color:var(--accent); padding:0 8px; }
.hud-btn--quiet:hover{ background:var(--accent-soft); border-color:transparent; }
.hud-btn--muted{ color:var(--muted); }
.hud-btn--block{ width:100%; height:52px; font-size:16px; }
.hud-btn--sm{ height:36px; font-size:13px; padding:0 12px; }
.hud-btn--icon{ width:var(--hud-tap); padding:0; }
.hud-btn--dashed{ border-style:dashed; justify-content:flex-start; }
.hud-btn:disabled{ opacity:.45; cursor:not-allowed; }

/* Three verbs under an item: Done, Snooze, Hand off. */
.hud-verbs{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }

/* Two choices side by side (Make a plan / Focus on one). The first is the solid one. */
.hud-choices{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.hud-choice{
  display:flex; flex-direction:column; align-items:flex-start; gap:6px; text-align:left; padding:14px;
  border-radius:var(--hud-radius); border:1px solid var(--line); background:var(--bg); color:var(--ink); font:inherit; cursor:pointer;
}
.hud-choice-title{ font-size:15px; font-weight:700; }
.hud-choice-text{ font-size:13px; line-height:1.35; color:var(--muted); }
.hud-choice--primary{ background:var(--accent); border-color:var(--accent); color:var(--on-accent); }
.hud-choice--primary .hud-choice-text{ color:inherit; opacity:.92; }

/* Selectable pills (welcome: what do you pay): <button class="hud-btn" aria-pressed="true|false"> in a .hud-pills row. */
.hud-pills{ display:flex; flex-wrap:wrap; gap:8px; }
.hud-pills .hud-btn[aria-pressed=true]{ background:var(--ink); border-color:var(--ink); color:var(--bg); }
.hud-pills .hud-btn[aria-pressed=true]::before{ content:"\2713"; margin-right:2px; }

/* ---------- Checkboxes and radios (proposals) ---------- */
.hud-check{ display:flex; align-items:flex-start; gap:12px; cursor:pointer; }
.hud-check input{ position:absolute; opacity:0; pointer-events:none; }
.hud-check-box{
  width:22px; height:22px; flex:none; margin-top:1px; box-sizing:border-box;
  border:1.5px solid var(--line-strong); border-radius:6px; display:inline-flex; align-items:center; justify-content:center; color:var(--on-accent);
}
.hud-check input:checked + .hud-check-box{ background:var(--accent); border-color:var(--accent); }
.hud-check input:checked + .hud-check-box::after{ content:""; width:10px; height:5px; border:2.5px solid currentColor; border-top:0; border-right:0; transform:translateY(-2px) rotate(-45deg); }
.hud-check input:focus-visible + .hud-check-box{ outline:2px solid var(--accent); outline-offset:2px; }
.hud-check input:not(:checked) ~ .hud-check-text .hud-item-title{ color:var(--muted); }
.hud-check-text{ display:flex; flex-direction:column; gap:3px; }
.hud-source{ font-size:12px; color:var(--muted); text-decoration:underline; }

.hud-radio-box{ width:20px; height:20px; flex:none; box-sizing:border-box; border:1.5px solid var(--line-strong); border-radius:50%; margin-top:1px; }
.hud-check input[type=radio]:checked + .hud-radio-box{ border:6px solid var(--accent); }

/* ---------- Tabs ---------- */
.hud-tabs{ display:flex; gap:24px; border-bottom:1px solid var(--line); }
.hud-tab{
  height:var(--hud-tap); padding:0; border:0; border-bottom:2px solid transparent; background:none;
  font:inherit; font-size:14px; font-weight:600; color:var(--muted); cursor:pointer;
}
.hud-tab[aria-selected=true]{ color:var(--ink); font-weight:700; border-bottom-color:var(--ink); }

/* Segmented control: same data, different input (Capture: Type, Photo, File, Voice). */
.hud-seg{ display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); padding:3px; border-radius:12px; background:var(--hud-neutral); }
.hud-seg-btn{ height:38px; border:0; border-radius:9px; background:none; font:inherit; font-size:13px; font-weight:600; color:var(--muted); cursor:pointer; }
.hud-seg-btn[aria-selected=true]{ background:var(--bg); color:var(--ink); font-weight:700; box-shadow:0 1px 2px rgba(0,0,0,.08); }

/* Welcome progress: one bar per step. */
.hud-steps{ display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:6px; }
.hud-step{ height:3px; border-radius:2px; background:var(--line); }
.hud-step--done{ background:var(--accent); }

/* ---------- Stats ---------- */
.hud-stats{ display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.hud-stat{ display:flex; flex-direction:column; gap:2px; padding:14px 0 14px 16px; border-left:1px solid var(--line); }
.hud-stat:first-child{ padding-left:0; border-left:0; }
.hud-stat-value{ font-size:22px; font-variant-numeric:tabular-nums; font-weight:600; }
.hud-stat-label{ font-size:13px; color:var(--muted); }

/* A quiet block for a single prompt (Finish your briefing). */
.hud-callout{ display:flex; flex-direction:column; gap:10px; padding:16px; border-radius:var(--hud-radius); background:var(--panel); }

/* A quoted draft (Get a fee back). */
.hud-draft{ border-left:2px solid var(--accent); padding:4px 0 4px 14px; font-size:16px; line-height:1.55; margin:0; }

/* ---------- Sheets, toast, capture button ---------- */
.hud-scrim{ position:fixed; inset:0; background:var(--hud-scrim); }
.hud-sheet{
  position:fixed; left:0; right:0; bottom:0; max-height:calc(100% - 36px); overflow:auto;
  background:var(--bg); border-radius:20px 20px 0 0; padding:8px 20px 28px; box-sizing:border-box;
  display:flex; flex-direction:column; gap:18px;
}
.hud-grab{ width:36px; height:4px; border-radius:2px; background:var(--line); align-self:center; }

.hud-toast{
  display:flex; align-items:center; gap:12px; min-height:56px; padding:8px 6px 8px 16px; box-sizing:border-box;
  border-radius:var(--hud-radius); background:var(--ink); color:var(--bg); box-shadow:var(--hud-float);
}
.hud-toast-text{ display:flex; flex-direction:column; gap:1px; margin-right:auto; font-size:14px; font-weight:600; }
.hud-toast-text small{ font-size:12px; font-weight:400; opacity:.7; }
.hud-toast-action{ min-height:var(--hud-tap); padding:0 10px; border:0; background:none; color:inherit; font:inherit; font-size:14px; font-weight:700; text-decoration:underline; cursor:pointer; }

.hud-fab{
  position:fixed; right:20px; bottom:96px; width:56px; height:56px; border-radius:18px; border:0;
  background:var(--ink); color:var(--bg); display:flex; align-items:center; justify-content:center;
  box-shadow:var(--hud-float); cursor:pointer;
}

/* ---------- Phone tab bar ---------- */
.hud-nav{
  position:fixed; left:0; right:0; bottom:0; height:78px; box-sizing:border-box; padding:0 4px 14px;
  display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr);
  background:var(--bg); border-top:1px solid var(--line);
}
.hud-nav-item{
  position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  border:0; background:none; padding:0; font:inherit; font-size:11px; font-weight:600; color:var(--muted); text-decoration:none; cursor:pointer;
}
.hud-nav-item[aria-current=page]{ color:var(--accent); }
.hud-nav-badge{ position:absolute; top:12px; right:calc(50% - 18px); width:8px; height:8px; border-radius:50%; background:var(--accent); }

/* ---------- Desktop rail ---------- */
.hud-rail{ display:flex; flex-direction:column; gap:2px; padding:20px 12px; border-right:1px solid var(--line); box-sizing:border-box; }
.hud-rail-item{ display:flex; align-items:center; gap:10px; height:40px; padding:0 12px; border-radius:8px; color:var(--muted); text-decoration:none; font-size:14px; font-weight:500; }
.hud-rail-item:hover{ background:var(--panel); color:var(--ink); }
.hud-rail-item[aria-current=page]{ background:var(--hud-neutral); color:var(--ink); font-weight:600; }

/* Only the compact (phone) layout uses the tab bar and floating Capture button. */
@media (min-width:1100px){
  .hud-nav, .hud-fab{ display:none; }
}
@media (prefers-reduced-motion: reduce){
  [data-ui=hud] *{ transition:none !important; animation:none !important; }
}
