/* Kalla console prototype — design tokens and components */
:root {
  color-scheme: light;
  --bg: #f2f5f5;
  --surface: #ffffff;
  --surface-2: #f7f9f9;
  --surface-3: #eef2f3;
  --border: #dae2e4;
  --border-strong: #c2ced1;
  --ink: #10242b;
  --ink-2: #34494f;
  --muted: #5b6f75;
  --faint: #8a9ca1;
  --accent: #0f6b58;
  --accent-hover: #0b5a4a;
  --accent-contrast: #ffffff;
  --accent-soft: #e2f0ec;
  --accent-ink: #0b5041;
  --focus: #2d7fd6;
  --ok: #17663a; --ok-bg: #e3f3e8; --ok-dot: #1f9d55;
  --warn: #7a4d00; --warn-bg: #fcefd2; --warn-dot: #d99a1b;
  --bad: #a3231a; --bad-bg: #fce7e4; --bad-dot: #d93b2f;
  --info: #1c5596; --info-bg: #e5eefa; --info-dot: #2f74c8;
  --neutral: #46585e; --neutral-bg: #eaeff0; --neutral-dot: #8a9ca1;
  --future: #5b3f99; --future-bg: #efe9fb; --future-dot: #7d5cc6;
  --live: #0e9f6e;
  --code-bg: #0f1c21;
  --code-ink: #d6e4e7;
  --code-muted: #7f979e;
  --code-tag: #7cc7e8;
  --code-attr: #e7c07a;
  --code-str: #9fd8a8;
  --code-key: #f0a38c;
  --code-border: #1d2f36;
  --scrim: rgba(12, 24, 28, 0.42);
  --shadow-sm: 0 1px 2px rgba(16, 36, 43, 0.06);
  --shadow-md: 0 6px 24px rgba(16, 36, 43, 0.10), 0 1px 3px rgba(16, 36, 43, 0.08);
  --shadow-lg: 0 24px 64px rgba(16, 36, 43, 0.18), 0 2px 8px rgba(16, 36, 43, 0.08);
  --proto-bg: #fff6de;
  --proto-ink: #6b4a00;
  --proto-border: #ecd592;
  --op-side: #1b1f23;
  --op-side-2: #24292e;
  --op-side-ink: #d5dade;
  --op-side-muted: #8e979f;
  --op-accent: #c8741b;
  --op-accent-soft: #3a2a17;
  --op-band: #f6e3c9;
  --op-band-ink: #7a4308;
  --radius: 10px;
  --radius-sm: 7px;
  --ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 252px;
  --proto-h: 40px;
  --top-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1316; --surface: #111c20; --surface-2: #142227; --surface-3: #192a30;
    --border: #22363c; --border-strong: #2f474e;
    --ink: #e3edef; --ink-2: #bccbcf; --muted: #8fa3a9; --faint: #6b8187;
    --accent: #34b38c; --accent-hover: #45c29b; --accent-contrast: #03211a;
    --accent-soft: #123a31; --accent-ink: #86dcbf; --focus: #6cb2ff;
    --ok: #86dca8; --ok-bg: #10301f; --ok-dot: #3cc47a;
    --warn: #f1c46d; --warn-bg: #33270c; --warn-dot: #e5a93a;
    --bad: #ff9f94; --bad-bg: #3a1714; --bad-dot: #f0594c;
    --info: #97c2f5; --info-bg: #132a45; --info-dot: #5b9ae6;
    --neutral: #b6c6ca; --neutral-bg: #1c2b30; --neutral-dot: #7c9197;
    --future: #c9b3ff; --future-bg: #2a2143; --future-dot: #a88cf0;
    --live: #3cd59b;
    --code-bg: #081114; --code-border: #1a2a30;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 8px 28px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.4);
    --shadow-lg: 0 24px 64px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
    --proto-bg: #2a220d; --proto-ink: #f0cf7a; --proto-border: #4d3d12;
    --op-side: #0d1013; --op-side-2: #171b1f; --op-side-ink: #d5dade; --op-side-muted: #87919a;
    --op-accent: #e59a4b; --op-accent-soft: #3a2a17; --op-band: #33230f; --op-band-ink: #f2bf85;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1316; --surface: #111c20; --surface-2: #142227; --surface-3: #192a30;
  --border: #22363c; --border-strong: #2f474e;
  --ink: #e3edef; --ink-2: #bccbcf; --muted: #8fa3a9; --faint: #6b8187;
  --accent: #34b38c; --accent-hover: #45c29b; --accent-contrast: #03211a;
  --accent-soft: #123a31; --accent-ink: #86dcbf; --focus: #6cb2ff;
  --ok: #86dca8; --ok-bg: #10301f; --ok-dot: #3cc47a;
  --warn: #f1c46d; --warn-bg: #33270c; --warn-dot: #e5a93a;
  --bad: #ff9f94; --bad-bg: #3a1714; --bad-dot: #f0594c;
  --info: #97c2f5; --info-bg: #132a45; --info-dot: #5b9ae6;
  --neutral: #b6c6ca; --neutral-bg: #1c2b30; --neutral-dot: #7c9197;
  --future: #c9b3ff; --future-bg: #2a2143; --future-dot: #a88cf0;
  --live: #3cd59b;
  --code-bg: #081114; --code-border: #1a2a30;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 28px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
  --proto-bg: #2a220d; --proto-ink: #f0cf7a; --proto-border: #4d3d12;
  --op-side: #0d1013; --op-side-2: #171b1f; --op-side-ink: #d5dade; --op-side-muted: #87919a;
  --op-accent: #e59a4b; --op-accent-soft: #3a2a17; --op-band: #33230f; --op-band-ink: #f2bf85;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--ui); font-feature-settings: "ss01" on;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.num, td.num { font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.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; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

:where(svg.i) { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
h1[tabindex="-1"]:focus { outline: none; }

/* ---------- prototype toolbar ---------- */
.proto-bar {
  position: relative; z-index: 60;
  min-height: var(--proto-h); display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 16px; background: var(--proto-bg); color: var(--proto-ink);
  border-bottom: 1px dashed var(--proto-border); font-size: 12.5px;
}
.proto-tag { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; display: inline-flex; align-items: center; gap: 6px; }
.proto-bar .seg { background: color-mix(in srgb, var(--proto-ink) 8%, transparent); border-color: var(--proto-border); }
.proto-bar .seg button { color: var(--proto-ink); }
.proto-bar .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.proto-bar select, .proto-bar .btn { height: 28px; font-size: 12.5px; border-color: var(--proto-border); background: transparent; color: var(--proto-ink); }
.proto-bar .btn:hover { background: color-mix(in srgb, var(--proto-ink) 10%, transparent); }
.proto-spacer { flex: 1; }
.proto-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.proto-check input { accent-color: var(--proto-ink); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100% - var(--proto-h)); }
.side {
  position: sticky; top: env(safe-area-inset-top, 0px); align-self: start;
  height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 12px 12px; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: 0.02em; }
.ws-switch {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer;
}
.ws-switch:hover { border-color: var(--border-strong); }
.ws-avatar { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; background: #3a6f8f; flex: none; }
.ws-meta { min-width: 0; flex: 1; }
.ws-name { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-plan { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-switch > svg { width: 16px; height: 16px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); padding: 4px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13.5px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.nav-item svg { width: 17px; height: 17px; flex: none; color: var(--muted); }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-item[aria-current="page"] svg { color: var(--accent-ink); }
.nav-item .count { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); line-height: 18px; }
.nav-item .count.alert { background: var(--bad-bg); color: var(--bad); }
.nav-item .nav-tag { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--future-bg); color: var(--future); line-height: 17px; white-space: nowrap; }
.nav-item .count.warn { background: var(--warn-bg); color: var(--warn); }
.nav-item .livedot { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.setup-mini { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); cursor: pointer; text-align: left; width: 100%; }
.setup-mini:hover { border-color: var(--border-strong); }
.setup-mini .row { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; }
.setup-mini .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a, .crumbs button { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.crumbs a:hover, .crumbs button:hover { color: var(--ink); }
.crumbs .cur { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumbs svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 10px; min-width: 240px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 13px;
}
.search-btn:hover { border-color: var(--border-strong); }
.search-btn svg { width: 15px; height: 15px; }
.search-btn kbd { margin-left: auto; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }
.env-badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); white-space: nowrap; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink-2); position: relative; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .badge-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad-dot); border: 2px solid var(--bg); }
.me { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); border: 0; cursor: pointer; }

