/*
 * Admin — framed sheet (taste-skill app style "framed-sheet", seed 63407443).
 * The sidebar and the 48px top bar share one tinted frame; the work sits on a white sheet
 * inset 8px from the right and bottom edges, 1px edge, 16px corners, no shadow.
 * Colour lives on data and status only; the one filled action is near-black.
 *
 * Grid arithmetic (1440 wide): 228 sidebar + 1204 sheet + 8 inset = 1440.
 * Inside the sheet: 24 padding each side → 1156 content; Bootstrap row g-4 (24 gutter):
 * 4 × 271 + 3 × 24 = 1156 · 2 × 566 + 24 = 1156 · 754 + 24 + 378 = 1156 (col-8 / col-4).
 */

:root {
  --ground: #f6f8f9;      /* the frame: a blue-grey step for an observability tool */
  --surface: #ffffff;
  --raised: #f4f6f8;
  --active: #e8ebed;
  --border: #e6e9eb;
  --rule: #eff1f2;
  --control: #cdced1;
  --text: #131416;
  --muted: #5d5f60;
  --faint: #6b6d6e;
  --primary: #131416;
  --accent: #1b6c80;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --warning: #92400e;
  --chart-1: #1b6c80;
  --chart-2: #2f70bb;
  --chart-3: #a86f0c;
  --chart-muted: #c9ced2;
  --grid: #e8eaec;
  --axis-ink: #5d5f60;
  --ink: #131416;
  --chart-span: 0.06;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;  --pill-warning-ink: #92400e;
  --pill-neutral-bg: #ebedee;  --pill-neutral-ink: #353736;

  --radius-sheet: 16px;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-field: 8px;
  --sheet-inset: 8px;
  --sidebar-width: 228px;
  --topbar: 48px;
  --gap: 24px;
  --pad: 24px;
  --card-pad: 20px;
  --control-height: 32px;
  --field-height: 40px;

  --font: "IBM Plex Sans", Inter, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-title: 22px;
  --fs-section: 16px;
  --fs-kpi: 28px;
  --fs-body: 14px;
  --fs-small: 12px;

  /* Bootstrap, mapped onto the tokens */
  --bs-body-font-family: var(--font);
  --bs-body-font-size: 0.875rem;
  --bs-body-line-height: 1.43;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--ground);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--muted);
  --bs-border-color: var(--border);
  --bs-border-radius: var(--radius-card);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: 27, 108, 128;
  --bs-link-hover-color: #134f5e;
  --bs-link-hover-color-rgb: 19, 79, 94;
  --bs-primary-rgb: 27, 108, 128;
  --bs-success-rgb: 30, 123, 79;
  --bs-danger-rgb: 196, 36, 42;
  --bs-warning-rgb: 146, 64, 14;
  --bs-info-rgb: 47, 112, 187;
  --bs-secondary-rgb: 93, 95, 96;
  --bs-font-monospace: var(--mono);
  --bs-code-color: #353736;
  --bs-heading-color: var(--text);
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--text); letter-spacing: 0; }
.h5, h5, .h4, h4 { font-size: var(--fs-section); font-weight: 600; line-height: 24px; }
.h6, h6 { font-size: var(--fs-body); font-weight: 600; }
.small, small { font-size: var(--fs-small); line-height: 16px; }
code, kbd, pre, samp, .font-monospace, .mono { font-family: var(--mono); font-size: 0.92em; }
code { color: #353736; background: var(--raised); padding: 1px 5px; border-radius: 4px; }
.text-muted, .text-body-secondary { color: var(--muted) !important; }
.text-uppercase { text-transform: none !important; letter-spacing: 0 !important; }
.fw-bold { font-weight: 600 !important; }
.fs-5 { font-size: 16px !important; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: #cfe4ea; }

/* ---------- shell: tinted L-frame + white sheet ---------- */
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  min-height: 100vh;
}
.admin-sidebar {
  grid-row: 1 / 3;
  grid-column: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 12px 16px;
  overflow-y: auto;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar);
  padding: 0 8px;
  color: var(--text);
  text-decoration: none;
  flex: none;
}
.admin-brand:hover { color: var(--text); }
.admin-mark { width: 24px; height: 24px; flex: none; display: block; }
.admin-brand-name { font-weight: 600; font-size: 15px; line-height: 18px; display: block; }
.admin-brand-scope { font-size: 12px; line-height: 16px; color: var(--muted); display: block; font-family: var(--mono); }

