:root {
  --bg: #F9FAFB;
  --surface: #FFFFFF;
  --surface-2: #F3F4F6;
  --surface-3: #E5E7EB;
  --ink: #111827;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --line: #E5E7EB;
  --line-2: #D1D5DB;
  --accent: #059669;
  --accent-soft: #D1FAE5;
  --red: #DC2626;
  --red-soft: #FEE2E2;
  --good: #059669;
  --good-soft: #D1FAE5;
  --hm-low: #E5E7EB;
  --hm-high: #059669;
  --r-xl: 32px;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .035);
  --toolbar-surface: rgba(255, 255, 255, .78);
  --sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0F0B1A;
  --surface: #161224;
  --surface-2: #211C32;
  --surface-3: #2C2640;
  --ink: #FFFFFF;
  --muted: rgba(255, 255, 255, .7);
  --faint: rgba(255, 255, 255, .45);
  --line: rgba(255, 255, 255, .10);
  --line-2: rgba(255, 255, 255, .16);
  --accent: #A78BFA;
  --accent-soft: rgba(167, 139, 250, .15);
  --red: #F87171;
  --red-soft: rgba(248, 113, 113, .15);
  --good: #34D399;
  --good-soft: rgba(52, 211, 153, .15);
  --hm-low: #211C32;
  --hm-high: #A78BFA;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  --toolbar-surface: rgba(22, 18, 36, .74);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  letter-spacing: -0.011em;
  transition: background .25s ease, color .25s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font-family: inherit;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 132px;
}

@media(max-width:560px) {
  .wrap {
    padding: 20px 16px 150px;
  }
}

/* ── header ───────────────────────────────── */
header.top {
  position: sticky;
  top: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 28px;
  padding: 12px 14px 12px 18px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--toolbar-surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

/* the header floats above the page, so it carries the page background with it
   to keep the sliver of content above it from peeking through the gap */
header.top::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -15px;
  left: -24px;
  right: -24px;
  height: 15px;
  background: var(--bg);
  pointer-events: none;
}


.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--ink);
  color: var(--surface);
  display: grid;
  place-items: center;
}

[data-theme="dark"] .mark {
  background: #FFF;
  color: #141414;
}

.mark svg {
  width: 18px;
  height: 18px;
}

.wordmark {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.035em;
  margin: 0;
  line-height: 1.1;
}

.brand .sub {
  font-size: 13px;
  color: var(--faint);
  margin: 2px 0 0;
  text-transform: lowercase;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}

.nav-link {
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  transition: .18s;
  font-weight: 500;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.nav-link.active {
  background: var(--ink);
  color: var(--surface);
}

[data-theme="dark"] .nav-link.active {
  background: #FFF;
  color: #141414;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: .18s;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

[data-theme="light"] .icon-btn .moon {
  display: block;
}

[data-theme="light"] .icon-btn .sun {
  display: none;
}

[data-theme="dark"] .icon-btn .moon {
  display: none;
}

[data-theme="dark"] .icon-btn .sun {
  display: block;
}

.role-badge {
  font-size: 12px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 500;
}

.role-badge.admin {
  color: var(--red);
  background: var(--red-soft);
}

.role-badge.client {
  color: var(--accent);
  background: var(--accent-soft);
}

@media(max-width:640px) {
  header.top {
    margin-bottom: 22px;
  }

  .top-controls {
    width: 100%;
    justify-content: space-between;
  }

  .nav {
    flex: 1 1 auto;
    justify-content: center;
  }

  .nav-link {
    padding: 8px 12px;
  }

  .role-badge {
    display: none;
  }
}

/* ── cards ────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px 26px;
  margin-bottom: 16px;
}

@media(max-width:560px) {
  .panel {
    padding: 20px 18px;
  }

  .hero {
    padding: 24px 20px !important;
  }

  .auth {
    padding: 18px;
  }
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.015em;
  text-transform: lowercase;
}

.panel-head .hint {
  font-size: 12px;
  color: var(--faint);
  text-transform: lowercase;
}

.panel-head .legend,
.sec-head .legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--faint);
  text-transform: lowercase;
  letter-spacing: 0;
}

.legend .scale {
  display: inline-flex;
  gap: 4px;
}

.legend .scale i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
}

/* ── auth ─────────────────────────────────── */
.auth {
  padding: 26px;
  margin-bottom: 22px;
}

.auth-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

@media(max-width:560px) {
  .auth-row>.btn {
    flex: 1 1 auto;
  }
}

.search {
  position: relative;
  flex: 1 1 380px;
  min-width: 220px;
}

.search .ico {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
  display: flex;
}

.search input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  padding: 15px 20px 15px 50px;
  outline: none;
  transition: .18s;
}

.search input::placeholder {
  color: var(--faint);
}

.search input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  padding: 14px 24px;
  border-radius: 999px;
  cursor: pointer;
  transition: .18s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
}

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