.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 26px 28px 120px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow { max-width: 920px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head .titles { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-size: 24px; letter-spacing: -0.02em; }
.page-head .lede { color: var(--muted); max-width: 72ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- layout helpers ---------- */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.split-wide { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); border: 0; margin: 4px 0; }
.mt0 { margin-top: 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 16px 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card.flat { box-shadow: none; }
.section-title { font-size: 15px; font-weight: 600; }
.section-sub { color: var(--muted); font-size: 13px; }

/* stat tiles (used sparingly) */
.stat { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.stat .foot { font-size: 12px; color: var(--muted); }

/* key/value */
.kv { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv.tight { gap: 4px 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad-dot); color: #fff; border-color: var(--bad-dot); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 2px; font-size: inherit; }
.link-btn:hover { text-decoration-color: currentColor; }

/* segmented */
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); cursor: pointer; min-height: 26px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--neutral-dot); flex: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.ok::before { background: var(--ok-dot); }
.pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.warn::before { background: var(--warn-dot); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.bad::before { background: var(--bad-dot); }
.pill.info { background: var(--info-bg); color: var(--info); } .pill.info::before { background: var(--info-dot); }
.pill.future { background: var(--future-bg); color: var(--future); } .pill.future::before { background: var(--future-dot); }
.pill.live { background: var(--ok-bg); color: var(--ok); } .pill.live::before { background: var(--live); animation: pulse 1.6s ease-in-out infinite; }
.pill.nodot::before { display: none; }
.pill.outline { background: none; border: 1px solid var(--border-strong); color: var(--ink-2); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 0%, transparent); } }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap; font-family: var(--mono); letter-spacing: -0.01em; }
.tag.plain { font-family: var(--ui); letter-spacing: 0; }
.livedot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); display: inline-block; animation: pulse 1.6s ease-in-out infinite; flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--neutral-dot); }
.dot.ok { background: var(--ok-dot); } .dot.warn { background: var(--warn-dot); } .dot.bad { background: var(--bad-dot); } .dot.info { background: var(--info-dot); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field .label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.field .opt { color: var(--muted); font-weight: 500; font-size: 12px; }
.help { color: var(--muted); font-size: 12.5px; }
.err { color: var(--bad); font-size: 12.5px; display: flex; gap: 6px; align-items: flex-start; }
.err svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font-size: 13.5px; min-width: 0;
}
.textarea { height: auto; min-height: 92px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input.mono, .textarea.mono { font-family: var(--mono); font-size: 12.5px; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid color-mix(in srgb, var(--focus) 55%, transparent); outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--bad-dot); }
.input[readonly] { background: var(--surface-2); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group .input { border-radius: 8px 0 0 8px; }
.input-group .btn { border-radius: 0 8px 8px 0; margin-left: -1px; height: 36px; }
.input-affix { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); padding-left: 10px; min-width: 0; }
.input-affix span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.input-affix .input { border: 0; height: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 14px; margin: 0; min-width: 0; }
.fieldset legend { font-weight: 600; padding: 0 6px; font-size: 13px; }
.secret-state { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--border-strong); background: var(--surface-2); font-size: 13px; flex-wrap: wrap; }
.secret-state svg { width: 16px; height: 16px; color: var(--ok-dot); flex: none; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 38px; height: 22px; margin: 0; cursor: pointer; }
.switch .track { width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .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,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }

