/* Auralock console — design system and layout.
   Tokens first; components below are written only against tokens so light and dark stay in one place. */

:root {
  color-scheme: light;
  --font-sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Sora', 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, 'Liberation Mono', monospace;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f2f4f7;
  --surface-hover: #f5f7fa;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --text-3: #5d6679;
  --text-4: #8a93a6;

  --accent: #3b40d6;
  --accent-hover: #3034b8;
  --accent-soft: #eef0ff;
  --accent-soft-2: #dfe2ff;
  --accent-text: #2b2fa0;
  --focus: 0 0 0 3px rgba(59, 64, 214, .22);

  --success-text: #067647; --success-bg: #ecfdf3; --success-border: #abefc6; --success-dot: #17b26a;
  --warning-text: #a64a07; --warning-bg: #fffaeb; --warning-border: #fedf89; --warning-dot: #f79009;
  --danger-text: #b42318;  --danger-bg: #fef3f2;  --danger-border: #fecdca;  --danger-dot: #f04438;
  --info-text: #175cd3;    --info-bg: #eff8ff;    --info-border: #b2ddff;    --info-dot: #2e90fa;
  --neutral-text: #475467; --neutral-bg: #f2f4f7; --neutral-border: #e4e7ec; --neutral-dot: #98a2b3;

  /* Chart roles (dataviz reference palette; status steps are reserved for state). */
  --series-1: #2a78d6;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --status-neutral: #a3a9b6;
  --grid-line: #eceef2;

  --nav-bg: #0b1020;
  --nav-border: #1a2236;
  --nav-text: #a3adc2;
  --nav-text-strong: #f4f6fb;
  --nav-hover: #151c30;
  --nav-active: #1c2540;
  --nav-label: #5f6b85;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 16px -4px rgba(16, 24, 40, .08), 0 3px 6px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -8px rgba(16, 24, 40, .18), 0 6px 12px -4px rgba(16, 24, 40, .06);
  --overlay: rgba(10, 15, 30, .45);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 256px;
  --topbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f19; --surface: #121826; --surface-2: #161d2c; --surface-3: #1c2435; --surface-hover: #182031;
    --border: #232c3f; --border-strong: #303b52;
    --text: #eef1f7; --text-2: #cfd5e1; --text-3: #9aa4b8; --text-4: #6e7891;
    --accent: #6f74ff; --accent-hover: #878bff; --accent-soft: #1a1e3a; --accent-soft-2: #262c5c; --accent-text: #a9adff;
    --focus: 0 0 0 3px rgba(111, 116, 255, .35);
    --success-text: #75e0a7; --success-bg: #0c2a1e; --success-border: #144d34;
    --warning-text: #fdb022; --warning-bg: #2d1f08; --warning-border: #5c3d0c;
    --danger-text: #fda29b;  --danger-bg: #301312;  --danger-border: #5c1f1b;
    --info-text: #84caff;    --info-bg: #0d2140;    --info-border: #1b3f70;
    --neutral-text: #b6becd; --neutral-bg: #1c2435; --neutral-border: #2a3448;
    --series-1: #3987e5; --status-neutral: #5b6478; --grid-line: #20293a;
    --nav-bg: #080b14; --nav-border: #161d2d; --nav-hover: #111828; --nav-active: #19223a;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3); --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
    --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, .45); --shadow-lg: 0 24px 48px -8px rgba(0, 0, 0, .6);
    --overlay: rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f19; --surface: #121826; --surface-2: #161d2c; --surface-3: #1c2435; --surface-hover: #182031;
  --border: #232c3f; --border-strong: #303b52;
  --text: #eef1f7; --text-2: #cfd5e1; --text-3: #9aa4b8; --text-4: #6e7891;
  --accent: #6f74ff; --accent-hover: #878bff; --accent-soft: #1a1e3a; --accent-soft-2: #262c5c; --accent-text: #a9adff;
  --focus: 0 0 0 3px rgba(111, 116, 255, .35);
  --success-text: #75e0a7; --success-bg: #0c2a1e; --success-border: #144d34;
  --warning-text: #fdb022; --warning-bg: #2d1f08; --warning-border: #5c3d0c;
  --danger-text: #fda29b;  --danger-bg: #301312;  --danger-border: #5c1f1b;
  --info-text: #84caff;    --info-bg: #0d2140;    --info-border: #1b3f70;
  --neutral-text: #b6becd; --neutral-bg: #1c2435; --neutral-border: #2a3448;
  --series-1: #3987e5; --status-neutral: #5b6478; --grid-line: #20293a;
  --nav-bg: #080b14; --nav-border: #161d2d; --nav-hover: #111828; --nav-active: #19223a;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3); --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, .45); --shadow-lg: 0 24px 48px -8px rgba(0, 0, 0, .6);
  --overlay: rgba(0, 0, 0, .6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-width: 320px; background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--font-sans); font-feature-settings: 'cv11', 'ss01', 'tnum' 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 16px; line-height: 1.35; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 14px; line-height: 1.4; font-weight: 600; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -48px; z-index: 100; padding: 8px 12px; background: var(--accent); color: #fff; border-radius: var(--radius); text-decoration: none; }
