/* TunaWebClient — styles.css (EngineResolverPlan §8.1)
   One dark theme: this is a map read at length, and a light ground under a dark board fights it. */

:root {
  --bg: #0b0f14;
  --panel: #121821;
  --panel2: #161d28;
  --line: #232c3a;
  --ink: #e6ecf5;
  --ink-dim: #97a3b6;
  --ink-faint: #6b7688;
  --accent: #ffd66c;
  --accent-dim: #8a7233;
  --refuse: #ff6b6b;
  --alert: #ffb454;
  --note: #66b2ff;
  --radius: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Must outrank the ID rules below: `#dropzone { display: grid }` beats the UA `[hidden]` rule on
   specificity, which left the drop panel sitting on top of the board — drawn, but covered and
   unclickable. Caught by fixtures/verify.mjs, 2026-09-01 (that harness was deleted 2026-09-13). */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex; flex-direction: column;
  overflow: hidden;
}
body.dragging::after {
  content: ""; position: fixed; inset: 8px; z-index: 50; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: 12px; background: rgba(255,214,108,0.05);
}

/* ── top bar ───────────────────────────────────────────────────────────────── */
#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.brand .mark { color: var(--accent); font-size: 18px; }
.brandtext { font-weight: 600; letter-spacing: 0.2px; white-space: nowrap; }
.brandtext em { font-style: normal; color: var(--ink-dim); font-weight: 400; }
.brandtext .ver { color: var(--ink-faint); font-size: 11px; }