/* radio / choice cards */
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.choice { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.choice:hover { border-color: var(--accent); }
.choice input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.choice .t { font-weight: 600; font-size: 13.5px; }
.choice .d { color: var(--muted); font-size: 12.5px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice.disabled { opacity: .6; cursor: not-allowed; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; min-width: 0; }
.table { display: table; width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead { display: table-header-group; }
.table tbody { display: table-row-group; }
.table tr { display: table-row; }
.table th, .table td { display: table-cell; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.table tbody tr.sel td { background: var(--accent-soft); }
.table .r { text-align: right; }
.table .mono { font-size: 12.5px; }
.table td .sub { color: var(--muted); font-size: 12px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.filters .input, .filters .select { height: 32px; width: auto; min-width: 150px; font-size: 13px; }
.filters .search { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.dir { display: inline-flex; align-items: center; gap: 6px; }
.dir svg { width: 15px; height: 15px; color: var(--muted); }
.e164 { font-family: var(--mono); font-size: 12.5px; letter-spacing: -0.01em; white-space: nowrap; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; padding: 9px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; background: var(--surface-3); border-radius: 999px; padding: 0 6px; color: var(--ink-2); }

/* ---------- callouts ---------- */
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.callout > svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--muted); }
.callout .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.callout .t { font-weight: 600; }
.callout.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 22%, transparent); } .callout.info > svg { color: var(--info); }
.callout.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 22%, transparent); } .callout.warn > svg { color: var(--warn); }
.callout.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 22%, transparent); } .callout.bad > svg { color: var(--bad); }
.callout.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 22%, transparent); } .callout.ok > svg { color: var(--ok); }
.callout.future { background: var(--future-bg); border-color: color-mix(in srgb, var(--future) 22%, transparent); } .callout.future > svg { color: var(--future); }

