/* Operator dashboard. Denser than the customer portal on purpose: this is
   scanned and operated at a desk, not read on a phone. */
:root {
  --bg: #0e1218;
  --surface: #161b23;
  --surface-2: #1c222c;
  --line: #262d38;
  --ink: #e5e9f0;
  --muted: #8a94a4;
  --accent: #4f8cff;
  --ok: #4fbf95;
  --warn: #e0a272;
  --bad: #ff7a7a;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eff2f6;
    --line: #dce1e9;
    --ink: #161a22;
    --muted: #626d7e;
    --accent: #2f5fe0;
    --ok: #0e7a56;
    --warn: #a8501a;
    --bad: #c0392b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---- chrome ---- */

.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 7px; }
.tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px;
}
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a {
  color: var(--muted); text-decoration: none; font-size: 14px;
  padding: 5px 10px; border-radius: 6px;
}
.topbar nav a:hover { color: var(--ink); background: var(--surface-2); }
.topbar nav a.on { color: var(--ink); background: var(--surface-2); font-weight: 600; }
.who { display: flex; align-items: center; gap: 12px; font-size: 13px; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
main.narrow { max-width: 400px; }

h1 { font-size: 21px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0 0 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.attention { color: var(--warn); }
.dim { opacity: .55; }

/* ---- surfaces ---- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; margin: 16px 0;
}
details.card > summary {
  cursor: pointer; font-weight: 600; font-size: 14px;
  margin: -18px; padding: 18px; list-style-position: inside;
}
details.card[open] > summary { margin-bottom: 8px; border-bottom: 1px solid var(--line); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.card { padding: 0; overflow: hidden; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); font-weight: 600;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ---- stat tiles ---- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 3px;
}
.tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tile .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--muted); }
/* State is encoded in form as well as number, so what needs attention reads at
   a glance rather than requiring the figure to be interpreted. */
.tile.attention { border-color: var(--warn); }
.tile.attention .v { color: var(--warn); }

dl.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0; }
dl.kv div { margin: 0; }
dl.kv dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
dl.kv dd { margin: 3px 0 0; font-variant-numeric: tabular-nums; }

/* ---- forms ---- */

label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; }
input, select {
  width: 100%; font: inherit; padding: 8px 10px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.grid .span { grid-column: 1 / -1; }
.inlineform { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.inlineform input, .inlineform select { width: auto; flex: 1; min-width: 140px; }
.inline { display: inline; }

button {
  font: inherit; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 7px; padding: 8px 14px;
}
button:hover { border-color: var(--muted); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.danger { color: var(--bad); }
.linkish { background: none; border: none; color: var(--muted); padding: 0; font-size: 13px; }
.linkish:hover { color: var(--ink); }

.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); margin: 0; }
.check input { width: auto; }
.scopes { display: flex; flex-wrap: wrap; gap: 10px 18px; }

a { color: var(--accent); }

/* ---- bits ---- */

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px; background: var(--surface-2);
  border-radius: 4px; padding: 2px 6px; word-break: break-all;
}

.pill {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.bad { color: var(--bad); border-color: var(--bad); }
.pill.warn { color: var(--warn); border-color: var(--warn); }

.flash {
  padding: 10px 14px; border-radius: 8px; margin: 0 0 16px;
  border: 1px solid var(--line); font-size: 14px;
}
.flash.ok { border-color: var(--ok); color: var(--ok); }
.flash.error { border-color: var(--bad); color: var(--bad); }

.reveal { border-color: var(--accent); }
.copyrow { display: flex; gap: 8px; align-items: stretch; }
.copyrow code { flex: 1; padding: 9px 11px; }

ul.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }

footer {
  display: flex; justify-content: space-between;
  max-width: 1080px; margin: 0 auto; padding: 18px 20px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12px;
}

@media (max-width: 640px) {
  .topbar { height: auto; padding: 10px 14px; }
  main { padding: 16px 14px 48px; }
  /* Tables carry more columns than a phone fits; let them scroll rather than
     squeezing the page. */
  table.card { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* sales: payments queue, balances, plan list */
.badge {
  display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px;
  border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 600;
}
.tabs { display: flex; gap: 4px; margin: 0 0 12px; }
.tabs a {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px;
  color: var(--muted); text-decoration: none; font-size: 14px;
}
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.big { font-size: 32px; font-weight: 600; margin: 4px 0 18px; }
td.ok { color: var(--ok); }
td.bad { color: var(--bad); }
form.topup input { width: 7em; padding: 2px 6px; }
details.card summary .pill { margin-left: 6px; }

/* TrxIDs and phone numbers are read digit by digit; never break them. */
td code { white-space: nowrap; word-break: normal; }