.skip-link:focus { top: 12px; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.subtle { color: var(--text-4); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius); font-size: 13.5px; font-weight: 550; line-height: 1;
  white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-hover); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-3); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: #d92d20; color: #fff; box-shadow: var(--shadow-xs); }
.btn-danger:hover { background: #b42318; }
.btn-danger-soft { background: var(--surface); color: var(--danger-text); border-color: var(--danger-border); }
.btn-danger-soft:hover { background: var(--danger-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--border-strong); border-top-color: var(--accent); }
.link-btn { text-decoration: none; border: 0; background: none; padding: 0; color: var(--accent-text); font-weight: 550; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > span:first-child, .field-label { font-size: 13px; font-weight: 550; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field .hint { font-size: 12px; color: var(--text-4); line-height: 1.45; }
.optional-tag { font-size: 11.5px; font-weight: 450; color: var(--text-4); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 9px 12px; line-height: 1.5; resize: vertical; }
.textarea.mono { font: 12.5px/1.55 var(--font-mono); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-4); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input[readonly] { background: var(--surface-2); color: var(--text-3); }
.input:disabled, .select:disabled { background: var(--surface-3); color: var(--text-4); cursor: not-allowed; }
.input-sm, .select-sm { height: 32px; font-size: 13px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon { position: absolute; left: 11px; color: var(--text-4); pointer-events: none; }
.input-group > .icon ~ .input { padding-left: 36px; }
.input-group > .input-suffix { position: absolute; right: 6px; }
.input-affix { position: absolute; right: 12px; font-size: 12.5px; color: var(--text-4); pointer-events: none; }
.input-group > .input.has-affix { padding-right: 48px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); line-height: 1.5; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-error { min-height: 18px; color: var(--danger-text); font-size: 13px; }
.file-drop {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 22px 16px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-3); font-size: 13px;
  transition: border-color .15s, background .15s;
}
.file-drop:hover, .file-drop.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop strong { color: var(--text); font-weight: 600; }
.file-drop .file-drop-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-3); box-shadow: var(--shadow-xs); }
.file-drop .file-name { color: var(--accent-text); font-weight: 550; word-break: break-all; }
.choice-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-card { position: relative; display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card:hover { border-color: var(--text-4); }
.choice-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-card:has(input:focus-visible) { box-shadow: var(--focus); }
.choice-card:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.choice-card .choice-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-3); color: var(--text-2); flex: 0 0 auto; }
.choice-card:has(input:checked) .choice-icon { background: var(--accent); color: #fff; }
.choice-card strong { display: block; font-size: 14px; font-weight: 600; }
.choice-card small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; line-height: 1.45; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-3); border: 1px solid var(--border); }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font-size: 13px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--neutral-border); background: var(--neutral-bg); color: var(--neutral-text); font-size: 12px; font-weight: 550; white-space: nowrap; line-height: 1; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--neutral-dot); }
.badge.no-dot::before { display: none; }
.badge.success { color: var(--success-text); background: var(--success-bg); border-color: var(--success-border); }
.badge.success::before { background: var(--success-dot); }
.badge.warning { color: var(--warning-text); background: var(--warning-bg); border-color: var(--warning-border); }
.badge.warning::before { background: var(--warning-dot); }
.badge.danger { color: var(--danger-text); background: var(--danger-bg); border-color: var(--danger-border); }
.badge.danger::before { background: var(--danger-dot); }
.badge.info { color: var(--info-text); background: var(--info-bg); border-color: var(--info-border); }
.badge.info::before { background: var(--info-dot); }
.badge.accent { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-soft-2); }
.badge.accent::before { background: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-3); font-size: 12px; font-weight: 550; white-space: nowrap; }
.tag .icon { width: 13px; height: 13px; }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface); color: var(--text-3); font: 600 11px var(--font-sans); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--info-border); background: var(--info-bg); color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.alert > .icon { margin-top: 1px; color: var(--info-text); }
.alert strong { color: var(--text); font-weight: 600; }
.alert.warning { border-color: var(--warning-border); background: var(--warning-bg); }
.alert.warning > .icon { color: var(--warning-text); }
.alert.danger { border-color: var(--danger-border); background: var(--danger-bg); }
.alert.danger > .icon { color: var(--danger-text); }
.alert.success { border-color: var(--success-border); background: var(--success-bg); }
.alert.success > .icon { color: var(--success-text); }
.alert .alert-body { display: grid; gap: 2px; min-width: 0; }