/* ---------- empty ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px; color: var(--muted); }
.empty svg { width: 28px; height: 28px; color: var(--faint); }
.empty .t { color: var(--ink); font-weight: 600; font-size: 14.5px; }

/* ---------- code ---------- */
.code { position: relative; background: var(--code-bg); color: var(--code-ink); border-radius: 9px; border: 1px solid var(--code-border); overflow: hidden; min-width: 0; }
.code-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--code-border); }
.code-head .lang { font-size: 11.5px; color: var(--code-muted); font-family: var(--mono); }
.code-head .code-tab { background: none; border: 0; color: var(--code-muted); font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 5px; cursor: pointer; }
.code-head .code-tab[aria-selected="true"] { color: var(--code-ink); background: rgba(255,255,255,.07); }
.code-head .copy { margin-left: auto; background: none; border: 1px solid var(--code-border); color: var(--code-muted); border-radius: 6px; height: 26px; padding: 0 8px; display: inline-flex; gap: 5px; align-items: center; font-size: 12px; cursor: pointer; }
.code-head .copy:hover { color: var(--code-ink); border-color: #35505a; }
.code-head .copy svg { width: 13px; height: 13px; }
.code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; tab-size: 2; }
.code pre code { font-size: inherit; }
.tk-tag { color: var(--code-tag); } .tk-attr { color: var(--code-attr); } .tk-str { color: var(--code-str); } .tk-key { color: var(--code-key); } .tk-com { color: var(--code-muted); font-style: italic; } .tk-num { color: #c9a8f5; } .tk-kw { color: #f59ec1; }
.inline-code { font-family: var(--mono); font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--surface-3); border: 1px solid var(--border); overflow-wrap: anywhere; }
.copy-field { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); padding: 4px 4px 4px 10px; min-width: 0; }
.copy-field .v { font-family: var(--mono); font-size: 12.5px; flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; padding: 4px 0; }
.copy-field .btn { height: 28px; }

/* ---------- meters & charts ---------- */
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; border: 1px solid var(--border); }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.meter.warn > span { background: var(--warn-dot); }
.meter.bad > span { background: var(--bad-dot); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { stroke: var(--border); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 2 3; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--ui); }
.chart .bar { fill: var(--accent); }
.chart .bar.alt { fill: color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 86px 18px minmax(0, 1fr); gap: 10px; position: relative; padding-bottom: 14px; }
.timeline li::before { content: ""; position: absolute; left: 104px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .t { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding-top: 2px; text-align: right; white-space: nowrap; }
.timeline .m { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); margin-top: 4px; margin-left: 3px; }
.timeline .m.ok { border-color: var(--ok-dot); background: var(--ok-dot); }
.timeline .m.warn { border-color: var(--warn-dot); background: var(--warn-dot); }
.timeline .m.bad { border-color: var(--bad-dot); background: var(--bad-dot); }
.timeline .m.info { border-color: var(--info-dot); background: var(--info-dot); }
.timeline .c { min-width: 0; }
.timeline .c .h { font-weight: 600; font-size: 13.5px; }
.timeline .c .d { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }

