/* Spare Key — app styles, following Apple's Human Interface Guidelines:
   system font (SF Pro), system colors (with higher-contrast variants for text),
   grouped inset surfaces, materials (blur) for bars, hairline separators,
   segmented controls, iOS switches, 44pt touch targets, sheets on phones,
   sentence-case labels, full light/dark support and reduced motion. */

:root {
  /* Backgrounds (systemGroupedBackground family) */
  --bg: #F2F2F7;
  --surface: #FFFFFF;
  --surface-alt: rgba(118, 118, 128, 0.12);       /* tertiarySystemFill */
  --surface-alt-strong: rgba(118, 118, 128, 0.2); /* secondarySystemFill */
  --material: rgba(249, 249, 251, 0.78);          /* bar/sidebar material */
  /* Labels */
  --ink: #000000;
  --ink-secondary: rgba(60, 60, 67, 0.75);
  --ink-muted: rgba(60, 60, 67, 0.6);
  --ink-quaternary: rgba(60, 60, 67, 0.3);
  /* Separators */
  --border: rgba(60, 60, 67, 0.18);
  --border-strong: rgba(60, 60, 67, 0.29);
  /* Tints: fill colors, plus darker text variants for contrast on light surfaces */
  --accent: #007AFF;
  --accent-text: #0062CC;
  --accent-ink: #FFFFFF;
  --accent-wash: rgba(0, 122, 255, 0.12);
  --good: #248A3D;
  --good-fill: #34C759;
  --good-wash: rgba(52, 199, 89, 0.15);
  --warning: #C93400;
  --warning-fill: #FF9500;
  --warning-wash: rgba(255, 149, 0, 0.15);
  --critical: #D70015;
  --critical-fill: #FF3B30;
  --critical-wash: rgba(255, 59, 48, 0.12);
  /* Effects */
  --focus: 0 0 0 4px rgba(0, 122, 255, 0.35);
  --shadow-sm: 0 0.5px 1px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  --blur: saturate(180%) blur(20px);
  --hairline: 0.5px;
  /* Shape */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-control: 10px;
  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", var(--font-body);
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --control-h: 36px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1C1C1E;
    --surface-alt: rgba(118, 118, 128, 0.24);
    --surface-alt-strong: rgba(118, 118, 128, 0.32);
    --material: rgba(28, 28, 30, 0.72);
    --ink: #FFFFFF;
    --ink-secondary: rgba(235, 235, 245, 0.75);
    --ink-muted: rgba(235, 235, 245, 0.6);
    --ink-quaternary: rgba(235, 235, 245, 0.3);
    --border: rgba(84, 84, 88, 0.55);
    --border-strong: rgba(84, 84, 88, 0.75);
    --accent: #0A84FF;
    --accent-text: #409CFF;
    --accent-ink: #FFFFFF;
    --accent-wash: rgba(10, 132, 255, 0.2);
    --good: #30DB5B;
    --good-fill: #30D158;
    --good-wash: rgba(48, 209, 88, 0.18);
    --warning: #FFB340;
    --warning-fill: #FF9F0A;
    --warning-wash: rgba(255, 159, 10, 0.18);
    --critical: #FF6961;
    --critical-fill: #FF453A;
    --critical-wash: rgba(255, 69, 58, 0.18);
    --focus: 0 0 0 4px rgba(10, 132, 255, 0.5);
    --shadow-sm: none;
    --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1C1C1E;
  --surface-alt: rgba(118, 118, 128, 0.24);
  --surface-alt-strong: rgba(118, 118, 128, 0.32);
  --material: rgba(28, 28, 30, 0.72);
  --ink: #FFFFFF;
  --ink-secondary: rgba(235, 235, 245, 0.75);
  --ink-muted: rgba(235, 235, 245, 0.6);
  --ink-quaternary: rgba(235, 235, 245, 0.3);
  --border: rgba(84, 84, 88, 0.55);
  --border-strong: rgba(84, 84, 88, 0.75);
  --accent: #0A84FF;
  --accent-text: #409CFF;
  --accent-ink: #FFFFFF;
  --accent-wash: rgba(10, 132, 255, 0.2);
  --good: #30DB5B;
  --good-fill: #30D158;
  --good-wash: rgba(48, 209, 88, 0.18);
  --warning: #FFB340;
  --warning-fill: #FF9F0A;
  --warning-wash: rgba(255, 159, 10, 0.18);
  --critical: #FF6961;
  --critical-fill: #FF453A;
  --critical-wash: rgba(255, 69, 58, 0.18);
  --focus: 0 0 0 4px rgba(10, 132, 255, 0.5);
  --shadow-sm: none;
  --shadow-md: 0 2px 10px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
}
/* Increased contrast: stronger separators and labels. */
@media (prefers-contrast: more) {
  :root { --border: var(--border-strong); --ink-muted: var(--ink-secondary); }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;          /* close to iOS Body at web density */
  line-height: 1.4;
  letter-spacing: -0.01em;  /* SF tracking at text sizes */
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
img, svg { flex-shrink: 0; }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }
p + p { margin-top: 8px; }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; letter-spacing: 0; }
.muted { color: var(--ink-muted); }
.secondary { color: var(--ink-secondary); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; }
.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; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
.input:focus-visible, .input:focus { box-shadow: var(--focus); }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 300; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.skip-link:focus { top: 8px; }

.boot, .boot-error { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink-muted); flex-direction: row; padding: 16px; text-align: center; }
.boot-error { flex-direction: column; color: var(--ink); }
.boot-error p { color: var(--ink-secondary); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
/* macOS-style sidebar: translucent material, source-list rows */
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--material);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-right: var(--hairline) solid var(--border);
  padding: 18px 10px; display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; }
