/* HUD shell styles on the household brand tokens (public/brand/tokens.css), remapped by public/hud.css to the crisp
   HUD look (docs/design/hud/README.md): hairline lists, one solid accent action per view, status always a word. Phone first: bottom bar under 640 px,
   left rail from 640 px, three-column-ready HUD from 1100 px. 44 px tap targets; status never by color alone. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: var(--lh-body); }
h1, h2, h3 { font-family: var(--display); line-height: var(--lh-tight); margin: 0 0 var(--space-2); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
a { color: var(--accent); }
p { margin: 0 0 var(--space-3); }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.good { color: var(--ok); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.boot { padding: 2rem; color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* layout */
#app { min-height: 100dvh; display: grid; grid-template-rows: auto auto 1fr auto; grid-template-areas: "top" "banner" "main" "nav"; }
.top { grid-area: top; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); padding-top: max(var(--space-3), env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: baseline; gap: var(--space-2); text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { font-family: var(--display); font-weight: 800; letter-spacing: .08em; color: var(--ink); }
.brand-mark.big { font-size: 1.4rem; }
.brand-home { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-btn { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--hud-radius-sm, 10px); background: var(--panel); color: var(--muted); font: inherit; cursor: pointer; }
.search-hint { display: none; }
.banner { grid-area: banner; padding: var(--space-2) var(--space-4); background: var(--warn-soft); color: var(--warn); font-size: .9rem; }
.view { grid-area: main; padding: var(--space-4); padding-bottom: 7rem; max-width: 1280px; width: 100%; margin: 0 auto; outline: none; }
.rail { grid-area: nav; position: sticky; bottom: 0; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.nav-btn { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--space-2) var(--space-1); min-height: 56px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; }
.nav-btn[aria-current="page"] { color: var(--accent); }
.nav-icon { display: grid; place-items: center; width: 2.4rem; height: 1.8rem; border-radius: var(--r-pill); font-size: 1.1rem; }
.settings-link { display: none; }
.badge { position: absolute; top: 4px; right: calc(50% - 1.5rem); min-width: 1.2rem; height: 1.2rem; padding: 0 4px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: .7rem; display: grid; place-items: center; }
.capture-fab { position: fixed; right: var(--space-4); bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 6; display: flex; align-items: center; gap: var(--space-2); min-height: 56px; padding: 0 var(--space-5); border: 0; border-radius: 18px; background: var(--ink); color: var(--bg); font: inherit; font-weight: 700; font-size: 1rem; box-shadow: var(--hud-float, 0 6px 18px rgb(0 0 0 / .18)); cursor: pointer; }
.capture-fab span:first-child { font-size: 1.5rem; line-height: 1; }

@media (min-width: 640px) {
  #app { grid-template-columns: 96px 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "top top" "banner banner" "nav main"; }
  .rail { position: sticky; top: 61px; align-self: start; height: calc(100dvh - 61px); flex-direction: column; justify-content: flex-start; gap: var(--space-2); border-top: 0; border-right: 1px solid var(--line); padding: var(--space-3) 0; }
  .nav-btn { flex: 0; }
  .settings-link { display: flex; margin-top: auto; }
  .search-hint { display: inline; }
  .capture-fab { bottom: var(--space-6); right: var(--space-6); }
  .view { padding: var(--space-6); }
}

/* the HUD */
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.hud-title { font-size: 1.875rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.hud-grid { display: grid; gap: var(--space-5); }
@media (min-width: 1100px) { .hud-grid { grid-template-columns: 3fr 2fr; } }
.hud-section { margin-bottom: var(--space-5); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.hud-section h2, .view section > h2 { font-family: var(--sans); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-2); }
.cards { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--hud-radius, 14px); overflow: hidden; }
.card { display: flex; align-items: center; gap: var(--space-3); padding: 14px; background: var(--surface); border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; cursor: pointer; }
.cards > .card:first-child { border-top: 0; }
.card:not(.cards > .card) { border: 1px solid var(--line); border-radius: var(--hud-radius, 14px); }
.card:hover { background: var(--panel); }
.card-main { flex: 1; min-width: 0; }
.card-title { margin: 4px 0 0; font-family: var(--sans); font-weight: 600; font-size: 1rem; letter-spacing: -.005em; }
.card-meta { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.job-card, .doc-card { flex-direction: column; align-items: flex-start; gap: 2px; }
.summary-card { flex-direction: column; align-items: flex-start; }
/* Status chips: the word carries the meaning; color only ranks it. Late is solid accent, due today or waiting on you
   is an accent outline, done is ink, everything else is neutral. A stopped job is the one danger color. */
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; font-size: .75rem; font-weight: 700; white-space: nowrap; background: var(--hud-neutral, var(--panel)); color: var(--ink); }
.chip.st-late { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.st-due, .chip.job-needs_approval, .chip.job-needs_answers, .chip.job-ready { background: transparent; border-color: var(--accent); color: var(--accent); }
.chip.st-done, .chip.st-waived, .chip.job-done { background: var(--ink); color: var(--bg); }
.chip.st-snoozed, .chip.st-handed_off, .chip.job-working, .chip.job-planning { background: var(--hud-neutral, var(--panel)); color: var(--muted); }
.chip.job-failed { background: var(--danger-soft); color: var(--danger); }
.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); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 0 14px 16px; border-left: 1px solid var(--line); }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat-num { font-family: var(--sans); font-weight: 600; font-size: 1.4rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat.good .stat-num { color: var(--gold-ink); }
.empty { padding: var(--space-5) var(--space-4); text-align: left; background: var(--panel); border-radius: var(--hud-radius, 14px); margin-bottom: var(--space-4); }
.empty-title { font-family: var(--sans); font-weight: 600; font-size: 1.05rem; margin-bottom: var(--space-2); }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-4); border-radius: var(--hud-radius-sm, 10px); border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.small { min-height: 44px; padding: 0 var(--space-3); font-size: .875rem; }
.btn.big { min-height: 56px; padding: 0 var(--space-6); font-size: 1.1rem; }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn { display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--ink); font-size: 1.2rem; text-decoration: none; border-radius: 50%; cursor: pointer; }
.icon-btn:hover { background: var(--hud-neutral, var(--panel)); }
.link { display: inline-block; margin-bottom: var(--space-3); }
.row { display: flex; gap: var(--space-2); align-items: center; margin: var(--space-2) 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.form { display: grid; gap: var(--space-3); }
.field { display: grid; gap: 4px; }
.label { font-weight: 650; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 10px 12px; min-height: 44px; width: 100%; }
.row input, .row select { width: auto; flex: 1; min-width: 8rem; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex: none; margin-top: 2px; }
.check { display: flex; gap: var(--space-3); align-items: flex-start; }
.notice { padding: var(--space-3) var(--space-4); background: var(--accent-soft); border-radius: var(--r-md); margin: var(--space-3) 0; }
.lead { font-size: 1.05rem; }
.pre { white-space: pre-wrap; background: var(--panel); padding: var(--space-3); border-radius: var(--r-sm); }
.recovery { font-family: var(--mono); font-size: 1.15rem; letter-spacing: .04em; word-break: break-all; background: var(--gold-soft); padding: var(--space-3); border-radius: var(--r-sm); }
.recovery.small { font-size: .85rem; }
details.more { margin: var(--space-3) 0; }
details.more > summary { cursor: pointer; font-weight: 650; min-height: 36px; display: flex; align-items: center; }
.tabs { display: flex; gap: var(--space-5); margin-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; min-height: 44px; border-bottom: 2px solid transparent; text-decoration: none; color: var(--muted); font-weight: 600; }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }
.page-head { margin-bottom: var(--space-4); }

