/* RunHotz provider console. A quiet, dashboard-style back office: near-black
   surfaces with hairline borders (light, dark or the system's choice, set by
   console-theme.js as data-theme on <html>), sans-serif
   text with tabular figures, monospace only for identifiers, and RunHotz pink
   used sparingly for focus and what an operator chose.

   Fonts: Geist is used when installed locally; the console's CSP is
   same-origin only, so no web fonts are fetched and the stack falls back to
   the platform UI font. */
:root {
  color-scheme: dark;

  /* Dark (default). */
  --bg: #0a0a0a;
  --bg-2: #000;
  --panel: #111;
  --panel-2: #1a1a1a;
  --hover: #1f1f1f;
  --line-soft: #1f1f1f;
  --line: #2a2a2a;
  --line-strong: #3a3a3a;
  --text: #ededed;
  --text-2: #c9c9c9;
  --muted: #a1a1a1;
  --faint: #8f8f8f;
  --link: #ededed;

  --accent: #ff4d9e;
  --accent-text: #ff6aae;
  --accent-bg: rgb(255 61 149 / 12%);
  --accent-line: rgb(255 61 149 / 45%);
  --focus: #ff4d9e;
  --focus-ring: rgb(255 61 149 / 28%);

  --primary-bg: #ededed;
  --primary-text: #0a0a0a;
  --primary-hover: #fff;

  --ok: #4ade80;
  --ok-bg: rgb(74 222 128 / 10%);
  --ok-line: rgb(74 222 128 / 28%);
  --warn: #fbbf24;
  --warn-bg: rgb(251 191 36 / 10%);
  --warn-line: rgb(251 191 36 / 28%);
  --bad: #ff6b6b;
  --bad-bg: rgb(255 107 107 / 10%);
  --bad-line: rgb(255 107 107 / 30%);
  --info: #60a5fa;
  --info-bg: rgb(96 165 250 / 10%);

  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-lg: 0 16px 48px rgb(0 0 0 / 55%);
  --backdrop: rgb(0 0 0 / 70%);

  --radius: 10px;
  --radius-sm: 6px;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 240px;

  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
}

