/* Kinetic Sandbox Gateway portal - Kinetic Smart branding, logos from
   Kinetic Central. Brand: blue #13588f, grey #808285. Chart colours are
   validated (dataviz validator) against the card surfaces below. */

:root,
[data-theme="light"] {
  color-scheme: light;
  --brand: #13588f;
  --brand-strong: #0f4a79;
  --brand-deep: #0b3558;
  --brand-grey: #808285;
  --brand-tint: #eaf2f9;
  --brand-ink: #13588f;

  --page: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f2f6fa;
  --border: #e3e7ed;
  --border-strong: #cfd5de;

  --text: #111827;
  --text-2: #4a5565;
  --muted: #7a8494;

  --focus: #2a78d6;
  --danger-ink: #b42323;
  --ok-ink: #0a6b0a;
  --warn-ink: #8a5a00;

  /* chart roles */
  --chart-surface: #ffffff;
  --grid: #e9ecf0;
  --axis: #c9ced6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 24px 56px rgba(16, 24, 40, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar: 252px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --brand-tint: #15304a;
  --brand-ink: #8cc0ef;
  --page: #0d1218;
  --surface: #151c25;
  --surface-2: #19212c;
  --surface-hover: #1d2733;
  --border: #253040;
  --border-strong: #334155;
  --text: #edf1f6;
  --text-2: #b6c0cc;
  --muted: #8592a1;
  --focus: #5598e7;
  --danger-ink: #f39a9a;
  --ok-ink: #4fd34f;
  --warn-ink: #f5c25b;
  --chart-surface: #151c25;
  --grid: #222c39;
  --axis: #364253;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4 { letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.booting { min-height: 100vh; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff; padding: 16px 14px 14px;
}
/* brand block as in Kinetic Central: the K mark with the product name */
.sidebar-brand {
  display: flex; align-items: center; gap: 12px; padding: 2px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12); text-decoration: none;
}
.sidebar-brand img { width: 38px; height: 38px; border-radius: 6px; flex: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.sidebar-brand .name { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidebar-brand .name span { color: rgba(255, 255, 255, 0.62); font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.sidebar-brand .name strong { color: #fff; font-size: 16.5px; font-weight: 650; letter-spacing: 0.02em; white-space: nowrap; }

.nav { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { margin: 16px 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: 9px;
  color: rgba(255, 255, 255, 0.82); text-decoration: none; font-weight: 550;
  transition: background 0.12s, color 0.12s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.nav a.active { background: #fff; color: var(--brand); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18); }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 12px; font-size: 12.5px; }
.listeners { display: flex; flex-direction: column; gap: 7px; }
.listeners h4 { margin: 0 2px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); }
.listener-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-l { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 20px; background: rgba(0, 0, 0, 0.18); color: rgba(255, 255, 255, 0.9); font-size: 12px; font-weight: 550; }
.chip-l.off { color: rgba(255, 255, 255, 0.55); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #5bd75b; box-shadow: 0 0 0 2px rgba(91, 215, 91, 0.22); flex: none; }
.dot.off { background: #9aa4ae; box-shadow: none; }
.user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.18); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--brand); font-weight: 750; font-size: 12.5px; flex: none; }
.user .who { min-width: 0; flex: 1; }
.user .who strong { display: block; font-size: 12.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .who span { font-size: 11.5px; color: rgba(255, 255, 255, 0.6); }
.icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  background: transparent; border: 1px solid rgba(255, 255, 255, 0.22); color: #fff; flex: none;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn svg { width: 15px; height: 15px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 32px; background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.crumb { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.topbar h1 { margin: 1px 0 0; font-size: 21px; font-weight: 700; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text-2);
  text-decoration: none; box-shadow: var(--shadow-sm); white-space: nowrap;
}
a.pill:hover { border-color: var(--border-strong); }
.pill .ico { font-weight: 800; }
.mode-pill.ok { color: var(--ok-ink); }
.mode-pill.warn { color: var(--warn-ink); border-color: color-mix(in srgb, var(--status-warning) 60%, transparent); background: color-mix(in srgb, var(--status-warning) 12%, var(--surface)); }
.mode-pill.bad { color: var(--danger-ink); border-color: color-mix(in srgb, var(--status-critical) 50%, transparent); background: color-mix(in srgb, var(--status-critical) 9%, var(--surface)); }
.live .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on .pulse { background: var(--status-good); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.45); } 70% { box-shadow: 0 0 0 7px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }
@media (prefers-reduced-motion: reduce) { .live.on .pulse { animation: none; } }
.content { padding: 24px 32px 56px; display: flex; flex-direction: column; gap: 20px; max-width: 1440px; width: 100%; }

/* ---------- building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 8px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card-head .desc { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 8px 20px 20px; }
.card > .table-wrap { border-top: 1px solid var(--border); }
.card > .card-head + .table-wrap { margin-top: 8px; }
.card > .table-wrap:first-child { border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > * { min-width: 0; }
@media (max-width: 1150px) { .grid.two, .grid.three, .grid.side { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-sm); transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { color: var(--danger-ink); }
.btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-sm); }
.segmented button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 7px; cursor: pointer; color: var(--text-2); font-weight: 600; }
.segmented button:hover { background: var(--surface-hover); }
.segmented button[aria-pressed="true"] { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.input, select.input {
  height: 36px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); min-width: 0; box-shadow: var(--shadow-sm);
}
textarea.input { height: auto; padding: 8px 10px; font-family: var(--mono); font-size: 12px; }
.input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.search { width: 290px; padding-left: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8494' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 11px center; background-size: 15px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }

/* toggle switch */
.switch { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--border); }
.switch:first-child { border-top: 0; padding-top: 4px; }
.switch .text strong { display: block; font-weight: 600; }
.switch .text span { color: var(--muted); font-size: 12.5px; }
.toggle { position: relative; display: inline-block; vertical-align: middle; width: 40px; height: 22px; flex: none; margin-top: 2px; }
.toggle input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; inset: 0; z-index: 1; }
.toggle .track { position: absolute; inset: 0; border-radius: 22px; background: var(--border-strong); transition: background 0.15s; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* mode picker */
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.mode {
  position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: 14px 16px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.mode:hover { border-color: var(--brand); }
.mode strong { font-weight: 650; padding-right: 24px; }
.mode span { color: var(--muted); font-size: 12.5px; }
.mode[aria-checked="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-tint); }
.mode[aria-checked="true"]::after {
  content: "✓"; position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--brand); color: #fff;
}

/* save bar */
.savebar {
  position: sticky; top: 76px; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px 10px 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
}
.savebar .state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.savebar.dirty { border-color: color-mix(in srgb, var(--status-warning) 70%, transparent); background: color-mix(in srgb, var(--status-warning) 10%, var(--surface)); }
.savebar.dirty .state { color: var(--warn-ink); }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 650; color: var(--muted); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; transition: background 0.1s; }
table.data tbody tr.clickable:hover { background: var(--surface-hover); }
table.data tbody tr.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--brand-tint); } to { background: transparent; } }
table.data select.input { max-width: 330px; }
table.data input.input { max-width: 150px; }
table.data td:last-child { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); }

