/* HUB v2 shell — design-spec.md §3 tokens. Dark only. Touch-first (tap >= 48px). */
:root {
  --bg: #0a0a0c; --surface: #131318; --surface-2: #1b1c22; --hairline: #262832;
  --text: #f4f5f7; --text-dim: #9aa0ab; --text-faint: #626775;
  --azure: #17b1ff; --azure-dim: #0d6a99; --attention: #ffd000; --positive: #00c853; --danger: #ff4d4d;
  --glow-azure: 0 0 40px rgba(23,177,255,.18);
  --display: 'Bebas Neue', 'Oswald', 'Arial Narrow', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --body: 'Inter', -apple-system, system-ui, sans-serif;
  --t-hero: clamp(38px, 12vw, 52px); --t-title: 22px; --t-body: 16px; --t-meta: 13px; --t-kicker: 11px;
  --r-card: 16px; --r-chip: 999px; --pad: 20px; --gap: 12px; --tap-min: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-top: env(safe-area-inset-top, 0px);
  --rail-w: 92px; --bar-h: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 400 var(--t-body)/1.45 var(--body); }
body { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden, [hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.kicker { font: 500 var(--t-kicker)/1.2 var(--mono); text-transform: uppercase; letter-spacing: .18em; color: var(--text-faint); }
.meta { font: 400 var(--t-meta)/1.3 var(--mono); color: var(--text-dim); }
.dim { color: var(--text-dim); } .faint { color: var(--text-faint); }
.err { color: var(--danger); font: 400 var(--t-meta)/1.3 var(--mono); min-height: 18px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- gate ---- */
#gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--pad); }
.gate-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--gap); }
.gate-card h1 { font: 400 40px/1 var(--display); letter-spacing: .02em; margin: 4px 0 8px; }
input, textarea, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px; min-height: var(--tap-min); width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--azure); }
.btn { min-height: var(--tap-min); padding: 0 20px; border-radius: 12px; border: 1px solid var(--azure); background: var(--azure); color: #04121a; font-weight: 600; transition: background 160ms ease-out; }
.btn:active { background: var(--azure-dim); }
.btn.outline { background: transparent; color: var(--azure); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn[disabled] { opacity: .45; }

/* ---- shell layout ---- */
#shell { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto 1fr auto; grid-template-columns: 1fr; }
#topbar { display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 10px) var(--pad) 6px; }
#topbar h2 { font: 400 var(--t-title)/1 var(--display); letter-spacing: .08em; margin: 0; flex: 1; }
#dev-btn { min-width: var(--tap-min); min-height: var(--tap-min); background: none; border: 0; color: var(--text-dim); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); display: inline-block; }
.dot.ok { background: var(--azure); box-shadow: var(--glow-azure); } .dot.down { background: var(--danger); }
#substrip { display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--pad) 10px; scrollbar-width: none; }
#substrip::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: var(--r-chip); background: var(--surface); border: 1px solid var(--hairline); color: var(--text-dim); font: 500 var(--t-meta)/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; display: inline-flex; align-items: center; gap: 8px; }
.chip.active { color: var(--azure); border-color: var(--azure); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--azure); color: #04121a; font: 600 11px/18px var(--mono); text-align: center; display: inline-block; }
.badge.zero { display: none; }
#stage { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px var(--pad) 24px; }
#content { display: block; }
#capture-host { padding: 0 0 8px; }

/* nav: bottom bar (phone) */
#nav { display: flex; overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; background: var(--surface); border-top: 1px solid var(--hairline); padding-bottom: var(--safe-bottom); scrollbar-width: none; }
#nav::-webkit-scrollbar { display: none; }
#nav button { flex: 1 0 auto; min-width: 64px; padding: 0 8px; white-space: nowrap; scroll-snap-align: center; min-height: var(--bar-h); background: none; border: 0; color: var(--text-faint); font: 500 10px/1.1 var(--mono); letter-spacing: .1em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative; }
#nav button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#nav button.active { color: var(--azure); box-shadow: inset 0 2px 0 var(--azure); }
#nav .badge { position: absolute; top: 6px; right: calc(50% - 26px); }

/* iPad >= 768: left rail + two columns */
@media (min-width: 768px) {
  #shell { grid-template-columns: var(--rail-w) 1fr; grid-template-rows: auto auto 1fr; }
  #nav { grid-row: 1 / 4; grid-column: 1; flex-direction: column; border-top: 0; border-right: 1px solid var(--hairline); padding: calc(var(--safe-top) + 8px) 0 8px; overflow-y: auto; }
  #nav button { flex: none; min-height: 68px; }
  #nav button.active { box-shadow: inset 2px 0 0 var(--azure); }
  #nav .badge { right: 18px; }
  #topbar, #substrip, #stage { grid-column: 2; }
  .two-col { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: var(--gap); align-items: start; }
  .two-col > .list-col, .two-col > .detail-col { max-height: calc(100vh - 170px); overflow-y: auto; }
  .detail-back { display: none; }
}
@media (max-width: 767px) {
  .two-col.has-detail > .list-col { display: none; }
  .two-col:not(.has-detail) > .detail-col { display: none; }
}

/* ---- cards / rows ---- */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: var(--pad); margin: 0 0 var(--gap); }
.card.glow { box-shadow: var(--glow-azure); }
.card.attention { border-left: 3px solid var(--attention); }
.card.grey { opacity: .55; }
.card:active.tap { background: var(--surface-2); }
.headline { font: 400 var(--t-hero)/1 var(--display); letter-spacing: .02em; margin: 6px 0 2px; }
.headline.good { color: var(--positive); } .headline.bad { color: var(--danger); } .headline.warn { color: var(--attention); }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hairline); min-height: 44px; align-items: center; }
.row:first-of-type { border-top: 0; }
.row .k { color: var(--text-dim); } .row .v { font-family: var(--mono); text-align: right; }
.proof { margin-top: 10px; font: 400 11px/1.3 var(--mono); color: var(--text-faint); }
.proof.stale { color: var(--attention); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.section-title { font: 400 18px/1 var(--display); letter-spacing: .12em; color: var(--text-dim); margin: 22px 0 10px; }
.item { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; min-height: 64px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; margin-bottom: 8px; width: 100%; text-align: left; }
.item.sel { border-color: var(--azure); }
.item .t { font-weight: 500; } .item .s { color: var(--text-dim); font-size: var(--t-meta); }
.tag { font: 500 10px/1 var(--mono); letter-spacing: .1em; padding: 4px 7px; border-radius: 6px; border: 1px solid var(--hairline); color: var(--text-dim); }
.tag.LIVE, .tag.done, .tag.ok { color: var(--positive); border-color: var(--positive); }
.tag.IN_BUILD, .tag.running, .tag.leased, .tag.queued { color: var(--azure); border-color: var(--azure); }
.tag.failed, .tag.bad { color: var(--danger); border-color: var(--danger); }
.tag.PARKED, .tag.ARCHIVED, .tag.DESIGNED { color: var(--text-faint); }
.empty { text-align: center; padding: 48px 0; font: 400 var(--t-meta)/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); }
.note { font: 400 var(--t-meta)/1.4 var(--mono); color: var(--text-dim); }
.pre { white-space: pre-wrap; word-break: break-word; font: 400 var(--t-meta)/1.5 var(--mono); color: var(--text-dim); background: var(--bg); border: 1px solid var(--hairline); border-radius: 10px; padding: 12px; margin: 10px 0; }
.detail-back { margin-bottom: 8px; }

