/* CBA-76 -- the shared look of every page of the Stripchat console: tokens (light and dark), the app shell, and the components.
   A copy of the Chaturbate console's app.css (chaturbate-unofficial-api, dev, commit 9c310fe), without the chart, bar and Docs parts.
   No build step, no external font or library. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;       /* inset / hover wash */
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;           /* axis labels, placeholders: never body text */
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --ring: rgba(37, 106, 191, 0.45);
  --accent: #2a78d6;
  --accent-text: #1c5cab;     /* links and active nav on the light surface */
  --accent-wash: rgba(42, 120, 214, 0.10);
  --btn: #256abf;
  --btn-hover: #1c5cab;
  --btn-ink: #ffffff;
  --good: #0ca30c;  --good-text: #006300;
  --warn: #fab219;  --warn-text: #8a5a00;
  --serious: #ec835a; --serious-text: #a4421a;
  --crit: #d03b3b;  --crit-text: #b02b2b;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --seq-100: #cde2fb; --seq-250: #86b6ef; --seq-400: #3987e5; --seq-550: #1c5cab; --seq-700: #0d366b;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 8px 24px rgba(11, 11, 11, 0.06);
  --radius: 10px; --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 248px;
  --topbar-h: 52px;           /* the top bar's height: sticky things below it and scroll-margin-top use it */

  /* The names the pages that existed before the shell were written against. */
  --bg: var(--page); --panel: var(--surface); --panel-border: var(--line);
  --text: var(--ink); --tip: var(--warn-text); --notice: var(--ink-2); --error: var(--crit-text); --ok: var(--good-text);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #242423;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --line: #2c2c2a; --line-strong: #383835;
    --ring: rgba(85, 152, 231, 0.55);
    --accent: #3987e5; --accent-text: #6da7ec; --accent-wash: rgba(57, 135, 229, 0.14);
    --btn: #256abf; --btn-hover: #2a78d6;
    --good-text: #0ca30c; --warn-text: #fab219; --serious-text: #ec835a; --crit-text: #ec6a6a;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #242423;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --line: #2c2c2a; --line-strong: #383835;
  --ring: rgba(85, 152, 231, 0.55);
  --accent: #3987e5; --accent-text: #6da7ec; --accent-wash: rgba(57, 135, 229, 0.14);
  --btn: #256abf; --btn-hover: #2a78d6;
  --good-text: #0ca30c; --warn-text: #fab219; --serious-text: #ec835a; --crit-text: #ec6a6a;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
p { margin: 0 0 10px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
pre { margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: auto; line-height: 1.55; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
::selection { background: var(--accent-wash); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
.muted { color: var(--ink-2); }
.dim { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 0 12px 24px; overflow-y: auto; scrollbar-width: thin; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; height: var(--topbar-h); margin: 0 -12px 8px; padding: 0 20px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }   /* same height as the top bar, so the two rules line up */
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--btn); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-weight: 650; letter-spacing: -0.01em; line-height: 1.15; }
.brand-name small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12px; letter-spacing: 0; }
.nav-section { margin: 18px 0 4px; padding: 0 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--accent-wash); color: var(--accent-text); }
.nav-link.disabled { cursor: default; color: var(--ink-2); flex-wrap: wrap; row-gap: 0; }   /* a page that waits for its route: visible, not a link */
.nav-link.disabled:hover { background: transparent; color: var(--ink-2); }
.nav-link.disabled > svg, .nav-link.disabled > .nav-text { opacity: 0.7; }
.nav-link .nav-note { flex-basis: 100%; margin-left: 27px; font-size: 12px; font-weight: 400; color: var(--ink-2); }
.nav-link svg { width: 17px; height: 17px; flex: none; opacity: 0.9; }
.nav-link .ext { margin-left: auto; opacity: 0.6; width: 13px; height: 13px; }
/* A View-only (User) key hides every write control, wherever it was rendered --
   including rows built after the role was resolved, since this is a plain CSS rule. */
body.role-user [data-admin], body.role-unknown [data-admin] { display: none !important; }
.main { min-width: 0; }

/* the top bar: always visible; Blur, Theme and the connection chip live on its right */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .title { display: none; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .menu-btn { display: none; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.conn-chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; margin-left: 6px; padding: 0 12px 0 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--page); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.conn-chip:hover { background: var(--surface-2); }
.conn-chip.bad { border-color: color-mix(in srgb, var(--crit) 55%, transparent); }
.conn-chip .dot, .conn-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.conn-chip.ok .dot, .conn-status.ok .dot { background: var(--good); }
.conn-chip.bad .dot, .conn-status.bad .dot { background: var(--crit); }
.conn-chip.warn .dot, .conn-status.warn .dot { background: var(--warn); }
.page { padding: 28px 32px 56px; max-width: 1320px; margin: 0 auto; }
.scrim { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); transform: translateX(-102%); visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s; box-shadow: var(--shadow); }   /* hidden while shut, so Tab skips it */
  .app.nav-open .sidebar { transform: none; visibility: visible; transition: transform .18s ease, visibility 0s; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 25; }
  .topbar { padding: 0 12px; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar .title { display: block; }
  .page { padding: 18px 16px 48px; }
}
@media (max-width: 520px) {
  .conn-chip { width: 32px; padding: 0; justify-content: center; margin-left: 2px; }
  .conn-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* the dot stays; the words stay for screen readers */
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } * { animation: none !important; } }

