/* Staff panel: the player site's look (near-black, hairline frame, monospace for anything
   measured, rust accent), denser and built for long sessions. */
:root {
  --bg: #0a0a0a;
  --raise: #0f1010;
  --raise-2: #151616;
  --line: #1d1f1f;
  --line-2: #2a2d2d;
  --fg: #ededeb;
  --muted: #9a9e9b;
  --dim: #5e6360;
  --accent: #ff6a2b;
  --accent-soft: rgba(255, 106, 43, 0.12);
  --gold: #e8c35a;
  --ok: #4ade80;
  --warn: #e8c35a;
  --bad: #f87171;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --radius: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.55 var(--sans); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--fg); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2 { font-family: var(--sans); font-weight: 600; line-height: 1.05; margin: 0; letter-spacing: -0.03em; }
h1 { font-size: clamp(28px, 3vw, 40px); overflow-wrap: anywhere; }
h2 { font-size: 15px; letter-spacing: -0.01em; }
p { margin: 0; }
code { font-family: var(--mono); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 500 12px/1 var(--mono); color: var(--muted); }
.eyebrow::before { content: ""; width: 6px; height: 6px; background: var(--accent); transform: rotate(45deg); flex: none; }
.eyebrow a { color: inherit; }
[hidden] { display: none !important; }

/* ---- Shell: a rail on the left, the work on the right ---- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg); }
.side > .logo { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 0 20px; border-bottom: 1px solid var(--line); font: 600 14px/1 var(--sans); letter-spacing: 0.02em; text-decoration: none; }
.logo span { color: var(--dim); font-weight: 500; }
.logo svg { width: 18px; height: 18px; flex: none; }
.nav { display: grid; gap: 1px; padding: 16px 12px; overflow-y: auto; }
/* Square markers like a checklist; the current page gets a lit diamond. */
.nav a { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: 14px; }
.nav a::before { content: ""; width: 7px; height: 7px; border: 1px solid var(--line-2); border-radius: 1.5px; flex: none; }
.nav a:hover { color: var(--fg); background: var(--raise-2); }
.nav a[aria-current] { color: var(--fg); }
.nav a[aria-current]::before { background: var(--accent); border-color: var(--accent); transform: rotate(45deg); box-shadow: 0 0 10px rgba(255, 106, 43, 0.6); }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.conn { display: flex; align-items: center; gap: 8px; font: 12px var(--mono); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.conn.up .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15), 0 0 10px rgba(74, 222, 128, 0.5); }
.conn.down .dot { background: var(--bad); }
.me { font-size: 13px; display: flex; align-items: center; flex-wrap: wrap; }
.me .role { font: 11px var(--mono); color: var(--accent); margin-left: 8px; }

.main { padding: 0 0 60px; display: grid; align-content: start; min-width: 0; }
.main[aria-busy="true"]:empty::before { content: "loading…"; color: var(--dim); font: 13px var(--mono); padding: 28px 32px; }
/* The page title is a band across the top; everything else sits in the padded area below. */
.main > *, .view > * { margin-left: clamp(16px, 2.6vw, 36px); margin-right: clamp(16px, 2.6vw, 36px); margin-top: 20px; }
.main > .page-head, .view > .page-head { margin: 0; padding: 28px clamp(16px, 2.6vw, 36px) 24px; border-bottom: 1px solid var(--line); }
.view { display: grid; align-content: start; min-width: 0; margin: 0 !important; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 20px; }
.page-head > div:first-child { display: grid; gap: 10px; }
.page-head .lede { color: var(--muted); max-width: 72ch; }