/* ---------- Login ---------- */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); background: var(--surface); }
.login-aside { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px; color: #e6eaf5; background: radial-gradient(1100px 560px at -10% -20%, #2b2fa0 0%, transparent 55%), radial-gradient(760px 480px at 110% 120%, #23267f 0%, transparent 55%), #0c0f1a; }
.login-aside::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); pointer-events: none; }
.login-aside > * { position: relative; z-index: 1; }
.login-aside h2 { font-size: 34px; line-height: 1.15; font-weight: 650; letter-spacing: -.03em; color: #fff; max-width: 520px; }
.login-aside p { color: #a7b1c8; font-size: 15px; line-height: 1.65; max-width: 480px; margin-top: 14px; }
.login-features { display: grid; gap: 16px; margin-top: 36px; max-width: 460px; }
.login-feature { display: flex; gap: 14px; align-items: flex-start; }
.login-feature .feature-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: #c4cffb; flex: 0 0 auto; }
.login-feature strong { display: block; color: #fff; font-weight: 600; font-size: 14px; }
.login-feature span { color: #98a3bd; font-size: 13px; }
.login-foot { color: #6f7b96; font-size: 12.5px; }
.login-main { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-card { width: min(400px, 100%); display: grid; gap: 18px; }
.login-card h1 { font-size: 26px; }
.login-card .lede { color: var(--text-3); margin-top: 6px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 64px; }
.password-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font-size: 12.5px; font-weight: 550; }
.password-wrap button:hover { background: var(--surface-3); color: var(--text); }
.login-security { display: flex; align-items: center; gap: 8px; color: var(--text-4); font-size: 12.5px; border-top: 1px solid var(--border); padding-top: 16px; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; background: var(--accent); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 17px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-text strong { font-family: var(--font-display); font-size: 15px; font-weight: 650; letter-spacing: -.015em; }
.brand-text small { font-size: 11px; color: var(--nav-label); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.login-aside .brand-text small { color: #8794b4; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-w); display: flex; flex-direction: column;
  background: var(--nav-bg); color: var(--nav-text); border-right: 1px solid var(--nav-border); transition: width .2s ease, transform .2s ease;
}
.sidebar-head { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--nav-border); color: var(--nav-text-strong); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px 18px; scrollbar-width: thin; scrollbar-color: #26304a transparent; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-label { padding: 0 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--nav-label); }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--nav-text); font-size: 13.5px; font-weight: 500; text-align: left; text-decoration: none; transition: background .12s, color .12s; }
.nav-item .icon { color: #7d89a6; }
.nav-item:hover { background: var(--nav-hover); color: var(--nav-text-strong); }
.nav-item:hover .icon { color: #c3cbe0; }
.nav-item[aria-current="page"] { background: var(--nav-active); color: #fff; }
.nav-item[aria-current="page"] .icon { color: #8fa5ff; }
.nav-item[aria-current="page"]::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #6d88ff; }
.nav-item .nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #3b1c22; color: #ff9d97; font-size: 11px; font-weight: 650; display: inline-grid; place-items: center; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--nav-border); }
.system-status { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.03); border: 1px solid var(--nav-border); font-size: 12.5px; }
.system-status .pulse { width: 8px; height: 8px; border-radius: 50%; background: #17b26a; box-shadow: 0 0 0 3px rgba(23,178,106,.18); flex: 0 0 auto; }
.system-status.is-down .pulse { background: #f04438; box-shadow: 0 0 0 3px rgba(240,68,56,.2); }
.system-status span { display: grid; line-height: 1.3; min-width: 0; }
.system-status strong { color: var(--nav-text-strong); font-weight: 550; font-size: 12.5px; }
.system-status small { color: var(--nav-label); font-size: 11.5px; }
.collapse-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #7d89a6; }
.collapse-btn:hover { background: var(--nav-hover); color: #fff; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s ease; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-3); min-width: 0; }
.breadcrumbs .icon { width: 14px; height: 14px; color: var(--text-4); }
.breadcrumbs strong { color: var(--text); font-weight: 550; }
.topbar-spacer { flex: 1; }
.search-trigger { display: flex; align-items: center; gap: 10px; width: min(340px, 34vw); height: 36px; padding: 0 8px 0 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-4); font-size: 13.5px; text-align: left; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-3); }
.search-trigger span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.branch-switch { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px; margin-right: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-3); }
.branch-switch .icon { color: var(--text-4); flex-shrink: 0; }
.branch-switch select { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 550; max-width: 180px; cursor: pointer; outline: none; }
/* The native option popup follows the element's color-scheme; inherit the app theme so it isn't stuck in light mode. */
.branch-switch select, .select, select { color-scheme: inherit; }
.branch-switch select option, .select option, select option { background: var(--surface); color: var(--text); }
@media (max-width: 720px) { .branch-switch select { max-width: 110px; } }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text-3); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.menu-btn { display: none; }
.user-btn { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-3); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 650; letter-spacing: .02em; }
.avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.user-meta { display: grid; line-height: 1.25; }
.user-meta strong { font-size: 13px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { font-size: 11.5px; color: var(--text-4); }
.content { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 28px 28px 56px; }

body.sidebar-collapsed { --sidebar-w: 72px; }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .nav-label,
body.sidebar-collapsed .sidebar .nav-text,
body.sidebar-collapsed .sidebar .nav-count,
body.sidebar-collapsed .sidebar .system-status span { display: none; }
body.sidebar-collapsed .sidebar-head { padding: 0; justify-content: center; flex-direction: column; gap: 0; height: auto; min-height: var(--topbar-h); padding: 12px 0; }
body.sidebar-collapsed .sidebar-head .collapse-btn { margin-top: 8px; transform: rotate(180deg); }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
body.sidebar-collapsed .nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--nav-border); }
body.sidebar-collapsed .system-status { justify-content: center; padding: 10px 0; }
.sidebar-scrim { display: none; }

/* ---------- Page scaffolding ---------- */
.view { display: none; }
.view.is-active { display: block; animation: view-in .18s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header .page-title { display: grid; gap: 4px; min-width: 0; }
.page-header p { color: var(--text-3); font-size: 14px; max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 20px; }
.grid-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header.plain { border-bottom: 0; padding-bottom: 4px; }
.card-header .card-title { display: grid; gap: 2px; min-width: 0; }
.card-header p { color: var(--text-3); font-size: 13px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 20px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-section + .card-section { border-top: 1px solid var(--border); }
.section-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 650; flex: 0 0 auto; }
.section-head h2 { font-size: 15px; }
.section-head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }

/* ---------- KPI / stats ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { position: relative; padding: 18px 20px; display: grid; gap: 10px; align-content: start; }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13px; font-weight: 550; color: var(--text-3); }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.kpi-icon .icon { width: 17px; height: 17px; }
.kpi-icon.accent { background: var(--accent-soft); color: var(--accent-text); }
.kpi-icon.danger { background: var(--danger-bg); color: var(--danger-text); }
.kpi-icon.success { background: var(--success-bg); color: var(--success-text); }
.kpi-icon.warning { background: var(--warning-bg); color: var(--warning-text); }
.kpi-value { font-size: 26px; line-height: 1.15; font-weight: 650; letter-spacing: -.025em; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.kpi-value .unit { font-size: 14px; font-weight: 550; color: var(--text-4); margin-right: 4px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.kpi-link { position: absolute; inset: 0; border-radius: inherit; }
.kpi-link:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-xs); margin-bottom: 16px; overflow: hidden; }
.stat-strip > div { padding: 14px 18px; display: grid; gap: 4px; }
.stat-strip > div + div { border-left: 1px solid var(--border); }
.stat-strip small { color: var(--text-3); font-size: 12.5px; font-weight: 550; }
.stat-strip strong { font-size: 18px; font-weight: 650; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.dl { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 0; font-size: 13.5px; }
.dl dt, .dl dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--border); }
.dl dt { color: var(--text-3); }
.dl dd { color: var(--text); font-weight: 500; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; }
.dl > :nth-last-child(-n+2) { border-bottom: 0; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.progress.success > span { background: var(--success-dot); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-group { flex: 1 1 260px; max-width: 380px; }
.toolbar .spacer { flex: 1; }
.filter-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 16px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.filter-tabs button { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--text-3); font-size: 13.5px; font-weight: 550; white-space: nowrap; }
.filter-tabs button:hover { color: var(--text); }
.filter-tabs button[aria-selected="true"] { color: var(--accent-text); }
.filter-tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.filter-tabs .count { min-width: 22px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--surface-3); color: var(--text-3); font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.filter-tabs button[aria-selected="true"] .count { background: var(--accent-soft); color: var(--accent-text); }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 1px dashed var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text-3); font-size: 13px; font-weight: 550; }
.chip-toggle:hover { color: var(--text); border-color: var(--text-4); }
.chip-toggle[aria-pressed="true"] { border-style: solid; border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
.notice-bar { padding: 9px 16px; font-size: 12.5px; color: var(--warning-text); background: var(--warning-bg); border-bottom: 1px solid var(--warning-border); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 1; height: 40px; padding: 0 16px; background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); }
.table th.num, .table td.num { text-align: right; }
.table th .sort-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; }
.table th .sort-btn:hover { color: var(--text); }
.table th .sort-btn .icon { width: 13px; height: 13px; opacity: .45; }
.table th[aria-sort] .sort-btn { color: var(--text); }
.table th[aria-sort] .sort-btn .icon { opacity: 1; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-selected { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.table .cell-main { display: block; color: var(--text); font-weight: 550; white-space: nowrap; }
.table .cell-sub { display: block; margin-top: 2px; color: var(--text-4); font-size: 12.5px; white-space: nowrap; }
.table .cell-flex { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table .cell-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; white-space: nowrap; }
.table td.money { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; color: var(--text); font-weight: 550; }
.table td.money.zero { color: var(--text-4); font-weight: 450; }
.table.compact td { padding: 9px 16px; }
.table.compact th { height: 36px; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); }
.table-footer .pager { display: flex; align-items: center; gap: 8px; }
.table-footer .select { width: auto; height: 30px; font-size: 12.5px; padding-left: 10px; }
.table-scroll { max-height: 420px; overflow: auto; }
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty .empty-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-3); color: var(--text-4); margin-bottom: 4px; }
.empty strong { color: var(--text); font-size: 14.5px; font-weight: 600; }
.empty p { max-width: 360px; font-size: 13.5px; }
.empty .btn { margin-top: 6px; }
.empty.error .empty-icon { background: var(--danger-bg); color: var(--danger-text); }
.skeleton { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-hover) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.platform { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 12.5px; }
.platform .icon { width: 13px; height: 13px; }
.stale-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warning-dot); margin-right: 6px; vertical-align: 1px; }

/* ---------- Overview ---------- */
.chart-card .card-body { padding-top: 8px; }
.chart-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chart-total { display: grid; gap: 2px; }
.chart-total strong { font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.chart-total small { color: var(--text-3); font-size: 12.5px; }
.chart { position: relative; margin-top: 14px; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .axis-label { fill: var(--text-4); font-size: 11px; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid-line); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .bar { fill: var(--series-1); transition: opacity .12s; }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart svg:hover .bar { opacity: .45; }
.chart .bar.is-hover { opacity: 1 !important; }
.chart-tooltip { position: absolute; z-index: 3; pointer-events: none; min-width: 150px; padding: 9px 11px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); font-size: 12.5px; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.chart-tooltip strong { display: block; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); }
.chart-tooltip span { color: var(--text-3); }
.chart-table { margin-top: 12px; max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.portfolio-total { display: flex; align-items: baseline; gap: 8px; }
.portfolio-total strong { font-size: 28px; font-weight: 650; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.portfolio-total span { color: var(--text-3); font-size: 13px; }
.stacked-bar { display: flex; gap: 2px; height: 12px; margin: 16px 0 18px; border-radius: 4px; overflow: hidden; background: var(--surface-3); }
.stacked-bar span { display: block; height: 100%; min-width: 3px; transition: flex-grow .4s ease; }
.legend-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.legend-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.legend-list li:last-child { border-bottom: 0; }
.legend-list .swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-list .val { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.legend-list .pct { color: var(--text-4); font-size: 12.5px; min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.attention-row { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.attention-row:last-child { border-bottom: 0; }
.attention-row:hover { background: var(--surface-hover); }
.attention-row .grow { flex: 1; min-width: 0; }
.attention-row strong { display: block; font-size: 13.5px; font-weight: 550; color: var(--text); }
.attention-row small { display: block; font-size: 12.5px; color: var(--text-4); }
.attention-row .amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--danger-text); white-space: nowrap; }
.feed { margin: 0; padding: 4px 0; list-style: none; }
.feed li { display: flex; gap: 12px; padding: 10px 20px; align-items: flex-start; }
.feed-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); color: var(--text-3); }
.feed-icon .icon { width: 15px; height: 15px; }
.feed-icon.success { background: var(--success-bg); color: var(--success-text); }
.feed-icon.warning { background: var(--warning-bg); color: var(--warning-text); }
.feed-icon.danger { background: var(--danger-bg); color: var(--danger-text); }
.feed-icon.info { background: var(--info-bg); color: var(--info-text); }
.feed .feed-body { flex: 1; min-width: 0; font-size: 13.5px; }
.feed .feed-body strong { font-weight: 550; color: var(--text); }
.feed .feed-body small { display: block; color: var(--text-4); font-size: 12.5px; margin-top: 1px; }
.feed .feed-body small a { color: inherit; text-decoration: none; }
.feed .feed-body small a:hover { color: var(--accent-text); text-decoration: underline; }
.feed time { color: var(--text-4); font-size: 12.5px; white-space: nowrap; }
.timeline { margin: 0; padding: 0; list-style: none; position: relative; }
.timeline li { position: relative; display: flex; gap: 12px; padding: 0 0 18px; }
.timeline li:not(:last-child)::before { content: ''; position: absolute; left: 14px; top: 32px; bottom: 2px; width: 1px; background: var(--border); }

/* ---------- Drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; z-index: 40; background: var(--overlay); opacity: 0; transition: opacity .2s; }
.drawer-scrim.is-open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(760px, 100vw); display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-lg); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
.drawer.is-open { transform: none; }
.drawer-header { display: flex; align-items: flex-start; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-header .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.drawer-header h2 { font-size: 18px; }
.drawer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--text-3); font-size: 13px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 28px; display: grid; grid-auto-rows: max-content; gap: 18px; align-content: start; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.mini-stats > div { padding: 12px 14px; display: grid; gap: 3px; min-width: 0; }
.mini-stats > div + div { border-left: 1px solid var(--border); }
.mini-stats small { color: var(--text-3); font-size: 12px; font-weight: 550; }
.mini-stats strong { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mini-stats .sub { color: var(--text-4); font-size: 12px; }
.repay-progress { display: grid; gap: 8px; }
.repay-progress .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); }
.repay-progress .row strong { color: var(--text); font-weight: 600; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tabs button { position: relative; height: 40px; padding: 0 12px; border: 0; background: none; color: var(--text-3); font-size: 13.5px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--accent-text); }
.tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.tabs .count { font-size: 11.5px; color: var(--text-4); font-weight: 600; }
.tab-panel { min-width: 0; }
.tab-panel .card { box-shadow: none; }

/* ---------- Dialogs ---------- */
.dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
.dialog[open] { display: flex; flex-direction: column; animation: dialog-in .16s ease-out; }
.dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.dialog.wide { width: min(860px, calc(100vw - 32px)); }
.dialog > form, .dialog > .dialog-inner { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog-header { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 6px; }
.dialog-header .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.dialog-header h2 { font-size: 17px; }
.dialog-header p { color: var(--text-3); font-size: 13.5px; }
.dialog-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--accent-soft); color: var(--accent-text); }
.dialog-icon.danger { background: var(--danger-bg); color: var(--danger-text); }
.dialog-icon.warning { background: var(--warning-bg); color: var(--warning-text); }
.dialog-icon.success { background: var(--success-bg); color: var(--success-text); }
.dialog-body { padding: 14px 22px 6px; display: grid; grid-auto-rows: max-content; gap: 16px; overflow-y: auto; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; margin-top: 10px; border-top: 1px solid var(--border); background: var(--surface-2); }
.dialog-footer .spacer { flex: 1; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.balance-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; }
.balance-box strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.qr-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.qr-box { display: grid; justify-items: center; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; text-align: center; }
.qr-box img { width: 100%; max-width: 220px; image-rendering: pixelated; }
.qr-box p { color: #5d6679; font-size: 12.5px; }
.secret-field { position: relative; }
.secret-field .textarea { min-height: 260px; }

/* ---------- Command palette ---------- */
.palette { width: min(620px, calc(100vw - 32px)); margin-top: 12vh; padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette::backdrop { background: var(--overlay); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--text-4); }
.palette-input input { flex: 1; height: 54px; border: 0; outline: none; background: transparent; font-size: 15.5px; }
.palette-list { max-height: min(420px, 55vh); overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.palette-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.palette-item .icon { color: var(--text-4); }
.palette-item small { margin-left: auto; color: var(--text-4); font-size: 12.5px; }
.palette-item[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }
.palette-item[aria-selected="true"] .icon { color: var(--accent-text); }
.palette-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--text-4); font-size: 12px; }
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }
.palette-empty { padding: 28px; text-align: center; color: var(--text-3); font-size: 13.5px; }

/* ---------- Menus / popovers ---------- */
.menu { position: absolute; z-index: 50; min-width: 220px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin: -2px -2px 6px; display: grid; gap: 1px; }
.menu-head strong { font-size: 13.5px; }
.menu-head small { color: var(--text-4); font-size: 12.5px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font-size: 13.5px; text-align: left; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-3); color: var(--text); }
.menu button .icon { width: 16px; height: 16px; color: var(--text-4); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px -6px; }
.menu .menu-label { padding: 6px 10px 4px; font-size: 11.5px; color: var(--text-4); font-weight: 600; }
.menu .theme-row { display: flex; gap: 4px; padding: 2px 4px 4px; }
.menu .theme-row button { flex: 1; justify-content: center; height: 30px; border: 1px solid var(--border); font-size: 12.5px; gap: 6px; }
.menu .theme-row button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.menu .danger { color: var(--danger-text); }
.menu .danger .icon { color: var(--danger-text); }

/* ---------- Toasts ---------- */
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 10px; width: min(400px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-lg); font-size: 13.5px; line-height: 1.5; animation: toast-in .22s cubic-bezier(.2, .8, .2, 1); }
.toast.is-leaving { animation: toast-out .18s ease-in forwards; }
.toast .toast-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--success-bg); color: var(--success-text); }
.toast .toast-icon .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.toast.error .toast-icon { background: var(--danger-bg); color: var(--danger-text); }
.toast.warning .toast-icon { background: var(--warning-bg); color: var(--warning-text); }
.toast.info .toast-icon { background: var(--info-bg); color: var(--info-text); }
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-body strong { display: block; color: var(--text); font-weight: 600; }
.toast .toast-close { border: 0; background: none; color: var(--text-4); padding: 2px; border-radius: 4px; }
.toast .toast-close:hover { color: var(--text); background: var(--surface-3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ---------- Enrollment ---------- */
.enroll-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.enroll-layout .card-section { padding: 22px 24px; }
.summary-card { position: sticky; top: calc(var(--topbar-h) + 20px); }
.summary-lines { display: grid; gap: 0; margin: 0; }
.summary-lines div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 13.5px; border-bottom: 1px dashed var(--border); }
.summary-lines div:last-child { border-bottom: 0; }
.summary-lines dt { color: var(--text-3); }
.summary-lines dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.summary-lines .total dd { font-size: 16px; color: var(--accent-text); }
.summary-message { padding: 11px 13px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-3); line-height: 1.5; }
.summary-message.error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.summary-message.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.enroll-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.enroll-actions .muted { font-size: 13px; max-width: 420px; }
.checklist { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: c; }
.checklist li { position: relative; padding-left: 30px; font-size: 13.5px; color: var(--text-2); line-height: 1.55; counter-increment: c; }
.checklist li::before { content: counter(c); position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); font-size: 11.5px; font-weight: 650; }
details.disclosure { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
details.disclosure > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; font-weight: 550; font-size: 14px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .icon:last-child { margin-left: auto; color: var(--text-4); transition: transform .15s; }
details.disclosure[open] > summary .icon:last-child { transform: rotate(180deg); }
details.disclosure > .disclosure-body { padding: 4px 16px 16px; display: grid; gap: 12px; }

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: grid; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 7px; color: var(--text-3); font-size: 13.5px; font-weight: 550; text-decoration: none; }
.settings-nav a:hover { background: var(--surface-3); color: var(--text); }
.settings-nav a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); border: 1px solid var(--border); }
.settings-section { display: grid; grid-template-columns: minmax(0, 1fr); scroll-margin-top: calc(var(--topbar-h) + 20px); }
.settings-row { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 24px; padding: 22px 24px; }
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-row > .row-label h3 { font-size: 14px; }
.settings-row > .row-label p { color: var(--text-3); font-size: 13px; margin-top: 4px; line-height: 1.5; }
.settings-row > .row-control { display: grid; gap: 14px; min-width: 0; }
.save-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-md); }
.save-bar .dirty { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-3); }
.save-bar .dirty::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); }
.save-bar.is-dirty .dirty { color: var(--warning-text); }
.save-bar.is-dirty .dirty::before { background: var(--warning-dot); }
.release-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.release-card .release-head { display: flex; align-items: center; gap: 12px; }
.release-card .release-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--success-bg); color: var(--success-text); flex: 0 0 auto; }
.release-card.is-empty .release-icon { background: var(--warning-bg); color: var(--warning-text); }
.copy-row { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.copy-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 12.5px; }
.copy-row small { color: var(--text-4); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; flex: 0 0 auto; }