/* ---------------------------------------------------------------- page header + layout helpers */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 70ch; }
.crumbs { font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }   /* minmax(0,..): a wide child must not stretch the track */
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.flush { margin: 0; }

/* ---------------------------------------------------------------- cards, stats */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 0; }
.card-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.card-body { padding: 14px 16px 16px; }
.card-flush { padding: 0; overflow: hidden; }
.stat { padding: 14px 16px; }
.stat .label { font-size: 12.5px; color: var(--ink-2); }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; margin-top: 2px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.stat .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.stat .spark { margin-top: 8px; height: 28px; }
.hero .value { font-size: 48px; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.btn.primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 9px; font-size: 13px; border-radius: 6px; }
.btn svg { width: 15px; height: 15px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.input, .select, textarea.input { width: 100%; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.input::placeholder { color: var(--muted); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.select { width: auto; padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.field { display: grid; gap: 4px; }
.field > label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 32px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 500; padding: 4px 11px; border-radius: 6px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip[aria-pressed="true"], .chip.on { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-text); }
.tag { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 12px; line-height: 20px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .search { min-width: 220px; flex: 0 1 320px; }

/* ---------------------------------------------------------------- badges and status (always icon/label + color) */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px; border: 1px solid var(--line-strong); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.badge.good { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 45%, transparent); } .badge.good::before { background: var(--good); }
.badge.warn { color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 55%, transparent); } .badge.warn::before { background: var(--warn); }
.badge.serious { color: var(--serious-text); border-color: color-mix(in srgb, var(--serious) 55%, transparent); } .badge.serious::before { background: var(--serious); }
.badge.crit { color: var(--crit-text); border-color: color-mix(in srgb, var(--crit) 55%, transparent); } .badge.crit::before { background: var(--crit); }
.badge.info { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 50%, transparent); } .badge.info::before { background: var(--accent); }
.badge.plain::before { display: none; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card-flush .table-wrap { border: 0; border-radius: 0; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th { position: sticky; top: 0; z-index: 1; text-align: left; padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface); border-bottom: 1px solid var(--line-strong); white-space: nowrap; user-select: none; }
table.t th.num { text-align: right; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--ink); }
table.t th .arrow { margin-left: 4px; opacity: 0.5; font-size: 10px; }
table.t th[aria-sort] .arrow { opacity: 1; color: var(--accent-text); }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.open td { background: var(--accent-wash); }
table.t td.wrap, table.t th.wrap { white-space: normal; }
table.t .sub { display: block; font-size: 12px; color: var(--ink-2); }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; }

/* ---------------------------------------------------------------- states */
.empty { display: grid; place-items: center; text-align: center; gap: 6px; padding: 36px 16px; color: var(--ink-2); }
.empty svg { width: 28px; height: 28px; color: var(--muted); }
.empty b { color: var(--ink); font-weight: 600; }
.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); font-size: 13.5px; }
.notice.warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.notice.crit { border-color: color-mix(in srgb, var(--crit) 55%, transparent); background: color-mix(in srgb, var(--crit) 8%, var(--surface)); }
.notice.info { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-wash); }
.skel { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; min-height: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.loading { opacity: 0.55; transition: opacity .15s; pointer-events: none; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 80; }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--page); font-size: 13.5px; box-shadow: var(--shadow); max-width: 360px; }
.toast.bad { background: var(--crit); color: #fff; }

/* ---------------------------------------------------------------- dialog (the connection dialog) */
.pop-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 70; display: grid; place-items: center; padding: 16px; }
.pop { width: min(440px, 100%); max-height: 100%; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; display: grid; gap: 12px; }
.pop h2 { font-size: 17px; }
.conn-dialog { gap: 14px; }
.conn-status { display: flex; align-items: flex-start; gap: 9px; }
.conn-status .dot { margin-top: 6px; }
.conn-status b { font-weight: 600; }
.conn-server { display: grid; gap: 2px; }
.conn-server .label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.conn-host { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.key-row { display: flex; align-items: center; gap: 6px; }
.key-row .input { flex: 1; min-width: 0; }
@media (max-height: 480px) { .conn-dialog { gap: 10px; padding: 14px; } }
@media (max-width: 520px) {
  .pop-back { align-items: start; padding: 10px; }   /* near the top, so the on-screen keyboard does not cover the field */
  .conn-dialog .input { font-size: 16px; }
}

/* ---------------------------------------------------------------- misc */
.blur { filter: blur(14px); transition: filter .15s; }
.blur:hover { filter: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; }
@media print { .sidebar, .topbar, .scrim, .toasts, .pop-back { display: none !important; } .app { display: block; } .page { padding: 0; max-width: none; } }

/* ---------------------------------------------------------------- blur for screen sharing (the eye button in the top bar) */
:root[data-blur="on"] .sensitive { filter: blur(6px); transition: filter .12s; }
:root[data-blur="on"] .sensitive:hover { filter: none; }
@media print { :root[data-blur="on"] .sensitive { filter: blur(6px); } }
