:root {
  --bg: #0b0e14; --panel: #121722; --panel-2: #182030; --line: #253046;
  --text: #e6ebf5; --muted: #8a96ad; --accent: #22d3ee; --accent-ink: #04141a;
  --good: #34d399; --warn: #fbbf24; --bad: #f87171;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 7px 12px; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { border-color: #7f1d1d; color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input, select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus { border-color: var(--accent); outline: none; }
label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
h1 { font-size: 16px; margin: 0; letter-spacing: .02em; }
h2 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.top h1 span { color: var(--accent); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { border-color: transparent; background: none; color: var(--muted); }
.tabs button.on { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--muted); }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }

.login { max-width: 340px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 14px; }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.ok { color: var(--good); font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; border-left: 4px solid var(--line); }
.pc.busy { border-left-color: var(--accent); }
.pc.ooo { border-left-color: var(--warn); }
.pc .head { display: flex; justify-content: space-between; align-items: baseline; }
.pc .name { font-weight: 700; font-size: 15px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.busy { color: var(--accent); border-color: var(--accent); }
.pill.ooo { color: var(--warn); border-color: var(--warn); }
.pc .user { font-size: 14px; }
.pc .time { font-size: 20px; font-weight: 600; }
.pc .time.low { color: var(--warn); }
.pc .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pc .acts button { padding: 5px 9px; font-size: 12px; }

.split { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 16px; align-items: start; }
/* Grid items default to min-width: auto and would grow to the widest table; let tables scroll instead. */
.split > * { min-width: 0; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 120px; }
.list { display: grid; gap: 2px; margin-top: 10px; max-height: 65vh; overflow: auto; }
.list button { text-align: left; border: 1px solid transparent; background: none; display: flex; justify-content: space-between; gap: 8px; }
.list button.on, .list button:hover { background: var(--panel-2); border-color: var(--line); }
.stats { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--muted); font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.scroll { overflow-x: auto; }
.section { margin-top: 18px; }
.method { display: flex; gap: 4px; }
.method button.on { border-color: var(--accent); color: var(--accent); }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(420px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog form { display: grid; gap: 12px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
@media (prefers-reduced-motion: no-preference) { button { transition: border-color .12s, background .12s; } }
.topup { background: var(--panel-2); display: grid; gap: 12px; }
.topup h2 { margin: 0; }
.topup .row > label { flex: none; min-width: 0; }
.topup .row > label.grow { flex: 1 1 220px; }
.topup .row > label[hidden] { display: none; }
.listbar { justify-content: space-between; align-items: center; margin-top: 10px; }
.listbar select { padding: 5px 8px; font-size: 13px; }
.count { font-size: 12px; }
.list button > span:first-child { display: grid; gap: 2px; }
.list small { font-size: 11px; }
.list button.more { justify-content: center; color: var(--accent); border-color: var(--line); margin-top: 6px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.shot { position: relative; aspect-ratio: 16 / 9; background: #05070b; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.shot canvas { width: 100%; height: 100%; display: block; }
.shot .note { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.shot .note[hidden] { display: none; }

/* ---- phones ---------------------------------------------------------------- */
.back { display: none; }
@media (max-width: 700px) {
  body { font-size: 15px; }
  input, select { font-size: 16px; }          /* iOS zooms into anything smaller */
  button { min-height: 40px; }
  .top { padding: 8px 12px; gap: 8px; }
  .top h1 { font-size: 15px; }
  .tabs { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs button { flex: none; }
  .who > span { display: none; }
  main { padding: 12px; }
  .grid { grid-template-columns: 1fr; }
  .pc .acts button { padding: 8px 12px; font-size: 14px; }
  .split .card { padding: 12px; }
  .split > #detail { display: none; }
  .split.open > :first-child { display: none; }
  .split.open > #detail { display: block; }
  .back { display: inline-block; margin-bottom: 12px; border: 0; background: none; padding: 0; color: var(--accent); }
  .list { max-height: none; }
  .stats { gap: 16px; }
  .topup .row > label.grow { flex-basis: 100%; }
  .method button { padding: 8px 14px; }
  th, td { padding: 6px; font-size: 13px; }
  dialog { padding: 16px; }
}
@media (min-width: 520px) and (max-width: 700px) { .grid { grid-template-columns: 1fr 1fr; } }

/* ---- modules ---------------------------------------------------------------- */
.pill.on { color: var(--good); border-color: var(--good); }
.mods, .tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mod, .tier { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 6px; background: var(--panel-2); }
.mod .head { display: flex; justify-content: space-between; align-items: center; }
.mod .acts { display: flex; gap: 6px; margin-top: 4px; }
.bar { height: 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; margin: 6px 0; }
.bar span { display: block; height: 100%; background: var(--accent); }
.bar.warn span { background: var(--warn); }
.bar.full span { background: var(--bad); }
.switch { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
.listbar .num.err { color: var(--bad); }
.issues { display: grid; gap: 6px; }
.issue { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.issue.critical, .issue.serious { border-color: #7f1d1d; }
.pill.bad { color: var(--bad); border-color: var(--bad); }
ul.plain { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; font-size: 13px; }
button.linkish { border: 0; background: none; padding: 0; color: var(--accent); min-height: 0; }
.op { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; grid-template-rows: auto 1fr; }
.op-bar { display: flex; gap: 14px; align-items: center; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.op-bar button { margin-left: auto; }
.op-stage { display: grid; place-items: center; overflow: hidden; }
.op-video { max-width: 100%; max-height: 100%; aspect-ratio: 16 / 9; width: 100%; background: #000; cursor: pointer; outline: none; }
