/* Command center styles. Mobile first.
   Brand colors come from /theme.css (built from branding.json): --primary --navy --accent --cyan
   --good --warn --bad. Everything below uses role tokens, one 4px spacing scale and one radius. */
:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --radius: 8px; --pill: 999px;
  --bg: #f6f7fb; --surface: #ffffff; --ink: #14142b; --muted: #545770; --line: #dfe2ec;
  --link: var(--primary); --emph: var(--primary); --focus: var(--primary);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0f1a; --surface: #181a2b; --ink: #ecedf5; --muted: #a9acc6; --line: #2c2f48;
    --link: var(--cyan); --emph: var(--cyan); --focus: var(--cyan); }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.error { color: var(--bad); font-weight: 600; }
@media (prefers-color-scheme: dark) { .error { color: #ff8aa0; } }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
a { color: var(--link); }

/* One visible focus ring for every control (keyboard users). */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button, input, select { font: inherit; color: inherit; }

/* Header and tabs */
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); background: var(--navy); color: #fff; }
.top h1 { font-size: 1.125rem; }

.top :focus-visible { outline-color: #fff; }
.tabs { display: flex; gap: var(--s1); overflow-x: auto; padding: var(--s2) var(--s3);
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.tabs button { flex: 0 0 auto; border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: var(--s2) var(--s3); border-radius: var(--radius); min-height: 44px; }
.tabs button[aria-selected="true"] { background: var(--primary); color: #fff; font-weight: 600; }

main { max-width: 1120px; margin: 0 auto; padding: var(--s4); }
.panel-title { font-size: 1.25rem; margin-bottom: var(--s3); }

/* Summary tiles (also filters) */
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin-bottom: var(--s3); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s3); text-align: left; cursor: pointer; min-height: 44px; }
.tile:hover { border-color: var(--emph); }
.tile[aria-pressed="true"] { border-color: var(--emph); box-shadow: inset 0 0 0 1px var(--emph); }
.tile strong { display: block; font-size: 1.5rem; color: var(--emph); }
.tile span { display: block; font-size: .8125rem; color: var(--muted); line-height: 1.3; }
.filter-note { margin: 0 0 var(--s3); font-size: .875rem; }
.link { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; }

/* Search, sort, folder chips */
.controls { display: flex; gap: var(--s2); margin-bottom: var(--s2); }
.controls input, .controls select { padding: var(--s2) var(--s3); border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); min-height: 44px; }
.controls input { flex: 1; min-width: 0; }
.chips { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.chip { font-size: .875rem; padding: var(--s1) var(--s3); border-radius: var(--pill); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); min-height: 32px; }
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Project cards */
#list { display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 720px) { #list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { #list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: var(--radius); padding: var(--s3) var(--s4); }
.card.stale { border-left-color: var(--warn); }
.card-head { display: flex; justify-content: space-between; gap: var(--s2); align-items: flex-start; }
.card h3 { font-size: 1rem; overflow-wrap: anywhere; }
.badges { display: flex; gap: var(--s1); flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: .75rem; font-weight: 600; padding: 2px var(--s2); border-radius: var(--pill);
  background: var(--line); color: var(--ink); white-space: nowrap; }
.s-active, .s-delivered, .s-done { background: var(--good); color: #0b2a07; }
.s-dormant, .s-paused, .s-stale { background: var(--warn); color: #3a2b00; }
.s-blocked { background: var(--bad); color: #fff; }
.s-sealed, .s-retired, .s-archived { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .s-sealed, .s-retired, .s-archived { background: #3a3d6b; } }
.folder { font: .75rem var(--mono); color: var(--muted); margin: var(--s1) 0; overflow-wrap: anywhere; }
.desc { margin: var(--s2) 0; font-size: .9375rem; }
.meta, .hstatus, .latest { font-size: .875rem; color: var(--muted); margin: var(--s1) 0; }
.label { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--emph);
  margin: var(--s2) 0 2px; font-weight: 700; }
.next { margin: 0; padding-left: var(--s4); font-size: .875rem; }
.next li + li { margin-top: 2px; }
.unindexed { margin-top: var(--s4); color: var(--muted); }
.soon { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: var(--s4); margin: 0; }
footer { text-align: center; font-size: .8125rem; padding: var(--s4); }

/* Long-form panels (cheat sheet, settings) */
.prose { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); }
.prose h1 { font-size: 1.375rem; margin-bottom: var(--s2); }
.prose h2 { font-size: 1.125rem; margin: var(--s5) 0 var(--s2); color: var(--emph); }
.prose h2:first-child { margin-top: 0; }
.prose code, .prose pre { font-family: var(--mono); font-size: .875rem; }
.prose pre { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s3); overflow-x: auto; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: var(--s2); text-align: left; vertical-align: top; }

/* Login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: var(--s4); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--primary);
  border-radius: var(--radius); padding: var(--s5); width: 100%; max-width: 400px; }
.login-card h1 { font-size: 1.375rem; margin-bottom: var(--s2); }
.login-card > p { margin: 0 0 var(--s3); }
.login-card form { display: grid; gap: var(--s4); margin-top: var(--s4); }
.field { display: grid; gap: var(--s1); }
.field label { font-size: .875rem; font-weight: 600; }
.field input { padding: var(--s3); border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg); min-height: 48px; width: 100%; }
.hint { margin: 0; font-size: .8125rem; color: var(--muted); }
.pw-wrap { display: flex; gap: var(--s2); }
.pw-wrap input { flex: 1; min-width: 0; }
.pw-toggle { flex: 0 0 auto; min-width: 72px; min-height: 48px; padding: 0 var(--s3); cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--link);
  font-weight: 600; }
.login-card button[type="submit"], .passkey-btn { font-weight: 600; padding: var(--s3); border: 0;
  border-radius: var(--radius); color: #fff; cursor: pointer; width: 100%; min-height: 48px; }
.login-card button[type="submit"] { background: var(--primary); }

/* Passkeys */
.passkey-box { margin-top: var(--s3); }
.passkey-btn { background: var(--navy); }
.passkey-btn:disabled, button.primary:disabled { opacity: .6; cursor: progress; }
.or { text-align: center; font-size: .875rem; margin: var(--s3) 0 0; }
button.primary { font-weight: 600; padding: var(--s2) var(--s4); border: 0; border-radius: var(--radius);
  background: var(--primary); color: #fff; cursor: pointer; min-height: 44px; }
.pk-name { display: grid; gap: var(--s1); font-size: .875rem; font-weight: 600; margin-bottom: var(--s3); max-width: 320px; }
.pk-name input { padding: var(--s2) var(--s3); border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg); min-height: 44px; font-weight: 400; }
.pk-heading { font-size: 1rem; margin: var(--s5) 0 var(--s2); }
.pk-list { padding-left: var(--s4); }
.pk-list li { margin: var(--s2) 0; display: flex; gap: var(--s3); flex-wrap: wrap; align-items: baseline; }

/* Phone layout fixes (from the 2026-12-04 browser check) */
.top-actions { display: flex; gap: var(--s4); align-items: center; }
.top-link { color: #fff; font-size: .875rem; background: none; border: 0; padding: var(--s2) 0;
  text-decoration: underline; cursor: pointer; }
.top-link[aria-current="page"] { font-weight: 700; text-decoration-thickness: 2px; }
.controls select { flex: 0 0 auto; }
@media (max-width: 719px) {
  /* One scrolling row of folder chips instead of six wrapped rows. */
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: var(--s1); scrollbar-width: thin; }
  .chip { flex: 0 0 auto; }
}
.desc.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more { font-size: .875rem; margin: 0 0 var(--s1); }

/* Brain tab */
.brain-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.brain-full { font-size: .875rem; font-weight: 600; }
.brain-hint { margin: 0 0 var(--s3); }
.brain-frame-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #05060d;
  height: calc(100vh - 220px); min-height: 420px; }
.brain-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Today tab */
.today-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.today-updated { margin: 0 0 var(--s3); }
.today { display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 900px) { .today { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tblock.git { grid-column: span 1; } }
.tblock { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3) var(--s4); }
.tblock-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.tblock h3 { font-size: 1rem; }
.tline { margin: 0 0 var(--s2); font-size: .9375rem; }
.tlist { margin: 0 0 var(--s2); padding-left: var(--s4); font-size: .9rem; }
.tlist li + li { margin-top: var(--s1); }
.tlist.issues li::marker { color: var(--warn); }
.tlist.ordered { list-style: decimal; }
.mono { font-family: var(--mono); font-size: .8125rem; }
.pill { font-size: .75rem; font-weight: 700; padding: 2px var(--s2); border-radius: var(--pill); white-space: nowrap; }
.l-ok { background: var(--good); color: #0b2a07; }
.l-warn, .l-unknown { background: var(--warn); color: #3a2b00; }
.l-bad { background: var(--bad); color: #fff; }
.svc { list-style: none; padding: 0; margin: 0 0 var(--s2); display: flex; flex-wrap: wrap; gap: var(--s2); }
.svc li { font-size: .8125rem; padding: 2px var(--s2); border-radius: var(--pill); border: 1px solid var(--line); }
.svc-ok::before { content: "● "; color: var(--good); }
.svc-bad::before { content: "● "; color: var(--bad); }
.tab-badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: var(--pill); background: var(--warn);
  color: #3a2b00; font-size: .75rem; font-weight: 700; line-height: 20px; text-align: center; }
@media (max-width: 420px) { .tabs { padding: var(--s2); gap: 0; } .tabs button { padding: var(--s2); } }
