/* manage.impactframe.app: the admin dashboard (docs/adr/0027), printed in
   ink like the mockups in design/mockups/admin. One theme on purpose: the
   back office is the ink side of the sheet. No inline styles anywhere (the CSP
   has no 'unsafe-inline'): bar widths and heights are set from app.js. */

@font-face{font-family:'Archivo';font-style:normal;font-display:swap;font-weight:100 900;src:url(fonts/archivo-latin-wght-normal.woff2) format('woff2-variations')}
@font-face{font-family:'Dela Gothic One';font-style:normal;font-display:swap;font-weight:400;src:url(fonts/dela-gothic-one-latin-400-normal.woff2) format('woff2')}
@font-face{font-family:'Martian Mono';font-style:normal;font-display:swap;font-weight:100 800;src:url(fonts/martian-mono-latin-wght-normal.woff2) format('woff2-variations')}

:root {
  color-scheme: dark;
  --ink: #141417; --paper: #f1f0eb; --panel: #1b1b20; --line: #2d2d34; --line2: #4a4a52; --hover: #202026;
  --mute: #a9a69e; --soft: #d6d3cb; --dim: #5c5850;
  --ok: #2cb9c1; --warn: #f0b429; --bad: #ff5a5f;
  --spot: #e8283c; --lift: #ff4458;
  --f-ui: 'Archivo', system-ui, sans-serif;
  --f-disp: 'Dela Gothic One', 'Arial Black', sans-serif;
  --f-mono: 'Martian Mono', ui-monospace, Menlo, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--paper); }
body { font: 15px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; text-underline-offset: .18em; }
:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