[data-theme="dark"] .btn.primary {
  background: #FFF;
  border-color: #FFF;
  color: #141414;
}

.btn.primary:hover {
  opacity: .86;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn.sm {
  padding: 10px 18px;
  font-size: 13px;
}

.btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
}

.auth-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.auth-meta .who {
  font-family: var(--mono);
  color: var(--ink);
  font-size: 12.5px;
}

.fresh {
  font-size: 12px;
  color: var(--faint);
}

.status {
  margin-top: 16px;
  font-size: 13.5px;
  border-radius: var(--r-md);
  padding: 14px 18px;
  display: none;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.6;
}

.status.show {
  display: flex;
}

.status.err {
  background: var(--red-soft);
  color: var(--red);
}

.status.warn {
  background: #FBEBDE;
  color: #B9691F;
}

[data-theme="dark"] .status.warn {
  background: rgba(222, 146, 85, .14);
  color: #DE9255;
}

.status.ok {
  background: var(--good-soft);
  color: var(--good);
}

.status .x {
  margin-left: auto;
  cursor: pointer;
  color: inherit;
  opacity: .55;
  background: none;
  border: none;
  font-size: 17px;
  line-height: 1;
  padding: 0;
}

.status .x:hover {
  opacity: 1;
}

.status code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(0, 0, 0, .06);
  padding: 2px 6px;
  border-radius: 6px;
}

[data-theme="dark"] .status code {
  background: rgba(255, 255, 255, .10);
}

#dash {
  display: none;
}

#dash.on {
  display: block;
}

.view {
  display: none;
}

.view.on {
  display: block;
}

/* This page also loads dashboard-v2.css, which is written for the admin shell:
   there panels are spaced by a grid gap, so its `.panel` rule zeroes the bottom
   margin — and being the later sheet at equal specificity, it won every panel on
   this page too, leaving the stacked cards touching. The client layout states
   its own spacing here at a specificity that does not depend on load order. */
#clientView>.card,
#clientView>.stats,
#clientView>.grid2 {
  margin-bottom: 16px;
}

#clientView>.card:last-child {
  margin-bottom: 0;
}

/* ── stats ────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media(max-width:820px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media(max-width:480px) {
  .stats {
    grid-template-columns: 1fr;
  }
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.stat .label {
  font-size: 12.5px;
  color: var(--faint);
  font-weight: 500;
  text-transform: lowercase;
}

.stat .val {
  font-size: 27px;
  font-weight: 500;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  color: var(--ink);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.stat .val.long {
  font-size: 20px;
  letter-spacing: -0.02em;
}

.stat.danger .val {
  color: var(--red);
}

.stat.accent .val {
  color: var(--accent);
}

.stat .sub {
  font-size: 12px;
  color: var(--faint);
  margin-top: 8px;
  text-transform: lowercase;
}

/* ── hero ─────────────────────────────────── */
.hero {
  padding: 32px 34px;
  margin-bottom: 16px;
}

.hero .eyebrow {
  font-size: 12.5px;
  color: var(--faint);
  font-weight: 500;
  text-transform: lowercase;
  display: block;
  margin-bottom: 14px;
}

