/* Accurate Capture — "Refined v2" design system.
   Light workspace, white menu (dark for admins), indigo→violet primary, Plus Jakarta Sans,
   JetBrains Mono for numbers. Status colours have -ink variants that pass 4.5:1 on their soft fills. */
:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --surface-3: #F1F3F7;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --faint: #94A3B8;
  --line: #E6E8EE;
  --line-2: #DDE1E9;
  --brand: #0670B0;
  --brand-2: #CE3785;
  --brand-soft: #E8F2FA;
  --brand-ink: #04548A;
  --grad: linear-gradient(135deg, #0670B0, #1A8FD0);
  --teal: #0D9488;
  --good: #16A34A;
  --good-soft: #ECFDF3;
  --good-ink: #15803D;
  --warn: #D97706;
  --warn-strong: #B45309;
  --warn-soft: #FFF7E6;
  --warn-line: #FBE2B0;
  --warn-ink: #92400E;
  --fix: #DC2626;
  --fix-soft: #FEF2F2;
  --fix-ink: #B91C1C;
  --info: #0284C7;
  --info-soft: #F0F9FF;
  --collect: #64748B;
  --rec: #062A47;
  --nav-dark: #0F1330;
  --plot-bg: #FFFFFF;
  --plot-grid: #EEF1F5;
  --plot-axis: #64748B;
  --focus: #0670B0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -14px rgba(15, 23, 42, .18);
  --shadow-lg: 0 24px 64px -16px rgba(15, 23, 42, .35);
  --radius: 16px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B0F1A;
  --surface: #121829;
  --surface-2: #151C2F;
  --surface-3: #1C2440;
  --ink: #E6EAF3;
  --ink-2: #C3CBDC;
  --muted: #8B96AD;
  --faint: #6B7593;
  --line: #243049;
  --line-2: #2F3C5A;
  --brand: #4FA8E0;
  --brand-2: #E46AA8;
  --brand-soft: #0F2638;
  --brand-ink: #BFE0F5;
  --good: #4ADE80;
  --good-soft: #10261A;
  --good-ink: #86EFAC;
  --warn: #FBBF24;
  --warn-strong: #F59E0B;
  --warn-soft: #2B2010;
  --warn-line: #5C4513;
  --warn-ink: #FCD34D;
  --fix: #F87171;
  --fix-soft: #2C1415;
  --fix-ink: #FCA5A5;
  --info: #38BDF8;
  --info-soft: #0C2233;
  --collect: #8B96AD;
  --rec: #161D31;
  --nav-dark: #070A12;
  --plot-bg: #0F1525;
  --plot-grid: #1B2336;
  --plot-axis: #8B96AD;
  --focus: #7CC3EE;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.input:focus-visible { outline: none; }
.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; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: 13px; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; }
.right { margin-left: auto; }
h1, h2, h3 { letter-spacing: -0.01em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 14.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s, filter .15s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); color: var(--ink); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 10px 22px -12px var(--brand); }
.btn.primary:hover:not(:disabled) { background: var(--grad); filter: brightness(1.08); color: #fff; }
.btn.danger { background: var(--fix); border-color: var(--fix); color: #fff; }
.btn.danger:hover:not(:disabled) { background: var(--fix); filter: brightness(1.08); color: #fff; }
.btn.success { background: var(--good); border-color: var(--good); color: #fff; }
.btn.success:hover:not(:disabled) { background: var(--good); filter: brightness(1.06); color: #fff; }
.btn.warn-solid { background: var(--warn-strong); border-color: var(--warn-strong); color: #fff; }
.btn.warn-solid:hover:not(:disabled) { background: var(--warn-strong); filter: brightness(1.08); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.lg { min-height: 54px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.recording { background: var(--rec); border-color: var(--rec); color: #fff; }
.btn.recording::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #EF4444; animation: blink 1.2s infinite; }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.bordered { border: 1px solid var(--line); background: var(--surface); }

/* ---------- Forms ---------- */
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 11px;
  background: var(--surface); color: var(--ink); outline: none; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.input.mono { font-family: var(--mono); font-size: 14px; }
.input.big { min-height: 56px; font-family: var(--mono); font-size: 24px; font-weight: 700; }
.input:disabled { opacity: .6; }
.input[aria-invalid="true"] { border-color: var(--fix); box-shadow: 0 0 0 3px var(--fix-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13.5px; font-weight: 700; color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.seg button { border: 0; background: transparent; min-height: 34px; padding: 0 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 14px; font-weight: 600; min-height: 34px; }
.check input { accent-color: var(--brand); width: 18px; height: 18px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.search { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 10px; background: var(--surface-3); color: var(--muted); min-width: 0; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; color: var(--ink); }
.search.big { background: var(--surface); border: 1px solid var(--line-2); height: 44px; flex: 1 1 280px; max-width: 420px; }
.search.big .input { border: 0; box-shadow: none; min-height: 40px; padding: 0; }

/* ---------- Pills, badges, dots ---------- */
.pill, .badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.pill.good, .badge.good { background: var(--good-soft); color: var(--good-ink); }
.pill.warn, .badge.warn { background: #FEF3C7; color: var(--warn-ink); }
.pill.fix, .badge.fix { background: var(--fix-soft); color: var(--fix-ink); }
.pill.brand, .badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.info { background: var(--info-soft); color: var(--info); }
:root[data-theme="dark"] .pill.warn, :root[data-theme="dark"] .badge.warn { background: var(--warn-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.dot.live { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- App shell ---------- */
.app { display: flex; height: var(--app-h, 100vh); overflow: hidden; }
.nav {
  width: 256px; flex: none; height: 100%; overflow-y: auto; padding: 18px 12px 14px; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.logo, .brand .logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 14px -10px #0670B0;
}
.logo img { width: 92%; height: 92%; object-fit: contain; }
.brand .logo { width: 52px; height: 52px; border-radius: 14px; }
.logo-long { display: inline-flex; align-items: center; flex: none; }
.logo-long img { height: 52px; width: auto; display: block; }
@media (max-width: 480px) { .logo-long img { height: 32px; } .logo-long { padding: 6px 10px; } }
.brand-logo-long { height: 44px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text b { font-size: 15px; font-weight: 800; }
.brand-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-section { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-decoration: none; transition: background .12s, color .12s;
}
.nav-item svg { flex: none; }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--brand); color: #fff; }
.nav-badge[data-badge="cuff"], .nav-badge[data-badge="waiting"] { background: #FEF3C7; color: var(--warn-ink); }
.nav-badge[data-badge="live"] { background: #EF4444; color: #fff; }
.nav-bottom { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.device-card { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.dc-row { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--muted); }
.dc-row.good { color: var(--good-ink); }
.dc-row.warn { color: var(--warn-ink); }
.dc-row.fix { color: var(--fix-ink); }
.dc-val { margin-left: auto; font-family: var(--mono); font-size: 12px; }
.user-card { display: flex; align-items: center; gap: 6px; }
.user-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; color: var(--ink); }
.user-link:hover { background: var(--surface-3); color: var(--ink); }
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--teal), var(--brand)); }
.who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { font-size: 12px; color: var(--muted); }
/* Admin menu: dark */
.nav.dark { background: var(--nav-dark); border-right-color: var(--nav-dark); color: #A5B0C8; }
.nav.dark .brand, .nav.dark .brand:hover, .nav.dark .user-link, .nav.dark .user-link:hover { color: #fff; }
.nav.dark .brand-text small, .nav.dark .who small { color: #8A94AD; }
.nav.dark .nav-section { color: #6B7593; }
.nav.dark .nav-item { color: #C3CBDC; }
.nav.dark .nav-item:hover, .nav.dark .user-link:hover { background: #1A2046; color: #fff; }
.nav.dark .nav-item.active { background: #1F2550; color: #fff; box-shadow: inset 3px 0 0 #7CC3EE; }
.nav.dark .device-card { background: #151A3A; border-color: #232A55; }
.nav.dark .dc-row { color: #A5B0C8; }
.nav.dark .dc-row.good { color: #86EFAC; }
.nav.dark .dc-row.warn { color: #FCD34D; }
.nav.dark .dc-row.fix { color: #FCA5A5; }
.nav.dark .icon-btn { color: #C3CBDC; }
.nav.dark .icon-btn:hover { background: #1A2046; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 10px; min-height: 66px; padding: 12px 28px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--line); position: relative; z-index: 4;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.crumbs b { color: var(--ink); font-weight: 800; font-size: 15px; }
.crumbs .sep { color: var(--line-2); }
.topbar .search { flex: 1 1 260px; max-width: 440px; margin-left: 12px; }
.topbar select.input { width: auto; min-height: 42px; }
.saved-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.saved-pill.good { background: var(--good-soft); color: var(--good-ink); }
.saved-pill.warn { background: #FEF3C7; color: var(--warn-ink); }
.content { flex: 1; overflow: auto; padding: 26px 32px 40px; min-height: 0; }
.content.flush { padding: 0; display: flex; flex-direction: column; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* Record / live: plot on the left, steps or controls on the right */
.workspace { flex: 1; min-height: 0; display: flex; gap: 16px; padding: 16px 20px 18px; overflow: hidden; }
.ws-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.ws-side { width: 420px; flex: none; overflow-y: auto; min-height: 0; padding-bottom: 12px; }
.side-stack { display: flex; flex-direction: column; gap: 12px; }
.side-stack .sidebar-section, .ws-side .sidebar-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.ws-side .record > div { display: flex; flex-direction: column; gap: 12px; }
.ws-side .sidebar-section.steps-list { background: transparent; border: 0; padding: 0; }
.section-title { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad { padding: 18px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.card-body { padding: 18px 20px; }
.card-title { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); color: var(--ink); }
.card.pad > .card-title { padding: 0 0 12px; border-bottom: 0; }
.card-title h2 { margin: 0; font-size: 16px; font-weight: 800; }
.cards { display: grid; gap: 16px; }
.table-wrap { overflow-x: auto; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { width: 40px; height: 40px; opacity: .4; }
.empty b { color: var(--ink-2); }
.empty-ok { padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); }
.empty-ok svg { color: var(--good); }
.empty-ok b { color: var(--ink); font-size: 15.5px; }
.page-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px 20px; color: var(--muted); font-size: 15px; }
.page-loading::before { content: ""; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.updated-ago { font-size: 13px; color: var(--muted); white-space: nowrap; }
.updated-ago.stale { color: var(--warn-ink); font-weight: 700; }

/* Stat cards (admin pages) */
.stats-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.stats-grid > * { flex: 1 1 200px; min-width: 0; }
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }
.stat .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat .ico { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.stat .ico svg { width: 18px; height: 18px; }
.stat.ok .ico { background: var(--good-soft); color: var(--good); }
.stat.alert .ico { background: var(--fix-soft); color: var(--fix); }
.stats-grid .stat:nth-child(5n+2) .ico { background: var(--good-soft); color: var(--good); }
.stats-grid .stat:nth-child(5n+3) .ico { background: #FDF4FF; color: #A21CAF; }
.stats-grid .stat:nth-child(5n+4) .ico { background: #FFF7ED; color: #EA580C; }
.stats-grid .stat.alert .ico { background: var(--fix-soft); color: var(--fix); }
:root[data-theme="dark"] .stats-grid .stat .ico { background: var(--brand-soft); color: var(--brand); }

/* KPI cards (Today / Overview): icon, label, value, comparison */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { display: flex; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); min-width: 0; }
.kpi.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.kpi-ic { width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.kpi-ic.brand { background: var(--brand-soft); color: var(--brand); }
.kpi-ic.good { background: var(--good-soft); color: var(--good); }
.kpi-ic.warn { background: #FEF3C7; color: var(--warn-strong); }
.kpi-ic.info { background: var(--info-soft); color: var(--info); }
.kpi-ic.fix { background: var(--fix-soft); color: var(--fix); }
.kpi-body { min-width: 0; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi.warn .kpi-label, .kpi.warn .kpi-value, .kpi.warn .kpi-sub { color: var(--warn-ink); }
.kpi-value { font-size: 27px; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.kpi-value small { font-size: 14px; color: var(--faint); font-weight: 600; }
.kpi-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi-sub.up { color: var(--good-ink); }
.kpi-sub.down { color: var(--fix-ink); }
.kpi-link { font-size: 12.5px; font-weight: 800; color: var(--warn-ink); text-decoration: underline; }
.mini-bar { width: 120px; height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.mini-bar > div { height: 100%; background: var(--good); border-radius: 3px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* ---------- Today / Patients ---------- */
.today { display: flex; flex-direction: column; gap: 22px; }
.greet { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.greet h1 { margin: 4px 0 0; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.greet-date { font-size: 14px; color: var(--muted); font-weight: 600; }
.two-col { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 2 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.att-list { display: flex; flex-direction: column; }
.att-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); position: relative; }
.att-row:first-child { border-top: 0; }
.att-row::before { content: ""; position: absolute; left: 8px; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: var(--brand); }
.att-row.warn::before { background: var(--warn); }
.att-why { font-size: 13.5px; color: var(--muted); }
.att-row.warn .att-why { color: var(--warn-ink); font-weight: 600; }
.p-avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--brand-soft); color: var(--brand-ink); }
.p-avatar.warn { background: #FEF3C7; color: var(--warn-ink); }
.p-avatar.good { background: var(--good-soft); color: var(--good-ink); }
.p-cell { display: flex; align-items: center; gap: 12px; }
.p-meta { font-size: 12.5px; color: var(--muted); }
.segs { display: flex; gap: 3px; }
.segs span { width: 18px; height: 8px; border-radius: 2px; background: var(--surface-3); }
.segs span.done { background: var(--good); }
.segs span.warn { background: #F59E0B; }
.segs span.next { background: #BFE0F5; }
.cuff-state { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 13.5px; }
.cuff-state.good { color: var(--good-ink); }
.cuff-state.warn { color: var(--warn-strong); }
.p-table td.actions { text-align: right; padding-right: 16px; }
.dh-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dh-cell { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.dh-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.dh-value { font-weight: 800; margin-top: 4px; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.dh-value.good { color: var(--good-ink); }
.dh-value.warn { color: var(--warn-ink); }
.dh-value.fix { color: var(--fix-ink); }
.dh-value.mono { font-family: var(--mono); }
.card.pad > .p-meta { margin-top: 10px; }
.timeline-v { display: flex; flex-direction: column; gap: 14px; }
.tl-row { display: flex; gap: 12px; font-size: 13.5px; }
.tl-ic { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.tl-ic.good { background: var(--good-soft); color: var(--good); }
.tl-ic.warn { background: #FEF3C7; color: var(--warn-strong); }
.tl-ic.fix { background: var(--fix-soft); color: var(--fix); }
.tl-ic.info { background: var(--info-soft); color: var(--info); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.click { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Notices, status messages ---------- */
.notice { border-radius: 12px; padding: 12px 14px; font-size: 14.5px; background: var(--brand-soft); color: var(--brand-ink); display: flex; gap: 10px; align-items: flex-start; }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice.fix { background: var(--fix-soft); color: var(--fix-ink); }
.notice.good { background: var(--good-soft); color: var(--good-ink); }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.status-line { font-size: 14px; color: var(--muted); }
.status-line:empty, .validation:empty { display: none; }
.status-line.msg, .validation {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14.5px; font-weight: 600; line-height: 1.4;
  background: var(--fix-soft); color: var(--fix-ink); border: 1px solid color-mix(in srgb, var(--fix) 30%, transparent);
}
.status-line.msg::before, .validation::before { content: "!"; flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--fix); color: #fff; font-weight: 800; font-size: 13px; }
.status-line.msg.ok { background: var(--good-soft); color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.status-line.msg.ok::before { content: "✓"; background: var(--good); }
.status-line.msg.info { background: var(--brand-soft); color: var(--brand-ink); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.status-line.msg.info::before { content: "i"; background: var(--brand); }
.status-line.msg.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: var(--warn-line); }
.status-line.msg.warn::before { background: var(--warn); }

/* ---------- Status area: recording banner + attention banners ---------- */
.status-area { flex: none; position: relative; z-index: 3; }
.status-strip { display: flex; flex-direction: column; gap: 8px; }
.status-strip.rec { padding: 12px 28px; color: #fff; background: linear-gradient(110deg, #062A47, #0A3A62 60%, #0B4470); }
.ss-rec { display: flex; align-items: center; gap: 16px; }
.ss-recdot { width: 16px; height: 16px; border-radius: 50%; background: #EF4444; flex: none; box-shadow: 0 0 0 6px rgba(239,68,68,.25); animation: blink 1.2s infinite; }
.ss-rectext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ss-rectext b { font-size: 17px; }
.ss-rectext span { font-size: 14px; color: #BFE0F5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-timer { display: flex; flex-direction: column; align-items: flex-end; }
.ss-timer .mono { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ss-timer small { font-size: 13px; color: #BFE0F5; }
.ss-stop { background: #fff; color: #062A47; border-color: #fff; min-width: 110px; }
.ss-stop:hover:not(:disabled) { background: #E8F2FA; color: #062A47; }
.ss-progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.ss-progress > div { height: 100%; background: linear-gradient(90deg, #7CC3EE, #F29CC8); transition: width .3s linear; }
.ss-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ss-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: rgba(255,255,255,.12); color: #fff; }
.ss-chip.warn, .ss-chip.fix { background: #FDE68A; color: #78350F; }
.ss-keep { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #BFE0F5; }
.banners { display: flex; flex-direction: column; }
.banner { display: flex; align-items: center; gap: 14px; padding: 11px 28px; font-size: 14px; line-height: 1.4; border-bottom: 1px solid var(--line); background: var(--brand-soft); color: var(--brand-ink); animation: fade .2s; }
.banner.warn { background: var(--warn-soft); color: var(--warn-ink); }
.banner.fix { background: var(--fix-soft); color: var(--fix-ink); box-shadow: inset 5px 0 0 var(--fix); }
.banner.good { background: var(--good-soft); color: var(--good-ink); }
.banner-ic { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, currentColor 13%, transparent); }
.banner-text { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.banner-text b { font-size: 15px; }
.banner-progress { flex: 0 0 160px; height: 8px; border-radius: 4px; background: color-mix(in srgb, currentColor 18%, transparent); overflow: hidden; }
.banner-progress > div { height: 100%; background: currentColor; transition: width .3s; }
.banner-x { flex: none; width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.banner-x:hover { background: color-mix(in srgb, currentColor 12%, transparent); }

/* ---------- Bell ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; width: 42px; min-height: 42px; padding: 0; border: 1px solid var(--line); background: var(--surface); }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: #EF4444; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; pointer-events: none; border: 2px solid var(--surface); }
.bell-count.warn { background: var(--warn); }
.bell-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 400px; max-height: 72vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 15px; position: sticky; top: 0; z-index: 1; background: var(--surface); }
.bell-new { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.bell-list { padding: 6px; }
.bell-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bell-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 11px 10px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.bell-item + .bell-item { margin-top: 2px; }
.bell-item:hover { background: var(--surface-2); }
.bell-item.link { cursor: pointer; }
.bell-item.unread { background: var(--brand-soft); }
.bell-item.unread::before { content: ''; position: absolute; left: 3px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--brand); }
.bell-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.bell-item.saved .bell-ic, .bell-item.synced .bell-ic { background: var(--good-soft); color: var(--good); }
.bell-item.failed .bell-ic { background: color-mix(in srgb, var(--fix) 14%, transparent); color: var(--fix); }
.bell-item.waiting .bell-ic, .bell-item.recovered .bell-ic { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.bell-item.feedback .bell-ic { background: var(--info-soft); color: var(--info); }
.bell-text { flex: 1; min-width: 0; }
.bell-title { display: block; font-size: 14px; }
.bell-body { color: var(--ink-2); font-size: 13.5px; overflow-wrap: anywhere; }
.bell-hint { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.bell-time { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; margin-top: 2px; }
.bell-panel { width: 420px; display: flex; flex-direction: column; overflow: hidden; }
.bell-panel .bell-list { overflow-y: auto; flex: 1; min-height: 0; }
.bell-head { justify-content: flex-start; }
.bell-head-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.bell-tabs { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bell-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.bell-tabs button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.bell-tab-n { min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; background: var(--surface-3); color: var(--ink-2); text-align: center; }
.bell-tabs button.on .bell-tab-n { background: rgba(255,255,255,.25); color: #fff; }
.bell-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bell-go { color: var(--faint); opacity: 0; transition: opacity .15s, transform .15s; }
.bell-item.link:hover .bell-go, .bell-item.link:focus-visible .bell-go { opacity: 1; transform: translateX(2px); color: var(--brand); }
.bell-item.link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.bell-foot { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-top: 1px solid var(--line); font-size: 13.5px; font-weight: 700; color: var(--brand); text-decoration: none; background: var(--surface-2); }
.bell-foot:hover { background: var(--brand-soft); }
.bell-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; }
.bell-empty-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); margin-bottom: 4px; }

/* ---------- Live plot (Record / Live view) ---------- */
.plot-page { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.plot-toolbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.plot-toolbar .grp { display: flex; align-items: center; gap: 10px; padding-right: 14px; border-right: 1px solid var(--line); }
.plot-toolbar .grp:last-child { border-right: 0; }
.plot-toolbar .grp-title { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.plot-body { flex: 1; min-height: 0; display: flex; flex-direction: column-reverse; }
.plot-area { position: relative; flex: 1; min-height: 220px; background: var(--plot-bg); }
.plot-area canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.plot-badge { position: absolute; left: 74px; bottom: 50px; display: flex; gap: 8px; z-index: 2; }
/* Metric cards above the waves */
.stats-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.sp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sp-title { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.sp-k { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.sp-num { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-num small { font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.sp-metric { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sp-hero .sp-k { color: #E05252; }
.sp-hero .sp-num.big { font-size: 30px; line-height: 1; }
.sp-hero .sp-num.big small { font-size: 13px; }
.sp-q { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; line-height: 1.35; font-weight: 700; color: var(--collect); background: color-mix(in srgb, currentColor 11%, transparent); max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.sp-rates .sp-num { font-size: 13.5px; }
.stats-panel.sp-off .sp-num { color: var(--line-2); }
.q-good { color: var(--good-ink) !important; }
.q-warn { color: var(--warn-ink) !important; }
.q-fix { color: var(--fix-ink) !important; }
.q-collect { color: var(--collect) !important; }

/* Connection card (record / live side panel) */
.conn-status { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-top: 10px; }
.conn-status .dot { color: var(--line-2); }
.conn-status.on .dot { color: var(--good); }
.sync-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; background: var(--surface-2); }
.sync-box.online { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.sync-box.offline { border-color: color-mix(in srgb, var(--fix) 40%, var(--line)); }
.sync-box b { font-size: 14px; }

/* ---------- Record flow ---------- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.big-action { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; min-height: 74px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; width: 100%; transition: border-color .15s, box-shadow .15s, transform .1s; }
.big-action:hover { border-color: var(--brand); box-shadow: 0 8px 20px -14px var(--brand); transform: translateY(-1px); }
.big-action .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.big-action .ic svg { width: 21px; height: 21px; }
.big-action b { display: block; font-size: 15.5px; }
.big-action span { font-size: 13px; color: var(--muted); }
.big-action.recording { border-color: var(--rec); background: var(--rec); color: #fff; }
.big-action.recording span { color: #BFE0F5; }
.big-action.recording .ic { background: #EF4444; color: #fff; animation: blink 1.2s infinite; }
.session-head { display: flex; flex-direction: column; gap: 12px; }
.patient-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--brand-2) 7%, var(--surface))); border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent); }
.patient-card.big { padding: 18px; }
.pc-avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 16px; }
.pc-avatar.alt { background: var(--surface-3); color: var(--ink-2); }
.pc-text { display: flex; flex-direction: column; min-width: 0; }
.pc-label { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); }
.pc-name { font-size: 19px; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.pc-meta { font-size: 14px; color: var(--ink-2); }
.iter-head { display: flex; align-items: center; gap: 8px; }
.iter-head h3 { flex: 1; margin: 0; font-size: 16px; text-align: center; font-weight: 800; }
.steps { display: flex; gap: 4px; }
.steps i { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); }
.steps i.done { background: var(--good); }
.steps i.cur { background: var(--brand); }
.steps-list { display: flex; flex-direction: column; gap: 12px; }
.step { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 14px 16px; transition: border-color .15s, opacity .15s, box-shadow .15s; }
.step-head { display: flex; gap: 12px; align-items: flex-start; }
.step-head h4 { margin: 3px 0 0; font-size: 16px; font-weight: 800; }
.step-hint { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.step-n { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14.5px; background: var(--surface-3); color: var(--ink-2); }
.step-body { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.step[data-state="current"] { border: 2px solid var(--brand); box-shadow: 0 10px 24px -18px var(--brand); }
.step[data-state="current"] .step-n { background: var(--grad); color: #fff; }
.step[data-state="done"] { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.step[data-state="done"] .step-n { background: var(--good); color: #fff; }
.step[data-state="todo"] { opacity: .62; }
.step.nudge { animation: nudge 1.4s ease-out 2; }
/* Signal passed: the Record step keeps glowing and its Start button pulses until recording starts. */
.step.ready { position: relative; background: color-mix(in srgb, var(--brand) 6%, var(--surface)); animation: readyGlow 1.6s ease-in-out infinite; }
.step.ready::after { content: "▶"; position: absolute; top: -10px; right: 14px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; background: var(--grad); box-shadow: 0 4px 10px -4px var(--brand); }
.step.ready .btn.primary { animation: btnPulse 1.6s ease-in-out infinite; }
@keyframes readyGlow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 40%, transparent); } 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand) 12%, transparent); } }
@keyframes btnPulse { 0%, 100% { transform: scale(1); filter: none; } 50% { transform: scale(1.025); filter: brightness(1.12); } }
@media (prefers-reduced-motion: reduce) { .step.ready, .step.ready .btn.primary { animation: none; } }
@keyframes nudge { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.progress { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--grad); transition: width .25s linear; }
.sqi-text:empty { display: none; }
.sqi-text { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-3); font-size: 14.5px; font-weight: 600; line-height: 1.4; white-space: pre-line; }
.sqi-text::before { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; content: "…"; background: var(--collect); }
.sqi-text.q-good { background: var(--good-soft); }
.sqi-text.q-good::before { content: "✓"; background: var(--good); }
.sqi-text.q-warn { background: var(--warn-soft); }
.sqi-text.q-warn::before { content: "!"; background: var(--warn); }
.sqi-text.q-fix { background: var(--fix-soft); }
.sqi-text.q-fix::before { content: "✕"; background: var(--fix); }
.timeline { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.tl-item { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 13.5px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.tl-item .id { font-family: var(--mono); font-weight: 700; color: var(--brand); }
.tl-item.gt .id { color: var(--teal); }
.tl-item input { min-height: 36px; font-size: 14px; }
.patient-list button { display: flex; align-items: center; gap: 14px; }
.patient-list .pc-avatar { width: 40px; height: 40px; font-size: 14px; }
.pl-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl-main b { font-size: 15.5px; }
.pl-main .muted { font-size: 13px; }
.pl-progress { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 104px; }
.pl-progress .pill { white-space: nowrap; }
.pl-bar { width: 96px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.pl-bar i { display: block; height: 100%; background: var(--grad); border-radius: inherit; }

/* ---------- My recordings (grouped by patient) ---------- */
.rec-group { overflow: hidden; }
.rg-bar { display: flex; align-items: center; gap: 8px; padding-right: 12px; }
.rg-head { flex: 1; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 0; background: transparent; text-align: left; cursor: pointer; min-height: 70px; color: var(--ink); }
.rg-head:hover { background: var(--surface-2); }
.rg-title { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rg-title b { font-size: 16px; }
.rg-title .muted { font-size: 13.5px; }
.rg-table { border-top: 1px solid var(--line); }
.chev { width: 14px; display: inline-block; color: var(--muted); font-size: 10px; }

/* ---------- Analysis / editor ---------- */
.analysis-layout { flex: 1; min-height: 0; display: flex; gap: 0; }
.analysis-side { width: 320px; flex: none; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); }
.analysis-layout > :not(.analysis-side) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tree { display: flex; flex-direction: column; gap: 2px; }
.tree-group > button, .tree-leaf { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; padding: 10px; border-radius: 9px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.tree-group > button { font-weight: 700; }
.tree-group > button:hover, .tree-leaf:hover { background: var(--surface-3); }
.tree-leaf { padding-left: 28px; color: var(--ink-2); }
.tree-leaf.sel { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.tree-leaf .hint { margin-left: auto; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.scrollbar-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.scrollbar-row input[type=range] { flex: 1; accent-color: var(--brand); }
.ed-table td, .ed-table th { padding: 9px 12px; }
.ed-date td { background: var(--surface-3); font-weight: 800; cursor: pointer; }
.ed-subj td { background: var(--surface-2); font-weight: 700; cursor: pointer; }
.ed-subj td:first-child { padding-left: 32px; }
.ed-iter.missing td { background: var(--warn-soft); }
.ed-iter input { width: 110px; min-height: 40px; }
.ed-iter input.dirty { border-color: var(--brand); background: var(--brand-soft); }

/* ---------- Admin overview ---------- */
.welcome { border-radius: 18px; padding: 22px 26px; color: #fff; position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: radial-gradient(600px 200px at 100% 0%, rgba(236, 72, 153, .4), transparent 60%), linear-gradient(120deg, #0670B0, #1A8FD0 60%, #1A8FD0);
  box-shadow: 0 16px 40px -22px rgba(6, 112, 176, .7); }
.welcome h2 { margin: 0; font-size: 22px; }
.welcome p { margin: 4px 0 0; color: #E0E7FF; font-size: 14.5px; }
.welcome .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; }
.welcome .btn:hover:not(:disabled) { background: rgba(255,255,255,.26); color: #fff; }
.welcome svg.deco { position: absolute; right: 0; bottom: -6px; width: 420px; opacity: .22; pointer-events: none; }
.welcome .updated-ago { color: #E0E7FF; }
.chart-bars { width: 100%; height: 220px; display: block; }
.chart-bars .bar { transition: height .6s cubic-bezier(.2,.8,.2,1), y .6s cubic-bezier(.2,.8,.2,1); }
.chart-bars .bar:hover { filter: brightness(1.08); }

/* ---------- Modal / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(8, 12, 24, .5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; animation: fade .15s; padding: 16px; }
.modal { width: min(540px, 100%); max-height: calc(var(--app-h, 100vh) - 32px); overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s; }
.modal.wide { width: min(780px, 100%); }
.modal-head { padding: 20px 22px 6px; }
.modal-head h3 { margin: 0; font-size: 20px; font-weight: 800; }
.modal-body { padding: 10px 22px 18px; white-space: pre-line; font-size: 15px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 18px 18px; }
.pick-list { border: 1px solid var(--line); border-radius: 12px; max-height: 360px; overflow: auto; }
.pick-list button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 14px 16px; cursor: pointer; font-size: 15px; white-space: normal; color: var(--ink); }
.pick-list button:last-child { border-bottom: 0; }
.pick-list button:hover { background: var(--surface-2); }
.pick-list button.sel { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.bp-result { text-align: center; padding: 10px 0 4px; font-size: 18px; font-weight: 700; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 280px; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--brand); border-radius: 12px; padding: 13px 16px; box-shadow: var(--shadow-lg); animation: pop .2s; font-size: 14px; }
.toast b { display: block; margin-bottom: 2px; }
.toast.success { border-left-color: var(--good); }
.toast.error { border-left-color: var(--fix); }
.toast.warning { border-left-color: var(--warn); }

/* ---------- Login / sign-up ---------- */
.login { min-height: var(--app-h, 100vh); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
/* Light, airy panel in the logo colours (blue #0670B0, pink #CE3785). */
.login-side { position: sticky; top: 0; height: var(--app-h, 100vh); overflow: hidden; color: #0A2F4F; padding: 40px 56px 32px; display: flex; flex-direction: column; gap: 26px;
  background: radial-gradient(800px 460px at 105% -5%, rgba(206, 55, 133, .13), transparent 60%), radial-gradient(760px 460px at -5% 105%, rgba(6, 112, 176, .14), transparent 60%), linear-gradient(160deg, #F4F9FD 0%, #EAF3FA 55%, #F8F2F6 100%);
  border-right: 1px solid #DCE8F1; }
.login-side::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image: radial-gradient(rgba(6,112,176,.13) 1px, transparent 1.2px); background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at 30% 45%, #000 15%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 30% 45%, #000 15%, transparent 70%); }
.login-side > * { position: relative; }
.lg-orb { position: absolute !important; border-radius: 50%; filter: blur(70px); pointer-events: none; opacity: .28; animation: orb 14s ease-in-out infinite alternate; }
.lg-orb.o1 { width: 320px; height: 320px; background: #CE3785; right: -100px; top: 16%; }
.lg-orb.o2 { width: 280px; height: 280px; background: #0670B0; left: -80px; bottom: 6%; animation-delay: -6s; }
@keyframes orb { to { transform: translate(-30px, 40px) scale(1.12); } }
.brandmark { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; font-weight: 800; font-size: 20px; }
.brandmark .logo { width: 44px; height: 44px; }
/* Product name under the logo: large and clear on the sign-in pages. */
.brand-name { display: flex; flex-direction: column; gap: 4px; line-height: 1.15; }
.brand-name b { font-size: 28px; font-weight: 800; letter-spacing: .06em; color: #0A2F4F; }
.brand-name small { font-size: 16px; font-weight: 600; color: #44576C; letter-spacing: .01em; }
.brand-text b { letter-spacing: .03em; }
.lg-copy { margin-top: auto; display: flex; flex-direction: column; gap: 14px; max-width: 540px; }
.login-side h1 { margin: 0; font-size: clamp(32px, 3.2vw, 46px); line-height: 1.08; letter-spacing: -.025em; color: #0A2F4F;
  background: linear-gradient(90deg, #0A2F4F 25%, #0670B0 60%, #CE3785); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login-side p { margin: 0; font-size: 17px; line-height: 1.6; color: #44576C; max-width: 480px; }
.hero-card { max-width: 540px; border-radius: 20px; padding: 14px 16px 6px; background: rgba(255,255,255,.8); border: 1px solid #DCE8F1; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 24px 50px -30px rgba(6,60,100,.35); }
.hv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hv-live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #0A2F4F; }
.hv-live .dot { color: #CE3785; }
.hv-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #33475C; background: #EEF5FA; }
.hv-dot { width: 7px; height: 7px; border-radius: 50%; background: #CE3785; }
.hv-dot.o { background: #16A34A; }
.hv-dot.c { background: #0670B0; }
.hero-wave { height: 104px; overflow: hidden; margin: 4px -16px 0; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.hero-wave svg { width: 200%; height: 100%; display: block; }
.hw-move { animation: hw 6s linear infinite; }
@keyframes hw { to { transform: translateX(-600px); } }
.lg-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 540px; }
.lg-points li { display: flex; gap: 12px; align-items: center; font-size: 15.5px; color: #33475C; }
.lg-feat-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0670B0, #CE3785); border: 0; box-shadow: 0 6px 14px -8px rgba(6,112,176,.6); }
.lg-trust { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: #0670B0; font-weight: 600; }
.lg-trust span { display: inline-flex; align-items: center; gap: 6px; }
.lg-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: #5A6B80; border-top: 1px solid #DCE8F1; padding-top: 16px; }
.login-form { display: flex; flex-direction: column; min-height: var(--app-h, 100vh); padding: 20px 32px; background: radial-gradient(700px 360px at 100% 0%, rgba(6, 112, 176, .07), transparent 60%), var(--bg); }
.lg-topbar { display: flex; align-items: center; gap: 12px; }
.lg-lang { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); }
.lg-lang select.input { border: 0; background: transparent; min-height: 38px; padding-left: 2px; font-weight: 700; box-shadow: none; }
.lg-center { flex: 1; display: grid; place-items: center; padding: 24px 0; }
.lg-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; padding: 30px 32px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 50px 100px -50px rgba(49, 46, 129, .45), 0 2px 6px rgba(15, 23, 42, .04); animation: lgIn .35s ease-out; }
.lg-card.wide { width: min(600px, 100%); }
@keyframes lgIn { from { opacity: 0; transform: translateY(8px); } }
.lg-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.lg-tabs:empty { display: none; }
.lg-tabs a { text-align: center; padding: 10px 8px; border-radius: 10px; font-weight: 700; font-size: 14.5px; color: var(--muted); text-decoration: none; transition: background .15s, color .15s; }
.lg-tabs a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.1), 0 0 0 1px var(--line); }
.lg-head h2 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.02em; }
.lg-head .muted { font-size: 15px; }
.lg-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lg-link { border: 0; background: transparent; padding: 0; color: var(--brand); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.lg-link:hover { text-decoration: underline; }
.lg-input { position: relative; display: flex; align-items: center; }
.lg-input > svg { position: absolute; left: 14px; color: var(--faint); pointer-events: none; transition: color .15s; }
.lg-input:focus-within > svg { color: var(--brand); }
.lg-input .input { min-height: 52px; padding-left: 44px; font-size: 16px; border-radius: 12px; }
.lg-eye { position: absolute; right: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; }
.lg-eye:hover, .lg-eye.on { color: var(--brand); background: var(--brand-soft); }
.lg-submit { min-height: 54px; border-radius: 12px; font-size: 16.5px; gap: 8px; background: var(--grad); border: 0; box-shadow: 0 12px 24px -12px rgba(6, 112, 176, .7); }
.lg-submit:hover:not(:disabled) { filter: brightness(1.06); }
.lg-submit.busy { opacity: .75; cursor: progress; }
.lg-secure { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12.5px; color: var(--faint); }
.lg-pane-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; font-size: 12.5px; color: var(--faint); }
.lg-legal { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.lg-legal a { color: var(--muted); text-decoration: none; }
.lg-legal a:hover { color: var(--brand); text-decoration: underline; }
.mobile-brand { display: none; }
.mobile-brand .brand-name small { color: var(--muted); }
.su-stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; counter-reset: s; }
.su-stepper li { display: flex; align-items: center; gap: 8px; min-width: 0; padding-top: 10px; border-top: 3px solid var(--line); color: var(--faint); font-size: 13px; font-weight: 700; transition: border-color .2s, color .2s; }
.su-stepper li.on { border-color: var(--brand); color: var(--ink); }
.su-stepper li.done { border-color: var(--good); color: var(--muted); }
.su-num { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.su-stepper li.on .su-num { background: var(--grad); border-color: transparent; color: #fff; }
.su-stepper li.done .su-num { background: var(--good); border-color: transparent; color: #fff; }
.su-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-host { display: flex; flex-direction: column; gap: 14px; animation: lgIn .25s ease-out; }
.su-step { display: flex; flex-direction: column; gap: 14px; }
.su-step .seg { width: 100%; flex-wrap: nowrap; }
.su-step .seg button { flex: 1; min-height: 44px; }
.req { color: var(--fix); }
.agree-box { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.45; cursor: pointer; }
.agree input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--brand); }
.agree a { font-weight: 700; text-decoration: underline; }
.agree.all { padding: 14px 16px; background: var(--brand-soft); }
.agree-list { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.lg-actions { display: flex; gap: 10px; align-items: center; }
.lg-back { min-height: 54px; border-radius: 12px; }
@media (max-width: 1100px) { .login-side { padding: 32px 36px 24px; } .lg-points { display: none; } }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .mobile-brand { display: flex; color: var(--ink); }
  .login-form { padding: 14px 16px; }
  .lg-card { padding: 22px 18px; border-radius: 20px; }
}
@media (max-width: 640px) { .lg-card.wide .grid2 { grid-template-columns: 1fr; } .su-label { display: none; } .su-stepper li { justify-content: center; } }

/* ---------- Unsupported-browser warning ---------- */
.browser-warning { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 300; width: min(720px, calc(100% - 32px)); display: flex; gap: 14px; align-items: flex-start;
  background: #FFF7ED; color: #7C2D12; border: 1px solid #FDBA74; border-left: 5px solid #F97316; border-radius: 14px; padding: 14px 16px; box-shadow: 0 18px 40px -16px rgba(124, 45, 18, .45); font-size: 14px; line-height: 1.5; animation: pop .25s; }
.browser-warning svg { width: 22px; height: 22px; flex: none; color: #EA580C; margin-top: 1px; }
.browser-warning b { display: block; font-size: 15px; margin-bottom: 2px; color: #9A3412; }
.browser-warning .bw-close { margin-left: auto; border: 0; background: transparent; color: #9A3412; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.bw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bw-actions .btn { background: #fff; border-color: #FDBA74; color: #9A3412; }
.bw-actions .btn.bw-chrome { background: #EA580C; border-color: #EA580C; color: #fff; }

/* ---------- Narrower screens ---------- */
.mobile-only { display: none !important; }
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-side { width: 360px; }
}
@media (max-width: 1100px) {
  .nav { width: 84px; padding: 16px 8px; }
  .nav .brand-text, .nav .nav-section, .nav .device-card, .nav .who, .nav .nav-label { display: none; }
  .nav .brand { justify-content: center; padding: 4px 0 14px; }
  .nav-item { justify-content: center; padding: 0; min-height: 48px; }
  .nav-badge { position: absolute; top: 2px; right: 6px; }
  .user-card { flex-direction: column; }
  .topbar .search { display: none; }
}
@media (max-width: 860px) {
  :root { --nav-h: 64px; }
  html, body { height: auto; }
  .mobile-only { display: inline-flex !important; }
  .app { flex-direction: column; height: auto; min-height: var(--app-h, 100vh); overflow: visible; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
  .main { height: auto; overflow: visible; }
  .content { overflow: visible; padding: 16px; }
  /* Menu becomes a bottom tab bar */
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; width: auto; height: auto; flex-direction: row; overflow-x: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 2px; border-right: 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -16px rgba(15, 23, 42, .4); }
  .nav .brand, .nav .nav-bottom { display: none; }
  .nav .nav-label { display: block; font-size: 11px; }
  .nav-item { flex: none; flex-direction: column; gap: 3px; min-width: 70px; min-height: 52px; padding: 4px 6px; font-size: 11px; }
  .nav-badge { position: absolute; top: 0; right: 10px; min-width: 18px; height: 18px; font-size: 11px; }
  .topbar { min-height: 56px; padding: 8px 12px; gap: 6px; position: sticky; top: 0; }
  .topbar .saved-pill, .topbar select.input { display: none; }
  .crumbs { overflow: hidden; }
  .workspace { flex-direction: column; overflow: visible; padding: 12px; }
  .ws-main { min-height: 56vh; }
  .ws-side { width: auto; overflow: visible; }
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi-ic { width: 36px; height: 36px; }
  .kpi-value { font-size: 22px; }
  .greet h1 { font-size: 24px; }
  .greet .btn { flex: 1 1 auto; }
  .att-row { flex-wrap: wrap; padding: 12px 16px 12px 20px; }
  .status-strip.rec { padding: 10px 12px; }
  .ss-rec { flex-wrap: wrap; }
  .ss-stop { flex: 1 0 100%; }
  .ss-keep { display: none; }
  .banner { padding: 10px 12px; flex-wrap: wrap; }
  .banner-progress { flex: 1 0 100%; }
  .plot-toolbar { flex-wrap: nowrap; overflow-x: auto; gap: 10px; padding: 8px 12px; }
  .plot-toolbar .grp { flex: none; }
  .stats-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; gap: 8px; }
  .sp-rates { display: none; }
  .plot-area { min-height: 260px; }
  .analysis-layout { flex-direction: column; }
  .analysis-side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .btn { min-height: 48px; }
  .btn.sm { min-height: 40px; }
  .input, select.input { min-height: 48px; font-size: 16px; }
  .grid3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .modal-back { align-items: end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 90vh; border-radius: 20px 20px 0 0; }
  .modal-foot { position: sticky; bottom: 0; border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .toasts { left: 12px; right: 12px; top: 12px; }
  .toast { min-width: 0; max-width: none; }
  .bell-panel { position: fixed; left: 8px; right: 8px; top: 60px; width: auto; }
  .rg-head .pill { display: none; }
}

/* ---------- V2 workspace: metrics, plot card, device card ---------- */
.btn.dark { background: #0F172A; border-color: #0F172A; color: #fff; }
.btn.dark:hover:not(:disabled) { background: #1E293B; color: #fff; }
.title-ic { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.plot-page { background: transparent; border: 0; box-shadow: none; gap: 14px; overflow: visible; }
.metrics { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.2fr; gap: 12px; flex: none; }
.mc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; box-shadow: var(--shadow-sm); }
.mc.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.mc.fix { background: var(--fix-soft); border-color: color-mix(in srgb, var(--fix) 30%, transparent); }
.mc-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.mc.warn .mc-label { color: var(--warn-ink); }
.mc.fix .mc-label { color: var(--fix-ink); }
.mc-hr .mc-label svg { color: #E05252; }
.mc-hr-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.mc-big { font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.mc-hr small { font-size: 13px; color: var(--muted); font-weight: 600; }
.mc-spark { width: 110px; height: 34px; flex: none; }
.mc-q { display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 800; color: var(--muted); min-width: 0; }
.mc-q { align-items: flex-start; line-height: 1.3; }
.mc-q span { white-space: normal; overflow-wrap: anywhere; }
.mc-q svg { flex: none; margin-top: 2px; }
.mc-q.good { color: var(--good-ink); }
.mc-q.warn { color: var(--warn-ink); }
.mc-q.fix { color: var(--fix-ink); }
.mc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mc-grid small { display: block; font-size: 11px; color: var(--faint); font-weight: 700; }
.mc-grid b { font-size: 13px; white-space: nowrap; }
.plot-card { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.plot-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.plot-title { display: flex; align-items: center; gap: 8px; color: var(--ink); margin-right: 4px; }
.plot-title svg { color: var(--brand); }
.plot-title b { font-size: 15.5px; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-chip { --c: #0670B0; flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.ch-chip .ch-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: .35; }
.ch-chip.on { border-color: color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 10%, var(--surface)); color: var(--ink); }
.ch-chip.on .ch-dot { opacity: 1; }
.ch-more { border: 0; background: transparent; color: var(--brand); font-weight: 700; font-size: 13px; cursor: pointer; min-height: 32px; padding: 0 6px; }
.mini-select { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); }
.mini-select select { border: 0; background: transparent; font-weight: 700; font-size: 13.5px; color: var(--ink); outline: none; min-width: 0; }
.mini-select.full { flex: 1; height: 44px; min-width: 0; }
.mini-select.full select { flex: 1; width: 100%; }
.plot-card .plot-area { flex: 1; min-height: 260px; }
.plot-card .seg button { min-height: 30px; }
.rec-ring { display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 3px; border-radius: 999px; background: var(--brand-soft); }
.rec-ring-text { display: flex; flex-direction: column; line-height: 1.05; margin-right: 4px; }
.rec-ring-text b { font-size: 16px; }
.rec-ring-text small { font-size: 11px; color: var(--muted); font-weight: 700; }
.ring-arc { transition: stroke-dashoffset .3s linear; }
.dev-card .card-title, .ctl-card .card-title { border-bottom: 1px solid var(--line); }
.dev-body, .ctl-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.dev-port { display: flex; gap: 8px; align-items: center; }
.dev-sync { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 11px; font-size: 13.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); }
.dev-sync.good { color: var(--good-ink); background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.dev-sync.fix { color: var(--fix-ink); background: var(--fix-soft); border-color: color-mix(in srgb, var(--fix) 25%, transparent); }
.ctl-card > summary { list-style: none; cursor: pointer; }
.ctl-card > summary::-webkit-details-marker { display: none; }
.sum-chev { display: inline-grid; color: var(--muted); transition: transform .15s; }
.ctl-card[open] .sum-chev { transform: rotate(90deg); }
@media (max-width: 1280px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .plot-head { flex-wrap: nowrap; overflow-x: auto; } .ch-chips { flex-wrap: nowrap; } .metrics { gap: 8px; } .mc { padding: 10px 12px; } .mc-big { font-size: 24px; } }
.table .row-actions { position: sticky; right: 0; text-align: right; white-space: nowrap; background: var(--surface); box-shadow: -8px 0 12px -10px rgba(15,23,42,.25); }
.table thead .row-actions { background: var(--surface-2); }
.table tr.click:hover .row-actions { background: var(--surface-2); }
/* Phones: logo, name and slogan stacked; sizes scaled to fit, slogan kept. */
.mobile-brand { gap: 8px; }
.mobile-brand .brand-name b { font-size: 21px; }
.mobile-brand .brand-name small { font-size: 13.5px; }
.lg-topbar { flex-wrap: wrap; }
.lg-topbar > .lg-lang { margin-left: auto; order: 1; }
.lg-topbar > .mobile-brand { order: 2; width: 100%; align-items: center; text-align: center; margin-top: 6px; }
.lg-topbar > .mobile-brand .brand-name { align-items: center; }
@media (max-width: 480px) { .mobile-brand .logo-long img { height: 34px; } .mobile-brand .brand-name b { font-size: 19px; } .mobile-brand .brand-name small { font-size: 12.5px; } .lg-lang { padding-left: 10px; } }

/* ---------- V2 page parts: toolbar card, cuff BP editor ---------- */
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.toolbar-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.toolbar-card .input[type=search] { max-width: 300px; }
.sum-chev.open { transform: rotate(90deg); }
.ed-day { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 4px 2px; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.ed-day b { color: var(--ink); }
.ed-group { display: flex; flex-direction: column; gap: 10px; }
.ed-cards { display: flex; flex-direction: column; gap: 10px; }
.ed-card { overflow: hidden; }
.ed-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
.ed-head:hover { background: var(--surface-2); }
.ed-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ed-who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-prog { display: flex; align-items: center; gap: 8px; width: 160px; flex: none; }
.ed-bar { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.ed-bar span { display: block; height: 100%; border-radius: inherit; background: var(--grad); }
.ed-rows { border-top: 1px solid var(--line); }
.ed-row { display: grid; grid-template-columns: 70px 110px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.ed-row:last-child { border-bottom: 0; }
.ed-row.missing { background: color-mix(in srgb, var(--warn-soft) 60%, transparent); }
.ed-th { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding-top: 8px; padding-bottom: 8px; }
.ed-num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--brand-soft); color: var(--brand); }
.bp-pair { display: flex; align-items: center; gap: 8px; }
.bp-in { width: 84px; min-height: 40px; text-align: center; font-weight: 700; font-size: 16px; }
.bp-in.dirty { border-color: var(--brand); background: var(--brand-soft); }
@media (max-width: 860px) {
  .kpis.k3 { grid-template-columns: 1fr; }
  .ed-prog { display: none; }
  .ed-row { grid-template-columns: 40px minmax(0, 1fr); }
  .ed-th { display: none; }
  .ed-row > .pill { grid-column: 2; justify-self: start; }
  .ed-row > .mono { display: none; }
}

/* ---------- V2 analysis ---------- */
.analysis-layout { padding: 20px 28px 24px; gap: 16px; }
.analysis-layout.embedded { padding: 0; height: 660px; }
.analysis-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; overflow: hidden; }
.an-side { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.an-search { padding: 12px 14px 4px; }
.an-side .tree { flex: 1; overflow-y: auto; padding: 8px 10px; gap: 4px; }
.an-side-foot { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.tree-group > button { gap: 10px; padding: 8px 10px; }
.tree-group.open > button { background: var(--surface-2); }
.tree-group .pc-avatar { width: 32px; height: 32px; font-size: 12px; }
.tree-leaves { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 6px 20px; margin-left: 16px; border-left: 2px solid var(--line); }
.tree-leaf { padding: 8px 10px; gap: 8px; }
.tree-leaf > svg { color: var(--faint); flex: none; }
.tree-leaf.sel > svg { color: var(--brand); }
.leaf-tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.leaf-tag.p { background: #FDECEC; color: #B42318; }
.leaf-tag.o { background: var(--good-soft); color: var(--good-ink); }
.an-view { min-height: 0; }
.an-view .plot-head .grp { display: flex; align-items: center; gap: 8px; }
.an-view .plot-area { flex: 1; min-height: 320px; }
.scrollbar-row > svg { color: var(--muted); flex: none; }
@media (max-width: 860px) { .analysis-layout { padding: 12px; } .analysis-side { max-height: 45vh; border-bottom: 1px solid var(--line); } }

/* ---------- V2 admin: profile, tabs, live monitor ---------- */
.kpis.auto { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; color: var(--muted); text-decoration: none; align-self: flex-start; }
.back-link:hover { color: var(--brand); }
.profile-card { overflow: hidden; }
.profile-band { height: 72px; background: radial-gradient(400px 120px at 90% 0%, rgba(240,171,252,.5), transparent 70%), var(--grad); }
.profile-body { display: flex; gap: 18px; align-items: flex-start; padding: 0 22px 20px; flex-wrap: wrap; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; margin-top: -36px; border: 4px solid var(--surface); box-shadow: var(--shadow); flex: none; }
.profile-main { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; min-width: 260px; }
.profile-main h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.profile-actions { padding-top: 14px; }
.info-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.info-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.info-chip svg { color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 11px 14px; font: inherit; font-weight: 700; font-size: 14.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.pill.info { background: var(--info-soft); color: var(--info); }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.lm-card { display: flex; flex-direction: column; overflow: hidden; }
.lm-card.recording { border-color: color-mix(in srgb, #E05252 40%, var(--line)); box-shadow: 0 0 0 3px rgba(224,82,82,.08), var(--shadow-sm); }
.lm-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.lm-head b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-head .grow { min-width: 0; }
.lm-head .grow .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-head > .badge { flex: none; }
.lm-alert { display: flex; align-items: flex-start; gap: 8px; margin: 10px 16px 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; line-height: 1.35; background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.lm-alert svg { flex: none; margin-top: 1px; }
.lm-q b { display: block; overflow-wrap: anywhere; line-height: 1.3; }
.lm-foot { flex-wrap: wrap; }
/* Cards never let text run outside: values, pills and hints wrap. */
.kpi-body { min-width: 0; }
.kpi-value, .kpi-sub, .kpi-label { overflow-wrap: anywhere; }
.card .badge:not(.table .badge), .card .pill:not(.table .pill) { white-space: normal; height: auto; padding-top: 3px; padding-bottom: 3px; line-height: 1.3; max-width: 100%; }
.card.pad > .p-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.badge.rec { background: #062A47; color: #fff; }
.badge.rec .dot { color: #F87171; }
.lm-hr { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; }
.lm-hr .mc-label svg { color: #E05252; }
.lm-big { font-size: 34px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; margin-top: 4px; }
.lm-big small { font-size: 13px; color: var(--muted); font-weight: 600; }
.spark { width: 200px; height: 46px; flex: none; }
.lm-qs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 16px 12px; }
.lm-q { border-radius: 11px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line); }
.lm-q small { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.lm-q b { font-size: 14px; }
.lm-q.q-good { background: var(--good-soft); border-color: transparent; }
.lm-q.q-good b { color: var(--good-ink); }
.lm-q.q-warn { background: var(--warn-soft); border-color: var(--warn-line); }
.lm-q.q-warn b { color: var(--warn-ink); }
.lm-q.q-fix { background: var(--fix-soft); border-color: transparent; }
.lm-q.q-fix b { color: var(--fix-ink); }
.lm-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.lm-foot span { display: inline-flex; align-items: center; gap: 5px; }
.lm-foot svg { color: var(--muted); }
.lm-dev { padding: 6px 16px 10px; font-size: 11.5px; color: var(--faint); background: var(--surface-2); }

/* ---------- V2 record panels ---------- */
.ws-side .sidebar-section, .side-stack .sidebar-section { box-shadow: var(--shadow-sm); }
.panel-title { display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; }
.panel-title h2 { margin: 0; font-size: 16px; font-weight: 800; }
.stack-label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 8px 2px 0; }
.big-action { gap: 14px; }
.big-action > .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.big-action b { color: var(--ink); }
.big-action .ba-chev { color: var(--faint); display: grid; transition: transform .15s, color .15s; }
.big-action:hover .ba-chev { color: var(--brand); transform: translateX(2px); }
.stack > .big-action:nth-of-type(2) .ic { background: var(--good-soft); color: var(--good); }
.stack > .big-action:nth-of-type(3) .ic { background: #FDF4FF; color: #A21CAF; }
.stack > .big-action:nth-of-type(4) .ic { background: #FFF7ED; color: #EA580C; }
.stack > .big-action:nth-of-type(5) .ic { background: var(--info-soft); color: var(--info); }
.big-action.recording b { color: #fff; }
.big-action.recording .ba-chev { color: #fff; }
.unit-input { position: relative; display: flex; align-items: center; }
.unit-input .input { padding-right: 58px; }
.bp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.bp-grid .input.big { min-height: 64px; font-size: 30px; width: 100%; min-width: 0; padding-left: 16px; }
.bp-grid input::-webkit-outer-spin-button, .bp-grid input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bp-grid input[type=number] { -moz-appearance: textfield; }
.unit-input > span { position: absolute; right: 12px; font-size: 13px; font-weight: 700; color: var(--faint); pointer-events: none; }
.iter-head .icon-btn { flex: none; }
.steps i { height: 6px; transition: background .2s; }
.kpi-value.txt { font-size: 19px; line-height: 1.3; padding: 4px 0 2px; }
.table .pill { white-space: nowrap; width: max-content; }

/* ---------- V2 users list ---------- */
.search-box { position: relative; display: flex; align-items: center; flex: 1 1 260px; max-width: 360px; }
.search-box > svg { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search-box .input { padding-left: 36px; width: 100%; }
.toolbar-card select.level-select { width: auto; flex: none; min-width: 180px; }
.seg-count { margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; background: var(--surface-3); color: var(--muted); }
.seg button.on .seg-count { background: var(--brand-soft); color: var(--brand); }
.users-card { overflow: hidden; }
.users-card .card-title .pill { font-weight: 700; }
.table-scroll { overflow-x: auto; }
.users-table td { padding-top: 12px; padding-bottom: 12px; vertical-align: middle; }
.user-row.off { background: var(--surface-2); }
.user-row.off .user-text b, .user-row.off .avatar { opacity: .55; }
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .avatar { width: 40px; height: 40px; font-size: 14px; }
.online-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface); }
.user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-text b { font-size: 14.5px; }
.user-text .muted { font-size: 13px; }
.user-meta { font-size: 12px; color: var(--faint); font-weight: 600; }
.user-meta:empty { display: none; }
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.presence.good { color: var(--good-ink); }
.presence.brand { color: var(--brand); }
.presence.rec { color: #B42318; }
.presence.rec .dot { color: #EF4444; }
.act-cell { white-space: nowrap; }
.act-cell b { font-size: 15px; }
.act-cell .pill { margin-top: 4px; }
.login-cell { display: flex; flex-direction: column; gap: 2px; min-width: 150px; }
.dev-line { display: inline-flex; align-items: center; gap: 5px; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-line svg { flex: none; }
.users-table .row-actions { width: 56px; }
.chev-go { color: var(--faint); display: inline-grid; }
.row-menu { position: relative; display: inline-block; }
.row-menu-pop { position: fixed; z-index: 400; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; text-align: left; }
.row-menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.row-menu-pop button:hover { background: var(--surface-3); }
.row-menu-pop button svg { color: var(--muted); }
.row-menu-pop button.danger { color: var(--fix); }
.row-menu-pop button.danger svg { color: var(--fix); }
.users-table .row-actions { box-shadow: none; }
.users-table .row-actions { background: transparent; position: static; } .user-row.off td { background: var(--surface-2); }

/* ---------- Feedback ---------- */
.toast-report { margin-top: 8px; align-self: flex-start; border: 1px solid currentColor; background: transparent; color: inherit; font: inherit; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 8px; cursor: pointer; display: block; }
.modal-head .title-ic { margin-right: 4px; }
.fb-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-cat { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.fb-cat svg { color: var(--muted); }
.fb-cat.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.fb-cat.on svg { color: var(--brand); }
.fb-shot-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: var(--surface-2); }
.fb-shot-empty > svg { color: var(--brand); }
.fb-preview { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.fb-preview img { display: block; max-width: 100%; max-height: 280px; margin: 0 auto; }
.fb-preview .icon-btn { position: absolute; top: 8px; right: 8px; }
.fb-details summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--brand); }
.fb-details pre { margin: 8px 0 0; max-height: 220px; overflow: auto; font-size: 11.5px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
.fb-list { display: flex; flex-direction: column; gap: 10px; }
.fb-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.fb-row:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.fb-row.unread { border-left: 4px solid var(--brand); }
.fb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.fb-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fb-msg { font-size: 14.5px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fb-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.fb-meta span { display: inline-flex; align-items: center; gap: 5px; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-thumb { width: 120px; height: 76px; object-fit: cover; object-position: top; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.fb-catpill { background: var(--surface-3); color: var(--ink-2); }
.fb-message { font-size: 15.5px; line-height: 1.55; white-space: pre-wrap; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.fb-shot-full img { display: block; max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.fb-sub { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.fb-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.fb-fact { padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.fb-fact small { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.fb-fact b { font-size: 13.5px; word-break: break-word; }
.fb-errlist { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.fb-err { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--fix-soft); }
@media (max-width: 640px) { .fb-thumb { display: none; } }
.modal-head { display: flex; align-items: center; gap: 10px; } .modal-head h3 { margin: 0; }

/* ---------- Standard user: record start, My data, Profile ---------- */
.metrics.m3 { grid-template-columns: 1.4fr 1fr 1fr; }
.self-card .btn { margin-left: auto; flex: none; }
.self-steps { margin: 4px 0 0; padding: 14px 16px 14px 34px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--ink-2); }
.self-steps li::marker { color: var(--brand); font-weight: 800; }
.my-session { overflow: hidden; }
.my-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.my-head .rg-title { flex: 1; }
.my-rows { display: flex; flex-direction: column; }
.my-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.my-row:last-child { border-bottom: 0; }
.profile-page { display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.pf-hero .profile-actions { padding-top: 16px; }
.pf-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: stretch; }
.pf-grid > .col > .card:last-child { flex: 1; }
.pf-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 16px; }
.pf-facts.one { grid-template-columns: 1fr; }
.pf-fact { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.pf-fact small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.pf-fact b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-ic { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.pf-fact:nth-child(5n+2) .pf-ic { background: #FDF4FF; color: #A21CAF; }
.pf-fact:nth-child(5n+3) .pf-ic { background: var(--good-soft); color: var(--good); }
.pf-fact:nth-child(5n+4) .pf-ic { background: #FFF7ED; color: #EA580C; }
.pf-fact:nth-child(5n+5) .pf-ic { background: var(--info-soft); color: var(--info); }
.pf-form { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.pf-form .seg { width: 100%; }
.pf-form .seg button { flex: 1; }
@media (max-width: 960px) { .pf-grid { grid-template-columns: 1fr; } .metrics.m3 { grid-template-columns: 1fr 1fr; } .metrics.m3 .mc-hr { grid-column: 1 / -1; } }
@media (max-width: 640px) { .pf-edit .grid3, .pf-edit .grid2 { grid-template-columns: 1fr; } .my-row { grid-template-columns: 32px minmax(0, 1fr); } .my-row > :nth-child(n+3) { grid-column: 2; justify-self: start; } }
.self-form .seg { width: 100%; flex-wrap: nowrap; } .self-form .seg button { flex: 1; }
.pf-form-dlg .seg { width: 100%; } .pf-form-dlg .seg button { flex: 1; } @media (max-width: 640px) { .pf-form-dlg .grid2, .pf-form-dlg .grid3 { grid-template-columns: 1fr; } }

/* Overview: live data flow strip */
.flow-card .card-title { flex-wrap: wrap; }
.flow { display: flex; align-items: stretch; gap: 6px; padding: 4px 16px 16px; overflow-x: auto; }
.flow-step { flex: 1 1 0; min-width: 120px; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.flow-step:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--brand); color: var(--ink); }
.flow-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.flow-n { font-size: 26px; font-weight: 800; line-height: 1; font-family: var(--mono); }
.flow-label { font-size: 12.5px; font-weight: 700; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.flow-step.info .flow-ic { background: var(--info-soft); color: var(--info); }
.flow-step.good .flow-ic { background: var(--good-soft); color: var(--good); }
.flow-step.warn { background: var(--warn-soft); border-color: var(--warn-line); } .flow-step.warn .flow-ic { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn-ink); }
.flow-step.fix { background: var(--fix-soft); border-color: color-mix(in srgb, var(--fix) 30%, transparent); } .flow-step.fix .flow-ic { background: color-mix(in srgb, var(--fix) 16%, transparent); color: var(--fix); }
.flow-step.zero .flow-n { color: var(--faint); }
.flow-arrow { flex: none; align-self: center; color: var(--faint); }
@media (max-width: 860px) { .flow-arrow { display: none; } .flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Overview lists: names and reasons never run outside the card */
.att-row .grow, .tl-row .grow, .tl-row > div { min-width: 0; }
.att-row .grow b, .tl-row .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-why, .tl-row .p-meta { overflow-wrap: anywhere; }
.att-row > .badge, .tl-row > .btn, .tl-row > .p-meta { flex: none; }

/* Live monitor: level + activity */
.lm-who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; min-width: 0; }
.lm-who .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lm-activity { display: flex; gap: 10px; align-items: flex-start; margin: 10px 16px 0; padding: 9px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); }
.lm-activity svg { flex: none; margin-top: 2px; }
.lm-activity small { display: block; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; opacity: .75; }
.lm-activity b { display: block; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; color: var(--ink); }

/* All readings (admin) and My data filters */
.readings-filters { flex-direction: column; align-items: stretch; gap: 10px; }
.rf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.rf-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; min-width: 52px; }
.rf-row .seg { flex-wrap: wrap; }
.readings-table td { vertical-align: top; }
.readings-table tr.rd-child td { background: var(--surface-2, var(--surface)); }
.readings-table tr.rd-child td:first-child { padding-left: 40px; }
.my-filters { flex-wrap: wrap; gap: 8px 10px; }
.my-filters .seg { flex-wrap: wrap; }
@media (max-width: 640px) { .rf-label { min-width: 100%; } .rf-row input.input { max-width: none !important; width: 100%; } }

/* Files (superadmin) */
.fm-table tr.on td { background: var(--brand-soft); }
.fm-user { display: flex; align-items: flex-start; gap: 8px; }
.fm-chev { display: inline-flex; margin-top: 2px; color: var(--muted); transition: transform .15s; }
.fm-table tr.on .fm-chev { transform: rotate(90deg); color: var(--brand); }
.fm-detail > td { background: var(--surface-2, var(--surface)); padding: 12px 16px !important; }
.fm-size { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.fm-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.fm-bar i { display: block; height: 100%; background: var(--grad, var(--brand)); border-radius: 4px; }
.fm-groups { gap: 10px; }
.fm-group { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.fm-ghead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; }
.fm-items { border-top: 1px solid var(--line); }
.fm-item { display: grid; grid-template-columns: 80px 1fr 1fr 80px auto; gap: 10px; align-items: center; padding: 6px 12px; border-top: 1px solid var(--line); }
.fm-item:first-child { border-top: 0; }
.btn.danger-ghost { color: var(--fix, #dc2626); background: transparent; border-color: color-mix(in srgb, var(--fix, #dc2626) 35%, transparent); }
.btn.danger-ghost:hover { background: color-mix(in srgb, var(--fix, #dc2626) 8%, transparent); }
@media (max-width: 640px) { .fm-item { grid-template-columns: 1fr auto; } .fm-item > span:nth-child(2), .fm-item > span:nth-child(4) { display: none; } }

/* Login: logo on the left, name and slogan stacked on its right */
.brandmark { flex-direction: row; align-items: center; gap: 16px; }
.brandmark .brand-name { align-items: flex-start; text-align: left; padding-left: 16px; border-left: 2px solid var(--line); }
.brandmark .brand-name b, .brandmark .brand-name small { white-space: nowrap; }
@media (max-width: 1100px) { .brandmark:not(.mobile-brand) { gap: 12px; } .brandmark:not(.mobile-brand) .brand-name { padding-left: 12px; } .brandmark:not(.mobile-brand) .logo-long img { height: 36px; } .brandmark:not(.mobile-brand) .brand-name b { font-size: 19px; } .brandmark:not(.mobile-brand) .brand-name small { font-size: 12.5px; } }
@media (max-width: 480px) {
  .mobile-brand.brandmark { gap: 10px; justify-content: center; }
  .mobile-brand.brandmark .brand-name { padding-left: 10px; }
  .mobile-brand .logo-long { padding: 0; }
  .mobile-brand .logo-long img { height: 26px; }
  .mobile-brand .brand-name b { font-size: 15px; letter-spacing: .04em; }
  .mobile-brand .brand-name small { font-size: 10.5px; }
}

/* Review one recording (admin): analysis + raw data */
.rv-head { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.rv-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rv-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rv-title b { font-size: 18px; }
.rv-nav { display: inline-flex; gap: 6px; }
.rv-body .an-view { min-height: 520px; }
.rv-raw { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.rv-raw-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rv-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rv-table-wrap { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.rv-table { font-size: 12.5px; }
.rv-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.rv-table td, .rv-table th { padding: 4px 10px; white-space: nowrap; }
.rv-text { margin: 0; padding: 12px; background: var(--surface-3); border-radius: 10px; font-size: 12.5px; overflow: auto; max-height: 560px; white-space: pre-wrap; }