.brand-text { min-width: 0; }
.sidebar-brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-sub { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.org-block { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 0 8px 14px; margin-bottom: 6px; border-bottom: var(--hairline) solid var(--border); }
.org-block:empty { display: none; }
.org-switch { width: 100%; }
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; border: none;
  background: none; width: 100%; text-align: left; text-decoration: none; transition: background 0.15s;
  min-height: 34px;
}
.nav-item:hover { background: var(--surface-alt); text-decoration: none; }
.nav-item.active { background: var(--surface-alt-strong); font-weight: 600; }
.nav-item .icon { color: var(--accent); opacity: 1; }
.nav-count { margin-left: auto; background: var(--critical-fill); color: #fff; font-size: 12px; font-weight: 600; padding: 0 7px; min-width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 10px; font-variant-numeric: tabular-nums; }
.nav-section-label { font-size: 12px; font-weight: 600; color: var(--ink-muted); padding: 16px 10px 4px; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: var(--hairline) solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.user-block { padding: 4px 10px 6px; min-width: 0; }
.user-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.main { flex: 1; padding: 32px 40px 56px; max-width: 1280px; width: 100%; }
.main:focus { box-shadow: none; }
.view { display: flex; flex-direction: column; gap: 22px; }
.app-banner { padding: 10px 40px; font-size: 14px; font-weight: 500; }
.app-banner-warning { background: var(--warning-wash); color: var(--warning); border-bottom: var(--hairline) solid var(--border); }

.mobile-nav { display: none; }
.more-menu { display: flex; flex-direction: column; gap: 2px; }
.more-section { font-size: 13px; font-weight: 600; color: var(--ink-muted); padding: 14px 10px 6px; overflow-wrap: anywhere; }

/* ---------- Page header (Large Title) ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.page-subtitle { font-size: 15px; color: var(--ink-muted); margin-top: 3px; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 2px; font-size: 15px; color: var(--accent-text); margin-bottom: 6px; }
.back-link:hover { text-decoration: none; opacity: 0.8; }

/* ---------- Grouped surfaces ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: var(--hairline) solid var(--border); flex-wrap: wrap; }
.card-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }   /* Headline */
.card-sub { font-size: 13px; color: var(--ink-muted); }
.card-pad { padding: 18px 20px; }
.card-body { padding: 18px 20px; }
.card-footer { padding: 12px 20px; border-top: var(--hairline) solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--ink-muted); margin-bottom: 6px; }
.stat-value { font-family: var(--font-rounded); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 17px; color: var(--ink-muted); font-weight: 600; }
.stat-sub { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }
.stat-sub.critical { color: var(--critical); font-weight: 600; }

/* Settings-style rows */
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: var(--hairline) solid var(--border); min-height: 44px; }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 15px; color: var(--ink); }
.info-value { font-size: 15px; color: var(--ink-secondary); text-align: right; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* ---------- Tables (list style) ---------- */
.table-wrap { width: 100%; overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--ink-muted); padding: 10px 14px; border-bottom: var(--hairline) solid var(--border); white-space: nowrap; background: var(--surface); }
.table td { padding: 12px 14px; border-bottom: var(--hairline) solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-alt); }
.table tbody tr.clickable:active { background: var(--surface-alt-strong); }
.table .right { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .row { justify-content: flex-end; flex-wrap: nowrap; }
.cell-title { font-weight: 600; color: var(--ink); }
a.cell-title:hover { color: var(--accent-text); text-decoration: none; }
.cell-sub { font-size: 13px; color: var(--ink-muted); }
.cell-sub.mono { font-size: 12px; }

.entity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-wash); color: var(--accent-text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 13px; font-weight: 600; }
.avatar.round { border-radius: 50%; background: linear-gradient(180deg, #A5ABB6, #858994); color: #fff; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; border-radius: 12px; }
.avatar.lg.round { border-radius: 50%; }

/* Lists (alerts, activity) */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 20px; border-bottom: var(--hairline) solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.list-item-desc { font-size: 14px; color: var(--ink-secondary); margin-top: 2px; overflow-wrap: anywhere; }
.list-item-meta { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }
.sev-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.sev-icon.info { background: var(--accent); }
.sev-icon.warning { background: var(--warning-fill); }
.sev-icon.critical { background: var(--critical-fill); }
.list-item.acked { opacity: 0.55; }

/* ---------- Badges (capsules) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; line-height: 1.45; }
.badge-good { background: var(--good-wash); color: var(--good); }
.badge-accent { background: var(--accent-wash); color: var(--accent-text); }
.badge-warning { background: var(--warning-wash); color: var(--warning); }
.badge-critical { background: var(--critical-wash); color: var(--critical); }
.badge-muted { background: var(--surface-alt); color: var(--ink-secondary); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--surface-alt); color: var(--ink-secondary); white-space: nowrap; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- Battery ---------- */
.battery { display: flex; align-items: center; gap: 8px; min-width: 96px; }
.battery-bar { flex: 1; height: 8px; background: var(--surface-alt-strong); border-radius: 4px; overflow: hidden; min-width: 40px; }
.battery-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.battery-fill.high { background: var(--good-fill); }
.battery-fill.mid { background: var(--warning-fill); }
.battery-fill.low { background: var(--critical-fill); }
.battery-label { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.battery-big { font-family: var(--font-rounded); font-size: 40px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ---------- Buttons: gray (default), filled (primary), tinted, plain ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px;
  border-radius: var(--radius-control); font-size: 15px; font-weight: 600; border: none;
  background: var(--surface-alt); color: var(--accent-text); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.15s, opacity 0.15s, transform 0.1s; min-height: var(--control-h); line-height: 1.2;
}
.btn:hover { background: var(--surface-alt-strong); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { background: var(--critical-wash); color: var(--critical); }
.btn-danger:hover { background: var(--critical-wash); filter: brightness(0.96); }
.btn-danger-solid { background: var(--critical-fill); color: #fff; }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-sm { padding: 4px 11px; font-size: 13px; min-height: 30px; border-radius: 999px; }
.btn.armed { background: var(--critical-fill); color: #fff; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: none; background: var(--surface-alt); color: var(--ink-secondary); cursor: pointer; transition: background 0.15s; }
.btn-icon:hover { background: var(--surface-alt-strong); color: var(--ink); }
.btn-block { width: 100%; }

/* Remote controls: Control Center–style tiles */
.controls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.control-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 8px; border-radius: 16px; border: none; background: var(--surface-alt); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); transition: background 0.15s, transform 0.1s; min-height: 84px; text-align: center; }
.control-btn:hover { background: var(--surface-alt-strong); }
.control-btn:active { transform: scale(0.96); }
.control-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.control-btn .icon { color: var(--accent); }
.control-btn.danger .icon { color: var(--critical-fill); }
.control-btn.armed { background: var(--critical-fill); color: #fff; }
.control-btn.armed .icon { color: #fff; }

/* ---------- Segmented controls (tabs + filters) ---------- */
.tabs {
  display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-alt);
  overflow-x: auto; scrollbar-width: none; max-width: 100%; align-self: flex-start;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 6px 14px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; border: none;
  background: none; white-space: nowrap; text-decoration: none; border-radius: 7px; transition: background 0.2s, box-shadow 0.2s;
  min-height: 30px; display: inline-flex; align-items: center;
}
.tab:hover { text-decoration: none; background: color-mix(in srgb, var(--surface) 40%, transparent); }
.tab.active, .tab[aria-selected="true"] { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
:root[data-theme="dark"] .tab.active, :root[data-theme="dark"] .tab[aria-selected="true"] { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab.active, :root:not([data-theme="light"]) .tab[aria-selected="true"] { background: #636366; } }
.filter-chips { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-alt); flex-wrap: wrap; align-self: flex-start; }
.filter-chip { padding: 5px 12px; border-radius: 7px; border: none; background: none; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; min-height: 28px; transition: background 0.2s; }
.filter-chip:hover { background: color-mix(in srgb, var(--surface) 40%, transparent); }
.filter-chip[aria-pressed="true"] { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
:root[data-theme="dark"] .filter-chip[aria-pressed="true"] { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .filter-chip[aria-pressed="true"] { background: #636366; } }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > legend, fieldset.field legend { font-size: 13px; font-weight: 500; color: var(--ink-secondary); padding: 0 2px; }
fieldset { border: none; padding: 0; min-width: 0; }
.req { color: var(--critical); }
.opt { font-weight: 400; color: var(--ink-muted); }
.hint { font-size: 13px; color: var(--ink-muted); padding: 0 2px; }
.input {
  width: 100%; padding: 8px 12px; border-radius: var(--radius-control); border: none;
  background: var(--surface-alt); color: var(--ink); font-size: 15px; min-height: var(--control-h);
  transition: box-shadow 0.15s, background 0.15s;
}
.input:hover { background: var(--surface-alt-strong); }
.input:focus { background: var(--surface); box-shadow: var(--focus), inset 0 0 0 1px var(--accent); }
.input::placeholder { color: var(--ink-quaternary); opacity: 1; text-transform: none; }
.input:disabled, .input[readonly] { color: var(--ink-secondary); }
.input-sm { padding: 5px 10px; font-size: 13px; min-height: 30px; }
/* Uppercase only what was typed, never the placeholder. */
.uppercase-value:not(:placeholder-shown) { text-transform: uppercase; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14' fill='none' stroke='%238E8E93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5l3-3 3 3M2 9l3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
textarea.input { resize: vertical; min-height: 76px; line-height: 1.4; }
.input-group { display: flex; gap: 6px; align-items: center; }
.input-group .input { flex: 1; min-width: 0; }
.copy-field { display: flex; gap: 6px; align-items: center; }
.copy-field .input { flex: 1; min-width: 0; font-size: 13px; font-family: var(--font-mono); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 140px; }
.form-error { background: var(--critical-wash); color: var(--critical); border-radius: var(--radius-control); padding: 10px 14px; font-size: 14px; font-weight: 500; margin-bottom: 12px; overflow-wrap: anywhere; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* Radio choices as a segmented control */
.radio-row { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-alt); flex-wrap: wrap; align-self: flex-start; }
.radio-card { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 7px; cursor: pointer; font-size: 14px; font-weight: 500; position: relative; min-height: 30px; transition: background 0.2s; }
.radio-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.radio-card:has(input:checked) { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.radio-card:has(input:focus-visible) { box-shadow: var(--focus); }
:root[data-theme="dark"] .radio-card:has(input:checked) { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .radio-card:has(input:checked) { background: #636366; } }

/* iOS switch (51×31) */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; font-weight: 500; position: relative; min-height: 31px; }
.switch input { position: absolute; opacity: 0; width: 51px; height: 31px; margin: 0; cursor: pointer; }
.switch-track { width: 51px; height: 31px; border-radius: 16px; background: var(--surface-alt-strong); position: relative; transition: background 0.25s; flex-shrink: 0; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06); transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.4, 1.2); }
.switch input:checked + .switch-track { background: var(--good-fill); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch input:disabled + .switch-track { opacity: 0.4; }

/* Multi-select chips (capsules) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.chip-check label { display: inline-flex; align-items: center; padding: 6px 13px; border-radius: 999px; background: var(--surface-alt); font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; user-select: none; min-height: 32px; transition: background 0.15s, color 0.15s; }
.chip-check label:hover { background: var(--surface-alt-strong); }
.chip-check input:checked + label { background: var(--accent); color: var(--accent-ink); }
.chip-check input:focus-visible + label { box-shadow: var(--focus); }

/* ---------- Notices, empty, loading ---------- */
.notice { padding: 12px 14px; border-radius: var(--radius-control); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.notice-info { background: var(--accent-wash); color: var(--ink); }
.notice-good { background: var(--good-wash); color: var(--ink); }
.notice-warning { background: var(--warning-wash); color: var(--ink); }
.notice-critical { background: var(--critical-wash); color: var(--critical); }
.notice strong { font-weight: 600; }
.notice ol, .notice ul { margin: 6px 0 0 18px; padding: 0; }
.empty { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-title { font-weight: 600; font-size: 17px; }
.empty-body { color: var(--ink-muted); font-size: 15px; max-width: 440px; }
.empty-action { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 44px 20px; color: var(--ink-muted); font-size: 15px; }
.error-block { padding: 32px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); border-radius: var(--radius); }
.error-title { font-weight: 600; font-size: 17px; }
.error-block p { color: var(--ink-secondary); max-width: 480px; overflow-wrap: anywhere; }
/* Activity indicator */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--surface-alt-strong); border-top-color: var(--ink-muted); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: var(--hairline) solid var(--border); min-height: 56px; }
.checklist li:last-child { border-bottom: none; }
.check-mark { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.checklist li.done .check-mark { background: var(--good-fill); border-color: var(--good-fill); color: #fff; }
.checklist li.fail .check-mark { border-color: var(--warning-fill); color: var(--warning); }
.check-title { font-weight: 600; font-size: 15px; }
.checklist li.done .check-title { color: var(--ink-muted); }
.check-desc { font-size: 13px; color: var(--ink-muted); overflow-wrap: anywhere; }
.progress { height: 6px; background: var(--surface-alt-strong); border-radius: 3px; overflow: hidden; width: 120px; }
.progress > span { display: block; height: 100%; background: var(--good-fill); border-radius: 3px; }

/* Connection cards */
.conn-head { display: flex; align-items: center; gap: 12px; }
.conn-logo { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-alt); font-weight: 700; color: var(--ink); flex-shrink: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-quaternary); display: inline-block; }
.status-dot.on { background: var(--good-fill); }
.divider { height: var(--hairline); background: var(--border); margin: 4px 0; }
.section-title { font-size: 15px; font-weight: 600; }
.steps { margin: 6px 0 0 20px; padding: 0; color: var(--ink-secondary); font-size: 15px; }
.steps li + li { margin-top: 4px; }

/* ---------- Toast (HUD banner) ---------- */
.toast-region { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  color: var(--ink); padding: 11px 20px; border-radius: 999px; font-size: 15px; font-weight: 600;
  box-shadow: var(--shadow-lg); border: var(--hairline) solid var(--border);
  opacity: 0; transform: translateY(12px) scale(0.98); transition: opacity 0.25s, transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  max-width: 100%; overflow-wrap: anywhere;
}
.toast.show { opacity: 1; transform: none; }
.toast-critical { background: var(--critical-fill); color: #fff; border-color: transparent; }
.toast-good::before, .toast-warning::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.toast-good::before { background: var(--good-fill); }
.toast-warning::before { background: var(--warning-fill); }

/* ---------- Modal (sheet) ---------- */
.modal { margin: auto; border: none; padding: 0; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); width: min(540px, calc(100vw - 24px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.modal-wide { width: min(780px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(0, 0, 0, 0.35); }
.modal[open] { animation: modal-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.modal-form { display: flex; flex-direction: column; max-height: inherit; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: var(--hairline) solid var(--border); }
.modal-header h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: var(--hairline) solid var(--border); flex-wrap: wrap; }

.pick-list { display: flex; flex-direction: column; background: var(--surface-alt); border-radius: var(--radius-control); }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: var(--hairline) solid var(--border); min-height: 44px; }
.pick-item:last-child { border-bottom: none; }
.pick-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.pick-item label { flex: 1; min-width: 0; cursor: pointer; }

/* ---------- Auth page ---------- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-md); padding: 32px; display: flex; flex-direction: column; gap: 20px; }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-title { font-size: 28px; letter-spacing: -0.025em; }
.auth-sub { color: var(--ink-secondary); font-size: 15px; margin-top: 4px; }
.auth-foot { font-size: 14px; color: var(--ink-muted); text-align: center; }

/* ---------- Touch devices: 44pt minimum targets ---------- */
@media (pointer: coarse) {
  :root { --control-h: 44px; }
  .btn-sm { min-height: 36px; padding: 6px 14px; }
  .nav-item { min-height: 44px; }
  .tab, .filter-chip, .radio-card { min-height: 36px; }
  .btn-icon { width: 44px; height: 44px; }
  .input { font-size: 17px; }  /* also prevents iOS zoom-on-focus */
  .chip-check label { min-height: 36px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .sidebar { display: none; }
  /* Translucent navigation bar */
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-bottom: var(--hairline) solid var(--border); position: sticky; top: 0; z-index: 50;
  }
  .topbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .topbar .sidebar-brand-name { max-width: 52vw; }
  .main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .app-banner { padding: 10px 16px; }
  .page-title { font-size: 28px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none !important; }
  /* Translucent tab bar */
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-top: var(--hairline) solid var(--border); padding: 6px 0 calc(4px + env(safe-area-inset-bottom, 0px));
    z-index: 90; justify-content: space-around;
  }
  .mobile-nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 8px; min-width: 60px; min-height: 44px; font-size: 10px; font-weight: 500; color: var(--ink-muted); background: none; border: none; cursor: pointer; text-decoration: none; position: relative; letter-spacing: 0.01em; }
  .mobile-nav-item:hover { text-decoration: none; }
  .mobile-nav-item.active { color: var(--accent); }
  .nav-dot { position: absolute; top: 2px; right: 16px; width: 9px; height: 9px; border-radius: 50%; background: var(--critical-fill); border: 1.5px solid var(--surface); }
  .card-header, .card-body, .card-pad, .list-item, .checklist li { padding-left: 16px; padding-right: 16px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .tabs { align-self: stretch; }
}
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 24px; }
  .table td, .table th { padding: 11px 8px; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1 1 auto; }
  .checklist li { grid-template-columns: 26px minmax(0, 1fr); }
  .checklist li > :nth-child(3) { grid-column: 2; }
  .table .actions .row { flex-wrap: wrap; }
  .auth-card { padding: 24px 20px; border-radius: 16px; }
  /* Sheets slide up from the bottom on phones */
  .modal, .modal-wide {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 14px 14px 0 0;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px));
  }
  .modal[open] { animation: sheet-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1); }
  .modal-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .modal-footer .btn { flex: 1 1 auto; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --material: var(--surface); }
  .sidebar, .topbar, .mobile-nav, .toast { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* =====================================================================
   v2.1 — onboarding, agreements, card payments (operator app)
   ===================================================================== */
.sev-icon.good { background: var(--good-fill); }
.sev-icon.muted { background: var(--surface-alt-strong); color: var(--ink-secondary); }
.list-link { color: inherit; text-decoration: none; align-items: center; transition: background 0.12s; }
.list-link:hover { background: var(--surface-alt); text-decoration: none; }
.list-link .list-item-title { color: var(--ink); }
.card-body-sep { border-top: var(--hairline) solid var(--border); }
.radio-card.is-disabled { opacity: 0.45; cursor: not-allowed; }
.radio-card.is-disabled input { cursor: not-allowed; }
.info-row-stack { flex-direction: column; align-items: flex-start; gap: 4px; }
.info-row-stack .info-value { text-align: left; }

/* Onboarding mini checklist (table cells) */
.mini-steps { list-style: none; padding: 0; margin: 6px 0 0; display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink-secondary); }
.mini-steps li { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.mini-check { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.mini-steps li.done { color: var(--ink); }
.mini-steps li.done .mini-check { background: var(--good-fill); border-color: var(--good-fill); }
.checklist-inset { background: var(--surface-alt); border-radius: var(--radius-control); }
.checklist-inset li { min-height: 48px; padding: 10px 14px; }
.ob-actions { margin-top: 8px; }
.card-list { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; }
.card-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; flex-wrap: wrap; }

/* Agreement document (operator + portal) */
.agreement-doc { font-size: 15px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.agreement-doc h1 { font-size: 22px; line-height: 1.25; margin: 0 0 14px; }
.agreement-doc h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 22px 0 8px; }
.agreement-doc p { margin: 0 0 12px; }
.agreement-doc p + p { margin-top: 0; }
.agreement-doc strong { font-weight: 600; }
.fingerprint { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }

/* Audit trail */
.timeline { list-style: none; margin: 0; padding: 16px 20px 16px 40px; position: relative; }
.timeline li { position: relative; padding-bottom: 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.timeline li::after { content: ""; position: absolute; left: -16px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline-title { font-weight: 600; font-size: 14px; }
.timeline-meta { font-size: 12px; color: var(--ink-muted); overflow-wrap: anywhere; }

/* Template editor */
.template-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.template-body { min-height: 420px; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; letter-spacing: 0; }
.template-preview { background: var(--surface-alt); border-radius: var(--radius-control); padding: 16px 18px; max-height: 560px; overflow: auto; }
.template-preview .agreement-doc { font-size: 14px; }
.chip-btn { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; border: none; background: var(--surface-alt); color: var(--accent-text); font-size: 12px; cursor: pointer; min-height: 28px; transition: background 0.15s; }
.chip-btn:hover { background: var(--surface-alt-strong); }
@media (max-width: 899px) {
  .template-grid { grid-template-columns: minmax(0, 1fr); }
  .template-body { min-height: 300px; }
  .timeline { padding-left: 36px; padding-right: 16px; }
}
@media (pointer: coarse) { .chip-btn { min-height: 36px; padding: 6px 12px; } }

/* =====================================================================
   Driver portal (/d) — mobile-first, iOS-style
   ===================================================================== */
.btn-lg { min-height: 50px; font-size: 17px; border-radius: 12px; padding: 12px 20px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
.portal { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.portal-bar {
  position: sticky; top: 0; z-index: 50;
  background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: var(--hairline) solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.portal-bar-inner { max-width: 640px; margin: 0 auto; min-height: 44px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 8px; }
.portal-bar-title { grid-column: 2; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.portal-back { grid-column: 1; justify-self: start; display: inline-flex; align-items: center; gap: 0; min-height: 44px; padding: 0 8px 0 2px; font-size: 17px; color: var(--accent-text); }
.portal-back:hover { text-decoration: none; opacity: 0.75; }
.portal-main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; }
.portal-main:focus { box-shadow: none; }
.portal-view { display: flex; flex-direction: column; gap: 22px; }
.portal-footer { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-muted); padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
.portal-link-btn { background: none; border: none; color: var(--accent-text); font-size: 13px; font-weight: 500; cursor: pointer; min-height: 44px; padding: 0 6px; }
.portal-link-btn:hover { text-decoration: underline; }

.portal-hero { padding: 14px 4px 0; }
.portal-eyebrow { font-size: 13px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.portal-title { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.12; overflow-wrap: anywhere; }
.portal-sub { font-size: 17px; color: var(--ink-secondary); margin-top: 6px; line-height: 1.4; }
.portal-muted { color: var(--ink-muted); font-weight: 400; }
.portal-error-text { color: var(--critical); }
.portal-footnote { font-size: 13px; color: var(--ink-muted); text-align: center; display: flex; gap: 6px; align-items: flex-start; justify-content: center; padding: 0 4px; }
.portal-footnote .icon { margin-top: 2px; }

.portal-section { display: flex; flex-direction: column; gap: 8px; }
.portal-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 0 4px; }
.portal-section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; padding: 0 4px; }
.portal-section-head .portal-section-title { padding: 0; }
.portal-section-meta { font-size: 13px; color: var(--ink-muted); }
.portal .card { border-radius: 14px; }
.portal .list-item, .portal .checklist li { padding-left: 16px; padding-right: 16px; }

.portal-car { display: flex; align-items: center; gap: 14px; padding: 16px; border-bottom: var(--hairline) solid var(--border); }
.portal-car-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-wash); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.portal-car-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.portal-car-sub { font-size: 14px; color: var(--ink-muted); }
.portal-rows { padding: 0 16px; }

.portal-balance { padding: 18px 16px 16px; text-align: center; border-bottom: var(--hairline) solid var(--border); }
.portal-balance:last-child { border-bottom: none; }
.portal-balance-label { font-size: 13px; font-weight: 600; color: var(--ink-muted); }
.portal-balance-value { font-family: var(--font-rounded); font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-top: 2px; }
.portal-balance-sub { font-size: 14px; color: var(--ink-secondary); margin-top: 2px; }
.portal-due { align-items: center; }
.portal-due-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.portal-amount { font-weight: 700; font-size: 17px; }
.portal-chevron { color: var(--ink-quaternary); }

.portal-hero-icon { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.portal-hero-icon-accent { background: var(--accent-wash); color: var(--accent); }
.portal-hero-icon-good { background: var(--good-wash); color: var(--good); }
.portal-hero-icon-warning { background: var(--warning-wash); color: var(--warning); }
.portal-hero-icon-critical { background: var(--critical-wash); color: var(--critical); }
.portal-center, .portal-center-inline { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 32px 20px; }
.portal-center { min-height: 100vh; min-height: 100dvh; max-width: 480px; margin: 0 auto; }
.portal-center:focus { box-shadow: none; }
.portal-center-inline { min-height: 50vh; }
.portal-center .portal-title, .portal-center-inline .portal-title { font-size: 28px; }
.portal-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 360px; margin-top: 10px; }
.portal-result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 6px 0 4px; }
.portal-result-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

/* Signing */
.portal-sign .card-header { padding-left: 16px; padding-right: 16px; }
.portal-sign .card-body { padding-left: 16px; padding-right: 16px; }
.portal-seg { align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; }
.portal-seg .radio-card { justify-content: center; min-height: 36px; }
.portal-sig-typed {
  font-family: "Snell Roundhand", "Apple Chancery", "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: 34px; line-height: 1.3; padding: 18px 16px 10px; min-height: 84px;
  background: #FFFFFF; color: #111827; border-radius: var(--radius-control);
  border: var(--hairline) solid var(--border-strong); border-bottom: 1.5px solid #9CA3AF;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.portal-sig-typed.is-empty { color: #9CA3AF; }
.portal-sigpad { position: relative; background: #FFFFFF; border-radius: var(--radius-control); border: var(--hairline) solid var(--border-strong); overflow: hidden; }
.portal-sigpad-canvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; }
.portal-sigpad::after { content: ""; position: absolute; left: 36px; right: 16px; bottom: 44px; height: 1.5px; background: #D1D5DB; pointer-events: none; }
.portal-sigpad-x { position: absolute; left: 14px; bottom: 46px; color: #9CA3AF; font-size: 14px; pointer-events: none; }
.portal-sigpad-hint { position: absolute; inset: 0 0 50px; display: flex; align-items: center; justify-content: center; color: #9CA3AF; font-size: 17px; pointer-events: none; }
.portal-consent { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 14px; background: var(--surface-alt); border-radius: var(--radius-control); cursor: pointer; font-size: 15px; line-height: 1.4; }
.portal-consent input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.portal-fingerprint { margin-top: 16px; padding-top: 12px; border-top: var(--hairline) solid var(--border); font-size: 12px; color: var(--ink-muted); display: flex; flex-direction: column; gap: 2px; }
.portal-fingerprint .mono { font-size: 11px; }

/* Card form */
.portal-card-element { min-height: 50px; }
.portal-card-element-stripe { background: var(--surface-alt); border-radius: var(--radius-control); padding: 15px 14px; }
.portal-card-element-stripe:focus-within { box-shadow: var(--focus); background: var(--surface); }

@media (min-width: 700px) {
  .portal-main { padding-top: 20px; }
  .portal-title { font-size: 38px; }
}
@media (max-width: 380px) {
  .portal-title { font-size: 30px; }
  .portal-balance-value { font-size: 38px; }
  .portal-due { flex-wrap: wrap; }
  .portal-due-side { flex-direction: row; align-items: center; width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-transparency: reduce) {
  .portal-bar { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* =====================================================================
   v2.2 — billing, insights, leads, inspections, assistant, academy,
   driver car controls, public booking page
   ===================================================================== */
a.badge:hover { text-decoration: none; filter: brightness(0.97); }
.app-banner a { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }

/* Toast with an action link */
.toast-has-action { pointer-events: auto; }
.toast-action { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; margin-left: 4px; white-space: nowrap; }
.toast-critical .toast-action { color: #fff; }

/* Meter (progress bar) */
.meter { display: block; height: 8px; border-radius: 4px; background: var(--surface-alt-strong); overflow: hidden; width: 100%; min-width: 48px; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--good-fill); transition: width 0.4s ease; }
.meter-accent > span { background: var(--accent); }
.meter-warning > span { background: var(--warning-fill); }
.meter-critical > span { background: var(--critical-fill); }
.util { display: flex; align-items: center; gap: 8px; }
.util .meter { flex: 1; }
.util .small { min-width: 38px; text-align: right; }

/* Small switch (inline rows) */
.switch-sm .switch-label { font-size: 14px; }

/* Segmented links (filter chips as <a>) */
a.filter-chip { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
a.filter-chip:hover { text-decoration: none; }
.filter-chip[aria-current] { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
:root[data-theme="dark"] .filter-chip[aria-current] { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .filter-chip[aria-current] { background: #636366; } }
.chip-count { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; font-weight: 500; }

/* Buttons that look like list rows */
.list-button { width: 100%; border: none; background: none; font: inherit; text-align: left; cursor: pointer; color: inherit; }
.list-button:focus-visible { border-radius: 0; box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.chev-right { transform: rotate(180deg); color: var(--ink-quaternary); align-self: center; }
.lead-age { align-self: center; }

/* Code */
.code-block { background: var(--surface-alt); border-radius: var(--radius-control); padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; max-width: 100%; }
.code-block code { font-size: inherit; white-space: pre; }
.code-inline { display: block; background: var(--surface-alt); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; }

/* Plans */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.plan-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; border: 2px solid transparent; }
.plan-card.current { border-color: var(--good-fill); }
.plan-name { font-size: 17px; font-weight: 600; }
.plan-price { font-family: var(--font-rounded); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.plan-price small { font-size: 15px; color: var(--ink-muted); font-weight: 500; }
.plan-limit { color: var(--ink-secondary); font-size: 14px; margin-bottom: 4px; }
.plan-card .btn-block { margin-top: auto; }
.plan-edit-list { gap: 12px; }
.plan-edit { background: var(--surface-alt); border-radius: var(--radius-control); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.plan-edit .input { background: var(--surface); }
.plan-edit-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.franchise-cell { display: flex; gap: 6px; align-items: center; min-width: 200px; }
.franchise-cell select { flex: 1; min-width: 0; }
.input-suffix { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-muted); font-size: 13px; }
.input-suffix .input { width: 64px; }

/* Tires (top view: front row, rear row) */
.tires { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.tire { background: var(--surface-alt); border-radius: var(--radius-control); padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.tire-pos { font-size: 12px; color: var(--ink-muted); }
.tire-val { font-size: 17px; font-weight: 600; }
.tire-val small { font-size: 12px; color: var(--ink-muted); font-weight: 500; }
.tire-low { background: var(--critical-wash); }
.tire-low .tire-val { color: var(--critical); }
.tire-flag { font-size: 12px; font-weight: 700; color: var(--critical); }

/* Photo tiles (inspections, operator + portal) */
.shot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.shot-tile { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.shot-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.shot-label, .shot-tile > .shot-empty { position: relative; display: flex; flex-direction: column; border-radius: var(--radius-control); overflow: hidden; background: var(--surface-alt); cursor: pointer; min-height: 44px; }
.shot-tile:not(:has(.shot-input)) { cursor: default; }
.shot-tile:not(:has(.shot-input)) > img { border-radius: var(--radius-control); }
.shot-label:hover { background: var(--surface-alt-strong); }
.shot-input:focus-visible + .shot-label { box-shadow: var(--focus); }
.shot-input:disabled + .shot-label { cursor: progress; }
.shot-label img, .shot-tile > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-alt-strong); }
.shot-empty { width: 100%; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; color: var(--accent); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-control); }
.shot-done { color: var(--good); border-style: solid; border-color: var(--good-fill); background: var(--good-wash); }
.shot-caption { display: flex; flex-direction: column; padding: 6px 8px 8px; gap: 0; }
.shot-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.shot-state { font-size: 12px; color: var(--accent-text); }
.has-photo .shot-state { color: var(--ink-muted); }
.shot-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.shot-error { font-size: 12px; color: var(--critical); min-height: 0; }
.shot-error:empty { display: none; }
.shot-grid-portal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shot-grid-portal .shot-name { font-size: 15px; }
.findings { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.findings li { background: var(--surface-alt); border-radius: var(--radius-control); padding: 10px 12px; }
.compare-grid { display: flex; flex-direction: column; gap: 14px; }
.compare-row { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.compare-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compare-pair img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); display: block; background: var(--surface-alt); }
.analyze-progress { display: flex; flex-direction: column; gap: 8px; background: var(--accent-wash); border-radius: var(--radius-control); padding: 12px 14px; }
.analyze-progress .spinner { width: 14px; height: 14px; vertical-align: -2px; }

/* Bar chart (inline SVG) */
.bar-chart { display: block; overflow: visible; font-family: var(--font-body); }
.bar-label { font-size: 13px; font-weight: 500; fill: var(--ink); }
.bar-value { font-size: 13px; font-weight: 600; fill: var(--ink-secondary); font-variant-numeric: tabular-nums; }
.bar-value.neg { fill: var(--critical); }
.bar-track { fill: var(--surface-alt); }
.bar-pos { fill: var(--accent); }
.bar-neg { fill: var(--critical-fill); }
.bar-zero { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.bar-hit { fill: transparent; }
.bar-row:hover .bar-hit { fill: var(--surface-alt); }
.bar-row:hover .bar { filter: brightness(1.1); }
.table tfoot th, .table tfoot td { border-top: var(--hairline) solid var(--border-strong); padding-top: 12px; padding-bottom: 12px; font-weight: 600; text-align: left; }
.table tfoot .right { text-align: right; }
.total-row th { color: var(--ink); font-size: 15px; }

/* Assistant (Messages-style) */
.chat-card { display: flex; flex-direction: column; height: min(68vh, 720px); min-height: 360px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.chat-log:focus-visible { border-radius: 0; box-shadow: inset var(--focus); }
.chat-row { display: flex; flex-direction: column; max-width: 100%; }
.chat-row.me { align-items: flex-end; }
.chat-row.them { align-items: flex-start; }
.bubble { max-width: min(78%, 560px); padding: 8px 13px; border-radius: 18px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-me { background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.bubble-them { background: var(--surface-alt-strong); color: var(--ink); border-bottom-left-radius: 6px; }
.bubble-error { background: var(--critical-wash); color: var(--critical); }
.chat-meta { font-size: 11px; color: var(--ink-muted); padding: 2px 8px 4px; }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-muted); animation: typing 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: var(--hairline) solid var(--border); }
.chat-input { resize: none; min-height: var(--control-h); max-height: 160px; border-radius: 18px; padding: 8px 14px; line-height: 1.35; }
.chat-send { width: var(--control-h); height: var(--control-h); padding: 0; border-radius: 50%; flex-shrink: 0; }
.chat-foot { font-size: 12px; color: var(--ink-muted); text-align: center; margin-top: -10px; }
.chat-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 460px; padding: 12px; }
.chat-empty-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-wash); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chat-suggestion { font-size: 14px; padding: 7px 13px; min-height: 34px; }

/* Academy */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.lesson-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.lesson-list a { display: flex; align-items: center; gap: 10px; padding: 9px 0; color: var(--ink); border-bottom: var(--hairline) solid var(--border); min-height: 44px; }
.lesson-list li:last-child a { border-bottom: none; }
.lesson-list a:hover { text-decoration: none; color: var(--accent-text); }
.lesson-list .lesson-title { flex: 1; min-width: 0; font-size: 14px; }
.lesson-list li.done .mini-check { background: var(--good-fill); border-color: var(--good-fill); }
.lesson-list li.done .lesson-title { color: var(--ink-secondary); }
.lesson-card { max-width: 760px; }
.lesson-body { padding-top: 22px; padding-bottom: 22px; }
.card-body-sep-bottom { border-bottom: var(--hairline) solid var(--border); }
.lesson-nav { justify-content: space-between; }
.lesson-editor textarea { font-family: var(--font-mono); font-size: 13px; min-height: 260px; }

/* Driver portal: car controls, photo buttons */
.car-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.control-btn-lg { min-height: 104px; font-size: 16px; border-radius: 18px; }
.portal-car-status { font-size: 14px; color: var(--ink-secondary); text-align: center; min-height: 20px; }
.portal-car-status[data-tone="good"] { color: var(--good); font-weight: 600; }
.portal-car-status[data-tone="warning"] { color: var(--warning); font-weight: 600; }
.portal-car-status[data-tone="critical"] { color: var(--critical); font-weight: 600; }
.portal-photo-actions { justify-content: flex-start; }
.file-btn { cursor: pointer; }
.shot-input:focus-visible + .file-btn { box-shadow: var(--focus); }
.file-btn[aria-disabled="true"] { opacity: 0.6; cursor: progress; }

/* Public booking page */
.pub-body { background: var(--bg); }
.pub { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pub-bar { position: sticky; top: 0; z-index: 50; background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-bottom: var(--hairline) solid var(--border); padding-top: env(safe-area-inset-top, 0px); }
.pub-bar-inner { max-width: 980px; margin: 0 auto; padding: 8px 16px; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pub-brand { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pub-main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px 32px; display: flex; flex-direction: column; gap: 40px; }
.pub-main:focus { box-shadow: none; }
.pub-hero { text-align: center; padding: 56px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pub-eyebrow { font-size: 15px; font-weight: 600; color: var(--accent-text); }
.pub-title { font-size: clamp(34px, 7vw, 56px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 700; max-width: 760px; overflow-wrap: anywhere; }
.pub-price { font-size: 19px; color: var(--ink-secondary); }
.pub-price strong { color: var(--ink); font-weight: 700; }
.pub-cta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.pub-section { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 72px; }
.pub-section:focus { box-shadow: none; }
.pub-h2 { font-size: 26px; letter-spacing: -0.025em; padding: 0 4px; }
.pub-about { white-space: pre-wrap; font-size: 17px; line-height: 1.5; color: var(--ink-secondary); overflow-wrap: anywhere; }
.pub-cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pub-car { display: flex; flex-direction: column; border-radius: 18px; }
.pub-car-art { height: 120px; display: flex; align-items: center; justify-content: center; color: var(--accent); background: linear-gradient(180deg, var(--accent-wash), transparent); }
.pub-car-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 4px; }
.pub-car-name { font-size: 19px; letter-spacing: -0.02em; min-width: 0; overflow-wrap: anywhere; }
.pub-car-sub { color: var(--ink-muted); font-size: 14px; }
.pub-car-rate { margin-top: 6px; font-size: 15px; color: var(--ink-muted); }
.pub-car-rate strong { font-family: var(--font-rounded); font-size: 24px; color: var(--ink); letter-spacing: -0.02em; }
.pub-reqs { list-style: none; margin: 0; padding: 4px 0; }
.pub-reqs li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-bottom: var(--hairline) solid var(--border); font-size: 16px; }
.pub-reqs li:last-child { border-bottom: none; }
.pub-reqs .icon { color: var(--good); margin-top: 2px; }
.pub-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.pub-footer { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--ink-muted); padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.pub-footer svg { width: 18px; height: 18px; }

@media (max-width: 899px) {
  .plan-edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-card { height: calc(100dvh - 300px); }
}
@media (max-width: 600px) {
  .shot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-edit-grid { grid-template-columns: minmax(0, 1fr); }
  .bubble { max-width: 86%; }
  .course-grid { grid-template-columns: minmax(0, 1fr); }
  .pub-hero { padding-top: 36px; }
  .pub-reqs li { padding-left: 16px; padding-right: 16px; }
  .lesson-nav .row { width: 100%; }
  .lesson-nav .row .btn { flex: 1 1 auto; }
}
@media (pointer: coarse) { .chat-suggestion { min-height: 40px; } }

/* ---------- v2.3 insurance settings ---------- */
.seg-wide { align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; }
.seg-wide .radio-card { justify-content: center; min-height: 36px; }
.mode-explain { background: var(--accent-wash); border-radius: var(--radius-control); padding: 12px 14px; }
.mode-explain-title { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent-text); margin-bottom: 4px; }
.mode-explain p { color: var(--ink-secondary); font-size: 14px; line-height: 1.45; }
.policy-list { display: flex; flex-direction: column; }
.policy { padding: 16px 20px; border-top: var(--hairline) solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.policy:first-child { border-top: 0; }
.policy.is-expiring { box-shadow: inset 3px 0 0 var(--warning-fill); }
.policy.is-expired { box-shadow: inset 3px 0 0 var(--critical-fill); }
.policy.is-inactive .policy-title, .policy.is-inactive .policy-limits { opacity: 0.6; }
.policy-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.policy-title { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.policy-meta { font-size: 13px; color: var(--ink-muted); }
.policy-limits { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 0; }
.policy-limits div { background: var(--surface-alt); border-radius: var(--radius-sm); padding: 8px 10px; }
.policy-limits dt { font-size: 12px; color: var(--ink-muted); }
.policy-limits dd { margin: 0; font-weight: 600; }
.policy-covers { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.policy-covers .section-title { margin: 0; }
.policy-drivers { display: flex; flex-direction: column; gap: 8px; }
.policy-drivers .section-title { display: flex; gap: 8px; align-items: center; margin: 0; }
.policy-driver-list { list-style: none; padding: 0; margin: 0; background: var(--surface-alt); border-radius: var(--radius-control); }
.policy-driver-list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px; border-bottom: var(--hairline) solid var(--border); }
.policy-driver-list li:last-child { border-bottom: 0; }
.policy-driver-body { min-width: 0; }
.policy-driver-actions { gap: 6px; }
.policy-add .field { max-width: 320px; }
.policy-actions { gap: 8px; }
.file-pick { position: relative; display: inline-flex; }
.ins-reason { color: var(--warning); }

/* ---------- v2.4 trips ---------- */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.link-btn:disabled { opacity: 0.5; cursor: progress; }
.quote-card { background: var(--surface-alt); border-radius: var(--radius-control); padding: 4px 14px; }
.quote-card.is-conflict { opacity: 0.6; }
.quote-card .info-row { padding: 8px 0; }
.quote-total .info-label, .quote-total .info-value { font-weight: 700; color: var(--ink); font-size: 16px; }
.avail-item { cursor: pointer; }
.avail-item input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
a.rental-dates { color: inherit; }
a.rental-dates:hover { color: var(--accent-text); }

/* Calendar: only .cal-scroll scrolls sideways; the car column is sticky. */
.cal-toolbar { flex-wrap: wrap; gap: 10px; }
.cal-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-secondary); }
.cal-legend li { display: inline-flex; align-items: center; gap: 6px; }
.cal-swatch { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.cal-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; border-top: var(--hairline) solid var(--border); }
.cal-scroll:focus-visible { box-shadow: inset var(--focus); outline: none; }
.cal-grid { --cal-label-w: 168px; --cal-day-w: 52px; min-width: calc(var(--cal-label-w) + var(--cal-days) * var(--cal-day-w)); }
.cal-row { display: grid; grid-template-columns: var(--cal-label-w) minmax(0, 1fr); border-bottom: var(--hairline) solid var(--border); }
.cal-row:last-child { border-bottom: 0; }
.cal-label { position: sticky; left: 0; z-index: 3; background: var(--surface); padding: 8px 12px 8px 16px; display: flex; flex-direction: column; justify-content: center; min-width: 0; border-right: var(--hairline) solid var(--border); }
.cal-car { font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-car-sub { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-head { position: sticky; top: 0; z-index: 4; background: var(--surface); }
.cal-days { display: grid; grid-template-columns: repeat(var(--cal-days), minmax(0, 1fr)); }
.cal-day { display: flex; flex-direction: column; align-items: center; padding: 8px 0 6px; font-size: 12px; color: var(--ink-muted); border-left: var(--hairline) solid var(--border); }
.cal-day:first-child { border-left: 0; }
.cal-dom { font-size: 15px; font-weight: 600; color: var(--ink); font-family: var(--font-rounded); width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-day.is-today .cal-dom { background: var(--critical-fill); color: #fff; }
.cal-day.is-today .cal-dow { color: var(--critical); font-weight: 600; }
.cal-track { position: relative; display: grid; grid-template-columns: repeat(var(--cal-days), minmax(0, 1fr)); min-height: 42px; }
.cal-track.is-maint { background: repeating-linear-gradient(135deg, transparent 0 8px, var(--surface-alt) 8px 16px); }
.cal-cell { border-left: var(--hairline) solid var(--border); }
.cal-cell:first-child { border-left: 0; }
.cal-cell.is-weekend, .cal-day.is-weekend { background: color-mix(in srgb, var(--surface-alt) 45%, transparent); }
.cal-cell.is-today { background: var(--critical-wash); }
.cal-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--critical-fill); z-index: 2; pointer-events: none; }
.cal-bar { position: absolute; height: 24px; display: flex; align-items: center; gap: 3px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; z-index: 1; min-width: 6px; }
.cal-bar span { overflow: hidden; text-overflow: ellipsis; }
.cal-bar:hover { text-decoration: none; filter: brightness(0.96); z-index: 2; }
.cal-bar:focus-visible { box-shadow: var(--focus); z-index: 2; }
.cal-bar .icon { flex: none; }
.cal-bar-trip { background: var(--accent); color: var(--accent-ink); }
.cal-bar-weekly { background: var(--good-wash); color: var(--good); box-shadow: inset 3px 0 0 var(--good-fill); }
.cal-bar.is-pending, .cal-swatch.is-pending { background: transparent; color: var(--warning); box-shadow: none; border: 1.5px dashed var(--warning-fill); }
.cal-bar.is-ended, .cal-swatch.is-ended { background: var(--surface-alt-strong); color: var(--ink-secondary); box-shadow: none; }
.cal-bar.cut-left { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar.cut-right, .cal-bar.is-open { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-bar-weekly.is-open:not(.is-pending):not(.is-ended) { background: linear-gradient(90deg, var(--good-wash) 80%, transparent); }
@media (max-width: 600px) {
  .cal-grid { --cal-label-w: 112px; --cal-day-w: 44px; }
  .cal-label { padding-left: 12px; padding-right: 8px; }
  .cal-legend { width: 100%; }
}

/* Public booking page: trip search */
.pub-lede { color: var(--ink-secondary); font-size: 16px; padding: 0 4px; }
.pub-trip-facts { list-style: none; padding: 0; margin: 4px 0 12px; font-size: 14px; color: var(--ink-secondary); display: grid; gap: 2px; }

/* =====================================================================
   Settings round 4 — hub, one-click connections, countersign
   ===================================================================== */
/* Grouped-list header between cards (Payments reads top to bottom) */
.settings-group { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-muted); margin: 6px 4px -12px; }
.settings-group:first-of-type { margin-top: 0; }
/* One plain-English status sentence per card */
.status-line { display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.status-line .status-dot { flex: none; transform: translateY(-1px); }
.text-warning { color: var(--warning); }
/* Collapsed "advanced" sections */
.disclosure > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 15px; font-weight: 500; color: var(--accent-text); border-radius: 6px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s; margin-right: 2px; }
.disclosure[open] > summary::before { transform: rotate(45deg); }
.disclosure > summary:focus-visible { box-shadow: var(--focus); outline: none; }
.disclosure > :not(summary) { margin-top: 8px; }
/* Highlighted upsell inside a card */
.feature-box { background: var(--surface-alt); border-radius: var(--radius-control); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.feature-box p { margin: 0; }
.feature-box .form-actions .hint { flex-basis: 100%; margin: 0; }
/* Carrier review stepper */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.stepper li { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--ink-muted); position: relative; padding-top: 2px; }
.stepper li::before { content: ""; position: absolute; top: 11px; left: 26px; right: 4px; height: 2px; border-radius: 1px; background: var(--surface-alt-strong); }
.stepper li:last-child::before { display: none; }
.stepper li.done::before { background: var(--good-fill); }
.stepper-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; position: relative; z-index: 1; }
.stepper li.done .stepper-dot { background: var(--good-fill); border-color: var(--good-fill); color: #fff; }
.stepper li.current { color: var(--ink); font-weight: 600; }
.stepper li.current .stepper-dot { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 10px var(--accent); }
.stepper li.fail { color: var(--warning); font-weight: 600; }
.stepper li.fail .stepper-dot { border-color: var(--warning-fill); color: var(--warning); }
/* Toggle that depends on the one above it */
.toggle-nested { margin-left: 22px; padding-left: 14px; border-left: 2px solid var(--border); }
.toggle-field.is-disabled { opacity: 0.5; }
/* State + ZIP stay side by side, even on phones */
.form-grid-tight { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) !important; gap: 12px; }
/* Setup progress */
.checklist li.waiting .check-mark { border-style: dashed; }
.checklist li.waiting .check-title { color: var(--ink-muted); }
.setup-done .card-body { gap: 12px; flex-wrap: nowrap; }
/* Countersign sheet: the agreement scrolls inside it */
.countersign-doc { max-height: 42vh; overflow: auto; border: var(--hairline) solid var(--border); border-radius: var(--radius-control); padding: 12px 16px; margin: 12px 0; background: var(--bg); -webkit-overflow-scrolling: touch; }
.countersign-doc:focus-visible { box-shadow: var(--focus); outline: none; }
.cell-action { margin-top: 6px; }
.alert-actions { flex-wrap: nowrap; flex: none; }
@media (max-width: 600px) {
  .alert-actions { flex-wrap: wrap; justify-content: flex-end; }
  .stepper li { font-size: 12px; }
  .toggle-nested { margin-left: 8px; }
}
/* Driver portal: a step that's done on the driver's side, waiting on the company */
.portal-waiting { display: inline-flex; align-items: baseline; gap: 6px; color: var(--ink-secondary); }
.portal-waiting .icon { flex: none; transform: translateY(1px); }
.checklist li.waiting-on-them .check-title { color: var(--ink); }

/* Platform → Health */
.health-pill { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.table tr.row-alert td { background: color-mix(in srgb, var(--critical) 6%, transparent); }
.list-item-trail { margin-left: auto; flex: none; font-variant-numeric: tabular-nums; }
.health-company { display: flex; flex-direction: column; }

/* =====================================================================
   v2.5 — Fleet map, driver issues, booking-site branding
   ===================================================================== */
/* Fleet map */
.fleet-map-wrap { position: relative; }
.fleet-map { height: 420px; width: 100%; background: var(--surface-alt); }
.fleet-map-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; font-size: 15px; color: var(--ink-secondary); background: var(--surface-alt); pointer-events: none; }
.fleet-map-overlay[hidden] { display: none; }
.fleet-map-overlay-quiet { background: color-mix(in srgb, var(--surface) 72%, transparent); }
.map-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-secondary); }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.map-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; box-shadow: 0 0 0 1.5px var(--surface); }
.map-marker { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: none; background: none; cursor: pointer; font: inherit; }
.map-pin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); flex: none; }
.map-marker-sleeping .map-pin { border-style: dashed; }
.map-label { font-size: 12px; font-weight: 600; color: #1c1c1e; background: rgba(255, 255, 255, 0.92); padding: 1px 6px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.map-marker:focus-visible { outline: none; }
.map-marker:focus-visible .map-pin { box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.55); }
.map-pop { display: flex; flex-direction: column; gap: 3px; font-family: var(--font-body); font-size: 14px; color: var(--ink); min-width: 170px; }
.map-pop-title { font-weight: 600; font-size: 15px; padding-right: 18px; overflow-wrap: anywhere; }
.map-pop-row { display: flex; align-items: center; gap: 6px; color: var(--ink-secondary); }
.map-pop-meta { font-size: 12px; color: var(--ink-muted); }
.map-pop-link { margin-top: 4px; font-weight: 600; color: var(--accent-text); }
.fleet-map-card .maplibregl-popup-content { background: var(--surface); color: var(--ink); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); }
.fleet-map-card .maplibregl-popup-close-button { width: 28px; height: 28px; font-size: 18px; color: var(--ink-muted); border-radius: 50%; }
.fleet-map-card .maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.fleet-map-card .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--surface); }
.fleet-map-card .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.fleet-map-card .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.fleet-map-card .maplibregl-cooperative-gesture-screen { font-family: var(--font-body); font-size: 15px; }
/* No dark map style is available: invert the light one so the canvas doesn't glare at night. Markers are DOM, so their colours stay true. */
:root[data-theme="dark"] .fleet-map .maplibregl-canvas { filter: invert(0.92) hue-rotate(180deg) saturate(0.6) brightness(0.95); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fleet-map .maplibregl-canvas { filter: invert(0.92) hue-rotate(180deg) saturate(0.6) brightness(0.95); } }
@media (max-width: 600px) {
  .fleet-map { height: 300px; }
  .map-legend { font-size: 12px; gap: 4px 10px; }
}
/* Tabs with a count */
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--critical-fill); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Driver issues (operator) */
.issue-row-title { gap: 6px; }
.issue-row-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.issue-row-status { flex: none; align-self: center; }
.issue-desc { font-size: 16px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.issue-photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.issue-photo { padding: 0; border: none; background: var(--surface-alt); border-radius: var(--radius-control); overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3; }
.issue-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.issue-photo:focus-visible { box-shadow: var(--focus); outline: none; }
.issue-photo-large { width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: var(--radius-control); background: var(--surface-alt); }
.issue-actions { border-top: var(--hairline) solid var(--border); padding-top: 14px; }
.issue-actions legend { padding: 14px 0 0; float: left; width: 100%; margin-bottom: 10px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; line-height: 1.4; }
.check-row input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--accent); }
@media (max-width: 600px) {
  .issue-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .issue-row-status { align-self: flex-start; }
}
/* Driver issues (portal) */
.portal-bar-title { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.portal-bar-title > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-bar-logo { height: 28px; width: auto; max-width: 96px; object-fit: contain; border-radius: 6px; flex: none; }
.portal-bar-logo[hidden] { display: none; }
legend.portal-section-title { padding: 0 4px; margin-bottom: 8px; float: left; width: 100%; }
legend.portal-section-title + * { clear: both; }
.issue-cats .chip-check label { min-height: 40px; font-size: 15px; padding: 8px 14px; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 2px; border-radius: 10px; background: var(--surface-alt); }
.segmented-item { position: relative; }
.segmented-item input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.segmented-item label { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 8px; font-size: 15px; font-weight: 500; cursor: pointer; user-select: none; transition: background 0.2s; }
.segmented-item input:checked + label { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.segmented-item input:focus-visible + label { box-shadow: var(--focus); }
:root[data-theme="dark"] .segmented-item input:checked + label { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented-item input:checked + label { background: #636366; } }
.issue-photo-remove { position: absolute; top: 6px; right: 6px; background: var(--material); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.portal-progress { font-size: 15px; color: var(--ink-secondary); text-align: center; }
.portal-progress:empty { display: none; }
.portal-note { margin-top: 6px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-alt); font-size: 14px; overflow-wrap: anywhere; }
.portal-note-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.portal-report-link { min-height: 60px; }
/* Settings → Booking site */
.site-address-primary .input { font-size: 15px; font-weight: 600; color: var(--ink); }
.brand-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-swatch { width: 44px; height: 36px; padding: 2px; border: none; border-radius: var(--radius-control); background: var(--surface-alt); cursor: pointer; flex: none; }
.brand-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.brand-swatch::-webkit-color-swatch { border: none; border-radius: 7px; }
.brand-swatch::-moz-color-swatch { border: none; border-radius: 7px; }
.brand-swatch:focus-visible { box-shadow: var(--focus); outline: none; }
.brand-hex { width: 120px; flex: none; text-transform: lowercase; }
.brand-preview { display: inline-flex; padding: 6px; border-radius: var(--radius-control); background: var(--bg); }
.brand-preview-btn { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--accent); color: var(--accent-ink); }
.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-preview { width: 160px; height: 64px; border-radius: var(--radius-control); background: var(--surface-alt); display: flex; align-items: center; justify-content: center; padding: 8px; flex: none; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.45; }
.dns-record { border-radius: var(--radius-control); background: var(--bg); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dns-kv { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dns-k { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.dns-record .copy-field .input { background: var(--surface); }
/* Booking site: logo + "Powered by" keeps Spare Key's own blue */
.pub-logo { height: 34px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.pub-footer svg rect { fill: #007AFF; }
.list-link.issue-row { align-items: flex-start; }
@media (max-width: 600px) { .site-addresses .copy-field { flex-wrap: wrap; } .site-addresses .copy-field .input { flex-basis: 100%; } }
.portal-calm-note { background: var(--surface-alt); color: var(--ink); }
@media (max-width: 600px) { .site-address-primary .input { font-size: 13px; } }
/* 2-step sign-in: setup (QR, key, code), recovery codes, sign-in code step */
.qr-box { display: flex; justify-content: center; }
.qr-img { width: 176px; height: 176px; padding: 10px; border-radius: var(--radius-control); background: #fff; box-shadow: inset 0 0 0 var(--hairline) var(--border); }
.center { text-align: center; }
.secret-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.secret-key { flex: 1 1 200px; min-width: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-alt); font-size: 14px; letter-spacing: 0.04em; overflow-wrap: anywhere; user-select: all; }
.code-input { font-size: 22px; letter-spacing: 0.3em; text-align: center; min-height: 48px; }
.code-input::placeholder { letter-spacing: 0.3em; }
.code-error { font-size: 14px; font-weight: 500; color: var(--critical); padding: 0 2px; }
.code-error:empty { display: none; }
.recovery-grid { list-style: none; margin: 0; padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; border-radius: var(--radius-control); background: var(--surface-alt); font-size: 15px; text-align: center; }
.confirm-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.confirm-check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.gate-page .auth-card { max-width: 460px; }
.two-step-setup .steps-list { font-size: 14px; color: var(--ink-secondary); }
/* Security rule: three-way segmented control */
.seg-3 { align-self: stretch; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg-3 .radio-card { justify-content: center; text-align: center; min-height: 36px; padding: 6px 8px; }
/* Shown only where .hide-sm hides the column it replaces */
.only-sm { display: none; }
@media (max-width: 600px) { .only-sm { display: block; } }
/* Live data */
.live-cell { min-width: 130px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mini-stats > div { padding: 10px 12px; border-radius: var(--radius-control); background: var(--bg); min-width: 0; }
.mini-stat-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
@media (max-width: 600px) { .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mono-area textarea { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.45; white-space: pre; overflow-x: auto; }
.preset-help { margin: 4px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink-secondary); display: flex; flex-direction: column; gap: 4px; }
/* Platform → Tesla for Business */
.biz-request .info-list { border-radius: var(--radius-control); }
.plain-list { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