/* ---------- checklist (onboarding) ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); align-items: start; }
.step:last-child { border-bottom: 0; }
.step .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); color: var(--muted); font-size: 12px; font-weight: 700; background: var(--surface); }
.step.done .ic { background: var(--ok-dot); border-color: var(--ok-dot); color: #fff; }
.step.done .ic svg { width: 14px; height: 14px; }
.step.wait .ic { border-color: var(--warn-dot); color: var(--warn); }
.step.current .ic { border-color: var(--accent); color: var(--accent-ink); }
.step .h { font-weight: 600; }
.step .d { color: var(--muted); font-size: 13px; margin-top: 2px; }
.step.done .h { color: var(--ink-2); }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 80; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 81; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .2s ease-out; border-left: 1px solid var(--border); }
.drawer.wide { width: min(760px, 100%); }
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
.drawer-head .titles { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); }
.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop .16s ease-out; display: flex; flex-direction: column; }
.modal.wide { width: min(720px, 100%); }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }
.modal-head { padding: 18px 20px 6px; display: flex; gap: 12px; align-items: flex-start; }
.modal-head h2 { font-size: 17px; flex: 1; }
.modal-body { padding: 8px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 14px 14px; }
.toasts { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(460px, calc(100% - 32px)); }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-md); font-size: 13.5px; font-weight: 500; animation: pop .18s ease-out; width: 100%; }
.toast svg { width: 16px; height: 16px; flex: none; }
.toast .btn { margin-left: auto; height: 26px; background: transparent; color: inherit; border-color: color-mix(in srgb, var(--bg) 35%, transparent); }

/* command palette */
.palette { position: fixed; z-index: 95; top: 12vh; left: 50%; transform: translateX(-50%); width: min(640px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .14s ease-out; }
.palette .input { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; height: 50px; font-size: 15px; padding: 0 16px; }
.palette .input:focus { outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 0; background: none; text-align: left; cursor: pointer; }
.palette li button:hover, .palette li button.hl { background: var(--surface-3); }
.palette li svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.palette .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 8px 10px 4px; font-weight: 600; }
.palette li .k { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---------- softphone / call strip ---------- */
.call-strip {
  position: fixed; left: calc(var(--side-w) + 16px); right: 16px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-radius: 12px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); flex-wrap: wrap;
}
.call-strip .who { display: flex; flex-direction: column; min-width: 0; }
.call-strip .who .n { font-weight: 600; font-size: 13.5px; }
.call-strip .who .s { font-size: 12px; opacity: .75; }
.call-strip .ctrls { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.call-strip .cbtn { height: 36px; min-width: 44px; padding: 0 10px; border-radius: 9px; border: 1px solid color-mix(in srgb, var(--bg) 22%, transparent); background: color-mix(in srgb, var(--bg) 8%, transparent); color: inherit; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: 12.5px; }
.call-strip .cbtn:hover { background: color-mix(in srgb, var(--bg) 16%, transparent); }
.call-strip .cbtn[aria-pressed="true"] { background: var(--bg); color: var(--ink); }
.call-strip .cbtn.end { background: var(--bad-dot); border-color: var(--bad-dot); color: #fff; }
.call-strip .cbtn svg { width: 16px; height: 16px; }
.call-strip .timer { font-family: var(--mono); font-size: 12.5px; opacity: .85; }
.ring-card { position: fixed; top: calc(var(--top-h) + 12px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 75; width: min(360px, calc(100% - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; animation: pop .2s ease-out; }
.ring-card .ringing { display: flex; align-items: center; gap: 10px; }
.ring-card .ring-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); animation: ring 1.4s ease-in-out infinite; flex: none; }
.ring-card .ring-ic svg { width: 20px; height: 20px; }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 45%, transparent); } 60% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--live) 0%, transparent); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { height: 52px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; font-family: var(--mono); }
.keypad button small { font-size: 9.5px; letter-spacing: .12em; color: var(--muted); font-family: var(--ui); font-weight: 600; }
.keypad button:hover { background: var(--surface-3); }
.dtmf-log { font-family: var(--mono); font-size: 13px; min-height: 22px; letter-spacing: .1em; }

