/* Agent map — one stylesheet for both pages. Design plan: ink navy chrome, warm off-white surface, one colour per board state,
   numbers set in tabular figures, cards with a single hairline and no drop-shadow soup. Dark mode follows the OS. */
:root {
  --bg: #f6f5f1; --surface: #ffffff; --surface-2: #f0efe9; --ink: #0c1b2e; --ink-2: #4a5568; --ink-3: #8a94a6;
  --line: #e4e2da; --accent: #1f6feb; --focus: #1f6feb;
  --s-waiting: #b7791f; --s-queued: #5a6b8c; --s-building: #4c51bf; --s-review: #9f3dce; --s-applying: #0b7285;
  --s-verifying: #138a72; --s-done: #2f855a; --s-blocked: #c53030; --s-none: #c9c7bf;
  --st-idea: #8a94a6; --st-spec: #5a6b8c; --st-building: #4c51bf; --st-live: #138a72; --st-trusted: #2f855a;
  --radius: 10px; --shadow: 0 1px 0 rgba(12, 27, 46, .04); --chrome: #0c1b2e; --chrome-ink: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #121a2b; --surface-2: #19233a; --ink: #e8edf6; --ink-2: #aab4c6; --ink-3: #75819a;
    --line: #243049; --accent: #6ea8ff; --focus: #6ea8ff; --s-none: #2c3852; --chrome: #070d18;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* chrome */
.top { position: sticky; top: 0; z-index: 5; background: var(--chrome); color: var(--chrome-ink); border-bottom: 1px solid rgba(255,255,255,.06); }
.top-in { max-width: 1400px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: #4fd1a5; box-shadow: 0 0 0 3px rgba(79, 209, 165, .25); }
.tabs { display: flex; gap: 4px; background: rgba(255, 255, 255, .08); padding: 3px; border-radius: 8px; }
.tabs a { color: #cfd8e8; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 13px; }
.tabs a[aria-current="page"] { background: #ffffff; color: #0c1b2e; }
.fresh { margin-left: auto; font-size: 12px; color: #aebbd0; display: flex; align-items: center; gap: 8px; }
.fresh button { background: rgba(255, 255, 255, .1); color: #fff; border: 0; border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer; }
.fresh .live { width: 7px; height: 7px; border-radius: 50%; background: #4fd1a5; }
.fresh.stale .live { background: #f6ad55; }
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.2px; }
.sub { color: var(--ink-2); margin: 0 0 18px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 26px 0 10px; }

/* cards and stats */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { padding: 12px 14px; }
.stat b { display: block; font-size: 24px; line-height: 1.1; }
.stat span { color: var(--ink-2); font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: #fff; white-space: nowrap; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); white-space: nowrap; }
.muted { color: var(--ink-3); }
.err { padding: 14px; border-color: var(--s-blocked); color: var(--s-blocked); }

/* needs-you list */
.needs { display: grid; gap: 8px; }
.need { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; }
.need:hover { border-color: var(--ink-3); }
.need .why { color: var(--ink-2); font-size: 13px; }
.need .age { font-size: 12px; color: var(--ink-3); }
.empty { padding: 14px; color: var(--ink-2); }

/* agent strip */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.agent { padding: 12px 14px; }
.agent h3 { margin: 0 0 6px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.agent .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); padding: 2px 0; }
.streak { display: flex; gap: 3px; }
.streak i { width: 14px; height: 6px; border-radius: 3px; background: var(--s-none); }
.streak i.on { background: var(--s-done); }

/* the grid */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input[type=search] { flex: 1 1 200px; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; }
.toolbar label { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.gridwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 560px; }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.grid thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-2); z-index: 1; }
.grid th.planned { color: var(--ink-3); font-weight: 500; }
.grid td.name { font-weight: 600; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 170px; }
.grid tbody tr:hover td { background: var(--surface-2); }
.cell { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.cell .pill { min-width: 84px; justify-content: center; }
.cell small { color: var(--ink-3); font-size: 11.5px; }
.dash { color: var(--s-none); }

/* drawer */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(460px, 100%); background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .18s ease; z-index: 20; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer header { padding: 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.drawer header h3 { margin: 0; font-size: 16px; }
.drawer .body { padding: 16px; overflow: auto; }
.drawer dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0 0 16px; }
.drawer dt { color: var(--ink-3); font-size: 12.5px; }
.drawer dd { margin: 0; }
.drawer pre { white-space: pre-wrap; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2);
  padding: 10px; border-radius: 8px; margin: 0; }
.close { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 4px 10px; cursor: pointer; font: inherit; }
.scrim { position: fixed; inset: 0; background: rgba(12, 27, 46, .35); opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 15; }
.scrim.open { opacity: 1; pointer-events: auto; }

/* builds page */
.progress { padding: 16px; display: grid; gap: 10px; }
.bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; }
.bar-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--ink-2); }
.bar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col > header { display: flex; justify-content: space-between; align-items: center; margin: 2px 2px 10px; font-weight: 700; font-size: 13px; }
.col > header .n { color: var(--ink-3); font-weight: 600; }
.col .cards { display: grid; gap: 8px; }
.build { padding: 11px 12px; border-left: 4px solid var(--st-spec); cursor: pointer; }
.build:hover { border-color: var(--ink-3); }
.build .head { display: flex; gap: 8px; align-items: baseline; }
.build .num { font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.build h4 { margin: 0; font-size: 14px; }
.build p { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); }
.build .trig { display: flex; gap: 6px; }
.build .trig svg { flex: none; margin-top: 2px; }
.build .chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.build .block { margin-top: 8px; font-size: 12px; color: var(--s-blocked); font-weight: 600; }
.build .metric { margin-top: 8px; display: flex; gap: 10px; font-size: 12px; color: var(--ink-2); }
.build .metric b { color: var(--ink); }
.blockers { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.blocker { padding: 12px 14px; }
.blocker b { color: var(--s-blocked); }
.filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.filter button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 5px 12px;
  font: inherit; font-size: 12.5px; cursor: pointer; }
.filter button[aria-pressed="true"] { background: var(--chrome); color: #fff; border-color: var(--chrome); }
@media (max-width: 700px) {
  .board { grid-template-columns: repeat(5, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .drawer dl { grid-template-columns: 1fr; }
  .fresh { margin-left: 0; width: 100%; }
}
/* 10-23: long chips overflowed a column — let cards and chips wrap inside their column */
.col, .build { min-width: 0; }
.build .chip { white-space: normal; }