/* empty states */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-ink); }
.empty-state .icon svg { width: 22px; height: 22px; }
.empty-state strong { color: var(--text); font-size: 14.5px; }
.empty-state code { font-family: var(--mono); font-size: 12px; padding: 6px 10px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }

/* badges: status always icon + label, never colour alone */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge .ico { font-size: 11px; line-height: 1; }
.badge.approved, .badge.active { color: var(--ok-ink); background: color-mix(in srgb, var(--status-good) 11%, transparent); border-color: color-mix(in srgb, var(--status-good) 32%, transparent); }
.badge.declined { color: var(--danger-ink); background: color-mix(in srgb, var(--status-critical) 9%, transparent); border-color: color-mix(in srgb, var(--status-critical) 32%, transparent); }
.badge.error, .badge.no_response, .badge.drop_connection, .badge.pending { color: var(--warn-ink); background: color-mix(in srgb, var(--status-warning) 13%, transparent); border-color: color-mix(in srgb, var(--status-warning) 45%, transparent); }
.badge.proto { background: var(--brand-tint); color: var(--brand-ink); border-color: transparent; font-family: var(--mono); font-size: 11px; font-weight: 600; }
.badge.disabled { color: var(--muted); }
.pan { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.card-label { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.tile .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile .tile-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-tint); color: var(--brand-ink); }
.tile .tile-icon svg { width: 16px; height: 16px; }
.tile .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.tile .note { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }

/* charts */
.chart-card .card-head .actions { display: flex; gap: 6px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:focus { outline: none; }
.chart .col-hover { fill: var(--text); opacity: 0; pointer-events: none; }
.chart g.col:focus-within .col-hover, .chart g.col:hover .col-hover { opacity: 0.05; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 2px 0 12px; font-size: 12.5px; color: var(--text-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.bars { display: grid; grid-template-columns: minmax(90px, max-content) 1fr; gap: 10px 14px; align-items: center; }
.bars .bar-label { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.bars .bar-row { display: flex; align-items: center; gap: 8px; min-width: 0; border-radius: 4px; padding: 3px 0; }
.bars .bar-row:focus-visible { outline-offset: 0; }
.bars .bar { height: 14px; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--series-1); transition: width 0.25s ease; }
.bars .bar-row:hover .bar, .bars .bar-row:focus .bar { filter: brightness(1.12); }
.bars .bar-value { font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }

.segbar { display: flex; gap: 2px; height: 28px; margin: 6px 0 12px; }
.segbar .seg { height: 100%; border-radius: 4px; display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: 12px; font-weight: 650; white-space: nowrap; min-width: 0; }
.segbar .seg:hover, .segbar .seg:focus { filter: brightness(1.1); }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 150px; max-width: 280px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 9px;
  box-shadow: var(--shadow-lg); padding: 9px 11px; font-size: 12.5px;
}
.tooltip .tt-title { color: var(--muted); font-size: 11.5px; margin-bottom: 5px; font-weight: 600; }
.tooltip .tt-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.tooltip .tt-key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .tt-line { width: 12px; height: 3px; border-radius: 2px; }
.tooltip .tt-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 20, 30, 0.4); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; width: min(780px, 100vw);
  background: var(--page); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slide-in 0.18s ease-out;
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-hero { padding: 18px 24px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-hero .row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-hero .kicker { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; }
.drawer-hero .amount { margin: 2px 0 8px; font-size: 30px; font-weight: 750; letter-spacing: -0.02em; }
.drawer-hero .facts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.drawer-hero .response { color: var(--text-2); font-weight: 550; }
.drawer .body { overflow: auto; padding: 18px 24px 40px; display: flex; flex-direction: column; gap: 16px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; }
.kv dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.trace { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.trace li { position: relative; padding: 0 0 14px 24px; }
.trace li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-ink); box-sizing: border-box; }
.trace li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.trace li:last-child::after { display: none; }
.trace li:last-child::before { background: var(--brand-ink); }
.trace .step { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
pre.code { margin: 0; padding: 12px 14px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); overflow: auto; font-family: var(--mono); font-size: 12px; max-height: 360px; white-space: pre; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; cursor: pointer; color: var(--text-2); font-weight: 650; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand-ink); }
details summary { cursor: pointer; color: var(--text-2); font-weight: 600; margin-top: 10px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(10, 20, 30, 0.45); display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(720px, 100%); max-height: 90vh; overflow: auto; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal header h2 { margin: 0; font-size: 17px; }
.modal .body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }

/* callouts */
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.callout.warn { border-color: color-mix(in srgb, var(--status-warning) 55%, transparent); background: color-mix(in srgb, var(--status-warning) 10%, var(--surface)); }
.callout.ok { border-color: color-mix(in srgb, var(--status-good) 40%, transparent); background: color-mix(in srgb, var(--status-good) 7%, var(--surface)); }
.callout .ico { font-weight: 800; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.checklist li { display: flex; gap: 10px; }
.checklist .yes, .checklist .no { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; margin-top: 1px; }
.checklist .yes { color: var(--ok-ink); background: color-mix(in srgb, var(--status-good) 14%, transparent); }
.checklist .no { color: var(--warn-ink); background: color-mix(in srgb, var(--status-warning) 18%, transparent); }

/* toasts */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--surface); padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 600; }
.toast.error { background: var(--status-critical); color: #fff; }

/* sign-in */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.login-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 26px; padding: 56px;
  background: linear-gradient(150deg, var(--brand) 0%, var(--brand-deep) 100%); color: #fff;
}
.login-brand::after { content: ""; position: absolute; right: -140px; bottom: -140px; width: 460px; height: 460px; border: 70px solid rgba(255, 255, 255, 0.06); transform: rotate(45deg); }
.brand-card { width: 330px; background: #fff; border-radius: 12px; padding: 16px 18px 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16); }
.brand-card img { display: block; width: 100%; height: auto; }
.brand-card .product {
  margin-top: 10px; padding-top: 8px; border-top: 1px solid #e6e9ee;
  color: var(--brand); font-weight: 700; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; text-align: center;
}
.login-brand h1 { margin: 0; font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; max-width: 520px; }
.login-brand p { margin: 0; max-width: 500px; color: rgba(255, 255, 255, 0.82); font-size: 15px; }
.login-brand .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.login-brand .chip { padding: 6px 12px; border-radius: 20px; background: rgba(255, 255, 255, 0.12); font-size: 12.5px; font-weight: 600; }
.login-form { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.login-form form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-form h2 { margin: 0 0 2px; font-size: 24px; }
.login-form .err { color: var(--danger-ink); font-size: 13px; min-height: 18px; }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login-brand { padding: 32px; } .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }
.copy-row { display: flex; gap: 8px; align-items: flex-start; }
.copy-row pre { flex: 1; min-width: 0; }
.row-sub { white-space: nowrap; }

/* terminal page */
.crumb a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.crumb a:hover { color: var(--text); }
.terminal-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 16px 20px; }
.terminal-summary .kv { flex: 1; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.content > .tabs { margin: 0 0 -6px; }
.tabs button { font-size: 14px; }
.tabs button:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: -2px; border-radius: 6px 6px 0 0; }
[role="tabpanel"][hidden] { display: none; }
.settings-table td.value { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-table td:first-child { white-space: nowrap; }
