:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e9eef5;
  --nav-bg: #ffffff;
  --border: #e4e9f0;
  --border-strong: #d3dbe6;
  --text: #0f172a;
  --text-muted: #56657a;
  --text-subtle: #6b778a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-ink: #ffffff;
  --primary-soft: #eaf1ff;
  --primary-text: #1d4ed8;
  --ring: rgba(37, 99, 235, 0.32);
  --ok: #067647;
  --ok-soft: #e6f6ed;
  --warn: #a15c07;
  --warn-soft: #fdf1d6;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --info: #3538cd;
  --info-soft: #eef0ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.06), 0 6px 16px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);
  --tooltip-bg: #0f172a;
  --tooltip-text: #ffffff;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-full: 999px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --nav-w: 248px;
  --top-h: 60px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e15;
  --surface: #111723;
  --surface-2: #161e2c;
  --surface-3: #1d2738;
  --nav-bg: #0d131d;
  --border: #212b3b;
  --border-strong: #2d394d;
  --text: #e6ebf3;
  --text-muted: #9aa9bd;
  --text-subtle: #738198;
  --primary: #5b8cff;
  --primary-hover: #7aa1ff;
  --primary-ink: #06101f;
  --primary-soft: #162341;
  --primary-text: #8fb0ff;
  --ring: rgba(91, 140, 255, 0.42);
  --ok: #6fd3a0;
  --ok-soft: #0f2a1f;
  --warn: #f0c26a;
  --warn-soft: #2c2210;
  --bad: #f5a399;
  --bad-soft: #2e1714;
  --info: #a5b0ff;
  --info-soft: #1b1f3d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --tooltip-bg: #f8fafc;
  --tooltip-text: #0f172a;
}

*, *::before, *::after { box-sizing: border-box; }

/* Class-level display rules would otherwise win over the UA [hidden] rule. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

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

a { color: var(--primary-text); text-decoration: none; transition: color 150ms var(--ease); }
a:hover { color: var(--primary); }

code, .mono {
  font-family: var(--mono);
  font-size: 0.86em;
  letter-spacing: -0.01em;
}

button, input, select, textarea { font: inherit; color: inherit; }

.icon { flex: none; display: inline-block; vertical-align: middle; }

.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: 12px; top: -48px; z-index: 100;
  background: var(--primary); color: var(--primary-ink);
  padding: 8px 14px; border-radius: var(--r-sm); font-weight: 600;
  transition: top 150ms var(--ease);
}
.skip-link:focus { top: 12px; color: var(--primary-ink); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.nav {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 14px;
  background: var(--nav-bg);
  border-right: 1px solid var(--border);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
}
.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.brand-name { display: block; font-weight: 650; font-size: 14px; line-height: 1.2; letter-spacing: -0.01em; }
.brand-sub { display: block; color: var(--text-subtle); font-size: 12px; }

.nav-label {
  margin: 14px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.nav-link .icon { color: var(--text-subtle); transition: color 150ms var(--ease); }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover .icon { color: var(--text-muted); }
.nav-link[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 600;
}
.nav-link[aria-current="page"] .icon { color: var(--primary); }
.nav-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.nav-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.nav-footer form { margin: 0; }
.nav-footer .nav-link { width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }

.main-col { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; min-width: 0; }
.topbar-title strong { color: var(--text); font-weight: 600; }
.topbar-title .sep { color: var(--text-subtle); }
.topbar-spacer { flex: 1; }
.icon-btn.menu-btn { display: none; }

main {
  width: 100%;
  max-width: 1240px;
  padding: 28px 28px 64px;
}

/* ---------- Page header ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.page-head p { margin: 4px 0 0; color: var(--text-muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.page-tabs {
  display: flex;
  gap: 4px;
  margin: -6px 0 24px;
  padding: 4px;
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.page-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.page-tabs a:hover { color: var(--text); }
.page-tabs a[aria-current] {
  background: var(--surface);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}

.count-chip {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }

.section { margin-top: 24px; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head p { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; }
.card-body { padding: 18px; }
.card-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.stat-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}
.stat-icon.ok { background: var(--ok-soft); color: var(--ok); }
.stat-icon.warn { background: var(--warn-soft); color: var(--warn); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-icon.neutral { background: var(--surface-3); color: var(--text-muted); }
.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-foot { color: var(--text-subtle); font-size: 12.5px; }
.stat-foot strong { color: var(--text-muted); font-weight: 600; }

.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--text-subtle); }
.delta.down .icon { transform: rotate(45deg); }
.delta.up .icon { transform: rotate(-45deg); }

/* ---------- Chart ---------- */