.hero .readout {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.hero .big {
  font-size: 60px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
  color: var(--ink);
  line-height: 1;
}

.hero .unit {
  font-size: 15px;
  color: var(--faint);
  text-transform: lowercase;
}

.hero .ctx {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.hero .kv .lbl {
  font-size: 12px;
  color: var(--faint);
  font-weight: 500;
  text-transform: lowercase;
  display: block;
}

.hero .kv .v {
  font-size: 14px;
  color: var(--ink);
  margin-top: 6px;
  display: block;
}

/* ── bars ─────────────────────────────────── */
.grid2 {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media(max-width:920px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 82px;
  align-items: center;
  gap: 16px;
}

.bar-row .nm {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}

.bar-row .v {
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.bar-row .v b {
  color: var(--ink);
  font-weight: 500;
}

.more {
  font-size: 12px;
  color: var(--faint);
  text-align: center;
  padding: 8px;
  text-transform: lowercase;
}

@media(max-width:560px) {
  .bar-row {
    grid-template-columns: 1fr auto;
    row-gap: 8px;
  }

  .bar-row .nm {
    order: 1;
  }

  .bar-row .v {
    order: 2;
  }

  .bar-row .bar-track {
    order: 3;
    grid-column: 1 / -1;
  }
}

#cDailyChart {
  width: 100%;
  height: 190px;
  display: block;
}

.axis-label {
  font-size: 11px;
  fill: var(--faint);
  font-family: var(--sans);
}

.heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 6px;
}

#cHeatmap {
  display: block;
  margin: 0 auto;
}

.hm-cell {
  cursor: pointer;
}

.hm-cell circle {
  transition: r .35s cubic-bezier(.2, .8, .2, 1), fill .35s ease;
}

.hm-cell:hover circle,
.hm-cell.selected circle {
  stroke: #050505;
  stroke-width: 2.5;
  stroke-opacity: .92;
}

.hm-day {
  font-size: 11px;
  fill: var(--muted);
}

.hm-hour {
  font-size: 10px;
  fill: var(--faint);
}

.hm-month {
  font-size: 11px;
  fill: var(--muted);
}

.hm-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hm-controls .seg button {
  padding: 7px 13px;
  font-size: 12px;
}

.hm-foot {
  font-size: 12.5px;
  color: var(--faint);
  margin-top: 14px;
  text-align: center;
  text-transform: lowercase;
}

.hm-foot b {
  color: var(--muted);
  font-weight: 500;
}

@media(max-width:640px) {
  .hm-controls {
    width: 100%;
  }

  .hm-controls .legend {
    display: none;
  }
}

.qrow {
  display: grid;
  grid-template-columns: 58px 1fr 230px;
  align-items: center;
  gap: 16px;
  padding: 11px 0;
}

.qrow .ql {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.qrow .qt {
  height: 8px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}

.qrow .qf {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.qrow .qf.bad {
  background: var(--red);
}

.qrow .qv {
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.qrow .qv b {
  color: var(--ink);
  font-weight: 500;
}

@media(max-width:560px) {
  .qrow {
    grid-template-columns: 52px 1fr;
    row-gap: 6px;
  }

  .qrow .qv {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* ── table ────────────────────────────────── */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 13px;
  min-width: 640px;
}

.tbl th {
  padding: 0 14px 6px;
  text-align: left;
  font-size: 12px;
  color: var(--faint);
  font-weight: 500;
  text-transform: lowercase;
}

.tbl td {
  padding: 15px 14px;
  text-align: left;
  background: var(--surface-2);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
}

.tbl td:first-child {
  border-radius: var(--r-md) 0 0 var(--r-md);
}

.tbl td:last-child {
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

.tbl td.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.tbl td b {
  color: var(--ink);
  font-weight: 500;
}

.tbl tbody tr {
  transition: .18s;
}

.tbl tbody tr:hover td {
  background: var(--surface-3);
}

.tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 500;
}

.tag.good {
  color: var(--good);
  background: var(--good-soft);
}

.tag.bad {
  color: var(--red);
  background: var(--red-soft);
}

#tip {
  position: fixed;
  pointer-events: none;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  font-size: 12.5px;
  z-index: 50;
  opacity: 0;
  transition: opacity .14s;
  transform: translate(-50%, -130%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

[data-theme="dark"] #tip {
  background: #FFF;
  color: #141414;
}

#tip.on {
  opacity: 1;
}

#tip .t-title {
  font-weight: 500;
  margin-bottom: 4px;
}

#tip .t-row {
  opacity: .75;
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

#tip .t-row b {
  opacity: 1;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ── page title ───────────────────────────── */
.page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 4px 2px 20px;
}

.page-title h2 {
  font-size: 54px;
  font-weight: 300;
  letter-spacing: -0.05em;
  margin: 0;
  line-height: 1;
  text-transform: lowercase;
}

.page-title .who {
  font-size: 13px;
  color: var(--faint);
  margin-top: 10px;
  font-family: var(--mono);
}

.title-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  font-size: 12.5px;
  padding: 10px 17px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 500;
  text-transform: lowercase;
}

.pill.solid {
  background: var(--ink);
  color: var(--surface);
}

[data-theme="dark"] .pill.solid {
  background: #FFF;
  color: #141414;
}

.pill.warn {
  background: var(--red-soft);
  color: var(--red);
}

@media(max-width:560px) {
  .page-title h2 {
    font-size: 40px;
  }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* ── section blocks ───────────────────────── */
.sec {
  margin-bottom: 26px;
}

.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.sec-label {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

.sec-note {
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}

.sec-note b {
  color: var(--muted);
  font-weight: 500;
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0 0 26px;
}

/* ── hero split ───────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 34px;
  align-items: end;
}

@media(max-width:820px) {
  .split {
    grid-template-columns: 1fr;
    gap: 26px;
    align-items: stretch;
  }
}

.split .readout-lg {
  align-self: center;
}

.readout-lg .eyebrow {
  font-size: 12.5px;
  color: var(--faint);
  font-weight: 500;
  text-transform: lowercase;
  display: block;
  margin-bottom: 16px;
}

.readout-lg .big {
  font-size: 64px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
  line-height: 1;
}

@media(max-width:560px) {
  .readout-lg .big {
    font-size: 46px;
  }
}

.kpis {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

@media(max-width:820px) {
  .kpis {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 22px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}

.kpi .k {
  font-size: 12px;
  color: var(--faint);
  text-transform: lowercase;
  display: block;
}

.kpi .v {
  font-size: 20px;
  font-weight: 400;
  margin-top: 5px;
  display: block;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ── metrics row ──────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

@media(max-width:700px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.metric .k {
  font-size: 12px;
  color: var(--faint);
  text-transform: lowercase;
  display: block;
}

.metric .v {
  font-size: 27px;
  font-weight: 300;
  margin-top: 8px;
  display: block;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
}

.metric .v small {
  font-size: 12px;
  color: var(--faint);
  font-weight: 400;
  margin-left: 3px;
  letter-spacing: 0;
}

.metric.danger .v {
  color: var(--red);
}

.metric .v.long {
  font-size: 17px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.delta {
  font-size: 12px;
  margin-top: 8px;
  display: block;
  color: var(--good);
  font-variant-numeric: tabular-nums;
}

.delta.down {
  color: var(--red);
}

.delta.flat {
  color: var(--faint);
}

.delta i {
  font-style: normal;
  margin-right: 4px;
}

.delta span {
  color: var(--faint);
  margin-left: 6px;
}

/* ── ranked list ──────────────────────────── */
.rank {
  display: flex;
  flex-direction: column;
}

.rank-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.rank-row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.rank-row .no {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  padding-top: 2px;
}

.rank-row .top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.rank-row .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-row .amt {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
}

.rank-row .amt b {
  color: var(--ink);
  font-weight: 500;
}

.rank-row .bar-track {
  margin-top: 10px;
  height: 6px;
}

.rank-row .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ── dual bars (p50 / p95) ────────────────── */
.dual {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dual .d-row .top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.dual .d-row .lab {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

.dual .d-line {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.dual .bar-track {
  height: 6px;
}

.bar-fill.soft {
  opacity: .42;
}

.bar-fill.bad {
  background: var(--red);
}

/* ── key rows ─────────────────────────────── */
.keyrow {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.keyrow:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.keyrow .top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.keyrow .nm b {
  font-weight: 500;
}

.keyrow .nm .quiet {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11.5px;
  margin-left: 6px;
}

.keyrow .amt {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.keyrow .amt b {
  color: var(--ink);
  font-weight: 500;
}

.keyrow .bar-track {
  margin-top: 11px;
  height: 6px;
}

.keyrow .meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  margin-top: 9px;
}

.quiet {
  color: var(--faint);
}

.chart-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  margin-top: 10px;
}

/* ── floating dock ────────────────────────── */
.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06), 0 14px 40px rgba(0, 0, 0, .10);
  font-size: 12.5px;
  color: var(--muted);
  max-width: calc(100vw - 32px);
}

.dock .when {
  color: var(--ink);
}

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
}

.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: .18s;
  font-weight: 500;
}

.seg button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

[data-theme="dark"] .seg button.active {
  background: var(--surface-3);
}

.seg button:hover:not(.active) {
  color: var(--ink);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  display: none;
}

.switch .track {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  transition: .2s;
}

.switch .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  transition: .2s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.switch input:checked+.track {
  background: var(--accent);
}

.switch input:checked+.track .knob {
  left: 19px;
}

.dot-sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-2);
  flex: 0 0 auto;
}