/* ---------- waveform player ---------- */
.player { display: flex; flex-direction: column; gap: 10px; }
.player-row { display: flex; align-items: center; gap: 10px; }
.play-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center; cursor: pointer; flex: none; }
.play-btn svg { width: 16px; height: 16px; }
.wave { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.wave .track-label { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.wave svg { width: 100%; height: 34px; display: block; }
.wave rect { fill: var(--border-strong); }
.wave rect.on { fill: var(--accent); }
.wave.b rect.on { fill: var(--info-dot); }
.player .time { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* transcript */
.transcript { display: flex; flex-direction: column; gap: 10px; }
.utt { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
.utt .who { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 1px; }
.utt .who .ts { display: block; font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--faint); }
.utt.a .who { color: var(--accent-ink); }
.utt.b .who { color: var(--info); }
.utt p { font-size: 13.5px; }
.hl-kw { background: color-mix(in srgb, var(--warn-dot) 28%, transparent); border-radius: 3px; padding: 0 2px; }

/* SIP ladder */
.ladder { overflow-x: auto; }
.ladder svg { min-width: 560px; width: 100%; height: auto; display: block; }
.ladder .ent { fill: var(--surface-2); stroke: var(--border-strong); }
.ladder .ent-t { fill: var(--ink); font: 600 12px var(--ui); }
.ladder .ent-s { fill: var(--muted); font: 11px var(--mono); }
.ladder .life { stroke: var(--border-strong); stroke-dasharray: 3 4; }
.ladder .msg { stroke: var(--ink-2); stroke-width: 1.3; fill: none; }
.ladder .msg.ok { stroke: var(--ok-dot); }
.ladder .msg.bad { stroke: var(--bad-dot); }
.ladder .msg.media { stroke: var(--info-dot); stroke-dasharray: 5 4; }
.ladder .lbl { fill: var(--ink); font: 500 11.5px var(--mono); }
.ladder .lbl.bad { fill: var(--bad); }
.ladder .ts { fill: var(--muted); font: 10.5px var(--mono); }
.ladder .arrow { fill: var(--ink-2); }
.ladder .arrow.ok { fill: var(--ok-dot); }
.ladder .arrow.bad { fill: var(--bad-dot); }

/* route flow */
.flow { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.flow-node { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; }
.flow-node .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.flow-node .ic svg { width: 16px; height: 16px; }
.flow-node .t { font-weight: 600; font-size: 13.5px; }
.flow-node .d { color: var(--muted); font-size: 12.5px; }
.flow-node.fallback { border-style: dashed; }
.flow-node.fallback .ic { background: var(--warn-bg); color: var(--warn); }
.flow-edge { height: 22px; margin-left: 27px; border-left: 2px solid var(--border-strong); position: relative; }
.flow-edge span { position: absolute; left: 10px; top: 2px; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.flow-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }

/* feature catalog */
.feature { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.feature-top { display: flex; gap: 12px; align-items: flex-start; }
.feature .fic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.feature .fic svg { width: 19px; height: 19px; }
.feature .fname { font-weight: 600; font-size: 14.5px; }
.feature .fdesc { color: var(--muted); font-size: 13px; }
.feature .fmeta { display: flex; gap: 6px; flex-wrap: wrap; }
.feature .ffoot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* fax pages */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.page-thumb { aspect-ratio: 8.5 / 11; max-width: 100%; background: #fff; border: 1px solid var(--border-strong); border-radius: 4px; box-shadow: var(--shadow-sm); padding: 10px 9px; display: flex; flex-direction: column; gap: 5px; position: relative; overflow: hidden; }
.page-thumb .ln { height: 3px; border-radius: 2px; background: #cfd6d8; }
.page-thumb .ln.h { height: 6px; background: #8f9ea3; width: 60%; margin-bottom: 4px; }
.page-thumb .ln.s { width: 45%; }
.page-thumb .pno { position: absolute; bottom: 5px; right: 7px; font: 600 10px var(--mono); color: #6b7c81; }
.page-thumb .cover { font: 700 11px var(--ui); color: #34464c; text-transform: uppercase; letter-spacing: .06em; }
.page-thumb.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.file-row svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.dropzone svg { width: 24px; height: 24px; color: var(--faint); }

/* messaging */
.inbox { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 560px; }
.thread-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 680px; }
.thread-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; }
.thread-item:hover { background: var(--surface-2); }
.thread-item[aria-current="true"] { background: var(--accent-soft); }
.thread-item .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: 12px; color: var(--ink-2); flex: none; }
.thread-item .meta { min-width: 0; flex: 1; }
.thread-item .top { display: flex; justify-content: space-between; gap: 8px; }
.thread-item .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-item .tm { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.thread-item .pv { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo { display: flex; flex-direction: column; min-width: 0; }
.convo-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.bubbles { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; background: var(--surface-2); max-height: 460px; }
.bubble { max-width: min(460px, 82%); padding: 9px 12px; border-radius: 14px; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.bubble.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--accent); color: var(--accent-contrast); border-bottom-right-radius: 4px; }
.bubble .st { font-size: 11px; opacity: .8; display: flex; gap: 6px; align-items: center; }
.bubble.sys { align-self: center; background: none; color: var(--muted); font-size: 12px; text-align: center; max-width: 90%; }
.composer { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.seg-meter { display: flex; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; align-items: center; }

/* docs */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr) 200px; gap: 28px; align-items: start; }
.docs-nav { position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100vh - var(--top-h) - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 6px; }
.docs-nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; padding: 0 8px; margin-bottom: 2px; }
.docs-nav button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px; border-radius: 6px; color: var(--ink-2); font-size: 13.5px; cursor: pointer; }
.docs-nav button:hover { background: var(--surface-3); }
.docs-nav button[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.doc { min-width: 0; display: flex; flex-direction: column; gap: 16px; max-width: 800px; }
.doc h1 { font-size: 28px; letter-spacing: -0.02em; }
.doc h2 { font-size: 19px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); scroll-margin-top: 120px; }
.doc h3 { font-size: 15px; margin-top: 6px; scroll-margin-top: 120px; }
.doc p, .doc li { color: var(--ink-2); line-height: 1.65; max-width: 72ch; }
.doc ul, .doc ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.doc .lead { font-size: 15.5px; color: var(--ink-2); }
.doc table { font-size: 13px; }
.doc-toc { position: sticky; top: calc(var(--top-h) + 16px); font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.doc-toc .t { font-weight: 600; color: var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.doc-toc a { color: var(--muted); text-decoration: none; }
.doc-toc a:hover { color: var(--ink); }
.endpoint { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); flex-wrap: wrap; overflow-wrap: anywhere; }
.method { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; letter-spacing: .02em; }
.method.get { background: var(--info-bg); color: var(--info); }
.method.post { background: var(--ok-bg); color: var(--ok); }
.method.put, .method.patch { background: var(--warn-bg); color: var(--warn); }
.method.delete { background: var(--bad-bg); color: var(--bad); }
.method.ws { background: var(--future-bg); color: var(--future); }
.params { width: 100%; border-collapse: collapse; font-size: 13px; }
.params th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.params td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.params td:first-child { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.params .req { color: var(--bad); font-size: 11px; font-family: var(--ui); font-weight: 600; margin-left: 4px; }
.support-yes { color: var(--ok); font-weight: 600; }
.support-part { color: var(--warn); font-weight: 600; }
.support-no { color: var(--muted); font-weight: 600; }

/* build notes panel (prototype) */
.notes { position: fixed; right: 16px; bottom: 16px; z-index: 72; width: min(380px, calc(100% - 32px)); max-height: 60vh; overflow-y: auto; background: var(--proto-bg); color: var(--proto-ink); border: 1px dashed var(--proto-border); border-radius: 12px; box-shadow: var(--shadow-md); padding: 12px 14px; font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; }
.notes h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; gap: 6px; }
.notes .ep { font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }
.notes ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 3px; }
.notes .close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; }
.status-legend { display: flex; flex-wrap: wrap; gap: 6px; }

/* operator chrome */
.surface-operator .side { background: var(--op-side); border-right-color: #000; color: var(--op-side-ink); }
.surface-operator .brand-sub { color: var(--op-accent); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.surface-operator .nav-label { color: var(--op-side-muted); }
.surface-operator .nav-item { color: var(--op-side-ink); }
.surface-operator .nav-item svg { color: var(--op-side-muted); }
.surface-operator .nav-item:hover { background: var(--op-side-2); color: #fff; }
.surface-operator .nav-item[aria-current="page"] { background: var(--op-accent-soft); color: #ffd9ad; box-shadow: inset 2px 0 0 var(--op-accent); }
.surface-operator .nav-item[aria-current="page"] svg { color: var(--op-accent); }
.surface-operator .nav-item .count { background: var(--op-side-2); color: var(--op-side-ink); }
.surface-operator .nav-item .count.warn { background: #4a3413; color: #f5c27e; }
.surface-operator .nav-item .count.alert { background: #4a1c18; color: #ffaaa0; }
.surface-operator .ws-switch { background: var(--op-side-2); border-color: #2f353b; color: var(--op-side-ink); }
.surface-operator .ws-plan { color: var(--op-side-muted); }
.surface-operator .setup-mini { background: var(--op-side-2); border-color: #2f353b; color: var(--op-side-ink); }
.surface-operator .setup-mini .sub { color: var(--op-side-muted); }
.op-band { display: flex; align-items: center; gap: 8px; padding: 6px 24px; background: var(--op-band); color: var(--op-band-ink); font-size: 12.5px; font-weight: 600; border-bottom: 1px solid color-mix(in srgb, var(--op-accent) 35%, transparent); flex-wrap: wrap; }
.op-band svg { width: 15px; height: 15px; }

/* public site */
.pub { background: var(--bg); min-height: calc(100% - var(--proto-h)); }
.pub-nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; display: flex; align-items: center; gap: 18px; padding: 0 max(16px, calc((100% - 1180px) / 2)); height: 60px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.pub-nav .links { display: flex; gap: 4px; }
.pub-nav .links button { background: none; border: 0; padding: 8px 10px; border-radius: 7px; font-weight: 600; color: var(--ink-2); cursor: pointer; font-size: 13.5px; }
.pub-nav .links button:hover, .pub-nav .links button[aria-current="page"] { color: var(--ink); background: var(--surface-3); }
.pub-nav .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pub-wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: center; padding: 64px 0 48px; }
.hero h1 { font-size: clamp(34px, 4.6vw, 54px); letter-spacing: -0.035em; line-height: 1.05; font-weight: 650; font-stretch: 92%; }
.hero .sub { font-size: 17px; color: var(--ink-2); line-height: 1.6; max-width: 56ch; margin-top: 16px; }
.hero .cta { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.hero .fine { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.pub-section { padding: 56px 0; border-top: 1px solid var(--border); }
.pub-section h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.025em; font-stretch: 94%; }
.pub-section .intro { color: var(--ink-2); font-size: 15.5px; max-width: 64ch; margin-top: 8px; }
.how { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 28px; counter-reset: how; }
.how .card { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.how .n { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); font-weight: 600; }
.how h3 { font-size: 15.5px; }
.how p { color: var(--muted); font-size: 13.5px; }
.cap-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.cap-grid .card { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.cap-grid .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }
.cap-grid .ic svg { width: 18px; height: 18px; }
.cap-grid h3 { font-size: 15px; }
.cap-grid p { color: var(--muted); font-size: 13.5px; }
.price-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0; overflow: hidden; margin-top: 28px; }
.price-card .left { padding: 28px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.price-card .amt { font-size: 48px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.price-card .amt small { font-size: 16px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.price-card .right { padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.price-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.price-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.price-list li:last-child { border-bottom: 0; }
.price-list li span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.pub-foot { padding: 32px 0 48px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.auth-wrap { min-height: calc(100vh - var(--proto-h) - 60px); display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(420px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-size: 22px; }
.demo-call { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.demo-call .line { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.demo-call .line .t { font-family: var(--mono); color: var(--muted); font-size: 11.5px; width: 62px; flex: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .docs { grid-template-columns: 220px minmax(0, 1fr); }
  .doc-toc { display: none; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  :root { --side-w: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; width: 280px; z-index: 85; transform: translateX(-105%); transition: transform .2s ease-out; box-shadow: var(--shadow-lg); padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .app.nav-open .side { transform: none; }
  .menu-btn { display: inline-grid; }
  .search-btn { min-width: 0; }
  .search-btn .lbl, .search-btn kbd { display: none; }
  .topbar { padding: 0 16px; }
  .page { padding: 18px 16px 120px; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-wide { grid-template-columns: minmax(0, 1fr); }
  .docs { grid-template-columns: minmax(0, 1fr); }
  .docs-nav { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; gap: 6px; padding: 0; }
  .docs-nav .grp { display: none; }
  .docs-nav > div { display: contents; }
  .docs-nav button { width: auto; border: 1px solid var(--border); background: var(--surface); }
  .call-strip { left: 16px; }
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: 40px; gap: 28px; }
  .how { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .thread-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 260px; }
  .op-band { padding: 6px 16px; }
  .pub-nav .links { display: none; }
}
@media (max-width: 640px) {
  .g2, .g3, .g4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .how, .cap-grid { grid-template-columns: minmax(0, 1fr); }
  .price-card { grid-template-columns: minmax(0, 1fr); }
  .price-card .left { border-right: 0; border-bottom: 1px solid var(--border); }
  .page-head h1 { font-size: 21px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 32px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .env-badge { display: none; }
  .timeline li { grid-template-columns: 58px 18px minmax(0, 1fr); }
  .timeline li::before { left: 76px; }
  .table.tstack thead { display: none; }
  .table.tstack, .table.tstack tbody, .table.tstack tr, .table.tstack td { display: block; width: 100%; }
  .table.tstack tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table.tstack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.tstack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; flex: none; }
  .table.tstack td.r { text-align: right; }
  .table.tstack td[data-label=""]::before { display: none; }
  .call-strip { gap: 8px; }
  .call-strip .cbtn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .proto-bar { font-size: 12px; }
  .filters .input, .filters .select { min-width: 0; flex: 1 1 140px; }
  .step { grid-template-columns: 30px minmax(0, 1fr); }
  .step > :last-child { grid-column: 2; }
}

/* Touch targets: at least 44px on phones and any coarse pointer (brief §9) */
@media (max-width: 640px), (pointer: coarse) {
  .btn, .btn.sm, .btn.lg { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .me { width: 44px; height: 44px; }
  .nav-item, .search-btn, .tab { min-height: 44px; }
  .seg button { min-height: 44px; }
  .docs-nav button { min-height: 44px; }
  .crumbs button, .crumbs a { min-height: 44px; display: inline-flex; align-items: center; }
  .input, .select { min-height: 44px; }
  .call-strip .cbtn { height: 44px; }
  .code-tab, .copy { min-height: 44px; }
  .proto-bar .btn, .proto-bar .select, .proto-bar .seg button { min-height: 0; } /* prototype-only chrome stays compact */
}
@media (max-width: 640px) {
  .crumbs .cur, .crumbs svg:has(+ .cur) { display: none; } /* the page title repeats it; keep the parent link */
}