/* ---- capture box ---- */
.capbox { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card); padding: 10px; }
.capbox textarea { border: 0; background: transparent; resize: none; min-height: 56px; padding: 8px; }
.capbox .bar { display: flex; gap: 8px; align-items: center; }
.capbox .bar .grow { flex: 1; }
.icon-btn { width: var(--tap-min); height: var(--tap-min); border-radius: 12px; background: var(--surface-2); border: 1px solid var(--hairline); color: var(--text-dim); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.rec { color: var(--danger); border-color: var(--danger); }
.capline { font: 400 var(--t-meta)/1.4 var(--mono); color: var(--text-dim); margin-top: 8px; }
.capline b { color: var(--azure); font-weight: 500; }
.attach { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.attach .tag { display: inline-flex; gap: 6px; align-items: center; }

/* ---- needs-me card ---- */
.nm { border-left: 3px solid var(--attention); }
.nm h3 { margin: 6px 0 8px; font-size: 20px; font-weight: 600; }
.nm .ctx { color: var(--text-dim); white-space: pre-wrap; margin-bottom: 12px; }
.nm .opts { display: flex; flex-direction: column; gap: 8px; }
.nm .opts .btn:first-child { }

/* ---- toast ---- */
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + var(--safe-bottom) + 16px); background: var(--surface-2); border: 1px solid var(--hairline); padding: 10px 16px; border-radius: 12px; font: 400 var(--t-meta)/1.3 var(--mono); z-index: 50; max-width: 90vw; }
@media (min-width: 768px) { #toast { bottom: 24px; } }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; z-index: 40; }
.sheet > div { width: 100%; max-width: 520px; margin: 0 auto; background: var(--surface); border-top-left-radius: 20px; border-top-right-radius: 20px; padding: var(--pad) var(--pad) calc(var(--pad) + var(--safe-bottom)); display: flex; flex-direction: column; gap: 10px; }
.stale-note { font: 400 var(--t-meta)/1.3 var(--mono); color: var(--attention); margin-bottom: 10px; }
.hero-time { font: 400 var(--t-hero)/1 var(--display); }
.hero-title { font-size: 20px; font-weight: 600; margin: 4px 0; }
.sub { opacity: .55; }
.p1 { color: var(--azure); }