/* sheets and toasts */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: var(--hud-scrim, rgb(0 0 0 / .35)); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 92dvh; overflow: auto; background: var(--bg); border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); background: var(--bg); border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; }
.sheet-body { padding: var(--space-4); }
@media (min-width: 640px) {
  .sheet-wrap { justify-content: flex-end; align-items: stretch; }
  .sheet { width: min(480px, 100%); max-height: none; height: 100dvh; border-radius: 0; }
  .sheet.wide { width: min(720px, 100%); }
}
.toasts { position: fixed; left: 50%; bottom: calc(140px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; display: grid; gap: var(--space-2); width: min(92vw, 420px); }
.toast { padding: var(--space-3) var(--space-4); background: var(--ink); color: var(--bg); border-radius: var(--hud-radius, 14px); font-weight: 600; box-shadow: var(--hud-float, 0 6px 18px rgb(0 0 0 / .2)); }
.toast.error { background: var(--danger); color: var(--on-danger); }

/* item, capture, proposals */
.item-head { margin-bottom: var(--space-3); }
.item-title { font-size: 1.3rem; margin-top: var(--space-2); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--space-4); margin: 0 0 var(--space-3); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-3) 0; }
.link-list, .history, .people, .result-list, .money-list, .checklist, .decided { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.people li, .money-list li { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.money-list li { justify-content: space-between; }
.result-list a { display: flex; gap: var(--space-2); padding: var(--space-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--hud-radius-sm, 10px); text-decoration: none; color: var(--ink); }
.capture-big { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-4); }
.big-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--space-5) var(--space-3); border: 1px solid var(--line); border-radius: var(--hud-radius, 14px); background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; text-align: center; }
.big-icon { font-size: 1.8rem; color: var(--accent); }
.preview { max-width: 100%; max-height: 50vh; border-radius: var(--r-md); border: 1px solid var(--line); display: block; margin: 0 auto; }
.reading { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-6) 0; text-align: center; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.checklist li { padding: var(--space-3); background: var(--panel); border-radius: var(--r-sm); }
.decided li { color: var(--muted); }
.decided .p-failed { color: var(--danger); }
.draft { flex-direction: column; align-items: stretch; }
.focus { min-height: 60dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-3); }
.focus-title { font-size: 2rem; max-width: 30ch; }
.search-input { font-size: 1.1rem; margin-bottom: var(--space-4); }
.settings { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.shelf { margin-top: var(--space-4); }
.app-frame { width: 100%; min-height: 70dvh; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }

/* onboarding */
.onboard { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-4); grid-column: 1 / -1; grid-row: 1 / -1; }
.onboard-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: var(--space-6); }