@media(max-width:640px) {
  .dock {
    border-radius: var(--r-lg);
    bottom: 12px;
    padding: 12px;
  }

  .dock .status-txt {
    display: none;
  }
}

.spin {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: -2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty {
  text-align: center;
  color: var(--faint);
  font-size: 13.5px;
  padding: 44px 16px;
  line-height: 1.75;
}

.empty b {
  color: var(--muted);
  font-weight: 500;
}

.quiet {
  color: var(--faint);
}

.hide {
  display: none !important;
}

.rise {
  animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

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


.client-logs-panel .tbl {
  min-width: 760px;
}

.client-logs-panel .tbl td:last-child {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.client-logs-head {
  align-items: center;
}

.client-log-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.client-log-actions select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 8px 12px;
  max-width: 180px;
}

.client-log-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  color: var(--faint);
  font-size: 12px;
}

.client-log-pager .btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

@media(max-width:640px) {
  .client-log-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .client-log-actions select {
    flex: 1 1 130px;
    max-width: none;
  }
}


.client-alerts {
  display: none;
  gap: 8px;
  margin: -4px 0 16px;
}

.client-alert {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 14px;
  font-size: 12.5px;
  line-height: 1.45;
}

.client-alert.warn {
  color: var(--warn, #B9691F);
  background: rgba(222, 146, 85, .10);
  border-color: rgba(222, 146, 85, .28);
}

.client-alert.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 28%, var(--line));
}