.admin-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
.admin-nav-group { font-size: 12px; color: var(--muted); padding: 0 10px; margin: 20px 0 6px; }
.admin-nav-group:first-child { margin-top: 0; }
.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-card);
  color: #4b4d4f;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}
.admin-nav-link:hover { color: var(--text); background: rgba(19, 20, 22, 0.04); }
.admin-nav-link.active { background: var(--active); color: var(--text); font-weight: 500; }
.admin-nav-icon { width: 16px; height: 16px; flex: none; color: #6b6d6e; display: inline-flex; }
.admin-nav-link.active .admin-nav-icon { color: var(--text); }
.admin-nav-icon svg { width: 16px; height: 16px; stroke-width: 1.5; }

.admin-sidebar-foot { margin-top: auto; padding-top: 16px; }
.admin-sidebar-foot .admin-nav-link { color: var(--muted); }

.admin-topbar {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar);
  padding: 0 calc(var(--sheet-inset) + 16px) 0 24px;
  min-width: 0;
}
.admin-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; }
.admin-crumbs span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-crumbs .sep { color: var(--control); }
.admin-crumbs .here { color: var(--text); }
.admin-account { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.admin-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: #d9e8ec; color: #134f5e;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.admin-account a { color: var(--muted); text-decoration: none; }
.admin-account a:hover { color: var(--text); }

.admin-sheet {
  grid-row: 2;
  grid-column: 2;
  margin: 0 var(--sheet-inset) var(--sheet-inset) 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  padding: var(--pad);
  min-width: 0;
}

/* mobile bar + menu sheet */
.admin-mobilebar { display: none; }
.admin-menu.offcanvas { --bs-offcanvas-width: 100vw; --bs-offcanvas-bg: var(--ground); border: 0 !important; }
.admin-menu .offcanvas-header { height: var(--topbar); padding: 0 16px; }
.admin-menu .offcanvas-body { padding: 8px 16px 24px; display: flex; flex-direction: column; }
.admin-menu .admin-nav-link { height: 44px; font-size: 15px; }

/* ---------- title row ---------- */
.admin-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: var(--gap);
}
.admin-title-row h1 {
  font-size: var(--fs-title);
  line-height: 28px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-title-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.admin-title-actions { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.admin-stamp { font-size: 12px; color: var(--muted); }

/* ---------- surfaces ---------- */
.card {
  --bs-card-border-color: var(--border);
  --bs-card-border-radius: var(--radius-card);
  --bs-card-inner-border-radius: calc(var(--radius-card) - 1px);
  --bs-card-spacer-x: var(--card-pad);
  --bs-card-spacer-y: var(--card-pad);
  --bs-card-bg: var(--surface);
  --bs-card-cap-bg: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: none !important;
  background: var(--surface);
}
.soft-panel {
  background: var(--raised);
  border: 0;
  border-radius: var(--radius-card);
  padding: 16px;
}
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.section-heading h2, .section-heading h1, .section-heading .h5 { margin: 0; font-size: var(--fs-section); line-height: 24px; font-weight: 600; }
.section-heading p { font-size: 13px; line-height: 18px; margin-top: 2px; }
.section-heading > div:last-child:not(:first-child) { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* KPI: label over value, no tile chrome, no icon */
.stat-card { background: var(--surface) !important; color: var(--text) !important; }
.stat-card::before, .stat-card::after { display: none !important; }
.stat-card .card-body { padding: 16px var(--card-pad); }
.stat-label { font-size: 13px; line-height: 18px; color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.stat-value { font-size: var(--fs-kpi); line-height: 36px; font-weight: 400; color: var(--text) !important; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat-card .text-muted { font-size: 13px; line-height: 18px; margin-top: 4px !important; }

/* one container split by hairlines */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(var(--kpi-cols, 4), minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
}
.kpi-strip > div { padding: 16px var(--card-pad); min-width: 0; }
.kpi-strip > div + div { border-left: 1px solid var(--border); }
.kpi-strip .lbl { font-size: 13px; line-height: 18px; color: var(--muted); font-weight: 500; }
.kpi-strip .val { font-size: var(--fs-kpi); line-height: 36px; margin-top: 4px; letter-spacing: -0.01em; white-space: nowrap; }
.kpi-strip .val small { font-size: 14px; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.kpi-strip .sub { font-size: 13px; line-height: 18px; color: var(--muted); margin-top: 4px; }
.kpi-strip .lead .val { font-size: 32px; line-height: 40px; }

.metric-chip, .admin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-ink);
  border: 0;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: none;
}
.pill-positive { background: var(--pill-positive-bg) !important; color: var(--pill-positive-ink) !important; }
.pill-negative { background: var(--pill-negative-bg) !important; color: var(--pill-negative-ink) !important; }
.pill-warning  { background: var(--pill-warning-bg) !important; color: var(--pill-warning-ink) !important; box-shadow: inset 0 0 0 1px #fde68a; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }

.badge {
  --bs-badge-font-size: 12px;
  --bs-badge-font-weight: 500;
  --bs-badge-padding-x: 8px;
  --bs-badge-padding-y: 3px;
  --bs-badge-border-radius: 999px;
  white-space: nowrap;
}
.text-bg-success, .badge.bg-success { background: var(--pill-positive-bg) !important; color: var(--pill-positive-ink) !important; }
.text-bg-danger, .badge.bg-danger { background: var(--pill-negative-bg) !important; color: var(--pill-negative-ink) !important; }
.text-bg-warning, .badge.bg-warning { background: var(--pill-warning-bg) !important; color: var(--pill-warning-ink) !important; }
.text-bg-secondary, .text-bg-light, .badge.bg-secondary, .badge.bg-light, .text-bg-info, .text-bg-primary, .badge.bg-primary, .badge.bg-info, .text-bg-dark, .badge.bg-dark {
  background: var(--pill-neutral-bg) !important; color: var(--pill-neutral-ink) !important;
}

/* ---------- tables: rules and alignment ---------- */
.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: transparent;
  --bs-table-hover-bg: var(--raised);
  --bs-table-border-color: var(--rule);
  --bs-table-color: var(--text);
  margin-bottom: 0;
  font-variant-numeric: tabular-nums;
}
.table > :not(caption) > * > * { padding: 12px 12px; border-bottom-color: var(--rule); box-shadow: none; }
.table-sm > :not(caption) > * > * { padding: 10px 12px; }
.table > :not(caption) > * > *:first-child { padding-left: 0; }
.table > :not(caption) > * > *:last-child { padding-right: 0; }
.table thead th {
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: var(--muted) !important;
  text-transform: none;
  letter-spacing: 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: bottom;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table td { vertical-align: middle; }
.table .num, .table th.num { text-align: right; white-space: nowrap; }
.table .id, .table .mono { font-family: var(--mono); font-size: 13px; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .table td, .table-scroll .table th { white-space: nowrap; }
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-color-type: initial; --bs-table-bg-type: transparent; }

/* ---------- controls ---------- */
.btn {
  --bs-btn-font-weight: 500;
  --bs-btn-font-size: 14px;
  --bs-btn-line-height: 20px;
  --bs-btn-padding-x: 12px;
  --bs-btn-padding-y: 5px;
  --bs-btn-border-radius: var(--radius-control);
  --bs-btn-box-shadow: none;
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: none !important;
  transform: none !important;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
  letter-spacing: 0;
}
.btn-sm { --bs-btn-font-size: 13px; --bs-btn-padding-y: 3px; --bs-btn-padding-x: 10px; min-height: 28px; }
.btn-lg { --bs-btn-font-size: 15px; --bs-btn-padding-y: 9px; min-height: var(--field-height); }
.btn-primary, .btn-dark, .btn-success {
  --bs-btn-color: #fff; --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #2b2d30; --bs-btn-hover-border-color: #2b2d30;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #000; --bs-btn-active-border-color: #000;
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: #8a8c8e; --bs-btn-disabled-border-color: #8a8c8e;
  background: var(--bs-btn-bg) !important;
}
.btn-primary:hover, .btn-dark:hover, .btn-success:hover { background: var(--bs-btn-hover-bg) !important; }
.btn-outline-primary, .btn-outline-secondary, .btn-outline-dark, .btn-light, .btn-secondary, .btn-outline-success, .btn-outline-info, .btn-outline-light, .btn-outline-warning {
  --bs-btn-color: var(--text); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--control);
  --bs-btn-hover-color: var(--text); --bs-btn-hover-bg: var(--raised); --bs-btn-hover-border-color: #b9bbbe;
  --bs-btn-active-color: var(--text); --bs-btn-active-bg: var(--active); --bs-btn-active-border-color: #b9bbbe;
  --bs-btn-disabled-color: var(--faint); --bs-btn-disabled-bg: var(--raised); --bs-btn-disabled-border-color: var(--border);
  background: var(--bs-btn-bg) !important;
}
.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-outline-dark:hover, .btn-light:hover, .btn-secondary:hover, .btn-outline-success:hover, .btn-outline-info:hover, .btn-outline-light:hover, .btn-outline-warning:hover { background: var(--bs-btn-hover-bg) !important; }
.btn-outline-danger, .btn-danger {
  --bs-btn-color: var(--negative); --bs-btn-bg: var(--surface); --bs-btn-border-color: #e9c1c2;
  --bs-btn-hover-color: #9f1d22; --bs-btn-hover-bg: #fff5f4; --bs-btn-hover-border-color: #dc9a9c;
  --bs-btn-active-color: #9f1d22; --bs-btn-active-bg: var(--pill-negative-bg); --bs-btn-active-border-color: #dc9a9c;
  background: var(--bs-btn-bg) !important;
}
.btn-outline-danger:hover, .btn-danger:hover { background: var(--bs-btn-hover-bg) !important; }
.btn-link { --bs-btn-color: var(--accent); --bs-btn-hover-color: #134f5e; text-decoration: none; padding-left: 0; padding-right: 0; }
.btn-close { box-shadow: none !important; }

/* segmented control: the active option a white pill on a grey track */
.btn-group, .segmented {
  display: inline-flex !important;
  width: auto !important;
  padding: 2px;
  gap: 2px;
  background: var(--raised);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.btn-group > .btn, .segmented > a {
  flex: none !important;
  min-width: 0 !important;
  min-height: 28px;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--muted) !important;
  margin: 0 !important;
  padding: 3px 12px;
  font-weight: 500;
}
.btn-group > .btn:hover { color: var(--text) !important; }
.btn-group > .btn.btn-primary, .btn-group > .btn.active, .btn-group > .btn-check:checked + .btn {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.form-label { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.form-text { font-size: 12px; line-height: 16px; color: var(--muted); margin-top: 6px; }
.form-control, .form-select {
  min-height: var(--field-height);
  padding: 9px 12px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--control);
  border-radius: var(--radius-field);
  box-shadow: none !important;
}
.form-select { padding-right: 36px; }
.form-control-sm, .form-select-sm { min-height: var(--control-height); padding: 5px 10px; font-size: 13px; }
.form-select-sm { padding-right: 32px; }
textarea.form-control { min-height: 88px; }
.form-control::placeholder { color: var(--faint); opacity: 1; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(27, 108, 128, 0.15) !important; }
.form-control:disabled, .form-control[readonly] { background: var(--raised); color: var(--muted); }
.input-group-text { background: var(--raised); border-color: var(--control); color: var(--muted); font-size: 13px; border-radius: var(--radius-field); }
.form-check-input { border-color: var(--control); box-shadow: none !important; }
.form-check-input:checked { background-color: var(--text); border-color: var(--text); }
.form-switch .form-check-input { width: 32px; height: 18px; margin-top: 1px; }
.form-switch .form-check-input:checked { background-color: var(--positive); border-color: var(--positive); }

/* underline tabs on a full-width rule */
.nav-pills, .nav-tabs {
  --bs-nav-link-color: var(--muted);
  --bs-nav-link-hover-color: var(--text);
  --bs-nav-link-padding-x: 0;
  --bs-nav-link-padding-y: 10px;
  --bs-nav-link-font-size: 14px;
  --bs-nav-link-font-weight: 500;
  gap: 4px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.nav-pills .nav-link, .nav-tabs .nav-link {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: var(--muted);
  box-shadow: inset 0 -2px 0 transparent;
  margin-bottom: -1px;
}
.nav-pills .nav-link.active, .nav-tabs .nav-link.active { color: var(--text) !important; box-shadow: inset 0 -2px 0 var(--text); }

.pagination {
  --bs-pagination-color: var(--text);
  --bs-pagination-bg: var(--surface);
  --bs-pagination-border-color: var(--control);
  --bs-pagination-hover-color: var(--text);
  --bs-pagination-hover-bg: var(--raised);
  --bs-pagination-hover-border-color: var(--control);
  --bs-pagination-focus-box-shadow: none;
  --bs-pagination-active-color: #fff;
  --bs-pagination-active-bg: var(--primary);
  --bs-pagination-active-border-color: var(--primary);
  --bs-pagination-disabled-color: var(--faint);
  --bs-pagination-disabled-bg: var(--raised);
  --bs-pagination-disabled-border-color: var(--border);
  --bs-pagination-font-size: 13px;
  --bs-pagination-padding-x: 10px;
  --bs-pagination-padding-y: 4px;
  --bs-pagination-border-radius: var(--radius-control);
}

/* alerts: pale pairs, flat */
.alert {
  --bs-alert-border-radius: var(--radius-card);
  --bs-alert-padding-y: 10px;
  --bs-alert-padding-x: 14px;
  font-size: 14px;
  box-shadow: none !important;
  backdrop-filter: none !important;
  background-image: none !important;
}
.alert-success { background: var(--pill-positive-bg); color: var(--pill-positive-ink); border-color: #b5ecc6; }
.alert-danger { background: var(--pill-negative-bg); color: var(--pill-negative-ink); border-color: #f5c8c2; }
.alert-warning { background: var(--pill-warning-bg); color: var(--pill-warning-ink); border-color: #fde68a; }
.alert-info, .alert-primary, .alert-secondary, .alert-light { background: var(--raised); color: var(--text); border-color: var(--border); }
.admin-flash { margin-bottom: var(--gap); }

/* empty state inside a block */
.empty-row td { color: var(--muted); }
.empty-box { border: 1px dashed var(--control); border-radius: 8px; padding: 10px 14px; color: var(--muted); font-size: 13px; }

/* charts drawn by assets/charts.js */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.chart-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: 0; }
.chart-wrap { position: relative; min-height: 260px; }

/* ---------- auth screens ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--ground);
}
.auth-shell > .row, .auth-shell .container { width: 100%; }
.auth-shell .card { max-width: 400px; width: 100%; margin: 0 auto; border-radius: var(--radius-sheet); }
.auth-shell .card-body { padding: 32px !important; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.auth-shell h1, .auth-shell .h4 { font-size: var(--fs-title); line-height: 28px; font-weight: 600; }
.auth-shell .btn-primary { min-height: var(--field-height); }

/* ---------- tablet and phone ---------- */
@media (max-width: 991.98px) {
  .admin-layout { display: block; }
  .admin-sidebar, .admin-topbar { display: none; }
  .admin-mobilebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: var(--topbar);
    padding: 0 16px;
    background: var(--ground);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1030;
  }
  .admin-mobilebar .title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; min-width: 0; }
  .admin-menu-btn { width: 44px; height: 44px; margin-left: -12px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--text); border-radius: 8px; }
  .admin-menu-btn svg { width: 20px; height: 20px; }
  .admin-sheet { margin: 0; border: 0; border-radius: 0; padding: 20px 16px 32px; min-height: calc(100vh - var(--topbar)); }
}
@media (max-width: 767.98px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip > div + div { border-left: 0; }
  .kpi-strip > div:nth-child(even) { border-left: 1px solid var(--border); }
  .kpi-strip > div:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi-strip > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi-strip .val { font-size: 24px; line-height: 32px; }
  .kpi-strip .lead .val { font-size: 28px; line-height: 36px; }
  .admin-title-row { flex-direction: column; gap: 12px; }
  .admin-title-actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .card .card-body { padding: 16px; }
  .stat-value { font-size: 24px; line-height: 32px; }
  /* tables become two-line rows: the first cell leads, the rest follow as label · value */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody { display: block; width: 100%; }
  .table-stack tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
  }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack tbody td { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: start; padding: 0 !important; border: 0 !important; white-space: normal !important; grid-column: 1 / -1; font-size: 13px; text-align: right; }
  .table-stack tbody td::before { content: attr(data-label); color: var(--muted); text-align: left; grid-row: 1 / span 6; }
  .table-stack tbody td > * { grid-column: 2; justify-self: end; text-align: right; max-width: 100%; }
  .table-stack tbody td:first-child { display: block; font-size: 14px; font-weight: 500; text-align: left; margin-bottom: 4px; }
  .table-stack tbody td:first-child::before { content: none; }
  .table-stack tbody td[colspan] { justify-content: flex-start; }
  .table-stack tbody td[colspan]::before { content: none; }
  .table-scroll table.table-stack { min-width: 0 !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.table .small, .table small { font-size: 13px; line-height: 18px; }

/* browser surfaces */
* { scrollbar-width: thin; scrollbar-color: #c9ced2 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9ced2; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
input, textarea { caret-color: var(--accent); }

/* flows that need attention: identity left, rate right, one edge */
.flow-list { list-style: none; margin: 0; padding: 0; }
.flow-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; border-top: 1px solid var(--rule); }
.flow-list li:first-child { border-top: 0; padding-top: 0; }
.flow-id, .flow-rate { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.flow-rate { align-items: flex-end; flex: none; }
.flow-id .mono { font-family: var(--mono); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* key-value list: label left, figure right, one right edge */
.kv-list { margin: 0; }
.kv-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule); }
.kv-list > div:first-child { border-top: 0; padding-top: 0; }
.kv-list dt { font-weight: 400; color: var(--muted); }
.kv-list dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }

/* a card never stretches to its neighbour's height with a blank band */
.card.h-100:not(.stat-card) { height: auto !important; }
.soft-panel.h-100 { height: auto !important; }

/* text wraps: balanced headings, no lone word on a last line, readable measure */
h1, h2, h3, .h4, .h5, .h6 { text-wrap: balance; }
p, .form-text, .sub, .admin-title-sub { text-wrap: pretty; }
.card-body > p.text-muted, .card-body > .text-muted.small, .section-heading p { max-width: 75ch; }