/* Light. console-theme.js resolves "system" to light or dark. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --bg-2: #fff;
  --panel: #fff;
  --panel-2: #f4f4f4;
  --hover: #f2f2f2;
  --line-soft: #eaeaea;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --text: #171717;
  --text-2: #2e2e2e;
  --muted: #616161;
  --faint: #6b6b6b;
  --link: #171717;

  --accent: #e0287a;
  --accent-text: #c2185f;
  --accent-bg: rgb(224 40 122 / 8%);
  --accent-line: rgb(224 40 122 / 40%);
  --focus: #e0287a;
  --focus-ring: rgb(224 40 122 / 20%);

  --primary-bg: #171717;
  --primary-text: #fff;
  --primary-hover: #383838;

  --ok: #15803d;
  --ok-bg: #ecfdf3;
  --ok-line: #b7ebc9;
  --warn: #a15c00;
  --warn-bg: #fff7e6;
  --warn-line: #f6d9a0;
  --bad: #c62828;
  --bad-bg: #fff1f1;
  --bad-line: #f5c2c2;
  --info: #0b62d6;
  --info-bg: #eef5ff;

  --shadow: 0 1px 2px rgb(0 0 0 / 5%);
  --shadow-lg: 0 16px 48px rgb(0 0 0 / 14%);
  --backdrop: rgb(0 0 0 / 35%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;
}

h1, h2, h3, h4, p { margin-top: 0; }
p { margin-bottom: 0; }
h1 { margin-bottom: .3rem; font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 1rem; font-weight: 600; letter-spacing: -.015em; }
h3 { margin-bottom: 0; font-size: .92rem; font-weight: 600; letter-spacing: -.01em; }
h4 { margin-bottom: .5rem; font-size: .85rem; font-weight: 600; }
h1:focus { outline: none; }
a { color: var(--link); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; text-decoration-color: var(--muted); }
code { font-family: var(--mono); font-size: .85em; overflow-wrap: anywhere; color: var(--text-2); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -3rem; z-index: 30; padding: .45rem .8rem; border-radius: var(--radius-sm); background: var(--primary-bg); color: var(--primary-text); font-weight: 500; }
.skip-link:focus { top: .6rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: .8rem; }
.accent-text { color: var(--accent-text); font-weight: 500; }
.warn-text { color: var(--warn); font-weight: 500; }
.positive { color: var(--ok); }
.negative { color: var(--bad); }
.zero { color: var(--muted); }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100vh; }
body.signed-in .shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem .75rem;
  border-right: 1px solid var(--line-soft);
  background: var(--bg);
  overflow-y: auto;
}
.sidebar[hidden] { display: none; }

.brand { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: var(--radius-sm); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-copy { display: flex; align-items: baseline; gap: .55rem; line-height: 1.1; }
.wordmark { display: inline-flex; align-items: baseline; white-space: nowrap; font: italic 800 1rem/1 var(--sans); }
.brand-name { color: var(--text); letter-spacing: -.04em; }
.brand-bolt { display: block; flex: none; width: .83em; height: 1.15em; margin-left: -.1em; transform: translateY(.17em); }
.brand-text { padding-left: .55rem; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: .78rem; font-weight: 500; }

.nav { display: grid; gap: 1px; }
.nav a, .operator-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 34px;
  padding: .35rem .55rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  transition: background-color .12s, color .12s;
}
.nav a:hover, .operator-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"], .operator-nav a[aria-current="page"] { background: var(--panel-2); color: var(--text); }
.nav-icon { width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid currentColor; opacity: .75; }
.nav-icon.catalog { border-radius: 50%; }
.nav-icon.operators { border-radius: 50% 50% 3px 3px; }
.nav-icon.rounds { border-radius: 50%; border-style: dashed; }
.nav-icon.activity { border-width: 0 0 1.5px 1.5px; border-radius: 0; }
.nav-icon.system { border-radius: 4px; box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 4px currentColor; }
.nav a[aria-current="page"] .nav-icon { border-color: var(--accent); opacity: 1; }

.nav-section { display: grid; gap: .25rem; min-height: 0; }
.nav-label { padding: 0 .55rem; color: var(--faint); font-size: .72rem; font-weight: 500; }
.operator-nav { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.operator-nav a { font-size: .86rem; }
.op-nav-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-nav-count { color: var(--faint); font-size: .75rem; font-variant-numeric: tabular-nums; }
.dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.dot.live { background: var(--ok); }
.dot.off { background: var(--warn); }

.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem .4rem 0; border-top: 1px solid var(--line-soft); }
.server-host { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-family: var(--mono); font-size: .7rem; }
.who { min-width: 0; display: grid; gap: .1rem; }
.signed-in-as { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: .8rem; font-weight: 500; }
.signed-in-as:empty { display: none; }
.sidebar-foot .who { flex: 1; }
.theme-switch { display: inline-flex; flex: none; height: 28px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.theme-switch button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--faint); }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.theme-switch svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

main { min-width: 0; padding: 2.5rem clamp(1rem, 3.5vw, 3rem) 5rem; }
main:focus { outline: none; }
#view { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
#view[hidden] { display: none; }

/* -------------------------------------------------------------- sign in */
.signin { min-height: calc(100vh - 7.5rem); display: grid; place-items: center; }
.signin[hidden] { display: none; }
.signin-card {
  width: min(100%, 400px);
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.signin-card h1 { font-size: 1.4rem; letter-spacing: -.03em; }
.signin-card .eyebrow { margin-bottom: .4rem; }
.signin-card .lede { margin-bottom: 1.5rem; font-size: .86rem; }
.signin-card form { display: grid; gap: .6rem; }
.signin-card form + form { margin-top: 1rem; }
.signin-card form > button, .signin-card form > .button-row { margin-top: .25rem; }
.signin-card label { font-size: .8rem; font-weight: 500; color: var(--text-2); }
.signin-card input + label, .signin-card .field + .field { margin-top: .35rem; }
.signin-card .status:empty { min-height: 0; }
.signin-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.75rem; }
.signin-brand .wordmark { font-size: 1.25rem; }
/* A one-time code or similar short secret: big, spaced and centred. */
input[autocomplete="one-time-code"], input.code {
  font: 500 1.15rem var(--mono);
  letter-spacing: .35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.button-row > button { flex: 1 1 auto; }

/* ------------------------------------------------------------- controls */
/* One control height per density: --control-h is 36px on the sign-in card
   and 32px inside the app and its dialogs, so every button, input, select,
   segmented control and pill of a toolbar shares one height and baseline. */
#view, dialog, .sidebar { --control-h: 32px; }

button, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  flex: none;
  height: var(--control-h, 36px);
  min-height: 0;
  max-width: 100%;
  padding: 0 .85rem;
  border: 1px solid var(--primary-bg);
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  color: var(--primary-text);
  font: 500 .8125rem/1 var(--sans);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s, opacity .12s;
}
button:hover, a.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; }
button:disabled { opacity: .5; cursor: progress; }
button.wide { width: 100%; height: 40px; }
button.ghost, a.btn.ghost { border-color: var(--line-strong); background: var(--panel); color: var(--text); }
button.ghost:hover, a.btn.ghost:hover { border-color: var(--muted); background: var(--hover); }
button.danger, a.btn.danger { border-color: #c62828; background: #c62828; color: #fff; }
button.danger:hover { border-color: #a61f1f; background: #a61f1f; }
button.ghost.danger-text { color: var(--bad); }
button.small-btn { height: 28px; padding: 0 .65rem; font-size: .75rem; }
button.link-btn { height: auto; min-height: 24px; padding: 0 .25rem; border: 0; background: none; color: var(--text-2); font-weight: 500; font-size: .8rem; }
button.link-btn:hover { background: none; color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
button.link-btn.danger { color: var(--bad); }
button.copy { height: 24px; padding: 0 .5rem; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .72rem; }
button.copy:hover { border-color: var(--line-strong); color: var(--text); background: var(--hover); }
button.icon-btn { width: var(--control-h); padding: 0; font-size: 1.1rem; }
.button-group { display: inline-flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }

input, select {
  width: 100%;
  height: var(--control-h, 36px);
  min-height: 0;
  padding: 0 .7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: .8125rem var(--sans);
  transition: border-color .12s, box-shadow .12s;
}
select { padding-right: 1.8rem; text-overflow: ellipsis; }
input[type="password"], input[type="date"] { font-family: var(--mono); font-size: .78rem; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input::placeholder { color: var(--faint); opacity: 1; }
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
input[aria-invalid="true"] { border-color: var(--bad); }
input[type="color"] { height: 40px; padding: 3px; background: var(--panel); cursor: pointer; }

.segmented { display: inline-flex; flex: none; align-items: center; height: var(--control-h, 36px); padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented button { height: 100%; padding: 0 .65rem; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: .78rem; }
.segmented button:hover { background: var(--hover); color: var(--text); }
.segmented button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

.status { min-height: 1.2em; color: var(--muted); font-size: .8rem; }
.status.error { color: var(--bad); }
.hint { color: var(--muted); font-size: .8rem; }
.field { display: grid; gap: .35rem; align-content: start; min-width: 0; }
.field[hidden] { display: none; }
.field label { font-size: .8rem; font-weight: 500; color: var(--text-2); }
.field-error { min-height: 0; color: var(--bad); font-size: .76rem; }
.field-error:empty { display: none; }

/* Single-line text: truncated with an ellipsis, the full text in title. */
.trunc { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strong { font-weight: 500; color: var(--text); }
.mono { font-family: var(--mono); font-size: .78rem; }
code.id { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow-wrap: normal; }
.nowrap { white-space: nowrap; }

/* -------------------------------------------------------------- toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; }
.toolbar > input, .toolbar > select { width: auto; flex: 0 1 180px; min-width: 120px; }
.toolbar > input.search { flex: 1 1 240px; }
.toolbar > input.search.wide { flex-basis: 420px; }
.toolbar > input.ccy-input { flex: 0 0 104px; min-width: 0; }
.toolbar .toolbar-actions { display: inline-flex; gap: .5rem; margin-left: auto; }
.date-range { display: inline-flex; flex: 0 1 auto; align-items: center; gap: .35rem; min-width: 0; }
.date-range input { width: 138px; min-width: 0; padding: 0 .45rem; }
.toolbar + * { margin-top: 1rem; }

/* ------------------------------------------------------------ page head */
.eyebrow { margin-bottom: .45rem; color: var(--muted); font-size: .75rem; font-weight: 500; letter-spacing: .02em; }
.lede { max-width: 62ch; color: var(--muted); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line-soft); }
.page-title { min-width: 0; flex: 1 1 320px; }
.page-title h1 { margin-bottom: .35rem; }
.head-tools, .head-badges { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.id-line { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; color: var(--muted); }
.id-line code { overflow-wrap: anywhere; }
.crumbs { display: flex; align-items: center; gap: .5rem; min-width: 0; color: var(--muted); font-size: .82rem; font-weight: 500; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }

.badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 20px;
  padding: 0 .5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: .7rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.badge.ok { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok); }
.badge.warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.badge.violet { border-color: var(--accent-line); background: var(--accent-bg); color: var(--accent-text); }
.badge.ext { border-color: transparent; background: var(--info-bg); color: var(--info); }
.badge.int { background: var(--panel-2); color: var(--text-2); }

.avatar { display: inline-grid; flex: none; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: linear-gradient(135deg, var(--panel-2), var(--hover)); color: var(--text); font-size: .8rem; font-weight: 600; }

/* ---------------------------------------------------------------- kpis */
/* One bordered strip; cells are separated by hairlines drawn with
   box-shadow so any column count (and a short last row) stays clean. */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.kpi { min-width: 0; padding: 1rem 1.15rem 1.1rem; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.kpi-label { margin-bottom: .4rem; color: var(--muted); font-size: .78rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { overflow: hidden; font-size: 1.5rem; font-weight: 600; letter-spacing: -.035em; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.kpi-note { margin-top: .2rem; overflow: hidden; color: var(--muted); font-size: .76rem; white-space: nowrap; text-overflow: ellipsis; }
.kpi-money-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 .8rem; min-width: 0; }
.kpi-money-row + .kpi-money-row { margin-top: .25rem; }
.ccy { margin-left: .1em; color: var(--muted); font-size: .72em; font-weight: 500; letter-spacing: 0; }
.money { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- sections */
.section { min-width: 0; container-type: inline-size; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; min-height: var(--control-h); margin-bottom: .85rem; }
.section-head h2 { flex: none; }
.section-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; min-width: 0; }
.section-head > .muted.small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; min-height: 28px; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line-soft); }
.panel { min-width: 0; padding: 1.25rem 1.4rem 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); container-type: inline-size; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: -.1rem 0 1rem; }
.panel-head h2 { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 1rem; align-items: start; }

.empty { padding: 1.6rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty-title { margin-bottom: .2rem; color: var(--text); font-weight: 500; }
.error-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; padding: .75rem 1rem; border: 1px solid var(--bad-line); border-radius: var(--radius); background: var(--bad-bg); color: var(--bad); }
.error-box p { min-width: 0; overflow-wrap: anywhere; }
.loading { display: flex; align-items: center; gap: .6rem; padding: 1.2rem 0; color: var(--muted); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--text); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } * { transition: none !important; } }
.more { display: flex; justify-content: center; margin-top: .9rem; }
.more:has(> [hidden]:only-child) { display: none; }

/* ---------------------------------------------------------------- health */
.health { display: flex; align-items: stretch; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.health-item { display: flex; flex: 1 1 0; align-items: center; gap: .6rem; min-width: 0; padding: .7rem 1rem; box-shadow: 1px 0 0 var(--line); }
.health-text { display: grid; min-width: 0; }
.health-label { overflow: hidden; color: var(--muted); font-size: .72rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.health-value { overflow: hidden; font-size: .85rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.health-link { display: flex; flex: none; align-items: center; padding: 0 1rem; color: var(--muted); font-size: .8rem; font-weight: 500; white-space: nowrap; }
.health-link:hover { color: var(--text); text-decoration: none; background: var(--hover); }
.health:not(.compact) { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.health:not(.compact) .health-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; row-gap: .15rem; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.health:not(.compact) .health-note { grid-column: 2; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.status-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.status-dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }

/* ----------------------------------------------------- operator rows */
/* The Vercel project list: one 56px line per operator. Columns drop out
   as the list narrows (container queries), never wrap. */
.rows { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; container-type: inline-size; }
.row + .row { border-top: 1px solid var(--line-soft); }
.row-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 112px 100px 150px 96px 16px;
  align-items: center;
  gap: 1rem;
  height: 56px;
  padding: 0 1rem;
  color: var(--text);
  transition: background-color .1s;
}
.row-link:hover { background: var(--hover); text-decoration: none; }
.row-main { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.row-title { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }
.row-sub { flex: none; }
.row-cell { display: flex; align-items: center; gap: .3rem; min-width: 0; overflow: hidden; white-space: nowrap; font-size: .82rem; }
.row-cell.num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.c-last { color: var(--muted); justify-content: flex-end; text-overflow: ellipsis; }
.cell-label { color: var(--faint); font-size: .72rem; }
.chevron { color: var(--faint); font-size: 1.1rem; line-height: 1; text-align: right; }
@container (max-width: 820px) {
  .row-link { grid-template-columns: minmax(0, 1fr) 88px 100px 140px 16px; }
  .row-link .c-wallet, .row-link .c-last { display: none; }
}
@container (max-width: 560px) {
  .row-link { grid-template-columns: minmax(0, 1fr) auto 16px; gap: .75rem; }
  .row-link .c-rounds, .row-link .c-ggr, .row-link .row-sub { display: none; }
}

/* -------------------------------------------------------------- tables */
/* Dense single-line tables. Columns marked p2 / p3 hide as the
   container narrows; on phones the table may scroll inside its frame. */
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); container-type: inline-size; }
table.data, table.plain { width: 100%; border-collapse: collapse; font-size: .8125rem; font-variant-numeric: tabular-nums; }
table.data th { height: 36px; padding: 0 .75rem; border-bottom: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: .74rem; font-weight: 500; text-align: left; white-space: nowrap; }
table.data td { height: 44px; max-width: 280px; padding: 0 .75rem; border-bottom: 1px solid var(--line-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
table.data td > .trunc, table.data td > .link-btn.trunc { max-width: 240px; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background-color .1s; }
table.data tbody tr:hover td { background: var(--hover); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tr.dim td { color: var(--muted); }
table.data .num { text-align: right; }
/* A cell with a second, muted line ("changed by X · 2 h ago"). */
.cell-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 4px 0; }
table.data .num .cell-stack { align-items: flex-end; }
.cell-sub { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.limit-line { display: inline-flex; align-items: center; gap: .35rem; }
.rtp-selects { display: inline-flex; flex-wrap: wrap; gap: 4px; }
select.rtp-select { height: 28px; max-width: 8.5rem; padding-left: .5rem; font-size: .78rem; }
select.rtp-select.assigned { border-color: var(--accent-line); color: var(--accent-text); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.timeline-meta .actor { min-width: 0; overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
table.data td.actions, table.data th.actions { width: 1%; text-align: right; }
/* Figures and actions are never clipped: on a phone the table scrolls in
   its frame instead. */
table.data td.num, table.data td.actions { max-width: none; overflow: visible; text-overflow: clip; }
table.data td.actions > * { vertical-align: middle; }
table.data td .badge, table.data td .rtp-pill { vertical-align: middle; }
table.data .player-won, .player-won { color: var(--text); font-weight: 600; }
table.data td > button.link-btn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; padding: 0; }
@container (max-width: 760px) { table.data .p3 { display: none; } }
@container (max-width: 560px) { table.data .p2 { display: none; } }
.verify-link { white-space: nowrap; }
.verify-link code { color: var(--text-2); }
.verify-link:hover code { color: var(--text); }
.code-block { max-height: 220px; margin: 0; padding: .75rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); font: .76rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------------------------------------------------------- game tiles */
.game-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; margin: 0; padding: 0; list-style: none; }
.game-tile { min-width: 0; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--bg); }
.game-tile.active { border-color: var(--line); background: var(--panel); }
.game-tile.off { opacity: .7; }
.tile-link { display: grid; gap: .3rem; padding: .6rem .75rem; color: var(--text); }
.tile-link:hover { text-decoration: none; background: var(--hover); border-radius: 8px; }
.tile-top { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.tile-name { flex: 1 1 auto; font-weight: 500; font-size: .84rem; }
.tile-play { overflow: hidden; color: var(--muted); font-size: .78rem; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tile-play .positive { color: var(--ok); }
.tile-play .negative { color: var(--bad); }
.more-pill { flex: none; color: var(--faint); font-size: .7rem; }

.rtp-pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: .3rem;
  height: 20px;
  padding: 0 .45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rtp-pill.assigned { border-color: var(--accent-line); background: var(--accent-bg); color: var(--accent-text); }
.rtp-pill.broken { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.rtp-pill .scope { color: var(--muted); font-size: .9em; }

/* ------------------------------------------------------------ operator */
.op-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.op-ident { display: flex; align-items: center; gap: .9rem; min-width: 0; flex: 1 1 320px; }
.op-ident .avatar { width: 44px; height: 44px; font-size: 1.05rem; }
.op-ident-text { min-width: 0; }
.op-ident-text h1 { margin-bottom: .25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: .25rem; margin-top: -1rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; flex: none; align-items: center; height: 44px; padding: 0 .7rem; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-size: .84rem; font-weight: 500; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { border-bottom-color: var(--text); color: var(--text); }
.tab-body { display: grid; gap: 2rem; min-width: 0; }

.settings-card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; container-type: inline-size; }
.settings-card.danger { border-color: var(--bad-line); }
.settings-body { display: grid; gap: .75rem; padding: 1.25rem 1.4rem; }
.settings-body > h2 { font-size: 1rem; }
.settings-body > p.muted { max-width: 80ch; font-size: .85rem; }
.settings-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; min-height: 56px; padding: .6rem 1.4rem; border-top: 1px solid var(--line); background: var(--bg); }
.settings-card.danger .settings-foot { border-top-color: var(--bad-line); background: var(--bad-bg); }
.settings-foot > :last-child:not(p) { margin-left: auto; }
.settings-foot > p { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-line { display: flex; align-items: center; gap: .5rem; }

.detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.detail-title { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1 1 200px; }
.detail-title strong { font-size: 1rem; }
.detail-actions button.copy { height: var(--control-h); padding: 0 .75rem; font-size: .8rem; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.detail-card, .player-card { padding: 1.25rem 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.player-card .kpis { margin-bottom: .75rem; }
.dl { display: grid; margin: 0; }
.dl-row { display: grid; grid-template-columns: minmax(110px, 35%) minmax(0, 1fr); align-items: center; gap: 1rem; min-height: 36px; border-bottom: 1px solid var(--line-soft); }
.dl-row:last-child { border-bottom: 0; }
.dl dt { overflow: hidden; color: var(--muted); font-size: .8rem; white-space: nowrap; text-overflow: ellipsis; }
.dl dd { display: flex; align-items: center; gap: .4rem; min-width: 0; margin: 0; overflow: hidden; font-size: .84rem; white-space: nowrap; }
.outcome { margin-top: 1rem; }

/* ------------------------------------------------------------ RTP cards */
.rtp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: .75rem; }
.rtp-card { display: grid; gap: .8rem; align-content: start; min-width: 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.rtp-card.assigned { border-color: var(--accent-line); }
.rtp-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.rtp-card-title { min-width: 0; }
.rtp-current { flex: none; font-size: 1.6rem; font-weight: 600; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.rtp-current small { margin-left: 2px; color: var(--muted); font-size: .5em; letter-spacing: 0; }
.rtp-card.assigned .rtp-current { color: var(--accent-text); }
.rtp-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.rtp-option { height: 28px; padding: 0 .25rem; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font: 500 .78rem var(--sans); font-variant-numeric: tabular-nums; }
.rtp-option:hover { background: var(--hover); color: var(--text); border: 0; }
.rtp-option.current, .rtp-option.current:hover { background: var(--primary-bg); color: var(--primary-text); cursor: default; }
.rtp-card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem; margin: -.3rem -.25rem -.2rem; }
.overrides { display: grid; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.overrides li { display: flex; align-items: center; gap: .5rem; min-width: 0; height: 32px; padding: 0 .5rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--bg); font-size: .8rem; }
.overrides code { flex: 1 1 auto; }
.overrides .link-btn { margin-left: auto; }
.override-value { flex: none; font-weight: 600; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.ccy-tag { flex: none; padding: 0 .35rem; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); color: var(--muted); font-family: var(--mono); font-size: .68rem; font-weight: 500; line-height: 1.6; }

/* ------------------------------------------------------------- origins */
.origins { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.origins li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 0; height: 40px; padding: 0 .5rem 0 .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.origins code { color: var(--text); font-size: .82rem; }

/* ------------------------------------------------------------ timeline */
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: .8rem; padding: 0 0 .9rem; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline-dot { width: 11px; height: 11px; margin-top: 4px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--panel); }
.timeline-dot.on { border-color: var(--accent); }
.timeline-body { min-width: 0; }
.timeline-what { display: flex; align-items: center; gap: .5rem; min-width: 0; color: var(--text); }
.timeline-what strong { flex: 0 1 auto; font-weight: 500; }
.timeline-what code { flex: 0 1 auto; color: var(--accent-text); }
.timeline-meta { display: flex; align-items: center; gap: .4rem; min-width: 0; color: var(--muted); font-size: .76rem; white-space: nowrap; }
.timeline-meta > a, .timeline-meta .reason { flex: 0 1 auto; }
.timeline-meta code { flex: none; }
.kind-tag { flex: none; height: 18px; padding: 0 .4rem; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: .66rem; font-weight: 500; line-height: 16px; text-transform: uppercase; letter-spacing: .03em; }

/* -------------------------------------------------------------- catalog */
.catalog { display: grid; gap: 1rem; }
.game-card h2 { font-size: 1.02rem; }
.game-id { flex: none; color: var(--muted); font-family: var(--mono); font-size: .72rem; font-weight: 400; }
.rtp-line { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.game-card > p.small { margin-top: .6rem; }
.versions { margin-top: 1rem; }
.versions .table-scroll + .table-scroll { margin-top: .8rem; }
.versions summary { cursor: pointer; color: var(--muted); font-size: .84rem; font-weight: 500; }
.versions summary:hover { color: var(--text); }
.versions[open] summary { margin-bottom: .7rem; }

/* --------------------------------------------------------------- dialog */
dialog {
  width: min(calc(100% - 2rem), 460px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
.dialog-body { display: grid; gap: .9rem; padding: 1.5rem; }
.dialog-body h2 { font-size: 1.15rem; letter-spacing: -.02em; }
#change-text, #secret-text { color: var(--muted); }
.dialog-fields { display: grid; gap: .8rem; }
#change-extra:empty { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin: .4rem -1.5rem -1.5rem; padding: .85rem 1.5rem; border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; background: var(--bg); }
.secret-dialog { width: min(calc(100% - 2rem), 560px); }
.secret-box { display: flex; align-items: center; gap: .5rem; min-width: 0; padding: .6rem .6rem .6rem .8rem; border: 1px solid var(--warn-line); border-radius: var(--radius-sm); background: var(--warn-bg); }
.secret-box code { flex: 1 1 auto; min-width: 0; color: var(--text); font-size: .78rem; overflow-wrap: anywhere; user-select: all; }

/* The round drawer slides in from the right on wide screens and fills the
   screen on phones. */
dialog.drawer { width: min(100%, 520px); max-width: 100%; height: 100%; max-height: 100%; margin: 0 0 0 auto; border-width: 0 0 0 1px; border-radius: 0; }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: .75rem; height: 56px; padding: 0 1rem 0 1.25rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.drawer-head h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-content { padding: 1.25rem; }

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 40;
  max-width: min(420px, calc(100% - 2.4rem));
  padding: .75rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast.ok { border-color: var(--ok-line); }
.toast.warn { border-color: var(--warn-line); }

/* ------------------------------------------- operator colours, accounting */
.theme-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 1.25rem; align-items: start; }
.theme-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.theme-preview { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); }
@container (max-width: 640px) { .theme-layout { grid-template-columns: minmax(0, 1fr); } }

.accounting-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; margin-top: 1rem; }
.accounting-body > * { min-width: 0; }
.accounting-body h4 { margin: .5rem 0 0; color: var(--muted); font-size: .78rem; font-weight: 500; }
.acct-currency .sub-head { margin-top: 0; padding-top: 0; border-top: 0; margin-bottom: .6rem; }
.acct-currency .kpi-value { font-size: 1.2rem; }
.accounting-body > .toolbar + * { margin-top: 0; }
.section > .hint { margin-top: .75rem; }

/* ----------------------------------------------------------- responsive */
@media (max-width: 860px) {
  body.signed-in .shell { display: block; }
  .sidebar {
    position: sticky;
    z-index: 20;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    overflow: visible;
  }
  .brand { padding: .25rem .25rem .25rem 0; }
  .brand-text { display: none; }
  .nav { order: 4; display: flex; flex: 1 0 100%; gap: .1rem; margin: 0 -1rem; padding: 0 1rem; overflow-x: auto; scrollbar-width: none; }
  .nav a { flex: none; min-height: 32px; padding: .3rem .6rem; }
  .nav-icon { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .server-host { display: none; }
  .signed-in-as { display: none; }
  .nav-section { order: 5; flex: 1 0 100%; margin: 0 -1rem; padding: 0 1rem; }
  .nav-label { display: none; }
  .operator-nav { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .1rem; scrollbar-width: none; }
  .operator-nav a { min-height: 28px; padding: .15rem .65rem; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; white-space: nowrap; }
  .op-nav-name { overflow: visible; }
  main { padding: 1.5rem 1rem 3rem; }
  .signin { min-height: calc(100vh - 4.5rem); }
  .health { flex-wrap: wrap; }
  .health.compact .health-item { flex: 1 1 45%; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
  .health-link { flex: 1 1 100%; height: 36px; justify-content: center; }
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
  #view { gap: 1.5rem; }
  .page-head { align-items: flex-start; padding-bottom: 1.1rem; }
  .head-tools { width: 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: .8rem .9rem; }
  .kpi.wide { grid-column: 1 / -1; }
  .kpi-value { font-size: 1.2rem; }
  .panel, .detail-card, .player-card { padding: 1rem; }
  .settings-body { padding: 1rem; }
  .settings-foot { flex-wrap: wrap; padding: .6rem 1rem; }
  .game-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signin-card { padding: 1.5rem 1.25rem; }
  .dialog-actions button { flex: 1; }
  .theme-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar > input, .toolbar > select, .toolbar > input.search { flex: 1 1 100%; }
  .date-range { flex: 1 1 100%; }
  .date-range input { flex: 1 1 0; width: auto; }
  .toolbar .toolbar-actions { margin-left: 0; }
  .health.compact .health-item { flex-basis: 50%; padding: .6rem .8rem; }
  .op-ident .avatar { width: 36px; height: 36px; }
  .dl-row { grid-template-columns: minmax(90px, 38%) minmax(0, 1fr); }
}