/* ---- Pieces ---- */
.panel { background: var(--raise); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* Stat tiles share their borders, like cells of one instrument. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 0; background: var(--raise); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
/* Lines on the right and bottom of each tile; the frame's overflow clips the outer ones. */
.tile { padding: 14px 16px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.tile dt { font: 12px var(--mono); color: var(--dim); }
.tile dd { margin: 6px 0 0; font: 500 24px/1.1 var(--sans); letter-spacing: -0.02em; }
.tile dd small { font: 12px var(--mono); color: var(--dim); margin-left: 4px; letter-spacing: 0; }
.tile .sub { font: 12px var(--mono); color: var(--dim); margin-top: 4px; }
.meter { height: 6px; margin-top: 10px; position: relative; background-image: radial-gradient(var(--line-2) 1px, transparent 1.3px); background-size: 4px 4px; }
.meter span { position: absolute; inset: 0 auto 0 0; display: block; background-image: radial-gradient(var(--accent) 1.1px, transparent 1.4px); background-size: 4px 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 500 13px var(--sans); color: var(--fg); background: transparent; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 7px 12px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--raise-2); border-color: #3a3e3e; color: var(--fg); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--fg); border-color: var(--fg); color: #0a0a0a; }
.btn.primary:hover { background: #fff; }
.btn.danger { border-color: rgba(248, 113, 113, 0.45); color: var(--bad); }
.btn.danger:hover { background: rgba(248, 113, 113, 0.1); }
.btn.ghost { border-color: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.steam { width: 100%; padding: 10px 12px; font-weight: 500; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

input, select, textarea { font: 13px var(--sans); color: var(--fg); background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input[type="checkbox"] { accent-color: var(--accent); }
label.field { display: grid; gap: 6px; font: 12px var(--mono); color: var(--muted); }
label.field input, label.field select { font-family: var(--sans); font-size: 14px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
.data th { text-align: left; font: 500 12px var(--mono); color: var(--dim); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data tbody tr:last-child td { border-bottom: 0; }
.data td.num, .data th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.data tr:hover td { background: var(--raise-2); }
.data .actions { text-align: right; white-space: nowrap; }
.data .actions > * + * { margin-left: 4px; }
.table-wrap { overflow-x: auto; }
.empty { color: var(--dim); padding: 22px 10px; font: 13px var(--mono); }
.pill { display: inline-block; font: 500 11px/1 var(--mono); padding: 4px 7px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); }
.pill.accent { border-color: rgba(255, 106, 43, 0.45); color: var(--accent); }

/* ---- Console: a terminal card ---- */
.console { font: 12.5px/1.55 var(--mono); background: #070707; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.console.tall { height: calc(100vh - 260px); min-height: 320px; }
.console.short { height: 320px; }
.console .l { display: block; }
.console .t { color: #474c49; margin-right: 10px; }
.console .warning { color: var(--warn); }
.console .error { color: var(--bad); }
.console .command { color: var(--accent); }
.console .system { color: #7fb4e0; }
.cmd-row { display: flex; gap: 8px; margin-top: 10px; }
.cmd-row input { flex: 1; font-family: var(--mono); }

.chat { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.chat li { font-size: 13px; overflow-wrap: anywhere; }
.chat .who { font-weight: 500; margin-right: 8px; }
.chat .team { color: #7fb4e0; }
.chat li.muted { font: 13px var(--mono); color: var(--dim); }
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.feed li:first-child { border-top: 0; }
.feed li.muted, .chat li.muted { display: block; font: 13px var(--mono); color: var(--dim); }
.feed .tag { font: 11px var(--mono); color: var(--dim); padding-top: 2px; }
.feed .destroy .tag, .feed li.destroy .tag { color: var(--accent); }
.feed .boss .tag, .feed li.boss .tag { color: var(--gold); }

/* ---- Live map ---- */
.livemap svg { width: 100%; height: auto; display: block; max-height: calc(100vh - 200px); }
.livemap .land { fill: #101211; }
.livemap .gl { stroke: rgba(237, 237, 235, 0.06); stroke-width: 1; }
.livemap .lbl { fill: var(--dim); font: 10px var(--mono); }
.livemap .mon { fill: var(--gold); opacity: 0.7; }
.livemap .mlbl { fill: var(--gold); font: 9px var(--mono); opacity: 0.8; }
.livemap .p { stroke: #0a0a0a; stroke-width: 1.5; }
.livemap .pname { fill: var(--fg); font: 10px var(--sans); paint-order: stroke; stroke: #0a0a0a; stroke-width: 3px; }

/* ---- Login ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; isolation: isolate; }
.login::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(rgba(255, 106, 43, 0.4) 1px, transparent 1.4px); background-size: 7px 7px;
  -webkit-mask-image: radial-gradient(ellipse 45% 40% at 50% 50%, #000, transparent 75%);
  mask-image: radial-gradient(ellipse 45% 40% at 50% 50%, #000, transparent 75%);
}
.login form { width: min(380px, 100%); display: grid; gap: 14px; background: rgba(15, 16, 16, 0.95); border: 1px solid var(--line-2); border-radius: 14px; padding: 28px; box-shadow: 0 30px 80px -20px #000; }
.login .logo { display: flex; align-items: center; gap: 10px; font: 600 18px var(--sans); margin-bottom: 6px; }
.form-error { color: var(--bad); font-size: 13px; min-height: 1em; }
.or { display: flex; align-items: center; gap: 10px; color: var(--dim); font: 12px var(--mono); }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

dialog { background: var(--raise); color: var(--fg); border: 1px solid var(--line-2); border-radius: 14px; padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px #000; }
dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(2px); }
dialog form { display: grid; gap: 14px; }
dialog h2 { font-size: 20px; }
dialog .row { justify-content: flex-end; }
.secret { font: 15px var(--mono); background: var(--bg); border: 1px dashed var(--accent); padding: 12px; border-radius: var(--radius); user-select: all; overflow-wrap: anywhere; }

.toast { position: fixed; right: 16px; bottom: 16px; max-width: min(420px, calc(100vw - 32px)); background: var(--raise-2); border: 1px solid var(--line-2); padding: 10px 14px 10px 32px; border-radius: 10px; z-index: 10; font-size: 13px; box-shadow: 0 20px 50px -20px #000; }
.toast::before { content: ""; position: absolute; left: 14px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.toast.error::before { background: var(--bad); }

/* ---- Profiles, scores, charts ---- */
.avatar { width: 22px; height: 22px; border-radius: 5px; margin-right: 8px; }
a.plain { text-decoration: none; }
a.plain:hover { text-decoration: underline; }

.score { display: inline-flex; align-items: center; gap: 8px; font: 500 13px var(--mono); }
.score .bar { width: 70px; height: 4px; background: var(--raise-2); border-radius: 2px; overflow: hidden; }
.score .bar span { display: block; height: 100%; }
.score.s-low .bar span { background: var(--ok); }
.score.s-mid .bar span { background: var(--warn); }
.score.s-high .bar span { background: var(--bad); }
.score.s-high { color: var(--bad); }
.score.s-mid { color: var(--warn); }
.factors { display: flex; flex-wrap: wrap; gap: 4px; }
.factor { font: 11px var(--mono); padding: 2px 7px; border-radius: 4px; border: 1px solid var(--line); color: var(--dim); }
.factor.hot { border-color: rgba(248, 113, 113, 0.45); color: var(--bad); background: rgba(248, 113, 113, 0.08); }
.factor.warm { border-color: rgba(232, 195, 90, 0.4); color: var(--warn); }
.factor.off { opacity: 0.45; }

.profile-head { align-items: center; }
.big-score { text-align: center; padding: 14px 20px; border-radius: 10px; border: 1px solid var(--line-2); min-width: 140px; display: grid; gap: 4px; background: var(--raise); }
.big-score .eyebrow { justify-content: center; }
.big-score b { font: 500 46px/1 var(--mono); letter-spacing: -0.04em; }
.big-score.s-high { border-color: rgba(248, 113, 113, 0.5); box-shadow: 0 0 40px -10px rgba(248, 113, 113, 0.35); }
.big-score.s-high b { color: var(--bad); }
.big-score.s-mid b { color: var(--warn); }
.factor-rows { display: grid; gap: 12px; }
.factor-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 13px; }
.factor-row .track { height: 8px; position: relative; background-image: radial-gradient(var(--line-2) 1px, transparent 1.3px); background-size: 4px 4px; }
.factor-row .track span { position: absolute; inset: 0 auto 0 0; display: block; background-image: radial-gradient(var(--accent) 1.2px, transparent 1.5px); background-size: 4px 4px; }
.factor-row > .mono { text-align: right; }
.factor-row .why { grid-column: 2 / 4; font: 12px var(--mono); color: var(--dim); margin-top: -6px; }
.bones { display: grid; gap: 8px; }
.bones div { display: grid; grid-template-columns: 70px minmax(0, 1fr) 46px; gap: 8px; align-items: center; font-size: 12px; }
.bones .track { height: 4px; background: var(--raise-2); border-radius: 2px; overflow: hidden; }
.bones .track span { display: block; height: 100%; background: #7fb4e0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line-2); }
.chart .lbl { fill: var(--dim); font: 10px var(--mono); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.chart .area { fill: var(--accent-soft); }
.spray svg { width: 100%; max-width: 420px; height: auto; display: block; background: #070707; border: 1px solid var(--line); border-radius: 10px; }
.spray .trace { fill: none; stroke: rgba(255, 106, 43, 0.5); stroke-width: 1.2; }
.spray .origin { fill: var(--fg); }
.spray .gl { stroke: rgba(237, 237, 235, 0.06); }
.spray .lbl { fill: var(--dim); font: 10px var(--mono); }

/* ---- Config form editor ---- */
.cfg { display: grid; gap: 10px; }
.cfg fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.cfg legend { font: 500 12px var(--mono); color: var(--accent); padding: 0 6px; }
.cfg .kv { display: grid; grid-template-columns: minmax(140px, 260px) minmax(0, 1fr); gap: 10px; align-items: start; }
.cfg .kv > span { font-size: 13px; padding-top: 7px; overflow-wrap: anywhere; color: var(--muted); }
.cfg textarea { width: 100%; min-height: 64px; resize: vertical; }
.cfg input[type="text"], .cfg input[type="number"] { width: 100%; }
.cfg .item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.raw { width: 100%; min-height: 60vh; font: 12.5px/1.55 var(--mono); background: #070707; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 7px 16px; }
.perm-grid label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.perm-grid h3 { grid-column: 1 / -1; margin: 10px 0 0; font: 500 12px var(--mono); color: var(--dim); }
.tabs { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 3px; gap: 2px; }
.tabs button { font: 500 13px var(--sans); background: transparent; color: var(--muted); border: 0; border-radius: 5px; padding: 5px 11px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--raise-2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; padding: 10px; border-bottom: 1px solid var(--line); }
  .side-foot { margin: 0; grid-auto-flow: column; justify-content: start; align-items: center; border-top: 0; border-bottom: 1px solid var(--line); }
  .me { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .console.tall { height: 60vh; }
  .cfg .kv { grid-template-columns: 1fr; }
  .factor-row { grid-template-columns: 100px minmax(0, 1fr) 36px; }
}

/* ---- "Rust on steel", same look as the player site ---- */
:root {
  --bg: #12161c; --raise: #1a2028; --raise-2: #212833; --line: #2b3440; --line-2: #364150;
  --fg: #e8ecf1; --muted: #8c97a6; --dim: #5f6b7a; --accent: #e0452b; --accent-soft: rgba(224, 69, 43, 0.14);
  --ok: #4fd18b; --warn: #f2b33d; --bad: #ff6b57; --gold: #f2b33d;
  --sans: "Saira", system-ui, sans-serif; --display: "Saira Condensed", "Saira", sans-serif; --mono: "Saira", system-ui, sans-serif;
}
body { font-variant-numeric: tabular-nums; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: 0; }
h1 { font-size: clamp(30px, 3vw, 42px); }
h2 { font-size: 19px; font-weight: 600; }
.side, .side > .logo { background: #151a21; }
.side > .logo { font: 700 20px var(--display); }
.side > .logo span { color: var(--accent); }
.nav a { font-size: 14px; }
.nav a::before { display: none; }
.nav a[aria-current] { background: var(--raise-2); box-shadow: inset 3px 0 0 var(--accent); }
.eyebrow { font: 500 13px var(--sans); }
.eyebrow::before { display: none; }
.panel { border-radius: 12px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03); }
.tiles { border-radius: 12px; }
.tile dt { font: 500 13px var(--sans); color: var(--muted); }
.tile dd { font: 700 30px/1.05 var(--display); }
.tile .sub, .feed .tag, .console .t, .data th, label.field, .factor-row .why, .conn, .or, .empty, .chat li.muted, .feed li.muted { font-family: var(--sans); }
.data th { font-size: 13px; font-weight: 500; color: var(--muted); }
.btn { border-radius: 8px; height: 36px; padding: 0 14px; font: 600 13px var(--sans); }
.btn.small { height: 30px; padding: 0 10px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #ee5a40; }
.console { font-family: "JetBrains Mono", ui-monospace, monospace; border-radius: 10px; }
.meter { height: 6px; border-radius: 3px; background: var(--raise-2); background-image: none; overflow: hidden; }
.meter span { background: var(--accent); background-image: none; border-radius: 3px; }
.factor-row .track { height: 6px; border-radius: 3px; background: var(--raise-2); background-image: none; overflow: hidden; }
.factor-row .track span { background: var(--accent); background-image: none; }
.login::before { display: none; }
.login form { border-radius: 16px; }
.pill { border-radius: 99px; }
.clan-row-banner { width: 22px; height: 33px; vertical-align: middle; margin-right: 8px; }