/* ---------- Locations ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: stretch; }
.map-card { display: flex; flex-direction: column; overflow: hidden; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.map-toolbar .grow { display: grid; gap: 2px; min-width: 0; }
.map-toolbar p { color: var(--text-3); font-size: 13px; }
.map-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.location-map { position: relative; flex: 1; height: clamp(380px, 62vh, 680px); overflow: hidden; background: #e7ecf2; cursor: grab; touch-action: none; isolation: isolate; }
:root[data-theme="dark"] .location-map { background: #1a2130; }
.location-map:active { cursor: grabbing; }
.map-tile-layer, .map-markers { position: absolute; inset: 0; pointer-events: none; }
.map-tile { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; }
.map-marker { position: absolute; z-index: 2; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; background: transparent; transform: translate(-50%, -50%); pointer-events: auto; }
.map-marker-dot { z-index: 2; width: 16px; height: 16px; border: 3px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 2px 8px rgba(16, 24, 40, .4); }
.map-marker.selected .map-marker-dot { width: 22px; height: 22px; background: #e5484d; box-shadow: 0 0 0 5px rgba(229, 72, 77, .22), 0 2px 8px rgba(16, 24, 40, .4); }
.location-accuracy { position: absolute; width: var(--accuracy-size); height: var(--accuracy-size); max-width: 140px; max-height: 140px; border: 1px solid rgba(51, 85, 217, .45); border-radius: 50%; background: rgba(51, 85, 217, .12); }
.map-marker.selected .location-accuracy { border-color: rgba(229, 72, 77, .5); background: rgba(229, 72, 77, .12); }
.map-attribution { position: absolute; right: 8px; bottom: 6px; z-index: 4; padding: 3px 7px; border-radius: 4px; background: rgba(255, 255, 255, .9); color: #344054; text-decoration: none; font-size: 11px; pointer-events: auto; }
.map-attribution:hover { text-decoration: underline; }
.map-zoom { position: absolute; z-index: 4; right: 12px; top: 12px; display: grid; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.map-zoom button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: var(--surface); color: var(--text-2); }
.map-zoom button + button { border-top: 1px solid var(--border); }
.map-zoom button:hover { background: var(--surface-hover); }
.map-tile-status, .location-map-empty { position: absolute; z-index: 3; top: 50%; left: 50%; width: min(340px, calc(100% - 36px)); padding: 14px 16px; transform: translate(-50%, -50%); border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-3); text-align: center; font-size: 13px; line-height: 1.5; box-shadow: var(--shadow-md); pointer-events: none; }
.map-foot { padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text-4); font-size: 12px; line-height: 1.5; }
.location-list-card { display: flex; flex-direction: column; overflow: hidden; }
.location-list { flex: 1; overflow-y: auto; max-height: clamp(380px, 68vh, 740px); }
.location-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; color: var(--text-2); }
.location-row:hover { background: var(--surface-hover); }
.location-row.selected { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.location-pin { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); color: var(--text-4); }
.location-pin.has-point { background: var(--accent-soft); color: var(--accent-text); }
.location-pin .icon { width: 16px; height: 16px; }
.location-copy { flex: 1; min-width: 0; display: grid; gap: 1px; }
.location-copy strong { font-size: 13.5px; font-weight: 550; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.location-copy small { font-size: 12px; color: var(--text-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--success-text); font-weight: 550; }
.live-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--success-dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-dot) 20%, transparent); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--success-dot) 5%, transparent); } }

/* ---------- Guide ---------- */
.guide-hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .7fr); gap: 24px; align-items: center; padding: 28px; margin-bottom: 20px; border-radius: 16px; color: #fff; background: radial-gradient(800px 300px at 0% 0%, rgba(102, 131, 255, .35), transparent 60%), linear-gradient(120deg, #0f1730, #1b2c5e 65%, #3355d9); }
.guide-hero .eyebrow { font-size: 11.5px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: #a9b9ff; }
.guide-hero h2 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; letter-spacing: -.025em; margin: 8px 0 10px; color: #fff; }
.guide-hero p { color: #cdd6f2; font-size: 14.5px; line-height: 1.65; max-width: 620px; }
.guide-start { padding: 20px; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); display: grid; gap: 8px; }
.guide-start p { color: var(--text-3); font-size: 13px; }
.guide-toc { position: sticky; top: calc(var(--topbar-h) + 12px); z-index: 5; display: flex; gap: 4px; overflow-x: auto; padding: 6px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); box-shadow: var(--shadow-sm); scrollbar-width: none; }
.guide-toc a { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; height: 34px; padding: 0 12px; border-radius: 8px; color: var(--text-3); text-decoration: none; font-size: 13px; font-weight: 550; }
.guide-toc a span { color: var(--accent-text); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.guide-toc a:hover { background: var(--surface-3); color: var(--text); }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.guide-card { padding: 22px; scroll-margin-top: calc(var(--topbar-h) + 72px); }
.guide-card.wide { grid-column: 1 / -1; }
.guide-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.guide-card header .num { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 13px; }
.guide-card header small { display: block; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); }
.guide-card p, .guide-card li { color: var(--text-2); font-size: 13.5px; line-height: 1.65; }
.guide-card code { padding: 1px 5px; border-radius: 5px; background: var(--surface-3); border: 1px solid var(--border); }
.guide-card .checklist li { color: var(--text-2); }
.guide-card .alert { margin: 14px 0; }
.guide-note { margin-top: 12px; color: var(--text-4) !important; font-size: 12.5px !important; }
.issue-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.issue { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.issue strong { display: block; margin-bottom: 4px; font-size: 13.5px; }
.issue p { font-size: 13px; color: var(--text-3); }

/* ---------- Misc ---------- */
.inline-list { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.kv-inline { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--text-3); }
.kv-inline strong { color: var(--text); font-weight: 600; }
.app-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; background: linear-gradient(140deg, var(--accent-soft-2), var(--accent-soft)); color: var(--accent-text); font-weight: 700; font-size: 13px; }
.loading-screen { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; }
.loading-screen .brand-mark { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .enroll-layout { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1100px) {
  .grid-3-1, .grid-sidebar, .map-layout, .enroll-layout { grid-template-columns: minmax(0, 1fr); }
  .summary-card { position: static; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-row { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 272px; }
  body.sidebar-collapsed { --sidebar-w: 272px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: var(--overlay); }
  body.sidebar-collapsed .sidebar .brand-text, body.sidebar-collapsed .sidebar .nav-label, body.sidebar-collapsed .sidebar .nav-text, body.sidebar-collapsed .sidebar .system-status span { display: revert; }
  body.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 0 10px; }
  .collapse-btn { display: none !important; }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; }
  .search-trigger { width: auto; flex: 1; min-width: 0; max-width: 360px; }
  .search-trigger .kbd { display: none; }
  .breadcrumbs { display: none; }
  .user-meta { display: none; }
  .content { padding: 20px 16px 48px; }
  .grid-2, .guide-grid, .issue-grid { grid-template-columns: 1fr; }
  .guide-hero { grid-template-columns: 1fr; }
  .login-screen { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .qr-layout { grid-template-columns: 1fr; }
  .qr-box { max-width: 280px; margin: 0 auto; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-grid, .form-grid-3, .choice-cards { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-stats > div:nth-child(3) { border-left: 0; }
  .mini-stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .stat-strip > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .page-header { align-items: flex-start; }
  .page-actions { width: 100%; }
  .toolbar .input-group { max-width: none; }
  .drawer-header, .drawer-actions, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
  .enroll-layout .card-section { padding: 18px 16px; }
  .settings-row { padding: 18px 16px; }
  .table td, .table th { padding-left: 12px; padding-right: 12px; }
  .toast-region { right: 16px; left: 16px; width: auto; bottom: 16px; }
}

/* Developer (API & webhooks) view */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 9px; margin-bottom: 16px; }
.seg-btn { border: 0; background: transparent; color: var(--text-3); font-weight: 550; font-size: 13.5px; padding: 6px 14px; border-radius: 7px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-3); }
.card-actions { display: flex; gap: 8px; }
.docs-group { font-size: 14px; font-weight: 650; color: var(--text-2); margin: 24px 2px 2px; letter-spacing: -.01em; }
.endpoint .card-header code { overflow-x: auto; white-space: nowrap; }
.endpoint-grid { display: grid; grid-template-columns: 1fr 380px; gap: 0; }
.endpoint-doc { padding: 16px 20px; min-width: 0; }
.endpoint-try { padding: 16px 20px; border-left: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.try-head { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-4); }
.try-result { margin: 4px 0 0; padding: 11px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.try-result.ok { border-color: var(--success-border); }
.try-result.err { border-color: var(--danger-border); }
.table.compact td, .table.compact th { padding: 7px 10px; font-size: 12.5px; }
@media (max-width: 860px) { .endpoint-grid { grid-template-columns: 1fr; } .endpoint-try { border-left: 0; border-top: 1px solid var(--border); } }