/* ---- operator announcements ----
   The one block on this page whose content did not come from the client's own
   traffic, so it is set apart: a coloured edge carries the severity, and the
   card never borrows the stat panels' chrome. */
.client-broadcasts {
  display: none;
  gap: 10px;
  margin: 0 0 18px;
}

.broadcast {
  position: relative;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: var(--r-md);
  background: var(--card, transparent);
  padding: 12px 14px;
}

.broadcast.pinned {
  box-shadow: 0 1px 0 var(--line);
}

.broadcast-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.broadcast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.broadcast-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.broadcast-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}

.broadcast-date {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
}

.broadcast-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 5px;
}

.broadcast-x:hover {
  color: var(--fg);
}

.broadcast-body {
  margin: 7px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
}

.broadcast.info {
  color: var(--accent);
  border-left-color: var(--accent);
}

.broadcast.success {
  color: var(--good);
  border-left-color: var(--good);
  background: var(--good-soft);
}

.broadcast.warning {
  color: var(--warn, #B9691F);
  border-left-color: var(--warn, #B9691F);
  background: rgba(222, 146, 85, .10);
}

.broadcast.critical {
  color: var(--red);
  border-left-color: var(--red);
  background: var(--red-soft);
}

.client-health-panel {
  margin-bottom: 16px;
}

.client-health-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.client-health-row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.client-health-name,
.client-health-meta {
  display: flex;
  align-items: center;
  gap: 9px;
}

.client-health-name {
  justify-content: space-between;
  font-size: 13.5px;
}

.client-health-name b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-health-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 7px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.client-health-row .bar-track {
  margin-top: 10px;
  height: 5px;
}

.client-health-row .bar-fill.bad {
  background: var(--red);
}


.client-integration-panel {
  margin-bottom: 16px;
}

.integration-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.integration-meta > div {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12.5px;
}

.integration-label {
  color: var(--faint);
  text-transform: lowercase;
}

.integration-meta code,
.integration-note code {
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
}

.integration-meta select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 8px 12px;
  max-width: 250px;
}

.integration-snippets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.snippet-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}

.snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.snippet-card pre {
  margin: 0;
  padding: 13px;
  min-height: 112px;
  overflow-x: auto;
  color: var(--muted);
  font: 11.5px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.integration-note {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 12px;
}

@media(max-width:720px) {
  .integration-snippets {
    grid-template-columns: 1fr;
  }
  .integration-meta > div {
    width: 100%;
    justify-content: space-between;
  }
  .integration-meta select {
    max-width: 65%;
  }
}

.daily-point { cursor: pointer; }
.daily-point circle { transition: r .16s ease, opacity .16s ease, stroke .12s ease; }
.daily-point .daily-request-dot { opacity: .75; }
.daily-point.selected .daily-token-dot,
.daily-point.selected .daily-request-dot { stroke: #050505; stroke-width: 2.5; stroke-opacity: .92; }
.chart-axis-label { fill: var(--faint); font: 10px var(--mono); }
.chart-key { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: var(--accent); }
.chart-key.request { background: var(--good); }

/* ── announcement answers ─────────────────── */
.broadcast-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 11px;
}

.broadcast-hint,
.broadcast-answered {
  font-size: 11.5px;
  color: var(--muted);
}

.broadcast-answered {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* A checkmark, not an empty circle: sitting under a list of poll options, a
   ring reads as one more option nobody has picked. */
.broadcast-answered::before {
  content: "✓";
  font-size: 12px;
  line-height: 1;
  color: var(--good);
  flex: none;
}

.broadcast-poll {
  display: grid;
  gap: 6px;
  margin-top: 11px;
}

/* Poll options are radio buttons in everything but markup: one answer at a
   time, changeable, and the chosen one has to be legible without relying on
   colour alone — hence the filled mark as well as the border. */
.poll-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.poll-option:hover:not(:disabled) {
  border-color: var(--muted);
}

.poll-option:disabled {
  opacity: .6;
  cursor: progress;
}

.poll-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2, var(--line));
  flex: none;
  position: relative;
}

.poll-option.chosen {
  border-color: currentColor;
  font-weight: 550;
}

.poll-option.chosen .poll-mark {
  border-color: currentColor;
}

.poll-option.chosen .poll-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: currentColor;
}

/* ── key wallet ───────────────────────────── */
.auth-remember {
  margin-top: 12px;
}

.key-wallet {
  margin-bottom: 16px;
}

.wallet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.wallet-chip {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-pill, 999px);
  overflow: hidden;
}

.wallet-chip.active {
  border-color: var(--accent);
}

.wallet-chip-main {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.wallet-chip.active .wallet-chip-main {
  color: var(--accent);
  font-weight: 550;
}

.wallet-chip-active,
.wallet-chip-state {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.wallet-chip-edit,
.wallet-chip-x {
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 10px;
  font: inherit;
  font-size: 11px;
}

.wallet-chip-x {
  font-size: 15px;
  line-height: 1;
}

.wallet-chip-edit:hover,
.wallet-chip-x:hover {
  color: var(--ink);
}

.wallet-add,
.wallet-rename {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.wallet-add input,
.wallet-rename input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}

.wallet-add input:focus,
.wallet-rename input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.wallet-status {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
  min-height: 15px;
}

.wallet-status.err {
  color: var(--red);
}

.wallet-status.ok {
  color: var(--good);
}