.ico { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.reg { fill: none; stroke: currentColor; stroke-width: 1.5; flex: none; }
.mono { font-family: var(--f-mono); }
.disp { font-family: var(--f-disp); font-weight: 400; }
.lbl { font: 11px/1.4 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.num { font-variant-numeric: tabular-nums; }
.sub { font-size: 13px; color: var(--mute); }
.small { font-size: 12px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); } .mute { color: var(--mute); }
.lift { color: var(--lift); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 2px solid var(--line2); background: transparent; color: var(--paper); font: 700 15px/1 var(--f-ui);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--paper); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad); color: var(--ink); }
.btn.solid { background: var(--bad); border-color: var(--bad); color: var(--ink); }
.btn.light { background: var(--paper); border-color: var(--paper); color: var(--ink); box-shadow: 4px 4px 0 var(--spot); }
.btn.on-paper { color: var(--ink); border-color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1.5px solid var(--line2);
  background: transparent; color: var(--soft); font: 600 14px/1 var(--f-ui); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.chip .n { font: 11px/1 var(--f-mono); opacity: .8; }

/* the header */
header.top {
  position: sticky; top: 0; z-index: 50; min-height: 68px; padding: 10px clamp(16px, 2.6vw, 32px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; border-bottom: 2px solid var(--paper); background: var(--ink);
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; }
.brand .disp { font-size: 19px; line-height: 1; white-space: nowrap; }
.brand .lbl { color: var(--paper); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.who .me { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1.5px solid currentColor;
  font: 10.5px/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.pill.big { font-size: 12px; padding: 6px 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* layout */
.layout {
  max-width: 1440px; margin-inline: auto; padding: 28px clamp(16px, 2.6vw, 32px) 80px;
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px;
}
.side { flex: 1 1 200px; max-width: 220px; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 96px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; color: var(--soft);
  text-decoration: none; font-weight: 600; font-size: 15px;
}
.nav a:hover { background: var(--hover); color: var(--paper); }
.nav a[aria-current="page"] { background: var(--paper); color: var(--ink); box-shadow: 4px 4px 0 var(--spot); }
.nav .cnt { margin-left: auto; font: 11px/1 var(--f-mono); opacity: .75; }
.build { padding: 14px; border: 2px dashed #3a3a42; display: flex; flex-direction: column; gap: 6px; font: 12px/1.5 var(--f-mono); }
main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
main:focus { outline: none; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.head > div { display: flex; flex-direction: column; gap: 6px; }
h1.disp { margin: 0; font-size: 44px; line-height: 1; letter-spacing: -.01em; text-shadow: 4px 4px 0 var(--spot); }
.grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.grid.g3 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }

.panel { background: var(--panel); border: 2px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ph { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.ph h2 { margin: 0; font: 800 20px/1.15 var(--f-ui); letter-spacing: -.005em; }
.ph a, .ph .note { font: 12px/1.4 var(--f-mono); color: var(--mute); }
.tile { background: var(--panel); border: 2px solid var(--line); padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile .big { font: 44px/1 var(--f-disp); font-variant-numeric: tabular-nums; }
.track { height: 8px; background: #2a2a30; position: relative; overflow: hidden; flex: 1; min-width: 40px; }
.fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--paper); }
.fill.warn, .bar.warn { background: var(--warn); } .fill.bad, .bar.bad { background: var(--bad); } .fill.ok, .bar.ok { background: var(--ok); }
.bar.now { background: var(--lift); }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; min-width: 0; }
.row:last-child { border-bottom: 0; }
.row .grow { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.top { align-items: flex-start; }
.av {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; background: #2d2d34; color: var(--paper);
  font: 14px/1 var(--f-disp); overflow: hidden;
}
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.lg { width: 56px; height: 56px; font-size: 24px; }
.empty { margin: 0; padding: 18px 0; color: var(--mute); font-size: 14px; }
.foot { margin: 0; }

/* health cards */
.health { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.health > div { padding: 14px; background: var(--ink); border: 1.5px solid var(--line); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.health .t { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* bar charts */
.bars { height: 140px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 2px solid var(--paper); padding-top: 8px; }
.bars.short { height: 120px; }
.bars > i { flex: 1 1 0; height: 0; min-height: 1px; background: var(--paper); }
.axis { display: flex; justify-content: space-between; font: 11px/1.4 var(--f-mono); color: var(--mute); }
.cols { display: grid; gap: 8px; align-items: end; }
.cols.c7 { grid-template-columns: repeat(7, minmax(0, 1fr)); height: 92px; }
.cols.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); height: 160px; border-bottom: 2px solid var(--paper); }
.cols > div { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; height: 100%; }
.cols span { font: 11px/1.2 var(--f-mono); text-align: center; }
.cols .bar { min-height: 2px; background: var(--paper); }
.cols .bar.now { background: var(--lift); }
.labels { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; font: 10.5px/1.3 var(--f-mono); color: var(--mute); text-align: center; }

/* meters: name, bar, value */
.meter { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) 110px; align-items: center; gap: 12px; min-height: 40px; }
.meter > :first-child { font: 12px/1.3 var(--f-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter > :last-child { font: 12px/1.3 var(--f-mono); text-align: right; font-variant-numeric: tabular-nums; }
.meter.tbl { grid-template-columns: 120px minmax(0, 1fr) 72px 72px; min-height: 34px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-top: 12px; border-top: 1px solid var(--line); }
.kv { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 10px; column-gap: 16px; }
.kv dt { font-size: 13px; color: var(--mute); }
.kv dd { margin: 0; font: 13px/1.5 var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* tables (grid rows) */
.scroll { overflow-x: auto; }
.gr { display: grid; align-items: center; column-gap: 12px; }
.th { padding-bottom: 10px; border-bottom: 2px solid var(--paper); font: 10.5px/1.4 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); white-space: nowrap; }
.td { min-height: 56px; padding: 6px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.td:last-child { border-bottom: 0; }
.r { text-align: right; }
.players { min-width: 1000px; font-size: 14px; }
.players .gr { grid-template-columns: minmax(0, 2.3fr) minmax(0, 1.4fr) 104px 112px 104px 52px 64px 64px; padding-right: 8px; }
.players .td { cursor: pointer; white-space: nowrap; }
.players .td:hover { background: var(--hover); }
.players .td.sel { background: #26262d; box-shadow: inset 4px 0 0 var(--spot); }
.pick { min-width: 0; max-width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 0 0 8px; background: none; border: 0; text-align: left; cursor: pointer; }
.pick .grow { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.pick .grow > * { overflow: hidden; text-overflow: ellipsis; }
.queue { min-width: 760px; } .queue .gr { grid-template-columns: minmax(0, 1.6fr) 110px 70px minmax(0, 2fr) 90px; }
.lobbies { min-width: 920px; } .lobbies .gr { grid-template-columns: 80px 120px minmax(0, 2.4fr) 110px 70px 110px 70px; }
.boxes { min-width: 820px; } .boxes .gr { grid-template-columns: minmax(0, 1.7fr) 90px minmax(0, 1.3fr) minmax(0, 1.3fr) 90px; }
.cell2 { display: flex; flex-direction: column; gap: 2px; line-height: 1.35; min-width: 0; }
.cell2 > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.withbar { display: flex; align-items: center; gap: 10px; }
.withbar .v { font: 12px/1.3 var(--f-mono); width: 92px; text-align: right; }
.loglines { display: flex; flex-direction: column; font: 12.5px/1.5 var(--f-mono); overflow-x: auto; }
.loglines > div { display: grid; grid-template-columns: 132px 60px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); min-width: 640px; }
.loglines > div > :last-child { overflow-wrap: anywhere; }

/* players: search, details */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.search { flex: 1 1 280px; max-width: 420px; position: relative; }
.search svg { position: absolute; left: 12px; top: 13px; color: var(--mute); }
.search input {
  width: 100%; min-height: 44px; padding: 0 12px 0 40px; background: var(--panel); border: 2px solid var(--line2);
  color: var(--paper); font: 15px/1 var(--f-ui);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.split { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.split > .list { flex: 999 1 560px; padding: 8px 0 0; }
.split > .list .scroll { padding: 8px 16px 8px 8px; }
.detail { flex: 1 1 340px; max-width: 420px; gap: 18px; box-shadow: 6px 6px 0 var(--spot); position: sticky; top: 96px; }
.detail .id { display: flex; align-items: center; gap: 14px; }
.detail .id > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.detail h2 { margin: 0; font: 26px/1 var(--f-disp); overflow-wrap: anywhere; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.dl { margin: 0; display: grid; grid-template-columns: minmax(0, 130px) minmax(0, 1fr); }
.dl dt { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); font: 10.5px/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.dl dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.note-box { margin: 0; padding: 12px 14px; background: var(--ink); border: 1.5px solid #3a3a42; font-size: 14px; overflow-wrap: anywhere; }
.acts { display: flex; flex-wrap: wrap; gap: 10px; }
.hist { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.hist > div { display: flex; gap: 10px; align-items: baseline; }
.hist .pill { min-width: 64px; justify-content: center; }

/* dialogs: printed on paper */
.scrim {
  position: fixed; inset: 0; z-index: 70; background: rgba(10, 10, 12, .72); display: flex; justify-content: center;
  align-items: flex-start; padding: clamp(40px, 12vh, 140px) 16px 40px; overflow-y: auto;
}
.dlg {
  width: 100%; max-width: 560px; background: var(--paper); color: var(--ink); padding: clamp(20px, 3vw, 32px);
  display: flex; flex-direction: column; gap: 20px; box-shadow: 10px 10px 0 var(--bad);
}
.dlg.spot { box-shadow: 10px 10px 0 var(--spot); }
.dlg .lbl { color: var(--dim); }
.dlg h2 { margin: 0; font: 32px/1.05 var(--f-disp); overflow-wrap: anywhere; }
.dlg p, .dlg ul { margin: 0; }
.dlg ul { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.dlg :focus-visible { outline-color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lbl { font: 11px/1.4 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.inp { width: 100%; min-height: 44px; padding: 10px 12px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font: 16px/1.4 var(--f-ui); }
textarea.inp { resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { min-height: 44px; padding: 0 14px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font: 700 14px/1 var(--f-ui); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.preview { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--ink); color: var(--paper); overflow-wrap: anywhere; }
.preview .lbl { color: var(--mute); }
.dlg .end { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.dlg .err { margin: 0; color: #b0141f; font: 600 13px/1.4 var(--f-mono); }
.dlg .err:empty { display: none; }

/* sign-in */
.gate { min-height: 100vh; display: flex; flex-direction: column; }
.gate header.top { position: static; }
.gate main { flex: 1 0 auto; display: grid; place-items: center; padding: 48px 16px 96px; }
.card {
  width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 24px; padding: clamp(24px, 4vw, 44px);
  background: var(--paper); color: var(--ink); box-shadow: 10px 10px 0 var(--spot);
}
.card .lbl { color: var(--dim); display: flex; align-items: center; gap: 10px; }
.card h1 { margin: 0; font: 48px/1 var(--f-disp); letter-spacing: -.01em; }
.card p { margin: 0; max-width: 38ch; font-size: 17px; }
.card .alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--ink); color: var(--paper); }
.card .alert svg { margin-top: 2px; color: var(--bad); }
.card .go { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.card .go .sub { color: var(--dim); font-size: 14px; }
.card dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 2px solid var(--ink); }
.card dl > div { padding: 12px 12px 0 0; display: flex; flex-direction: column; gap: 2px; }
.card dt { color: var(--dim); }
.card dd { margin: 0; font-weight: 700; }
.gsi { min-height: 44px; color-scheme: light; }
/* Google draws a stand-in button with its own inline <style>, which the CSP refuses; keep it small until its iframe takes over */
.gsi svg { width: 18px; height: 18px; }
.gsi [role="button"] { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; max-width: calc(100% - 32px);
  padding: 12px 16px; background: var(--paper); color: var(--ink); box-shadow: 6px 6px 0 var(--spot); font-weight: 600;
}

@media (max-width: 860px) {
  .side { position: static; max-width: none; min-width: 0; flex-basis: 100%; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav a { flex: none; }
  .build { display: none; }
  .detail { position: static; max-width: none; scroll-margin-top: 16px; }
  header.top { position: static; }
  .tile .big { font-size: 36px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1.disp { font-size: 36px; }
  .meter { grid-template-columns: minmax(0, 110px) minmax(0, 1fr) 96px; }
}
@media (prefers-reduced-motion: no-preference) {
  .fill, .bars > i, .cols .bar { transition: width .4s ease, height .4s ease; }
}
