/* The admin GUI and the portal — design tokens (system light/dark) + shared components. dialers.css uses the same tokens. */
/* Typed colors resolve light-dark() before canvas readers fetch these tokens. */
@property --bg { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --surface { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --surface2 { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --border { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --text { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --dim { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --green { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --orange { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --red { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --blue { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --diag-source-1 { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --diag-source-2 { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --diag-source-3 { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --diag-source-4 { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --diag-source-5 { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --diag-source-6 { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --diag-source-7 { syntax: "<color>"; inherits: true; initial-value: transparent; }
@property --diag-source-8 { syntax: "<color>"; inherits: true; initial-value: transparent; }
:root {
  --bg: light-dark(#f3f5f7, #121212); --surface: light-dark(#ffffff, #1e1e1e); --surface2: light-dark(#edf1f5, #262626); --border: light-dark(#d4dce4, #333); --text: light-dark(#233143, #e0e0e0); --dim: light-dark(#586778, #8f8f8f);
  --green: light-dark(#287a32, #4caf50); --orange: light-dark(#a35d00, #ff9800); --red: light-dark(#b3261e, #f44336); --blue: light-dark(#1769aa, #1e88e5); --accent: light-dark(#1867a0, #90caf9);
  --diag-source-1: light-dark(#1769aa, #64b5f6); --diag-source-2: light-dark(#a35d00, #ffb74d); --diag-source-3: light-dark(#287a32, #81c784); --diag-source-4: light-dark(#7950b3, #ba9bea);
  --diag-source-5: light-dark(#b83360, #f07e91); --diag-source-6: light-dark(#00796e, #4dd0c1); --diag-source-7: light-dark(#7e7300, #d6cd64); --diag-source-8: light-dark(#855338, #c49a7a);
  --mono: 'Consolas', 'Menlo', 'DejaVu Sans Mono', monospace; --sans: Arial, 'Segoe UI', system-ui, sans-serif;
  --video-stage: #101318; --on-video: #fff; --video-label: #0009;
  --on-call: #fff; --dock-w: 360px;
  color-scheme: light dark;
}
/* The phone uses the native apps' semantic palette; the admin keeps its own tokens. Copies, changed together:
   ios/BC4H3/Theme.swift and android/app/src/main/res/values{,-night}/colors.xml. */
body:has(.portal) {
  --bg: #11151b; --surface: #181d24; --surface2: #1f252d; --border: #606975; --text: #f4f7fb; --dim: #9fa4ac;
  --green: #35bf73; --orange: #f59b3c; --red: #ef5d5e; --blue: #7596fa; --accent: #7596fa;
  --on-call: #06251a; --on-accent: #0d1220; --on-decline: #2b1013; --field: #10151c; --secondary: #22284a;
}
@media (prefers-color-scheme: light) {
  body:has(.portal) {
    --bg: #f1f3f5; --surface: #ffffff; --surface2: #eaeef3; --border: #e2e6ea; --text: #131f5d; --dim: #666e79;
    --green: #00a35a; --orange: #e36b00; --red: #d23031; --blue: #3e5cfb; --accent: #3e5cfb;
    --on-call: #ffffff; --on-accent: #ffffff; --on-decline: #ffffff; --field: #eaeef3; --secondary: #eff2fc;
  }
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body.connection-moving, body.connection-moving * { pointer-events: none !important; }
/* The app is a fixed viewport: header on top, then main and the dock, each scrolling on its own. */
html, body { height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); font-variant-numeric: tabular-nums; }
body { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--accent); }
.mono { font-family: var(--mono); }
.muted { color: var(--dim); }
.err { color: var(--red); font-size: 12px; }
.err:empty { display: none; }
h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); white-space: nowrap; }
h3 { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
p { overflow-wrap: anywhere; }

input, select, textarea {
  background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; font: inherit; min-width: 0; max-width: 100%; height: 28px;
}
textarea { font-family: var(--mono); font-size: 12px; width: 100%; resize: vertical; height: auto; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); height: auto; }
input[type=range] { padding: 0; border: 0; background: none; height: auto; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #6b6b6b; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #4a4a4a; }
::-webkit-scrollbar-corner { background: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 28px;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  padding: 0 12px; font: inherit; cursor: pointer; white-space: nowrap; flex: none; text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover:not(:disabled) { border-color: #fff6; }
.btn.danger { color: var(--red); }
.btn.danger:hover:not(:disabled) { border-color: var(--red); }
.btn.primary.danger { background: #c62828; border-color: #c62828; color: #fff; }
.btn.small { height: 23px; padding: 0 8px; font-size: 12px; }
.btn.icon { width: 23px; padding: 0; }
.btn.on { border-color: var(--accent); color: var(--accent); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; height: 19px; border-radius: 999px;
  border: 1px solid var(--border); font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--text); flex: none;
}
.pill.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.pill.warn { color: var(--orange); border-color: color-mix(in srgb, var(--orange) 45%, var(--border)); }
.pill.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.pill.dim { color: var(--dim); }
.pill.info { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.card > header { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 42px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card > header > h2 { padding: 12px 0 11px; }
.card > header .sp { flex: 1; }
.card > .body, .card.body { padding: 10px 12px; }
.body:empty { display: none; }
.card.warn { border-color: var(--orange); }
.card.bad { border-color: var(--red); }
.kv { display: flex; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sp { flex: 1; }
.empty { padding: 20px 16px; text-align: center; color: var(--dim); }
.note { color: var(--dim); font-size: 12px; max-width: 72ch; }
.count { color: var(--dim); font-family: var(--mono); font-size: 12px; white-space: nowrap; min-width: 8ch; text-align: right; }
.id { font-family: var(--mono); white-space: nowrap; }
[data-copy] { cursor: copy; }
[data-copy]:hover { text-decoration: underline dotted; text-underline-offset: 3px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--dim);
  padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--surface2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.data td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td, table.data tr.sel td { background: var(--surface2); }
table.data tr.sel td:first-child { box-shadow: inset 2px 0 var(--accent); }
.scrollx { overflow-x: auto; max-width: 100%; }

details.json > summary { cursor: pointer; color: var(--dim); font-size: 12px; user-select: none; padding: 2px 0; }
details.json > summary:hover { color: var(--text); }
details.json pre, pre.json { font-size: 12px; white-space: pre-wrap; word-break: break-all; background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px; margin-top: 4px; max-height: 420px; overflow: auto; cursor: text; }

.top { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; flex: none; }
.top .brand { font-weight: 600; color: var(--accent); font-size: 15px; white-space: nowrap; }
.top .sp { flex: 1; }
#docktoggle.on { border-color: var(--accent); color: var(--accent); }
body:has(#dialers[data-ringing]) #docktoggle { border-color: var(--orange); color: var(--orange); animation: ring 1.2s ease-in-out infinite; }
@keyframes ring { 50% { background: color-mix(in srgb, var(--orange) 25%, var(--surface2)); } }
.banner { padding: 6px 16px; background: color-mix(in srgb, var(--orange) 18%, var(--bg)); color: var(--text); border-bottom: 1px solid var(--orange); flex: none; }
.banner.bad { background: color-mix(in srgb, var(--red) 15%, var(--bg)); color: var(--text); border-bottom-color: var(--red); }
.banner:empty { display: none; }
nav.tabs { display: flex; gap: 2px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; flex: none; }
nav.tabs a { padding: 8px 12px; color: var(--dim); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
nav.tabs a:hover { color: var(--text); }
nav.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.shell { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
/* Views lay out against their own width (container queries), so the dock's width never breaks them. */
main#view { padding: 12px 16px 24px; min-width: 0; min-height: 0; overflow: auto; scrollbar-gutter: stable; container: view / inline-size; transition: opacity .2s; }
/* A view's panels stack with .stack's gap. Not `* + *`: with a universal sibling rule each row a
   virtual list inserts restyles its whole list. */
main#view > :not(:first-child) { margin-top: 12px; }
body:is([data-conn=down], [data-conn=connecting], [data-conn=unauthorized]) main#view { opacity: .55; }
aside#dialers { width: var(--dock-w); min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; background: var(--bg); }
aside#dialers.hidden { display: none; }
.grip { width: 5px; cursor: col-resize; border-left: 1px solid var(--border); touch-action: none; }
.grip:hover, .grip.drag, .grip:focus-visible { outline: none; border-left: 2px solid var(--accent); }
.grip:has(+ aside.hidden) { display: none; }
.dockerr { padding: 12px; color: var(--red); white-space: pre-wrap; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
/* Narrow: the dock replaces the view instead of squeezing it; the Dialers button switches. */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .grip { display: none; }
  aside#dialers { width: auto; }
  .shell:has(> aside#dialers:not(.hidden)) > main { display: none; }
  main#view { padding: 10px 10px 24px; }
  .top { padding: 8px 10px; gap: 8px; }
  nav.tabs { mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
}
/* Neither authentication surface is ready until the session check decides which to show. */
body[data-auth]:not([data-auth=in]) > :not(#login, #banner, .toasts, #server-updated, #server-unavailable) { display: none !important; }
body:not([data-auth=out]) > #login { display: none; }
.login { flex: 1; display: grid; place-items: center; padding: 24px 16px; overflow: auto;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, color-mix(in srgb, var(--blue) 14%, var(--bg)), var(--bg)); }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 8px; padding: 32px 28px 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 48px #0009; }
.login-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px;
  color: var(--accent); background: color-mix(in srgb, var(--blue) 20%, transparent); }
.login h1 { font-size: 19px; font-weight: 600; }
.login label { font-size: 12px; font-weight: 600; color: var(--dim); }
.login input:not([type=checkbox]) { height: 40px; padding: 0 12px; font-size: 14px; }
.login label.trust { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.login-err { min-height: 18px; color: var(--red); font-size: 12px; }
.login .btn { height: 40px; font-size: 14px; font-weight: 600; }
/* A sign-in waiting for the server (signin.js): disabled, the label led by a spinner. */
.login .btn[aria-busy=true] { gap: 8px; opacity: .7; cursor: progress; }
.login-secret { font-size: 12px; word-break: break-all; user-select: all; }
/* A TOTP secret's QR code (qr.js): dark on white in either theme, sized for a phone camera. */
.qr { width: 200px; align-self: center; }
.qr svg { display: block; width: 100%; height: auto; border-radius: 4px; }
/* What a step of the sign-in (signin.js), or a plain admin (app.js), does not show. */
.login [hidden], [data-advanced][hidden] { display: none !important; }

/* The session shell keeps navigation and a minimised call visible in every view. */
.portal { flex: 1; min-height: 0; display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); gap: 12px; padding: 12px; }
.portal > #tabs { grid-column: 1; grid-row: 1 / -1; flex-direction: column; gap: 8px; padding: 8px; border: 0; border-radius: 16px; mask-image: none; }
.portal > #tabs a { min-height: 80px; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; padding: 10px 4px; border: 0; border-radius: 12px; font-size: 12px; }
.portal > #tabs a.on { color: var(--accent); background: var(--secondary); }
.portal > #tabs svg, svg.phone-icon { width: 24px; height: 24px; flex: none; }
.portal-main { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.portal-main > main#view { padding: 0; flex: 1; overflow: auto; }
.portal .phone { grid-column: 3; grid-row: 1 / -1; width: 340px; overflow: auto; opacity: 1; transform: translateY(0); transition: opacity 150ms, transform 300ms cubic-bezier(.2,0,0,1), display 300ms allow-discrete; }
.portal .phone[hidden] { opacity: 0; transform: translateY(24px); }
@starting-style { .portal .phone:not([hidden]) { opacity: 0; transform: translateY(24px); } }
.portal:not(:has(#phone:not([hidden]))) { grid-template-columns: 104px minmax(0, 1fr); }
.call-bar { grid-column: 2; display: flex; align-items: center; gap: 8px; }
.call-bar #restore-call { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.identity { position: relative; min-width: 0; max-width: 180px; }
.identity > summary { cursor: pointer; min-height: 44px; max-width: 100%; padding: 8px 14px; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.top:has(.identity) #conn { height: 32px; font-size: 12px; transition: color 150ms, border-color 150ms; }
.top:has(.identity) #langsel { min-height: 44px; }
.identity-menu { position: absolute; right: 0; top: 100%; z-index: 10; min-width: 220px; padding: 12px; display: flex; flex-direction: column; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.identity-menu summary { cursor: pointer; }
.identity-menu label { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dialer { width: min(360px, 100%); margin: 0 auto; border: 0; background: none; }
.dial-match { display: flex; align-items: center; justify-content: center; height: 48px; gap: 8px; min-width: 0; }
.dial-match > .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dial-match .match-target { background: none; border: 0; color: var(--accent); padding: 0 4px; }
#dial-matches { position: absolute; top: 112px; right: 0; left: 0; z-index: 3; max-height: 260px; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.btn.call-button { background: var(--green); border-color: var(--green); color: var(--on-call); }
.colleague { width: 100%; text-align: left; background: var(--surface); border: 0; color: var(--text); font: inherit; cursor: pointer; }
.colleague:hover { background: var(--surface2); }
#call-end { min-height: 100px; display: grid; place-items: center; font-size: 20px; }
.phone .body { display: flex; flex-direction: column; gap: 10px; }
.receive-health { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.receive-health summary { cursor: pointer; padding: 4px 0; }
.receive-health > div { transition: opacity 150ms ease-out, transform 150ms ease-out; }
@starting-style { .receive-health[open] > div { opacity: 0; transform: translateY(-4px); } }
.receive-health-values { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; font-size: 12px; }
.receive-health-values dt { color: var(--dim); }
.receive-health-values dd { margin: 0; text-align: right; font-family: var(--mono); }
.receive-health-values [data-quality="excellent"], .receive-health-values [data-quality="good"] { color: var(--green); }
.receive-health-values [data-quality="fair"] { color: var(--orange); }
.receive-health-values [data-quality="weak"] { color: var(--red); }
[data-level="warn"] { color: var(--orange); }
[data-level="bad"] { color: var(--red); }
.receive-health-events { font-size: 12px; padding-left: 20px; }
.phone.video-call .receive-health { position: absolute; top: 160px; right: 16px; width: min(360px, calc(100% - 32px)); max-height: calc(100dvh - 380px); overflow: auto; z-index: 6; }
.ph-line, .ph-inc, .ph-call { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); }
#parked { transition: opacity 120ms, transform 120ms, visibility 120ms; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: 24px 44px; }
#parked > [data-i18n="portal.held"] { grid-column: 1; font-size: 12px; }
#parkedpeer { grid-column: 2 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#parked .btn { grid-row: 2; height: 44px; padding: 4px; white-space: normal; }
#swap { grid-column: 1; } #merge { grid-column: 2; } #held-transfer { grid-column: 3; }
.ph-inc { border-color: var(--orange); animation: ring 1.2s ease-in-out infinite; }
.ph-inc .btn, .ph-pad .row .btn { flex: 1; height: 36px; }
.ph-peer { display: flex; align-items: baseline; gap: 8px; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.ph-peer .mono { flex: none; white-space: nowrap; }
.conf-tiles { position: relative; height: min(480px, max(180px, calc(100dvh - 300px))); overflow: hidden; background: var(--video-stage); border-radius: 10px; }
/* Keep held-strip tap points empty after the held leg ends. */
#parked[hidden] { display: grid !important; visibility: hidden; pointer-events: none; opacity: 0; transform: translateY(-3px); }
.conf-tile { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 0; overflow: hidden; padding: 6px; border-radius: 10px; background: var(--surface2);
  --ring: 0px; outline: var(--ring) solid var(--green); outline-offset: calc(var(--ring) * -1); transition: outline-width 80ms linear, outline-offset 80ms linear, left 150ms ease-out, top 150ms ease-out, width 150ms ease-out, height 150ms ease-out; animation: conf-in 150ms cubic-bezier(.2,0,0,1); }
.conf-loading { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--on-video); font-size: 14px; }
.spinner, .login .btn[aria-busy=true]::before { flex: none; width: var(--spinner, 32px); height: var(--spinner, 32px); border: 3px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 900ms linear infinite; }
.conf-tile.compact .conf-loading > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.conf-tile.compact:has(.conf-loading:not([hidden])) .message-avatar { display: none; }
.conf-tile.compact .conf-loading { gap: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
/* After .spinner, whose border it thins. */
.login .btn[aria-busy=true]::before { content: ''; --spinner: 14px; border-width: 2px; }
.conf-tile .message-avatar { width: var(--avatar); height: var(--avatar); }
.conf-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--video-stage); }
.conf-tile .conf-backdrop { object-fit: cover; filter: blur(16px) brightness(.4); transform: scale(1.1); }
.conf-tiles.conference video[data-video] { background: transparent; }
.conf-tile:not(.live) video { opacity: 0; }
.conf-tile.live .message-avatar { visibility: hidden; }
.conf-tile.live .conf-name { padding: 0 4px; border-radius: 4px; color: var(--on-video); background: var(--video-label); }
.conf-self { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.conf-tile.screen { background: var(--video-stage); color: var(--on-video); }
.conf-tiles.conference .conf-tile.screen video[data-video] { background: var(--video-stage); }
.conf-tile.screen.large { touch-action: none; }
.conf-unsupported { position: relative; padding: 12px; text-align: center; }
.conf-self .conf-tile { pointer-events: auto; }
.conf-tile.floating { z-index: 1; cursor: move; touch-action: none; box-shadow: 0 2px 8px var(--video-label); }
.conf-tile.dragging { transition: none; }
.conf-name { position: absolute; left: 6px; bottom: 4px; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conf-tile:not(.live) { padding-bottom: 28px; }
.conf-name small { color: var(--dim); font-size: 12px; }
.conf-mute { position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; color: var(--red); }
.signal-bars { width: 16px; height: 14px; display: inline-flex; flex: none; align-items: end; gap: 2px; color: var(--dim); vertical-align: middle; }
.signal-bars i { width: 4px; height: 5px; border: 1px solid currentColor; border-radius: 1px; }
.signal-bars i:nth-child(2) { height: 9px; } .signal-bars i:nth-child(3) { height: 14px; }
.signal-bars i[data-filled] { background: currentColor; }
.signal-bars[data-q="good"] { color: var(--green); } .signal-bars[data-q="fair"] { color: var(--orange); } .signal-bars[data-q="poor"] { color: var(--red); }
.conf-q { position: absolute; top: 8px; left: 8px; }
.conf-strip { position: absolute; overscroll-behavior: contain; }
.conf-strip .conf-tile { transition: outline-width 80ms linear; }
.conf-tiles.conference .conf-name { display: flex; align-items: center; gap: 4px; color: var(--on-video); background: var(--video-label); padding: 3px 6px; border-radius: 4px; }
.conf-person-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conf-tiles.conference .conf-mute, .conf-tiles.conference .conf-q { position: static; flex: none; }
.conf-tiles.conference .conf-tile:not(.live) { padding-bottom: 0; }
.conf-tiles.conference .conf-tile { cursor: pointer; outline-color: var(--accent); }
.conf-tiles.conference .conf-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.conf-pin { position: absolute; top: 6px; right: 6px; display: none; color: var(--on-video); background: var(--video-label); border-radius: 4px; padding: 4px; }
.conf-pin svg { width: 16px; height: 16px; }
.conf-tile.pinned .conf-pin { display: flex; }
.conf-overflow { border: 0; color: var(--on-video); font-size: 32px; }
.conf-roster { display: grid; gap: 6px; max-height: 60dvh; overflow: auto; }
.conf-roster > button { display: flex; align-items: center; gap: 10px; text-align: left; }
.conf-roster .conf-person-name { flex: 1; }
@keyframes conf-in { from { opacity: 0; transform: scale(.94); } }
.ph-acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ph-acts .btn > .phone-icon { display: none; }
.ph-acts .btn { min-width: 0; height: 44px; padding: 4px; white-space: normal; }
.ph-acts { transition: opacity 150ms ease-out, transform 150ms ease-out, visibility 150ms; }
.phone.controls-hidden .ph-acts { opacity: 0; transform: translateY(6px); visibility: hidden; }
.ph-acts #hangup { grid-column: 1 / -1; height: 36px; }
.phone-controls { display: contents; }
.phone-video-info { display: none; }
.portal .phone.video-call { position: fixed; inset: 0; width: 100%; height: 100dvh; z-index: 8; border: 0; border-radius: 0; padding: 0; overflow: hidden; background: var(--video-stage); }
.phone.video-call > .body, .phone.video-call .ph-call { position: absolute; inset: 0; padding: 0; border: 0; border-radius: 0; background: none; }
.phone.video-call .conf-tiles { position: absolute; inset: 0; height: 100%; border-radius: 0; }
.phone.video-call .conf-tile { border-radius: 0; background: var(--video-stage); }
.phone.video-call .conf-name { color: var(--on-video); background: var(--video-label); padding: 2px 4px; border-radius: 4px; transition: bottom 150ms ease-out; }
.phone.video-call .conf-name small { color: inherit; }
.phone.video-call::before { content: ''; position: absolute; inset: 0 0 auto; height: min(260px, 35%); background: linear-gradient(var(--video-stage), color-mix(in srgb, var(--video-stage) 65%, transparent), transparent); pointer-events: none; z-index: 2; }
.phone.video-call > header { position: absolute; inset: 0 0 auto; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: none; border: 0; color: var(--on-video); z-index: 4; }
.phone.video-call > header h2 { display: none; }
.phone.video-call .phone-video-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.phone.video-call .phone-video-info b { font-size: 14px; font-weight: 500; }
.phone.video-call .phone-video-info small { font-size: 12px; }
.phone.video-call .ph-peer { position: absolute; top: calc(76px + env(safe-area-inset-top)); left: 24px; right: 24px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--on-video); z-index: 3; }
.phone.video-call .ph-peer > b { font-size: 24px; }
.phone.video-call .ph-peer .muted { color: var(--on-video); }
.phone.video-call .phone-controls { position: absolute; inset: auto 0 0; display: flex; flex-direction: column-reverse; gap: 12px; padding: 32px 24px calc(24px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, color-mix(in srgb, var(--video-stage) 65%, transparent), var(--video-stage)); z-index: 4; transition: opacity 150ms ease-out, transform 150ms ease-out, visibility 150ms; }
.phone.video-call .ph-acts, .phone.video-call .ph-pad { width: min(100%, 560px); margin: auto; }
.phone.video-call .ph-acts .btn { min-height: 44px; }
.ph-acts .btn[hidden] { display: block !important; visibility: hidden; pointer-events: none; }
.phone.controls-hidden .phone-controls { opacity: 0; transform: translateY(6px); visibility: hidden; }
.phone.video-call #parked { position: absolute; top: calc(176px + env(safe-area-inset-top)); left: 24px; right: 24px; max-width: 560px; margin: auto; color: var(--on-video); background: var(--video-label); z-index: 5; }
.phone.video-call.controls-hidden #parked { opacity: 0; visibility: hidden; pointer-events: none; }
.phone.video-call #plainvideo { display: none; }
.phone.video-call .ph-pad { color: var(--on-video); }
.phone.video-call .ph-pad input { color: var(--on-video); }
@media (orientation: landscape) and (max-height: 500px) {
  .phone.video-call .ph-peer { top: 52px; flex-direction: row; justify-content: center; gap: 12px; }
  .phone.video-call .ph-peer > b { font-size: 18px; }
  .phone.video-call .ph-acts { width: min(100%, 720px); grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .phone.video-call .phone-controls { padding-top: 20px; padding-bottom: 12px; }
  .phone.video-call.conference-call .ph-acts { grid-template-columns: repeat(8, minmax(44px, 1fr)); }
  .phone.video-call.conference-call .ph-acts .btn { display: flex; align-items: center; justify-content: center; }
  .phone.video-call.conference-call .ph-acts .btn > .phone-icon { display: block; width: 24px; height: 24px; }
  .phone.video-call.conference-call .ph-acts .call-control-label { display: none; }
  .phone.video-call.conference-call .ph-acts #hangup { grid-column: auto; height: 44px; }
  .phone.video-call.conference-call .phone-controls { padding-top: 12px; padding-bottom: 12px; }
}
.ph-pad { position: relative; display: flex; flex-direction: column; gap: 8px; }
.ph-pad input { height: 56px; width: 100%; font: 34px var(--sans); text-align: center; background: none; border: 0; }
.ph-keys { display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center; gap: 14px 8px; }
.ph-keys .btn { width: 72px; height: 72px; padding: 0; border-radius: 50%; border: 0; display: flex; flex-direction: column; gap: 0; font-size: 28px; }
.ph-keys small { font-size: 10px; letter-spacing: .1em; height: 16px; }
.ph-pad .dial-actions { position: relative; justify-content: center; height: 72px; flex-wrap: nowrap; margin-top: 8px; }
.ph-pad .dial-actions .btn { flex: none; }
.ph-pad #go { width: 64px; height: 64px; border-radius: 50%; padding: 0; }
.ph-pad #backspace { position: absolute; right: 4px; width: 48px; height: 48px; padding: 0; border: 0; background: none; font-size: 24px; }
.ph-pad #cancel { position: absolute; left: 0; max-width: 88px; padding: 0 8px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.portal { font-size: 15px; }
.portal input::placeholder { color: var(--dim); }
.portal .btn.primary { color: var(--on-accent); }
.portal .btn.primary.danger { background: var(--red); border-color: var(--red); color: var(--on-decline); }
.portal #answer { background: var(--green); border-color: var(--green); color: var(--on-call); }
.person-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; min-height: 100%; }
.home-list { align-self: start; overflow: hidden; }
.call-filters { display: flex; flex-direction: column; gap: 12px; }
.home-list input { width: 100%; height: 44px; border-radius: 24px; padding: 0 16px; }
.call-filters .btn { border-radius: 24px; min-height: 36px; }
.call-row { display: flex; align-items: center; min-width: 0; margin: 0 16px; border-top: 1px solid var(--border); gap: 8px; }
.call-row:last-child { border-bottom: 1px solid var(--border); }
.call-person { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; min-height: 80px; padding: 12px 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.call-person time { flex: none; white-space: nowrap; color: var(--dim); font-size: 12px; }
.call-outcome { display: flex; gap: 5px; align-items: center; font-size: 12px; color: var(--dim); }
.call-outcome svg { width: 14px; height: 14px; }
.round { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; width: 48px; height: 48px; padding: 0; background: var(--surface2); color: var(--accent); }
.call-back { border: 0; }
.call-unseen { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.missed-name { color: var(--red); }
.colleagues { padding: 0 16px; }
.colleague { border-top: 1px solid var(--border); min-height: 80px; padding: 12px 0; }
.colleague-subtitle { position: relative; }
.colleague-activity { position: absolute; inset: 0 auto auto 0; width: max-content; visibility: hidden; }
.colleague-subtitle.fits .colleague-activity { visibility: visible; }
.colleague-subtitle.fits .colleague-number { visibility: hidden; }
.colleague:last-child { border-bottom: 1px solid var(--border); }
.presence-dot { width: 8px; height: 8px; background: var(--dim); border: 1px solid transparent; box-sizing: border-box; border-radius: 50%; flex: none; transition: background 150ms; }
.presence-dot.available { background: var(--green); }
.presence-dot.away { background: transparent; border: 2px solid var(--green); }
.presence-dot.offline { background: transparent; border: 2px solid var(--dim); }
.presence-dot.unknown { background: transparent; border-color: var(--dim); }
.person { padding: 16px; min-width: 0; }
.person-back { border: 0; background: none; width: 44px; height: 44px; padding: 0; }
.person-identity { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; margin: 8px 0 24px; }
.person-identity > .message-avatar { width: 80px; height: 80px; font-size: 28px; }
.person-identity h3 { font-size: 24px; }
.person-number { user-select: all; font-size: 18px; }
.person-presence { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 13px; }
.person-actions { display: flex; justify-content: center; gap: 24px; margin-top: 8px; }
.person-action { min-width: 56px; display: flex; flex-direction: column; align-items: center; gap: 8px; font: inherit; font-size: 12px; color: var(--accent); border: 0; background: none; cursor: pointer; }
.person-day { padding: 16px 0 8px; color: var(--dim); font-size: 13px; font-weight: 500; }
.person-call { width: 100%; padding: 0; border: 0; background: transparent; color: var(--text); text-align: start; cursor: pointer; display: grid; grid-template-columns: auto 18px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 56px; border-top: 1px solid var(--border); font-size: 13px; }
.person-call svg { width: 18px; height: 18px; color: var(--dim); }
.person-call time { color: var(--dim); }
.person-call-subtitle { display: block; }
/* Theme foregrounds and backgrounds must switch together to preserve contrast. */
.portal button:active, .portal a:active { background-color: var(--surface2); }
.view-enter { animation: tab-enter 210ms ease-out; }
.detail-enter { animation: detail-enter 300ms cubic-bezier(.2,0,0,1); }
@keyframes tab-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes detail-enter { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
.leg-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.leg-row.mine > .row > b { color: var(--accent); }
.account { max-width: 520px; }
.account .form label { font-size: 12px; color: var(--dim); } .account .form label > span { font-family: var(--sans); }

.menu { position: fixed; z-index: 50; display: none; min-width: 200px; max-width: min(420px, 94vw); max-height: 70vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.menu.open { display: block; }
.menu .mh { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); padding: 6px 10px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu .sep { height: 1px; background: var(--border); margin: 4px; }
.menu button { display: flex; width: 100%; gap: 16px; align-items: center; padding: 6px 10px; border: 0; background: none;
  color: var(--text); font: inherit; text-align: left; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--surface2); outline: none; }
.menu button.danger { color: var(--red); }
.menu button:disabled { opacity: .4; cursor: default; }
.menu .hint { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); }
dialog { inset: 0; margin: auto; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.target-list { max-height: min(360px, 45dvh); overflow-y: auto; }
/* This width keeps grouped forms readable while fitting narrower windows.
   Clip the frame so focusing a field scrolls only the body, leaving the title and footer in place. */
.grid-dialog { width:min(960px, calc(100vw - 32px)); max-height:calc(100dvh - 32px); overflow:clip; padding:24px; border:1px solid var(--border); border-radius:12px; background:var(--surface); color:var(--text); }
.grid-dialog::backdrop { background:#0006; }
.grid-dialog[open] { display:flex; flex-direction:column; }
.grid-dialog h2 { flex:none; margin:0 0 16px; font-size:20px; color:var(--text); text-transform:none; letter-spacing:normal; white-space:normal; }
.grid-dialog-body { flex:1; min-height:0; overflow:auto; }
/* A solid footer belongs to the dialog frame, outside its scrolling form body. */
.grid-dialog-footer { flex:none; margin:16px -24px -24px; padding:12px 24px; border-top:1px solid var(--border); background:var(--surface); }
.segmented input { position:absolute; opacity:0; pointer-events:none; }
.segmented label:has(input:focus-visible) { outline:2px solid var(--accent); outline-offset:-2px; }
.segmented { display:inline-flex; border:1px solid var(--border); border-radius:6px; overflow:hidden; align-self:flex-start; }
.segmented label { padding:4px 12px; cursor:pointer; border-left:1px solid var(--border); }
.segmented label:first-child { border-left:0; }
.segmented label:has(input:checked) { background:var(--accent); color:var(--surface); }
.segmented label:has(input:disabled) { opacity:.45; cursor:default; }
.grid-field { display:grid; grid-template-columns:minmax(140px, 220px) minmax(0, 1fr); align-items:center; gap:16px; padding:8px 0; }
.grid-field > input:not([type=checkbox]), .grid-field > select { width:100%; min-width:0; }
/* A switch leads its name at every width (owner 2026-11-15); an enabled branch's body takes the next row.
   The element names outrank the contexts' label columns (.grid-dialog .grid-field in admin/grid.css). */
:is(label, div).grid-field.grid-check { grid-template-columns:auto minmax(0, 1fr); gap:12px; }
.grid-check > input[type=checkbox], .grid-check > .grid-enabled > input[type=checkbox] { order:-1; }
/* A class, not `span`: see the row-dimming rule in admin/grid.css. */
.grid-field:has(input:required) > .grid-field-label::after { content:' *'; color:var(--red); }
.grid-dialog fieldset { padding:16px; border:1px solid var(--border); border-radius:8px; margin:12px 0; }
.grid-dialog details.form-group { padding:16px; border:1px solid var(--border); border-radius:8px; margin:12px 0; }
.grid-dialog details.form-group > summary { cursor:pointer; font-weight:600; }
@media(max-width:560px) { .grid-field { grid-template-columns:minmax(96px, 140px) minmax(0, 1fr); gap:12px; } }
.target-picker .modal { display: flex; flex-direction: column; gap: 12px; }
.ask-dialog { width: min(460px, calc(100vw - 32px)); max-width: none; padding: 0; border: 0; background: transparent; color: var(--text); }
.modal { width: min(460px, 100%); max-height: 90vh; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.modal label.row { flex-wrap: nowrap; }
.modal .field > span, .modal .row > span { font-size: 12px; color: var(--dim); }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.warnbox { padding: 8px 10px; border: 1px solid var(--orange); border-radius: 6px; color: var(--orange);
  background: color-mix(in srgb, var(--orange) 10%, transparent); }
.toasts { position: fixed; bottom: 16px; left: 16px; z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; max-width: min(520px, calc(100vw - 32px)); }
.toast { background: var(--surface2); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 7px 14px; border-radius: 6px;
  overflow-wrap: anywhere; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); transition: opacity .3s; }
.toast.ok { border-left-color: var(--green); }
.toast.warn { border-left-color: var(--orange); }
.toast.bad { border-left-color: var(--red); }

.board { display: grid; gap: 12px; align-items: start; grid-template-columns: minmax(0, 1fr); grid-template-areas: "ep" "calls" "insp"; }
.board > .eps { grid-area: ep; } .board > .calls { grid-area: calls; } .board > .insp { grid-area: insp; }
.board > .eps > .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
@container view (min-width: 720px) {
  .board { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto 1fr; grid-template-areas: "ep insp" "calls insp"; }
}
@container view (min-width: 1200px) {
  .board { grid-template-columns: 250px minmax(0, 1fr) 340px; grid-template-rows: auto; grid-template-areas: "ep calls insp"; }
  .board > .eps > .list { display: block; }
}
@container view (min-width: 720px) { .board > .insp { position: sticky; top: 0; max-height: calc(100dvh - 130px); overflow: auto; } }
.eprow { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 12px; min-width: 0; }
.eprow:hover { background: var(--surface2); }
.eprow .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.eprow .nm > b { font-weight: 500; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eprow .nm > span { display: flex; gap: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--dim); }
.dot.avail { background: var(--green); } .dot.oncall { background: var(--orange); } .dot.away { background: transparent; box-shadow: inset 0 0 0 2px var(--green); }
.dot.gone { background: transparent; box-shadow: inset 0 0 0 2px var(--dim); }
.tag { font-family: var(--mono); font-size: 10.5px; line-height: 16px; padding: 0 5px; border-radius: 4px; background: var(--surface2); color: var(--dim); white-space: nowrap; }
.tag.warn { color: var(--orange); } .tag.info { color: var(--accent); }
.call { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; overflow: hidden; border-left: 3px solid var(--hue, var(--dim)); }
.call:last-child { margin-bottom: 0; }
.call.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.call > .ch { cursor: pointer; }
/* Offscreen cards defer layout during seeking; the estimate preserves scroll extent. */
.board .call { content-visibility: auto; contain-intrinsic-size: auto 66px; }
.call > .ch { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 10px; background: var(--surface2); flex-wrap: wrap; min-height: 34px; }
.brg { margin: 6px 8px; border: 1px dashed var(--border); border-radius: 6px; }
.brg > .bh { display: flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 12px; color: var(--dim); flex-wrap: wrap; cursor: pointer; min-height: 30px; }
.brg > .empty { padding: 8px; }
/* A leg: what (state, direction, who) | where (id, transport, endpoint, flags) | when + actions. */
.leg { display: flex; align-items: center; gap: 4px 10px; padding: 4px 8px 4px 10px; cursor: pointer; flex-wrap: wrap; min-height: 32px; }
.leg:hover { background: var(--surface2); }
.leg.sel, .brg.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.leg > .what { display: flex; align-items: center; gap: 8px; flex: 1 1 180px; min-width: 0; }
.leg .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg > .where { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.leg > .acts { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-left: auto; }
/* A leg's live quality (quality.js): MOS, loss/jitter both ways, round trip, as sparklines. */
.qrow { flex-basis: 100%; display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: 11px; padding-left: 76px; }
.spark { display: inline-flex; align-items: center; gap: 5px; }
.spark canvas { display: block; background: var(--bg); border-radius: 3px; }
.qaxis { display: flex; justify-content: space-between; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
/* Wide enough: reserve the actions column so ended and live legs line up. */
.board > .calls { container: calls / inline-size; }
@container calls (min-width: 640px) { .leg > .acts { min-width: 140px; } }
.st { display: inline-block; width: 68px; text-align: center; flex: none; font-size: 10.5px; font-weight: 700; text-transform: uppercase; padding: 1px 0; border-radius: 999px; background: var(--bg); color: var(--dim); }
.st.incoming { color: var(--accent); } .st.ringing, .st.dialing { color: var(--orange); } .st.up { color: var(--green); } .st.ended { color: var(--dim); opacity: .7; }
.dur { font-family: var(--mono); color: var(--dim); min-width: 5ch; text-align: right; }
.insp dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 8px 0; }
.insp dt { color: var(--dim); font-size: 11px; text-transform: uppercase; line-height: 19px; }
.insp dd { overflow-wrap: anywhere; }
.insp .acts { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }

.tl .clock { font-family: var(--mono); color: var(--dim); white-space: nowrap; }
.tl .board-running { white-space: nowrap; }
.tl .zoom { font-family: var(--mono); color: var(--dim); min-width: 7ch; text-align: center; }
.tl { border-top: 2px solid var(--orange); }
.tl.is-live { border-top-color: var(--accent); }
.tl.is-live .clock { color: var(--accent); }
.board-overview { display: block; width: 100%; height: 44px; touch-action: none; cursor: grab; }
.board-overview-tooltip { position: fixed; z-index: 20; padding: 4px 8px; background: var(--surface); color: var(--text); border: 1px solid var(--dim); font-size: 12px; pointer-events: none; }
.board-overview + .muted { display: block; padding: 2px 12px; font-size: 11px; }
.board-empty { margin: 8px 12px; }
.board-help { max-width: 560px; padding: 20px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.board-help::backdrop { background: color-mix(in srgb, var(--bg) 70%, transparent); }
.board-help dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; }
.board-help dt { font-family: var(--mono); }
.board-loading { height: 2px; background: var(--accent); }
.board-loading-slot { height: 2px; }
.tlbody { overflow-x: hidden; overflow-y: auto; height: 108px; cursor: grab; }
.board-lane-resize { height: 8px; cursor: ns-resize; touch-action: none; border-bottom: 2px solid var(--dim); }
.tlinner { position: relative; }
.tlinner canvas { position: sticky; top: 0; left: 0; display: block; touch-action: none; }
/* Reserve a text line plus padding when the loading status is empty. */
.board-progress:empty { display: none; }

/* Kinds of Audit rows. */
.k-out { color: var(--accent); } .k-reply { color: #64b5f6; } .k-sys { color: var(--orange); } .k-ev { color: var(--green); }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 3px; }
.form label > span { font-family: var(--mono); font-size: 12px; }
.form label > small { color: var(--dim); font-size: 11px; }
.form input:not([type=checkbox]), .form select { width: 100%; }

.network-check canvas { display: block; width: 100%; height: 100%; }
.network-check .bad, .network-check .loss { color: var(--red); }
.network-check .good, .network-check .audio { color: var(--green); }
.network-check .warn, .network-check .late { color: var(--orange); }
.network-check .video { color: var(--accent); }

.grid.metrics { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.metric-plot { position: relative; width: 100%; height: 110px; overflow: hidden; background: var(--bg); border-radius: 4px; }
.metric-plot canvas, .quality-plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.metric-base, .quality-plot canvas:first-child { pointer-events: none; }
.mleg { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 12px; margin-top: 4px; min-height: 18px; }
.mswatch { width: 10px; height: 3px; border-radius: 2px; }

.nowrap, .card > header.nowrap{flex-wrap:nowrap}
.gap4{gap:4px}
.gap6{gap:6px}
.shrink{width:1%}
.full-width{width:100%}
/* Messaging shares the portal and dock; the containing pane sets its breakpoint. */
.account .account-form { padding: 16px; gap: 14px; }
.account .account-form [role=status]:empty { display: none; }
.account .account-form textarea { font-family: var(--sans); font-size: 14px; min-height: 90px; }
.account .account-form input, .account .account-form .btn { min-height: 38px; }
.messages { font-size: 14px; display: grid; grid-template-columns: minmax(260px, 30%) minmax(0, 1fr); height: min(760px, calc(100dvh - 155px)); min-height: 420px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.messages .btn { min-height: 38px; height: auto; padding: 9px 12px; white-space: normal; }
.messages input::placeholder, .messages textarea::placeholder { color: var(--dim); }
.messages input { min-height: 40px; padding: 10px 12px; }
.messages :is(input, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.message-sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border); position: relative; }
.message-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 18px 16px; }
.message-toolbar h2 { flex: 1 1 100px; min-width: 0; font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--text); }
.message-toolbar .btn { margin-inline-start: auto; min-height: 0; height: 28px; padding: 0 10px; font-size: 12px; }
.message-sidebar > input { margin: 0 16px 14px; }
.message-list { overflow: auto; flex: 1; padding: 4px 8px; }
.message-conversation, .message-person { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-align: left; padding: 14px 10px; cursor: pointer; font: inherit; }
.message-conversation:hover, .message-person:hover, .message-person[aria-selected=true] { background: var(--surface2); }
.message-conversation.selected { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); box-shadow: inset 3px 0 var(--accent); }
.message-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, var(--surface2)); color: var(--accent); font-weight: 650; font-size: 15px; }
.message-summary { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.message-summary > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Unset subtitles keep the recipient row geometry without a placeholder. */
.message-summary small { min-block-size: 1lh; }
.message-preview, .message-summary small, .message-meta, .message-presence { color: var(--dim); font-size: 12px; }
.message-meta { display: flex; flex-direction: column; align-items: end; gap: 6px; }
.message-unread { border-radius: 20px; padding: 2px 7px; background: var(--accent); color: var(--surface); font-weight: 700; }
.message-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.message-tools .btn { font-size: 11px; flex: 1; }
.message-picker { position: absolute; inset: 0; z-index: 2; background: var(--surface); display: flex; flex-direction: column; border-radius: 14px 0 0 14px; }
.message-picker > .people-picker { padding: 0 16px; min-height: 0; overflow: auto; }
.message-directory { overflow: auto; padding: 8px; }
.message-detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.message-header { min-height: 80px; display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.message-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.message-heading h3 { font-size: 16px; }
.message-back { display: none; }
.message-thread { flex: 1; overflow: auto; min-height: 0; padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.message-day { align-self: center; color: var(--dim); font-size: 11px; padding: 6px 12px; margin: 6px 0; background: var(--surface); border-radius: 20px; }
.message-bubble { align-self: flex-start; max-width: 82%; border-radius: 14px 14px 14px 3px; padding: 10px 14px 7px; background: var(--surface); border: 1px solid var(--border); }
.message-bubble.mine { align-self: flex-end; border-radius: 14px 14px 3px 14px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.message-bubble p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-mark { display: inline-block; width: 1.5em; text-align: center; }
.message-bubble footer { display: flex; justify-content: flex-end; gap: 6px; margin-top: 5px; color: var(--dim); font-size: 10px; }
.message-empty { margin: auto; padding: 32px 20px; text-align: center; color: var(--dim); max-width: 340px; }
.message-empty h3, .message-empty strong { color: var(--text); font-size: 18px; }
.message-empty p { margin-top: 10px; line-height: 1.7; }
.message-older { align-self: center; flex: none; margin: 12px 12px 0; }
.message-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; padding: 16px 20px; background: var(--surface); border-top: 1px solid var(--border); }
.message-send { position: relative; }
.message-counter { position: absolute; inset: auto 0 100%; height: 28px; line-height: 28px; text-align: center; font-size: min(1rem, 22px); font-variant-numeric: tabular-nums; color: var(--dim); overflow: hidden; }
.message-counter.over-limit { color: var(--red); }
.message-input { display: grid; max-height: 150px; overflow: auto; }
.message-input > * { grid-area: 1 / 1; font: inherit; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 42px; }
.message-input textarea { resize: none; height: 100%; overflow: hidden; }
.message-mirror { visibility: hidden; }
.message-status { font-size: 11px; color: var(--dim); text-align: right; }
.message-status:empty { display: none; }
.portal-main:has(.messages) main#view { display: flex; flex-direction: column; overflow: hidden; }
.portal .messages { flex: 1; height: auto; min-height: 0; }
.dk-card:has(.messages) { container-type: inline-size; }
@container (max-width: 620px) {
  .messages { grid-template-columns: minmax(0, 1fr); }
  .messages:not(.has-conversation) .message-detail, .messages.has-conversation .message-sidebar { display: none; }
  .message-back { display: inline-flex; }
  .message-sidebar { border: 0; }
  .message-header, .message-thread { padding: 14px; }
  .message-compose { padding: 12px; }
  .messages input, .message-input > * { font-size: 16px; }
}

.people-picker { position: relative; }
.people-picker > input { width: 100%; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 6px; padding: 8px; }
.card > header > .header-values { color: var(--dim); font-size: 12px; }
.card > .scrollx > .body { padding: 10px 12px; }
.filter-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.filter-field > label { color: var(--dim); font-size: 11px; }
.filter-bar input:not([type=checkbox]), .filter-bar .people-picker { width: 150px; max-width: 100%; }
.filter-bar input:not([type=checkbox]), .filter-bar select, .filter-bar .btn { min-height: 28px; }
.filter-bar select { max-width: 150px; }
.filter-bar .people-picker > input { width: 100%; }
.people-picker.anchored .message-directory { position: fixed; margin: 0; width: 260px; max-width: calc(100vw - 40px); max-height: 280px; overflow: auto; z-index: 20; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 24px color-mix(in srgb, var(--bg) 80%, transparent); animation: filter-open 100ms ease-out; }
.people-picker.anchored .message-person { padding: 8px 10px; }
.people-picker.anchored .message-avatar { width: 32px; height: 32px; font-size: 12px; }
.picker-title { padding: 4px 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
/* A line's number tag stands where a person's avatar does, so the two pickers read apart at a glance. */
.line-tag { flex: none; min-width: 44px; min-height: 24px; padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--mono); font-weight: 600; text-align: center; }
@keyframes filter-open { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }

#phone-offer .primary { flex-direction: column; gap: 4px; height: auto; min-height: 48px; padding: 10px 12px; white-space: normal; }

@media (max-width: 699px) {
  .portal, .portal:not(:has(#phone:not([hidden]))) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; padding: 8px; }
  .portal > #tabs { grid-column: 1; grid-row: 3; flex-direction: row; padding-bottom: env(safe-area-inset-bottom); }
  .portal > #tabs a { flex: 1; min-width: 0; min-height: 64px; font-size: 11px; }
  .portal > #tabs { gap: 0; padding: 4px; }
  .person-layout { grid-template-columns: minmax(0, 1fr); }
  .person-layout:not([data-person=open]) .person, .person-layout[data-person=open] .home-list { display: none; }
  .portal:has(.person-layout[data-person=open]) > #tabs { display: none; }
  .call-row { margin: 0 12px; gap: 4px; }
  .call-person { gap: 8px; }
  .call-person .message-avatar { width: 36px; height: 36px; }
  .call-person time { font-size: 11px; }
  .portal-main { grid-column: 1; grid-row: 2; }
  .call-bar { grid-column: 1; grid-row: 1; }
  .portal .phone { grid-column: 1; grid-row: 1 / 3; width: auto; z-index: 2; }
  body[data-call=open] .portal-main { visibility: hidden; }
  .portal .btn, .portal input, .identity-menu .btn { min-height: 44px; }
  .ph-acts .btn { width: 100%; padding: 0 4px; }
  .top:has(.identity) { flex-wrap: nowrap; }
  .identity { max-width: 120px; }
  .identity > summary { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 359px) { .top:has(.identity) .brand { display: none; } .top:has(.identity) #langsel { width: 68px; padding: 0 4px; } }
@media (prefers-reduced-motion: reduce) { .ph-inc, .portal *, .top:has(.identity) * { animation: none !important; transition: none !important; } }

.guest-page { overflow: auto; }
.guest { display: block; flex: 1; padding: 20px; overflow: visible; }
.guest .phone { width: min(100%, 960px); margin: auto; }
.guest .form { max-width: 440px; margin: auto; gap: 16px; }
.guest h1 { font-size: 24px; overflow-wrap: anywhere; }
.guest .conf-tiles { height: min(58dvh, 600px); min-height: 240px; }
.conf-guest { position: absolute; top: 6px; left: 6px; color: var(--text); background: var(--surface); }
.guest-controls .btn { min-height: 44px; }
.invite-fields .field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.invite-fields input { flex: 1; }
@media (max-width: 500px) { .guest { padding: 12px; } }

.direction-evidence { min-width: 0; container: directions / inline-size; }
.direction-evidence input[type=range] { width: 100%; }
.direction-evidence label { min-width: 0; max-width: 100%; }
.direction-evidence select { max-width: 100%; }
.direction-table td { vertical-align: middle; }
.direction-table { min-width: 1040px; }
.direction-table .direction-plot { min-width: 220px; width: 220px; }
.direction-table td:not(:first-child) { white-space: nowrap; }
.quality-plot { position: relative; width: 100%; height: 48px; cursor: crosshair; overflow: hidden; background: var(--bg); }
.direction-table td:first-child { min-width: 180px; max-width: 260px; overflow-wrap: break-word; }

/* The dock and log evidence panel can leave less space than the viewport width. */
@container directions (max-width: 1100px) {
  .direction-table { display: block; min-width: 0; }
  .direction-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
  .direction-table tr:first-child { display: none; }
  .direction-table td { min-width: 0; border: 0; padding: 4px; font-size: 11px; }
  .direction-table td:first-child, .direction-table .direction-plot { grid-column: 1 / -1; min-width: 0; max-width: none; width: auto; }
  .direction-table td:not(:first-child) { white-space: normal; }
  .direction-table td:first-child { overflow-wrap: normal; white-space: normal; font-size: 12px; }
  .direction-table td[data-label]::before { content: attr(data-label); display: block; color: var(--dim); font-size: 11px; }
}
.network-check .canvas-wrap { height: 260px; }
.network-table { overflow-x: auto; }
.network-table table { width: 100%; table-layout: fixed; }
.network-table th:first-child { width: 88px; }
.network-table th:nth-child(2), .network-table td:nth-child(2) { width: 210px; }
.network-table th:last-child { width: 140px; }
.network-table th, .network-table td { padding: 12px 8px; white-space: nowrap; }
.network-table td:nth-child(2), .network-table th { white-space: normal; }
.network-table td:nth-child(2) .pill { display: block; width: fit-content; margin-top: 4px; }
.network-table tr { height: 70px; cursor: pointer; }
.network-table thead tr { height: auto; cursor: default; }
.network-table tr.selected { background: var(--surface2); }
.network-table .btn { min-width: 115px; }
.network-legend { gap: 24px; }
.network-steps th, .network-steps td { padding: 5px 8px; text-align: left; }
.network-steps tr { animation: network-in 120ms ease-out; }
.network-detail { animation: network-in 120ms ease-out; }
.network-check summary { padding: 12px 16px; cursor: pointer; }
.network-check pre { max-height: 400px; overflow: auto; }
.network-check [data-carrier] { animation: network-in 120ms ease-out; }
@media (max-width: 1100px) { .network-table table { min-width: 1000px; } }
@keyframes network-in { from { opacity: 0; transform: translateY(4px); } }
.network-controls { position: sticky; top: 0; z-index: 2; }

.server-unavailable { --spinner: 20px; }
.server-unavailable h3 { display: flex; align-items: center; gap: 12px; margin: 0; }
.server-unavailable h3 .spinner { color: var(--accent); }
.connection-recovery { min-height:52px; display:flex; align-items:center; gap:16px; margin:0 auto 12px; padding:4px 4px 4px 16px; width:calc(100% - 32px); max-width:680px; flex-shrink:0; border:1px solid var(--border); border-radius:12px; background:var(--surface); font-variant-numeric:tabular-nums; }
.connection-recovery span { flex:1; color:var(--dim); font-size:13px; }
.connection-recovery button { min-height:44px; justify-content:center; padding:0 12px; flex:none; font-weight:600; }
.connection-recovery button:disabled { opacity:.4; cursor:default; }
@media (max-width:720px) { .connection-recovery { margin-inline:16px; } }

.called-number { height: 1.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }

.dialog-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.dialog-actions > button:not(.primary) { color:var(--dim); }

/* Operational time controls keep native date/time fields intact when the filter bar wraps. */
.time-window { flex-wrap: wrap; align-items: end; }
.filter-bar input.time-input { width: auto; }