.matchline { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.matchline.muted { color: var(--ink-faint); }
.hchip {
  display: inline-flex; align-items: baseline; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 10px; max-width: 100%;
}
.hchip.warn { border-color: var(--alert); }
.hk { color: var(--ink-faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; }
.hv { color: var(--ink); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topactions { display: flex; gap: 8px; flex: 0 0 auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #241c00; border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 6px 12px; font: inherit; font-weight: 600;
  cursor: pointer; user-select: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink-dim); border-color: var(--line); font-weight: 400; }
.btn.ghost:hover { color: var(--ink); border-color: var(--ink-faint); }
.btn.tiny { padding: 3px 9px; font-size: 12px; background: var(--panel2); color: var(--ink-dim); border-color: var(--line); font-weight: 400; }
.btn.tiny:hover { color: var(--ink); }

/* ── banners ───────────────────────────────────────────────────────────────── */
#banners { flex: 0 0 auto; max-height: 34vh; overflow-y: auto; }
#banners:empty { display: none; }
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--panel2);
}
.banner.refuse { background: #2a1417; border-left: 3px solid var(--refuse); }
.banner.alert  { background: #2a2113; border-left: 3px solid var(--alert); }
.banner.note   { background: #13202e; border-left: 3px solid var(--note); }
.blabel {
  flex: 0 0 auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px;
  padding: 2px 7px; border-radius: 4px; margin-top: 1px;
}
.banner.refuse .blabel { background: var(--refuse); color: #2a0d0d; }
.banner.alert  .blabel { background: var(--alert); color: #2b1e00; }
.banner.note   .blabel { background: var(--note); color: #052036; }
.bbody { flex: 1 1 auto; min-width: 0; }
.bmsg { font-weight: 600; }
.bdetail { color: var(--ink-dim); margin-top: 2px; }
.bclose { background: none; border: 0; color: var(--ink-faint); font-size: 16px; cursor: pointer; line-height: 1; }
.bclose:hover { color: var(--ink); }

/* ── layout ────────────────────────────────────────────────────────────────── */
#layout { flex: 1 1 auto; display: grid; grid-template-columns: 300px 1fr 340px; min-height: 0; }
#layout.empty #leftpane, #layout.empty #rightpane { opacity: 0.35; pointer-events: none; }
.pane { background: var(--panel); overflow-y: auto; min-height: 0; }
#leftpane { border-right: 1px solid var(--line); }
#rightpane { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
@media (max-width: 1100px) { #layout { grid-template-columns: 240px 1fr 280px; } }

.panehead { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
.panehead h2 { margin: 0; font-size: 14px; font-weight: 600; }
.sub { font-size: 11px; margin-top: 2px; }
.muted { color: var(--ink-faint); }
.small { font-size: 11px; }
.block { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.block h3 {
  margin: 0 0 8px; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--ink-faint); font-weight: 600;
}
.count { color: var(--ink-faint); font-weight: 400; }

.stocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 5px; }
.stock {
  display: flex; justify-content: space-between; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px;
}
.sk { color: var(--ink-faint); font-size: 11px; }
.sv { font-variant-numeric: tabular-nums; font-weight: 600; }

.list { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 12px; }
.panehead + .list, .tabpanel > .list { padding-top: 12px; }
.row { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.row.clickable { cursor: pointer; }
.row.clickable:hover { border-color: var(--accent-dim); }
.rowhead { display: flex; align-items: center; gap: 6px; }
.rowtitle { font-weight: 600; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowsub { color: var(--ink-dim); font-size: 11px; margin-top: 2px; }
.pill {
  flex: 0 0 auto; background: #1e2836; border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; font-variant-numeric: tabular-nums;
}
.pill.dim { color: var(--ink-faint); }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.comp { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.catchip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #1a2130; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px 1px 3px;
}
.catn { font-size: 10.5px; color: var(--ink-dim); }

/* ── centre / map ──────────────────────────────────────────────────────────── */
#centre { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0d1117; }
#maptools {
  display: flex; align-items: center; gap: 12px; padding: 7px 12px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.seg { display: flex; gap: 12px; flex-wrap: wrap; }
.seg label { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-dim); font-size: 11.5px; cursor: pointer; }
.seg input { accent-color: var(--accent); }
.spacer { flex: 1 1 auto; }
.zoom { display: flex; gap: 5px; }

#canvaswrap { position: relative; flex: 1 1 auto; min-height: 0; }
#map { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map:active { cursor: grabbing; }

#dropzone {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: #0d1117; padding: 24px;
}
.dz-inner { max-width: 420px; text-align: center; }
.dz-mark { font-size: 40px; color: var(--accent-dim); }
.dz-title { font-size: 16px; margin: 10px 0 6px; }
.dz-body { color: var(--ink-faint); font-size: 12px; margin: 0; }
code { background: #1a2130; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 0.94em; }

.agekey {
  position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px;
  background: rgba(12,17,24,0.9); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}
.agekey .k { color: var(--ink-faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; }
.agekey .chip { font-size: 10.5px; padding: 0 7px; border-radius: 999px; border: 1px dashed; }
.chip.fresh  { color: #f2f6ff; border-color: #ffffff; }
.chip.recent { color: #cfd9ea; border-color: #b9c6dd; }
.chip.stale  { color: #9aa5b8; border-color: #7f8b9f; }
.chip.cold   { color: #6d7484; border-color: #575e6c; }

/* ── right pane ────────────────────────────────────────────────────────────── */
/* Seven tabs where there were four (2026-09-11): they must wrap rather than clip, or the last two —
   Roster and Blobs — silently leave the window on a narrower pane. */
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.tab {
  flex: 1 1 auto; min-width: 0; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--ink-faint); font: inherit; font-size: 11.5px; padding: 9px 3px; cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink-dim); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel { display: none; flex: 1 1 auto; min-height: 0; overflow-y: auto; flex-direction: column; }
.tabpanel.active { display: flex; }

.notices { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 14px; }
.notice { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.notice:last-child { border-bottom: 0; }
.ndot { flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-dim); margin-top: 6px; }
.ntext { flex: 1 1 auto; }

.hexinfo { padding: 12px 14px; }
.hexcoord { font: 600 15px ui-monospace, monospace; color: var(--accent); margin-bottom: 8px; }
.hexsect { margin-bottom: 14px; }
.hexsect h4 {
  margin: 0 0 5px; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--ink-faint); font-weight: 600;
}
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.kvk { color: var(--ink-faint); }
.kvv { text-align: right; word-break: break-word; }
.subrow { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; margin-bottom: 6px; }
.subtitle { font-weight: 600; }
.unitline { color: var(--ink-dim); font-size: 11px; padding: 1px 0; }
.ageline { font-size: 11px; margin-top: 4px; }
.ageline.fresh { color: #f2f6ff; }
.ageline.recent { color: #cfd9ea; }
.ageline.stale { color: #9aa5b8; }
.ageline.cold { color: #6d7484; }

/* ── inspector ─────────────────────────────────────────────────────────────── */
.blobtabs { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px 6px; }
.blobtab {
  display: flex; align-items: center; gap: 7px; text-align: left;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px; color: var(--ink-dim); font: inherit; cursor: pointer;
}
.blobtab.active { border-color: var(--accent-dim); color: var(--ink); }
.fmt {
  flex: 0 0 auto; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 1px 6px; border-radius: 4px; background: #24303f; color: var(--ink-dim);
}
.fmt.tunaturn { background: #23331f; color: #a8d68e; }
.fmt.tunamatch { background: #1f2a3a; color: #8fb6e8; }
.fmt.tunaorders { background: #33261f; color: #e0ac82; }
.fn { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }

.filter {
  margin: 6px 14px; padding: 5px 8px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font: inherit;
}
.filter:focus { outline: 1px solid var(--accent-dim); }
.envelope { padding: 0 14px 8px; }
.ordersum { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.cmdrow { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.cmdname { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--ink-dim); }
.rawjson {
  margin: 0; padding: 10px 14px 24px; flex: 1 1 auto;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-dim); white-space: pre; overflow: auto;
  border-top: 1px solid var(--line);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Added 2026-09-11 with the widened projection (S5 step 2 / D21).

   The v0 client showed ten fields. It now shows the seat's whole §5.4 surface and lets it compose a
   turn, so the layout needs a repeating unit rather than one-off rules per section: `.card` for a
   thing (an army, a city, a satrapy, an offer), `.kv` for one fact about it, `.acts` for the row of
   buttons that queue an order about it. Everything below is that vocabulary.
   ═══════════════════════════════════════════════════════════════════════════════ */

.card {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.028);
  padding: 8px 10px;
  margin-bottom: 8px;
}
.card.report { border-style: dashed; opacity: 0.92; }
.card.urgent { border-color: rgba(238, 160, 92, 0.5); }
.cardhead { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.ctitle { font-weight: 600; font-size: 12.5px; }
.csub { font-size: 11px; opacity: 0.62; }

.kv { display: flex; justify-content: space-between; gap: 10px; padding: 1.5px 0; font-size: 11.5px; }
.kv .k { opacity: 0.6; white-space: nowrap; }
.kv .v { text-align: right; }
.facts { margin: 3px 0; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 5px; }
.tag {
  display: inline-block; font-size: 10px; letter-spacing: 0.02em;
  padding: 1px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1);
}
.tag.warn { background: rgba(238, 176, 92, 0.14); border-color: rgba(238, 176, 92, 0.35); }
.tag.bad  { background: rgba(228, 102, 102, 0.14); border-color: rgba(228, 102, 102, 0.38); }

/* Everything riding a courier. Set apart because "ordered" and "done" are different facts and the
   whole point of the courier model is that a player can tell them apart. */
.flight {
  margin: 6px 0 4px; padding: 5px 7px; border-radius: 5px;
  background: rgba(126, 186, 244, 0.07); border-left: 2px solid rgba(126, 186, 244, 0.4);
}
.flighthead { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.55; }
.flightline { font-size: 11px; padding: 1px 0; }

.units { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.unit {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; padding: 2px 6px 2px 3px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07);
}
.unit .g { width: 16px; height: 16px; }
.unit .un { font-weight: 500; }
.unit .us { opacity: 0.7; font-variant-numeric: tabular-nums; }
.unit .um { opacity: 0.5; font-size: 9.5px; }
.unit.hullbad { border-color: rgba(228, 102, 102, 0.45); }
.unit.hullok  { border-color: rgba(126, 186, 244, 0.3); }

.pline { font-size: 11.5px; padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }

/* Your own score and your place in the order — never the rank table (D21). */
.standhead { font-size: 13px; margin-bottom: 5px; }
.terms { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.term {
  display: inline-flex; gap: 5px; font-size: 10.5px; padding: 1px 6px;
  border-radius: 4px; background: rgba(120, 200, 140, 0.11);
  border: 1px solid rgba(120, 200, 140, 0.22);
}
.term.neg { background: rgba(228, 102, 102, 0.11); border-color: rgba(228, 102, 102, 0.26); }
.term .tk { opacity: 0.75; }
.term .tv { font-variant-numeric: tabular-nums; }

/* The compose surface. Nothing here is validated locally — the resolver is the one rules binary. */
.composer .card { background: rgba(255, 255, 255, 0.035); }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 4px 0; }
.acts .muted.small { flex: 0 0 auto; }
.btn.order { background: rgba(126, 186, 244, 0.14); border-color: rgba(126, 186, 244, 0.32); }
.btn.order:hover { background: rgba(126, 186, 244, 0.24); }
.btn.order.cooling { opacity: 0.45; }
.coordin, .namein, .numin, .unitsel {
  background: rgba(0, 0, 0, 0.3); color: inherit; font: inherit; font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 4px; padding: 2px 5px;
}
.numin { width: 62px; }
.unitsel { max-width: 260px; }

.offer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; }
.oterms { font-size: 11.5px; }

/* The order queue. In memory only: a stateless client holds no authoritative state, and an unsent
   turn is exactly that (§6.2). */
.draftbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 12px; border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}
.draftsummary { font-size: 11.5px; display: flex; gap: 8px; align-items: baseline; }
.draftactions { display: flex; gap: 6px; }
.draftrow {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 3px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.dtext { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; }

.notice.portent { border-left: 2px solid rgba(198, 158, 232, 0.5); padding-left: 7px; }