.legend { display: flex; gap: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12.5px; font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dot.revenue { background: var(--primary); }
.dot.deposit { background: var(--info); }

.card.chart-card { position: relative; overflow: visible; }
.chart-title-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  cursor: help;
}
.chart-info-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-subtle);
  background: var(--surface-3);
}
.chart-title-trigger:hover .chart-info-icon,
.chart-title-trigger:focus-visible .chart-info-icon {
  color: var(--primary);
  background: var(--primary-soft);
}

.chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: end;
  gap: 6px;
  height: 180px;
  padding-top: 8px;
}
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.chart-col { border-radius: 5px; cursor: crosshair; }
.chart-col:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chart-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 100%; height: 100%; }
.chart-bar {
  width: 46%;
  max-width: 16px;
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  transition: filter 150ms var(--ease);
  animation: rise-bar 600ms var(--ease) both;
  transform-origin: bottom;
}
.chart-bar.revenue { background: var(--primary); }
.chart-bar.deposit { background: color-mix(in srgb, var(--info) 78%, var(--surface)); }
.chart-col:hover .chart-bar { filter: brightness(1.08); }
.chart-x { color: var(--text-subtle); font-size: 11px; font-variant-numeric: tabular-nums; }

.chart-tooltip {
  position: fixed;
  z-index: 80;
  width: 250px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  --arrow-left: 24px;
  animation: tooltip-in 140ms var(--ease) both;
}
.chart-tooltip[hidden] { display: none !important; }
.chart-tooltip::before {
  content: "";
  position: absolute;
  left: var(--arrow-left);
  bottom: -5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: inherit;
  transform: rotate(45deg);
}
.chart-tooltip.is-below::before {
  bottom: auto;
  top: -5px;
}
.chart-tooltip > strong { display: block; margin-bottom: 9px; font-size: 13px; }
.chart-tooltip dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0; }
.chart-tooltip dl div { min-width: 0; }
.chart-tooltip dt { opacity: 0.66; font-size: 11px; }
.chart-tooltip dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@keyframes rise-bar { from { transform: scaleY(0); opacity: 0.4; } to { transform: scaleY(1); opacity: 1; } }
@keyframes tooltip-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.card > .table-wrap:first-child thead th:first-child,
.card > table thead th:first-child { border-top-left-radius: var(--r-md); }
.card > .table-wrap:first-child thead th:last-child,
.card > table thead th:last-child { border-top-right-radius: var(--r-md); }
tbody tr { transition: background 120ms var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.request-row { cursor: pointer; }
.request-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num { font-family: var(--mono); font-size: 13px; }
.stamp { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.cell-sub { display: block; margin-top: 2px; color: var(--text-subtle); font-size: 12px; }
td code { display: inline-block; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; color: var(--text-muted); }
.tx-cell code { max-width: 9rem; }
.service-name { font-weight: 500; }
.row-end { width: 46px; text-align: right; }
.muted-num { color: var(--text-subtle); }

.copy-cell { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.copy-btn {
  width: 26px; height: 26px;
  display: inline-grid; place-items: center;
  flex: none;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--text-subtle);
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.copy-btn:hover, .copy-btn.copied { background: var(--primary-soft); color: var(--primary-text); }

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.avatar.lg { width: 52px; height: 52px; font-size: 18px; border-radius: 14px; }
.who-text { min-width: 0; }
.who-name { display: block; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.who:hover .who-name { color: var(--primary-text); }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  text-transform: capitalize;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.completed, .badge.credited, .badge.user { background: var(--ok-soft); color: var(--ok); }
.badge.enabled { background: var(--ok-soft); color: var(--ok); }
.badge.refunded, .badge.rejected, .badge.disabled { background: var(--bad-soft); color: var(--bad); }
.badge.pending, .badge.reserved { background: var(--warn-soft); color: var(--warn); }
.badge.global { background: var(--primary-soft); color: var(--primary-text); }
.badge.default, .badge.veridocs { background: var(--info-soft); color: var(--info); }

/* ---------- Bars (usage) ---------- */

.usage-list { list-style: none; margin: 0; padding: 6px 18px 16px; }
.usage-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.usage-item:last-child { border-bottom: 0; }
.usage-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.usage-name { font-weight: 600; }
.usage-meta { color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.usage-value { font-family: var(--mono); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { margin-top: 8px; height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transform-origin: left; animation: grow 700ms var(--ease) both; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 150ms var(--ease), border-color 150ms var(--ease), box-shadow 150ms var(--ease), transform 100ms var(--ease);
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--primary-hover); color: var(--primary-ink); }
.btn:active { transform: translateY(1px); }
.btn.is-loading { opacity: 0.65; cursor: progress; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.btn.sm { min-height: 32px; padding: 6px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn .spinner { display: none; }
.btn.is-loading .spinner { display: inline-block; }
.btn.is-loading .btn-icon { display: none; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

.spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 700ms linear infinite;
}

.theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: inline-block; }
html[data-theme="dark"] .theme-icon-light { display: none; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text); }
.field-hint { font-size: 12.5px; color: var(--text-subtle); }

.input, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), background 150ms var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--border-strong)); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}
select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238593a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
textarea { resize: vertical; min-height: 140px; line-height: 1.55; }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .prefix {
  position: absolute; left: 12px;
  color: var(--text-subtle);
  font-weight: 600;
  pointer-events: none;
}
.input-group input { padding-left: 36px !important; font-variant-numeric: tabular-nums; }
.input-group .prefix + input { font-family: var(--mono); }

.form-row { display: grid; gap: 14px; }
.form-row.cols-3 { grid-template-columns: 170px 1fr 1.4fr; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.card-form { padding: 0 18px 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.row-actions form { margin: 0; }
.form-note { color: var(--text-muted); font-size: 13px; }
.form-note strong { color: var(--text); font-variant-numeric: tabular-nums; }
.balance-after {
  justify-content: center;
  min-height: 68px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.balance-after.over .preview-balance,
.balance-after.over .field-hint { color: var(--bad); }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 7px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 150ms var(--ease), color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.segmented label:hover { color: var(--text); }
.segmented input:checked + label { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 1px; }
.segmented.full { display: flex; }
.segmented.full label { flex: 1; justify-content: center; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; color: var(--text); font-size: 13.5px; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); }

/* ---------- Filters / chips ---------- */

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.toolbar .field { min-width: 200px; }
.toolbar .search-field { min-width: min(420px, 100%); }
.toolbar-hint { margin-left: auto; color: var(--text-subtle); font-size: 12px; }
kbd {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: all 150ms var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--text-subtle); }
.chip[aria-current] { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip > span { opacity: 0.72; font-variant-numeric: tabular-nums; }
.status-tabs { display: flex; gap: 7px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }

/* ---------- Prices ---------- */

.price-list { list-style: none; margin: 0; padding: 0; }
.price-item {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(250px, auto);
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 120ms var(--ease);
}
.price-item:hover { background: var(--surface-2); }
.price-item:last-child { border-bottom: 0; }
.price-name { font-weight: 600; }
.price-now { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.price-value { font-family: var(--mono); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
.price-value.off { color: var(--text-subtle); font-family: var(--font); font-weight: 500; }
.price-form { display: flex; gap: 8px; }
.price-form .input-group { width: 130px; }

.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--primary-soft);
  color: var(--text);
  font-size: 13.5px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
}
.callout .icon { color: var(--primary); margin-top: 1px; }
.callout p { margin: 0; }
.callout strong { font-weight: 650; }

/* ---------- Services ---------- */

.service-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.service-card { display: flex; flex-direction: column; }
.service-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}
.service-card-head h2 { margin: 3px 0 2px; font-size: 16px; }
.service-card-head code { color: var(--text-subtle); }
.service-group {
  display: block;
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.service-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.service-metrics > div { padding: 13px 18px; border-right: 1px solid var(--border); }
.service-metrics > div:last-child { border-right: 0; }
.service-metrics dt { color: var(--text-muted); font-size: 12px; }
.service-metrics dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.service-price {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
}
.service-price > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.service-price .field-label { flex-basis: 100%; color: var(--text-muted); }
.service-price strong { font-family: var(--mono); font-size: 17px; }
.service-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.service-actions form { margin: 0; }

/* ---------- Telegram menu board ---------- */

.menu-board { position: relative; overflow: visible; }
/* .reveal animates a transform, so every card is its own stacking context and
   the next one would paint over an open editor. Lift the card being edited. */
.menu-board.is-editing { z-index: 40; }
.menu-board-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(210px, 0.65fr);
  gap: 18px;
  align-items: start;
}
.callout kbd {
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 11.5px;
}

.tg-phone {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.tg-phone-bar { display: flex; align-items: center; gap: 10px; }
.tg-phone-logo { border-radius: 50%; object-fit: cover; }
.tg-phone-name { display: grid; font-size: 13.5px; font-weight: 650; line-height: 1.25; }
.tg-phone-name small { color: var(--text-subtle); font-size: 11.5px; font-weight: 500; }
.tg-phone-bubble {
  margin: 12px 0 10px;
  width: fit-content;
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}

.tg-keyboard { display: grid; gap: 2px; }
.tg-row { display: flex; gap: 6px; min-height: 42px; border-radius: 9px; }
.tg-row.is-over { outline: 2px dashed var(--primary); outline-offset: 3px; }
.tg-row.is-full { outline: 2px dashed var(--bad); outline-offset: 3px; }

.tg-chip {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: grab;
  transition: transform 120ms var(--ease), box-shadow 150ms var(--ease), opacity 120ms var(--ease);
}
.tg-chip:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tg-chip:active { cursor: grabbing; }
.tg-chip.is-dragging { opacity: 0.4; }
.tg-chip.is-active { box-shadow: 0 0 0 2px var(--primary); }
.tg-chip.is-locked { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-muted); }
.tg-chip-grip { display: grid; opacity: 0.45; }
.tg-chip-label { grid-column: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-chip-lock { grid-column: 3; display: grid; opacity: 0.7; }

.tg-dropline {
  height: 6px;
  border-radius: var(--r-full);
  transition: height 120ms var(--ease), background 120ms var(--ease);
}
.tg-dropline.is-armed { background: color-mix(in srgb, var(--primary) 18%, transparent); }
.tg-dropline.is-over {
  height: 26px;
  background: var(--primary-soft);
  border: 1px dashed var(--primary);
}

.menu-tray {
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.menu-tray.is-over { border-color: var(--primary); background: var(--primary-soft); }
.menu-tray-head { display: flex; gap: 10px; }
.menu-tray-head strong { font-size: 13.5px; }
.menu-tray-head p { margin: 2px 0 0; color: var(--text-subtle); font-size: 12px; }
.tray-icon { flex: none; color: var(--text-muted); margin-top: 1px; }
.tg-tray { display: grid; gap: 6px; margin-top: 12px; }
.tg-tray:empty { display: none; }
.tg-tray .tg-chip { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-muted); }
.tray-empty { margin: 12px 0 0; color: var(--text-subtle); font-size: 12.5px; }

.menu-board-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.menu-board-bar .btn[type="submit"] { margin-left: auto; }
.menu-dirty, .menu-saved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
}
.menu-dirty { color: var(--warn); }
.menu-saved { color: var(--text-subtle); }

.chip-editor {
  position: absolute;
  z-index: 30;
  width: min(320px, calc(100vw - 32px));
  display: grid;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: rise 160ms var(--ease) both;
}
.chip-editor[hidden] { display: none !important; }
.chip-editor-head { display: flex; align-items: flex-start; gap: 10px; }
.chip-editor-head > div { flex: 1; min-width: 0; }
.chip-editor-head strong { font-size: 14px; }
.chip-editor-head p { margin: 3px 0 0; color: var(--text-muted); font-size: 12.5px; }
.chip-editor-moves { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-arrows { display: flex; gap: 4px; flex: 1 1 100%; }
.chip-editor-moves .btn { flex: 1 1 40%; }
.chip-editor-foot {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 12px;
}
.chip-editor-foot code { color: var(--text-muted); }
.icon-btn.sm { width: 30px; height: 30px; }

/* ---------- Request detail ---------- */

.request-summary-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
}
.request-summary-main h2 { margin: 2px 0 0; font-size: 18px; }
.request-summary-main > .badge { margin-left: auto; }
.request-kv {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--border);
}
.request-kv > div { min-width: 0; padding: 14px 20px; border-right: 1px solid var(--border); }
.request-kv > div:last-child { border-right: 0; }
.request-kv dt { color: var(--text-muted); font-size: 12px; }
.request-kv dd { margin: 5px 0 0; font-weight: 600; min-width: 0; }
.request-kv .who .avatar { display: none; }
.audit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.audit-card { min-width: 0; }
.json-view {
  max-height: 560px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
.error-json { background: var(--bad-soft); color: var(--bad); }

/* ---------- User profile ---------- */

.profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}
.profile-name { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.profile-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; color: var(--text-muted); font-size: 13px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 6px; }
.profile-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.kv {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}
.kv > div { padding: 14px 20px; border-right: 1px solid var(--border); }
.kv > div:last-child { border-right: 0; }
.kv dt { color: var(--text-muted); font-size: 12.5px; }
.kv dd { margin: 4px 0 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.preview-balance { font-family: var(--mono); }
.compact-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Broadcast ---------- */

.compose { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.counter { font-size: 12px; color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); }
.tg-preview { padding: 18px; background: var(--surface-2); border-radius: 0 0 var(--r-md) var(--r-md); min-height: 220px; }
.tg-bubble {
  max-width: 92%;
  padding: 10px 12px 18px;
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
}
.tg-bubble .tg-time { position: absolute; right: 10px; bottom: 4px; color: var(--text-subtle); font-size: 11px; }
.tg-empty { color: var(--text-subtle); font-style: italic; }
.tg-sender { font-weight: 650; color: var(--primary-text); font-size: 13px; margin-bottom: 2px; }

/* ---------- Empty ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--text-subtle);
}
.empty strong { color: var(--text); font-size: 14px; }
.empty p { margin: 0; font-size: 13px; max-width: 34ch; }

/* ---------- Pager ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.pager-nav { display: flex; gap: 8px; }
.pager .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  animation: toast-in 240ms var(--ease) both;
}
.toast.ok .toast-icon { color: var(--ok); }
.toast.bad .toast-icon { color: var(--bad); }
.toast.ok { border-left: 3px solid var(--ok); }
.toast.bad { border-left: 3px solid var(--bad); }
.toast p { margin: 0; flex: 1; padding-top: 1px; }
.toast-close { width: 26px; height: 26px; border: 0; background: none; color: var(--text-subtle); border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.toast-close:hover { background: var(--surface-2); color: var(--text); }
.toast.leaving { animation: toast-out 180ms var(--ease) both; }

/* ---------- Dialog ---------- */

dialog.confirm {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
dialog.confirm::backdrop { background: rgba(10, 14, 21, 0.5); backdrop-filter: blur(2px); }
dialog.confirm[open] { animation: dialog-in 180ms var(--ease) both; }
.confirm-body { display: flex; gap: 14px; padding: 22px 22px 8px; }
.confirm-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--bad-soft); color: var(--bad); }
.confirm-icon.neutral { background: var(--primary-soft); color: var(--primary); }
.confirm h3 { margin: 2px 0 6px; font-size: 16px; font-weight: 650; }
.confirm p { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 22px 20px; }

/* ---------- Login ---------- */

.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 60%),
    var(--bg);
}
.login-card { width: min(400px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow-md); }
.login-card .brand { padding: 0; }
.login-card h1 { margin: 6px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.login-card .lede { margin: 4px 0 0; color: var(--text-muted); }
.login-tools { position: fixed; top: 16px; right: 16px; }
.pw-field { position: relative; }
.pw-field input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: none; border-radius: 6px; color: var(--text-subtle); cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.inline-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--bad-soft); color: var(--bad); font-size: 13px; font-weight: 500; }

