/* Hippynet design system tokens (Hippynet/design-system, tokens.json); system fonts, so no
   third-party requests. */
:root {
  --bg: #f9fafb; --surface: #fff; --alt: #f3f4f6; --line: #e5e7eb; --line-strong: #d1d5db;
  --ink: #111827; --muted: #6b7280; --subtle: #9ca3af; --navy: #0f172a;
  --primary: #2563eb; --primary-hover: #1d4ed8; --primary-wash: rgba(37, 99, 235, 0.08);
  --ok: #15803d; --ok-bg: rgba(34, 197, 94, 0.10);
  --warn: #92400e; --warn-mark: #d97706; --warn-bg: #fef3c7;
  --bad: #b91c1c; --bad-mark: #dc2626; --bad-bg: rgba(220, 38, 38, 0.08);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1a; --surface: #0f172a; --alt: #1e293b; --line: #1e293b; --line-strong: #334155;
    --ink: #e2e8f0; --muted: #94a3b8; --subtle: #64748b; --navy: #020617;
    --primary: #60a5fa; --primary-hover: #93c5fd; --primary-wash: rgba(96, 165, 250, 0.12);
    --ok: #4ade80; --ok-bg: rgba(74, 222, 128, 0.12);
    --warn: #fbbf24; --warn-mark: #f59e0b; --warn-bg: rgba(245, 158, 11, 0.14);
    --bad: #f87171; --bad-mark: #ef4444; --bad-bg: rgba(239, 68, 68, 0.14);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font);
       -webkit-font-smoothing: antialiased; }
main { max-width: 1440px; margin: 0 auto; padding: 28px 16px 40px; display: grid; gap: 20px;
       grid-template-columns: minmax(0, 1fr); }  /* wide tables scroll inside, not the page */
h1 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.85em; }
code { background: var(--alt); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.muted, .note, .sub, small { color: var(--muted); }
.small, .sub, small { font-size: 0.82rem; }
.sub, small { display: block; }
.strong { font-weight: 600; }

/* Header and footer */
.top { background: var(--navy); color: #fff; }
.top-in { max-width: 1440px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap;
          align-items: center; gap: 8px 24px; }
.brand { color: #fff; font-weight: 700; letter-spacing: -0.01em; }
.brand:hover { color: #fff; text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: 2px; }
nav a { color: #cbd5e1; padding: 6px 10px; border-radius: 6px; font-size: 0.9rem; }
nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); text-decoration: none; }
nav a[aria-current] { color: #fff; background: rgba(255, 255, 255, 0.14); }
.who { margin-left: auto; color: #cbd5e1; font-size: 0.9rem; display: flex; gap: 10px; align-items: center; }
.who .link { color: #fff; }
.foot { max-width: 1440px; margin: 0 auto; padding: 0 16px 32px; color: var(--subtle); font-size: 0.8rem; }

/* Dashboard */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.page-head p { margin-top: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 16px 18px; display: grid; gap: 2px; }
.tile-n { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-l { color: var(--muted); font-size: 0.88rem; }
.tile.warn { border-color: var(--warn-mark); background: var(--warn-bg); }
.tile.warn .tile-l { color: var(--warn); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input { flex: 0 1 320px; }
.spacer { flex: 1; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
         overflow-x: auto; }
.panel > h2 { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.count { font-weight: 500; color: var(--muted); margin-left: 4px; }
.admin-link { float: right; font-size: 0.85rem; font-weight: 500; }  /* Hippynet admins only */
/* Streaming and AutoPod side by side; one above the other on narrower screens. */
.columns { display: grid; gap: 20px; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .columns { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.columns th, .columns td { padding: 9px 12px; }
.columns .panel > h2 { padding: 14px 12px; }
.panel > p { padding: 14px 18px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 18px; vertical-align: middle; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
     font-weight: 600; white-space: nowrap; background: var(--alt); }
td { border-top: 1px solid var(--line); }
tbody tr:hover td { background: var(--primary-wash); }
tr.off td { color: var(--muted); }
/* One station's streams on both servers: a bar down the left, joined without a full rule. */
tr.linked td:first-child { box-shadow: inset 3px 0 var(--primary); }
tr.joined td { border-top: 1px dashed var(--line); }
.sorted tr.joined td { border-top-style: solid; }
/* Sortable headings (the script turns each into a button) */
th .sort { all: unset; cursor: pointer; }
th .sort:hover { color: var(--ink); }
th .sort:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
th[aria-sort=ascending] .sort::after { content: " ▲"; }
th[aria-sort=descending] .sort::after { content: " ▼"; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list .name { font-weight: 600; color: var(--ink); }
.id { display: block; font-family: var(--mono); font-size: 0.75rem; color: var(--subtle); }
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* Status and usage */
.pill { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
        background: var(--alt); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.info { background: var(--primary-wash); color: var(--primary); }
.sub.higher { color: var(--warn); font-weight: 600; }  /* more than it's set up (and sold) for */
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.usage { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.85rem;
         font-variant-numeric: tabular-nums; }
.usage progress { width: 70px; }
progress { appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px;
           background: var(--alt); color: var(--primary); }
progress::-webkit-progress-bar { background: var(--alt); border-radius: 3px; }
progress::-webkit-progress-value { background: currentColor; border-radius: 3px; }
progress::-moz-progress-bar { background: currentColor; border-radius: 3px; }
.warn progress { color: var(--warn-mark); }
.bad progress { color: var(--bad-mark); }
.toast { background: var(--ok-bg); color: var(--ink); padding: 10px 14px; border-radius: 8px; }
.error { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: 8px; }

/* Sign-in */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
        display: grid; gap: 10px; min-width: 0; }
.narrow { max-width: 420px; margin: 40px auto 0; width: 100%; }

/* Forms */
label { display: grid; gap: 4px; font-size: 0.85rem; font-weight: 600; }
input, select { font: inherit; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
                background: var(--surface); color: var(--ink); min-width: 0; height: 38px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px; }
button, .button { font: inherit; font-weight: 600; font-size: 0.92rem; padding: 8px 14px; border: 0;
                  border-radius: 8px; background: var(--primary); color: #fff; cursor: pointer;
                  justify-self: start; display: inline-block; }
button:hover, .button:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
button.quiet, .button.quiet { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
button.quiet:hover, .button.quiet:hover { background: var(--alt); color: var(--ink); }
button.link { background: none; padding: 0; font-weight: 500; text-decoration: underline; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.actions { display: flex; gap: 6px; }
