/* ============================================================================
 * MINER BOSS — operator console presentation.
 *
 * Same tokens as the game (css/style.css), none of its motion. There is not one
 * @keyframes or transition in this file, on purpose: a screen someone reads at
 * 3am before making an irreversible decision should hold still. A control that
 * moves when you approach it is a control you misclick.
 *
 * Density is the other deliberate difference. The game is a touch app with a
 * 46px tap floor; this is a keyboard-and-mouse reading surface, so rows are
 * tight and every number is tabular so columns line up down the page.
 * ========================================================================== */

:root {
  /* game tokens, verbatim */
  --bg0: #17110d;
  --panel: #2c2118;
  --panel-hi: #362a1e;
  --card: rgba(255, 220, 170, 0.055);
  --card-line: rgba(255, 214, 160, 0.13);
  --line: #4d3a28;
  --ink: #f5edda;
  --ink-dim: #d5c6ab;
  --muted: #a8957a;
  --gold: #f6c453;
  --gold-hi: #ffdf8e;
  --gold-deep: #b98f2e;
  --on-gold: #3a2708;
  --good: #58d68e;
  --bad: #ff7767;
  --info: #66b4ff;

  --fs0: 12px; --fs1: 13.5px; --fs2: 15px; --fs3: 18px; --fs4: 24px;
  --r-s: 10px; --r-m: 15px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
  --bevel: inset 0 1px 0 rgba(255, 230, 190, 0.09);

  /* console-only */
  --row-hi: rgba(255, 220, 170, 0.04);
  --btn-face: linear-gradient(#4c3826, #3a2a1c);
  --btn-line: #63492f;
  --in-bg: rgba(0, 0, 0, 0.3);
  --side-w: 236px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg0: #f4ead7; --panel: #fffaf0; --panel-hi: #f7ecd8;
    --card: rgba(96, 63, 24, 0.05); --card-line: rgba(96, 63, 24, 0.16);
    --line: #d3bd9a; --ink: #2a1e12; --ink-dim: #4d3b26; --muted: #7a6242;
    --gold: #a5761a; --gold-hi: #c8922a; --gold-deep: #6d4c0d; --on-gold: #2b1c04;
    --good: #1e7a48; --bad: #a52d1d; --info: #1a5c99;
    --shadow: 0 2px 8px rgba(80, 55, 20, 0.14);
    --bevel: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    --row-hi: rgba(96, 63, 24, 0.045);
    --btn-face: linear-gradient(#fffdf7, #f0e2c9);
    --btn-line: #c9b28c;
    --in-bg: #fffdf8;
  }
}
:root[data-theme="light"] {
  --bg0: #f4ead7; --panel: #fffaf0; --panel-hi: #f7ecd8;
  --card: rgba(96, 63, 24, 0.05); --card-line: rgba(96, 63, 24, 0.16);
  --line: #d3bd9a; --ink: #2a1e12; --ink-dim: #4d3b26; --muted: #7a6242;
  --gold: #a5761a; --gold-hi: #c8922a; --gold-deep: #6d4c0d; --on-gold: #2b1c04;
  --good: #1e7a48; --bad: #a52d1d; --info: #1a5c99;
  --shadow: 0 2px 8px rgba(80, 55, 20, 0.14);
  --bevel: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --row-hi: rgba(96, 63, 24, 0.045);
  --btn-face: linear-gradient(#fffdf7, #f0e2c9);
  --btn-line: #c9b28c;
  --in-bg: #fffdf8;
}

/* ---------- base ----------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  font: var(--fs1)/1.5 -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg0); color: var(--ink);
  /* Every figure in this console is meant to be compared with the one above it. */
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; font-variant-numeric: tabular-nums; }
button { background: none; border: 0; cursor: pointer; }
h1, h2, h3 { line-height: 1.2; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: var(--fs0); }
code { font-family: var(--mono); font-size: .92em; background: var(--card); padding: 1px 5px; border-radius: 4px; }

/* ---------- buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--btn-face); border: 1px solid var(--btn-line);
  border-radius: 8px; padding: 7px 13px; min-height: 34px;
  font-size: var(--fs1); font-weight: 600; color: var(--ink);
  box-shadow: var(--bevel);
}
.btn:hover { border-color: var(--gold); }
.btn:disabled { opacity: .42; pointer-events: none; }
.btn.small { padding: 5px 10px; min-height: 30px; font-size: var(--fs0); }
.btn.primary { background: linear-gradient(var(--gold-hi), var(--gold) 50%, var(--gold-deep)); border-color: var(--gold-deep); color: var(--on-gold); }
.btn.ghost { background: none; box-shadow: none; }
/* Destructive controls must LOOK destructive from across the room: filled red,
   not a red word on the same face as Cancel. */
.btn.danger {
  background: linear-gradient(#8a3227, #6b241c); border-color: #b04a3a;
  color: #ffe4de; font-weight: 700;
}
.btn.danger:hover { border-color: var(--bad); }
.btn.danger:disabled { opacity: .32; }

/* ---------- inputs --------------------------------------------------------- */
.in {
  background: var(--in-bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; min-height: 34px;
  color: var(--ink); width: 100%; min-width: 0;
}
.in:hover { border-color: var(--card-line); }
.in::placeholder { color: var(--muted); }
.fl { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fl > span, .fl > label { font-size: var(--fs0); color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.fl.block { display: block; margin-bottom: 14px; }
.fl.block > label { display: block; margin-bottom: 4px; }

/* ---------- sign-in gate --------------------------------------------------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  width: 100%; max-width: 460px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 26px; box-shadow: var(--shadow), var(--bevel);
}
.gate-title { font-size: var(--fs4); font-weight: 800; margin-bottom: 10px; }
.gate-sub { font-size: var(--fs1); color: var(--ink-dim); margin-bottom: 20px; }
.gate-msg { margin-top: 14px; font-size: var(--fs1); color: var(--ink-dim); }
.gate-msg:empty { display: none; }
.gate-msg.is-bad { color: var(--bad); }
.gate-msg.is-warn { color: var(--gold); }
.gate-fine { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: var(--fs0); color: var(--muted); }
.wp-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.wp-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--r-s); padding: 11px 14px; min-height: 48px;
  text-align: start; text-decoration: none; color: var(--ink);
}
.wp-row:hover { border-color: var(--gold); }
.wp-row .wr-name { font-weight: 700; flex: 1; }
.wp-row .wr-tag { font-size: var(--fs0); color: var(--muted); }
.wp-row .wr-tag.ok { color: var(--good); }

/* ---------- shell ---------------------------------------------------------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--panel-hi);
  border-bottom: 1px solid var(--line); box-shadow: var(--bevel);
}
.tb-brand { font-size: var(--fs2); font-weight: 800; flex: none; }
.tb-env { display: flex; gap: 16px; flex-wrap: wrap; margin-inline-start: auto; }
.kv { display: inline-flex; align-items: baseline; gap: 6px; font-size: var(--fs0); }
.kv i { font-style: normal; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.kv b { color: var(--ink-dim); font-weight: 600; }
.tb-acts { display: flex; gap: 8px; flex: none; }

.shell { flex: 1; display: flex; align-items: stretch; min-height: 0; }
.side {
  width: var(--side-w); flex: none;
  background: var(--panel); border-inline-end: 1px solid var(--line);
  padding: 14px 12px; display: flex; flex-direction: column; gap: 3px;
}
.navb {
  text-align: start; padding: 9px 12px; border-radius: 8px;
  font-size: var(--fs1); font-weight: 600; color: var(--ink-dim);
  border: 1px solid transparent;
}
.navb:hover { background: var(--row-hi); }
.navb.is-on { background: var(--card); border-color: var(--gold); color: var(--gold); }

.cannot {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.cannot h2 {
  font-size: var(--fs0); font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--bad); margin-bottom: 9px;
}
.cannot ul { list-style: none; display: grid; gap: 7px; margin-bottom: 10px; }
.cannot li { font-size: var(--fs0); color: var(--muted); line-height: 1.45; }
.cannot li b { color: var(--ink-dim); }
.cannot p { font-size: var(--fs0); color: var(--muted); line-height: 1.45; }

.main { flex: 1; min-width: 0; padding: 22px 24px 60px; }
.sc-title { font-size: var(--fs4); font-weight: 800; margin-bottom: 6px; }
.sc-sub { font-size: var(--fs1); color: var(--muted); max-width: 72ch; margin-bottom: 22px; }
.sc-h2 { font-size: var(--fs3); font-weight: 700; margin: 30px 0 12px; }

/* ---------- overview tiles ------------------------------------------------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.tile {
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--r-m); padding: 15px 16px; box-shadow: var(--bevel);
}
.tile .tl { font-size: var(--fs0); color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 7px; }
.tile .tv { font-size: 30px; font-weight: 800; line-height: 1.05; }
.tile .tn { font-size: var(--fs0); color: var(--muted); margin-top: 5px; }
.tile.attn { border-color: var(--gold); }
.tile.attn .tv { color: var(--gold); }
.tile.stale .tv { color: var(--bad); }

/* ---------- toolbar -------------------------------------------------------- */
.toolbar {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
  padding: 13px 14px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-m);
}
.toolbar .fl { flex: 1 1 190px; }
.toolbar .btn { flex: none; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabb {
  padding: 9px 15px; font-size: var(--fs1); font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabb:hover { color: var(--ink-dim); }
.tabb.is-on { color: var(--gold); border-bottom-color: var(--gold); }

/* ---------- tables --------------------------------------------------------- */
/* Wide tables scroll inside their own box; the page itself never scrolls
   sideways, because a horizontal page scrollbar hides the row you were reading. */
.tablewrap {
  border: 1px solid var(--line); border-radius: var(--r-m);
  background: var(--panel); overflow-x: auto; box-shadow: var(--bevel);
}
table { width: 100%; border-collapse: collapse; font-size: var(--fs1); }
thead th {
  text-align: start; padding: 10px 13px; white-space: nowrap;
  font-size: var(--fs0); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: var(--panel-hi);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 9px 13px; border-bottom: 1px solid var(--card-line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--row-hi); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.acts { text-align: end; white-space: nowrap; }
td.acts .btn { margin-inline-start: 5px; }
td.mono, .mono td { font-family: var(--mono); font-size: var(--fs0); }
.trunc { display: inline-block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: var(--fs0); font-weight: 700; white-space: nowrap;
  border: 1px solid var(--card-line); color: var(--ink-dim); background: var(--card);
}
.pill.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.pill.warn { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.pill.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, transparent); }

/* ---------- empty / error / loading states --------------------------------- */
/* Every table gets all three. A table that renders nothing when a fetch fails
   is a table that quietly tells an operator the queue is empty. */
.state { padding: 30px 22px; text-align: center; }
.state .st-t { font-size: var(--fs2); font-weight: 700; margin-bottom: 6px; }
.state .st-b { font-size: var(--fs1); color: var(--muted); max-width: 60ch; margin: 0 auto 14px; }
.state.err .st-t { color: var(--bad); }
.state.err code { display: inline-block; margin-top: 8px; }
.state.missing .st-t { color: var(--gold); }
.state .btn { margin-top: 4px; }

/* ---------- player detail -------------------------------------------------- */
.detail {
  margin-top: 18px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-m); padding: 20px;
  box-shadow: var(--bevel);
}
.dt-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.dt-head h2 { font-size: var(--fs3); font-weight: 800; word-break: break-all; }
.dt-head .dt-acts { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 12px; }
.dl div { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-s); padding: 10px 12px; }
.dl dt { font-size: var(--fs0); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
/* `anywhere`, not `break-all`: a long address still wraps, but a timestamp that
   only just overflows is no longer split down the middle of "19:52Z". */
.dl dd { font-size: var(--fs2); font-weight: 700; overflow-wrap: anywhere; }

/* ---------- dialog --------------------------------------------------------- */
.dlg {
  border: 1px solid var(--line); border-radius: var(--r-m);
  background: var(--panel); color: var(--ink);
  padding: 24px; width: min(520px, calc(100vw - 32px));
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  /* The `*` reset above zeroes the margin a <dialog> uses to centre itself, so
     it has to be given back explicitly or the modal pins to the top-left. */
  margin: auto;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.dlg::backdrop { background: rgba(8, 5, 3, 0.66); }
.dlg-title { font-size: var(--fs3); font-weight: 800; margin-bottom: 10px; color: var(--bad); }
.dlg-body { font-size: var(--fs1); color: var(--ink-dim); margin-bottom: 18px; }
.dlg-body b { color: var(--ink); }
.dlg-err { color: var(--bad); font-size: var(--fs1); min-height: 1px; margin-bottom: 12px; }
.dlg-err:empty { display: none; }
.dlg-acts { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- toast ---------------------------------------------------------- */
/* Fixed, not animated. It appears and it disappears. */
.toast {
  position: fixed; inset-block-end: 22px; inset-inline-start: 50%;
  transform: translateX(-50%); z-index: 90;
  background: var(--panel-hi); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 11px 18px; font-size: var(--fs1);
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.good { border-color: var(--good); color: var(--good); }
.toast.bad { border-color: var(--bad); color: var(--bad); }

/* ---------- v6.11 ---------------------------------------------------------- */

/* An address that was NOT frozen on the row. Marked rather than hidden: the
   operator is about to send real money to "wherever this player's wallet points
   today", and that is a fact they should see before the wallet opens. */
.addr-loose { color: var(--gold); border-bottom: 1px dashed currentColor; }

/* Buttons that live inside a table cell or under a detail block. Wraps, because
   the payout desk has four of them and a narrow window must not hide the last. */
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.detail .btnrow { justify-content: flex-start; margin-top: 18px; }

/* A `dd` that carries the number the whole screen is about — the payout amount.
   One size step, not a colour: colour on this line would compete with the
   good/bad states that mean something. */
.dl dd.big { font-size: var(--fs4); }

/* The raw save. Monospace and scrollable; nothing here is edited, so it is a
   reading surface rather than a form. */
.raw {
  font-family: var(--mono); font-size: var(--fs0); white-space: pre;
  background: var(--in-bg); border: 1px solid var(--card-line); border-radius: var(--r-s);
  padding: 12px; margin-top: 12px; max-height: 420px; overflow: auto;
}

/* ---------- announcement composer ------------------------------------------ */
/* Two languages side by side, deliberately. A translator working from a form
   that shows one field at a time writes two different announcements. */
.ann-form { display: grid; gap: 14px; margin-bottom: 26px; }
.ann-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.ann-form textarea.in { resize: vertical; min-height: 68px; }
.ann-form .btn { justify-self: start; }

/* ---------- charts --------------------------------------------------------- */
/* Hand-drawn SVG, no library: the question a chart answers here is "which way
   is the line going", and that does not need a dependency on the one page that
   also signs transactions. */
.charts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.chart {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-m); padding: 14px 16px 10px; box-shadow: var(--bevel);
}
.chart h3 { font-size: var(--fs1); font-weight: 700; margin-bottom: 8px; }
.chart .sc-sub { margin: 6px 0 0; }
.chart-svg { display: block; width: 100%; height: auto; }
.ch-line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-bar { fill: var(--gold); opacity: .8; }
.ch-zero { stroke: var(--card-line); stroke-width: 1; }
.ch-ax { fill: var(--muted); font-size: 10px; font-family: var(--mono); }

/* ---------- narrow --------------------------------------------------------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: 100%; border-inline-end: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; }
  .navb { flex: 1 1 auto; text-align: center; }
  /* The console can never do these things on a phone either, so the three
     claims stay — but the reasoning behind them is desktop-only. An operator
     scrolling past 600px of rationale to reach the payout queue is a worse
     outcome than one who reads the "why" on a bigger screen. */
  .cannot { margin-top: 10px; width: 100%; }
  .cannot ul { gap: 4px; margin-bottom: 0; }
  .cannot > p { display: none; }
  .main { padding: 16px 14px 48px; }
  .tb-env { width: 100%; margin-inline-start: 0; order: 3; }
}

/* No motion exists in this file. The block is here so that a rule added later
   in a hurry still has to answer to it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