/* ---------- Motion ---------- */

.reveal { animation: rise 420ms var(--ease) both; }
.reveal:nth-child(2) { animation-delay: 40ms; }
.reveal:nth-child(3) { animation-delay: 80ms; }
.reveal:nth-child(4) { animation-delay: 120ms; }
.reveal:nth-child(5) { animation-delay: 160ms; }
.reveal:nth-child(6) { animation-delay: 200ms; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}

/* ---------- Responsive ---------- */

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(10, 14, 21, 0.45);
}

@media (max-width: 1100px) {
  .grid-2, .compose { grid-template-columns: minmax(0, 1fr); }
  .service-grid { grid-template-columns: minmax(0, 1fr); }
  .menu-board-body { grid-template-columns: minmax(0, 1fr); }
  .audit-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv > div:nth-child(2) { border-right: 0; }
  .kv > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(290px, 86vw);
    transform: translateX(-100%);
    transition: transform 220ms var(--ease);
    box-shadow: var(--shadow-lg);
  }
  html[data-nav="open"] .nav { transform: none; }
  html[data-nav="open"] .scrim { display: block; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  main { padding: 20px 16px 48px; }
  .form-row.cols-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .kv > div:last-child { border-bottom: 0; }
  .profile { flex-wrap: wrap; }
  .profile-actions { margin-left: 0; width: 100%; }
  .stat-value { font-size: 22px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select { min-height: 44px; }
  .btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn.sm { width: 40px; height: 40px; }
  .copy-btn { width: 44px; height: 44px; }
  .segmented label, .chip { min-height: 44px; }
  .nav-link { min-height: 44px; }
  .toolbar .field { min-width: 0; flex: 1 1 160px; }
  .compact-stats { grid-template-columns: minmax(0, 1fr); }
  .service-summary { grid-template-columns: minmax(0, 1fr); }
  .request-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-kv > div:nth-child(2) { border-right: 0; }
  .request-kv > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .page-actions, .profile-actions { width: 100%; }
  .page-actions .btn, .profile-actions .btn { flex: 1; }
  .toolbar-hint { display: none; }
}

@media (min-width: 960px) {
  .stats:not(.compact-stats) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .topbar-title .sep { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 14px; }
  .price-item { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .price-now { justify-content: flex-start; }
  .price-value { text-align: left; }
  .price-form { grid-column: auto; }
  .price-form .input-group { flex: 1; width: auto; }
  .service-price { align-items: stretch; flex-direction: column; }
  .service-price .price-form { width: 100%; }
  .tg-chip { grid-template-columns: minmax(0, 1fr); font-size: 12.5px; padding: 11px 6px; }
  .tg-chip-grip { display: none; }
  .tg-chip-label, .tg-chip-lock { grid-column: 1; }
  .tg-chip-lock { display: none; }
  .request-kv { grid-template-columns: minmax(0, 1fr); }
  .request-kv > div { border-right: 0; border-bottom: 1px solid var(--border); }
  .request-kv > div:last-child { border-bottom: 0; }
  .profile { align-items: flex-start; }
  .profile-actions .btn { flex-basis: 100%; }
  .legend { gap: 8px; }
  .chart { gap: 3px; }
  .chart-col:nth-child(even) .chart-x { display: none; }
  .toasts { left: 16px; right: 16px; width: auto; bottom: 16px; }
}

@media (max-width: 420px) {
  .segmented.full { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { align-items: flex-start; flex-direction: column; }
  .pager-nav { width: 100%; }
  .pager-nav .btn { flex: 1; }
}
