/* ── Reset + variables ───────────────────────────────────────────────────── */
:root {
  --text:    #edf3fb;
  --muted:   #a3b2c2;
  --soft:    #7f92a6;
  --green:   #22c55e;
  --red:     #ef4444;
  --amber:   #f59e0b;
  --blue:    #38bdf8;
  --indigo:  #818cf8;
  --orange:  #fb923c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1400px 800px at 10% -10%, #14314a 0%, transparent 45%),
    radial-gradient(1200px 700px at 100% 0%,  #1b233d 0%, transparent 40%),
    linear-gradient(180deg, #050b12 0%, #071019 100%);
}

/* ── App shell ───────────────────────────────────────────────────────────── */
.app {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: grid;
}
.app-wall       { grid-template-rows: 64px 1fr 108px; }
.app-dispatcher { grid-template-rows: 64px 1fr 136px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: rgba(4,8,14,.75);
  backdrop-filter: blur(12px);
}
.brand  { font-weight: 800; letter-spacing: .14em; font-size: 28px; color: #63b3ff; }
.event  { font-size: 18px; color: #cbd9e7; }
.user   { font-size: 18px; font-weight: 700; }
.meta   { font-size: 15px; color: #b8c8d8; }
.soft   { color: #8297ac; }
.spacer { flex: 1; }

.alert-pill {
  padding: 8px 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(239,68,68,.22), rgba(239,68,68,.12));
  border: 1px solid rgba(239,68,68,.35);
  color: #ffd2d2;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
}

/* ── System status indicator (Slice 3) — at-a-glance wall health ─────────── */
.sys-status {
  padding: 8px 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .06em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.sys-status.sys-idle { color: #9fb0c2; background: rgba(148,163,184,.10); border-color: rgba(148,163,184,.24); }
.sys-status.sys-ok   { color: #86efac; background: rgba(34,197,94,.12);   border-color: rgba(34,197,94,.34); }
.sys-status.sys-warn { color: #fde68a; background: rgba(245,158,11,.14);  border-color: rgba(245,158,11,.40); animation: pulse 1.6s infinite; }
.sys-status.sys-err  { color: #ffd2d2; background: rgba(239,68,68,.18);   border-color: rgba(239,68,68,.50); animation: pulse 1.2s infinite; }
.admin-link {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #7f92a6;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.1);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.admin-link:hover {
  background: rgba(99,179,255,.1);
  border-color: rgba(99,179,255,.25);
  color: #78c0ff;
}

.logout-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: #7f92a6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.logout-btn:hover {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.28);
  color: #ff9191;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(34,197,94,.7);
}
.live-dot.dot-offline {
  background: #374151;
  box-shadow: none;
  border: 1px solid #4b5563;
}
.clock { font-size: 24px; color: #d9e8f6; font-weight: 700; }

/* ── WS reconnect banner ─────────────────────────────────────────────────── */
.ws-banner {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(245,158,11,.18);
  border-bottom: 1px solid rgba(245,158,11,.35);
  color: #fde68a;
  text-align: center;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
}

/* ── Wall: 3×2 channel grid (legacy, retained for reference) ─────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 14px;
  padding: 14px;
  overflow: hidden;
}

/* ── Wall: four-column department layout (4.1) ───────────────────────────── */
.wall-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
  min-height: 0;
}
.dept-columns {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}
.dept-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}
.dept-head {
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 16px;
  color: #cbd9e7;
  text-align: center;
  padding: 4px 0 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
/* Radio box gets more room than the phone box; both always present per column. */
.dept-radio { flex: 1.5; min-height: 0; display: flex; }
.dept-phone { flex: 1;   min-height: 0; display: flex; }
.dept-radio > .widget, .dept-phone > .widget { width: 100%; height: 100%; }

/* Compact widget header (column mode): one row, no big title, so the transcript
   stream gets the vertical space. */
.widget-compact { grid-template-rows: auto 1fr; }
.whead-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.whead-compact .wmeta { font-size: 12px; color: var(--muted); }
.whead-compact .owner { margin-left: auto; font-size: 12px; color: var(--muted); }

/* Phone half, awaiting 3CX per-extension binding. */
.widget-awaiting { opacity: .72; }
.awaiting-body { display: flex; align-items: center; justify-content: center; padding: 12px; }
.awaiting-note { font-size: 12px; color: #6f8296; text-align: center; letter-spacing: .02em; }

/* ── Widget card (wall + dispatcher phone panels) ────────────────────────── */
.widget {
  background: linear-gradient(180deg, rgba(13,24,36,.95), rgba(9,18,28,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  display: grid;
  grid-template-rows: 74px 1fr;
  min-width: 0;
  min-height: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.03);
  position: relative; /* required for incoming-overlay positioning */
}
.widget.active   { box-shadow: 0 0 0 1px rgba(34,197,94,.25),   0 10px 30px rgba(0,0,0,.24); }
.widget.degraded { box-shadow: 0 0 0 1px rgba(245,158,11,.2),   0 10px 30px rgba(0,0,0,.24); }

/* ── Widget header ───────────────────────────────────────────────────────── */
.whead {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: grid;
  gap: 8px;
}
.r1 { display: flex; align-items: center; gap: 10px; }
.r2 { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }

/* ── Channel title + type tag ────────────────────────────────────────────── */
.title { font-weight: 800; letter-spacing: .06em; font-size: 21px; }
.tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.phone { color: #b8bfff; background: rgba(129,140,248,.12); border-color: rgba(129,140,248,.24); }
.radio { color: #88dbff; background: rgba(56,189,248,.12);  border-color: rgba(56,189,248,.24); }

/* ── Status indicator ────────────────────────────────────────────────────── */
.status       { font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.online       { color: #73f0a4; }
.idle         { color: #b0bfce; }
.degradedtxt  { color: #f3c46b; animation: pulse 1.5s infinite; }
/* Phone-line status */
.line-clear     { color: #73f0a4; }       /* green  — line ready, no active call */
.in-use         { color: #fb923c; }       /* orange — call in progress */
.call-ended-txt { color: #f3c46b; }       /* amber  — call just completed, resetting */
.disconnected   { color: #ef4444; }       /* red    — no capture client */
.ringing-txt    { color: #ef4444; animation: pulse 0.7s infinite; }

/* ── Owner / station label ───────────────────────────────────────────────── */
.owner {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  font-size: 13px;
  color: var(--muted);
}

/* ── Transcript stream ───────────────────────────────────────────────────── */
.stream {
  padding: 10px 12px 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
}

/* ── Buffer — live-entry zone at stream bottom ───────────────────────────── */
.buffer {
  flex: 1;          /* fills remaining space — blocks stack from top, buffer below */
  min-height: 64px; /* always visible breathing room at bottom */
}

/* ── Block enter animation (new messages rise from buffer zone) ───────────── */
@keyframes blockEnter {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.block-enter {
  animation: blockEnter 0.18s ease-out forwards;
}

/* ── Transcript blocks ───────────────────────────────────────────────────── */
.block {
  border-left: 3px solid #334155;
  margin: 0 0 8px;
  background: rgba(255,255,255,.02);
  border-radius: 0 10px 10px 0;
  flex-shrink: 0;
}

/* Phone blocks: conversational — thicker border, more padding, speaker badge */
.caller, .medical, .security {
  border-left-width: 4px;
  padding: 8px 12px 10px;
  background: rgba(255,255,255,.03);
}
.caller   { border-left-color: #64748b; }
.medical  { border-left-color: #22c55e; }
.security { border-left-color: #ef4444; }

/* Radio blocks: flat log-line — time + text on one line, no speaker label */
.radioseg {
  border-left-width: 2px;
  border-left-color: #2a7da8;
  padding: 3px 10px 3px 8px;
  background: rgba(255,255,255,.012);
  margin: 0 0 2px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-radius: 0 5px 5px 0;
}
/* Emergency phone blocks: conversational layout (station-as-phone-speaker) */
.emergency {
  border-left-width: 4px;
  border-left-color: #c2612a;
  padding: 8px 12px 10px;
  background: rgba(194,97,42,.04);
}

/* ── Phone block header row ──────────────────────────────────────────────── */
.meta, .meta2 {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

/* Phone speaker labels: pill badge style */
.who {
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.caller    .who { background: rgba(100,116,139,.2);  color: #c8d3de; border: 1px solid rgba(100,116,139,.3); }
.medical   .who { background: rgba(34,197,94,.12);   color: #6ee7a0; border: 1px solid rgba(34,197,94,.25); }
.security  .who { background: rgba(239,68,68,.12);   color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
.emergency .who { background: rgba(194,97,42,.15);   color: #ffa56f; border: 1px solid rgba(194,97,42,.3); }

.time { color: #6a8090; font-size: 11px; }

/* Phone text: readable conversational size */
.caller .text, .medical .text, .security .text, .emergency .text { font-size: 17px; line-height: 1.35; }

/* Radio log-line: time in radio-blue tint so it reads as a source indicator */
.radioseg .time { color: #4a8fa8; font-size: 11px; flex-shrink: 0; }
.radioseg .text { font-size: 15px; color: #c8d8e8; line-height: 1.3; }

.text     { font-size: 16px; line-height: 1.3; }
.interim  { color: #5a6e7e !important; font-style: italic; }
.critical { color: #ff6d6d !important; font-weight: 800; }

/* ── Transfer divider (prominent box with flash) ─────────────────────────── */
.transfer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 10px;
  padding: 8px 14px;
  background: rgba(129,140,248,.1);
  border: 1px solid rgba(129,140,248,.28);
  border-radius: 10px;
  flex-shrink: 0;
  animation: transferFlash 1.8s ease-out forwards;
}
.transfer::before,
.transfer::after { display: none; } /* remove old line pseudo-elements */

@keyframes transferFlash {
  0%   { background: rgba(129,140,248,.28); border-color: rgba(129,140,248,.55); }
  60%  { background: rgba(129,140,248,.16); border-color: rgba(129,140,248,.38); }
  100% { background: rgba(129,140,248,.08); border-color: rgba(129,140,248,.22); }
}

.transfer-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  color: #7880cc;
  text-transform: uppercase;
  flex-shrink: 0;
}
.transfer-time {
  font-size: 11px;
  color: #6570a8;
  flex-shrink: 0;
}
.transfer-sep {
  flex: 1;
  height: 1px;
  background: rgba(129,140,248,.2);
}
.transfer-route {
  font-size: 13px;
  font-weight: 700;
  color: #c2c6ff;
  flex-shrink: 0;
}

/* ── Incoming call overlay (ringing state) ───────────────────────────────── */
.incoming-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: linear-gradient(180deg, rgba(239,68,68,.18), rgba(120,20,20,.12));
  animation: incomingBorder 0.65s ease-in-out infinite alternate;
}
.incoming-overlay.hidden { display: none; }
@keyframes incomingBorder {
  from { box-shadow: 0 0 0 1px rgba(239,68,68,.3);  }
  to   { box-shadow: 0 0 0 2px rgba(239,68,68,.75), 0 0 30px rgba(239,68,68,.25); }
}
.incoming-word {
  font-size: 54px;
  font-weight: 900;
  color: #ff2222;
  letter-spacing: .1em;
  line-height: 1;
  animation: incomingPulse 0.65s ease-in-out infinite alternate;
}
@keyframes incomingPulse {
  from { opacity: 0.65; transform: scale(0.97); }
  to   { opacity: 1;    transform: scale(1);    }
}

/* ── Call-end line ───────────────────────────────────────────────────────── */
.ended {
  margin: 10px 4px 8px;
  text-align: center;
  color: #c9962a;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .07em;
  flex-shrink: 0;
  background: rgba(243,196,107,.07);
  border: 1px solid rgba(243,196,107,.20);
  border-radius: 8px;
  padding: 9px 12px;
}

/* ── Alerts bottom strip (wall) ──────────────────────────────────────────── */
.alerts {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px 14px;
  background: rgba(5,9,14,.82);
  display: flex;
  gap: 12px;
  align-items: stretch;
  overflow: hidden;
}
.abar-title {
  min-width: 84px;
  color: #aebfd0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  padding-top: 7px;
}
.alert-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  flex: 1;
  padding-bottom: 2px;
  align-items: stretch;
}
/* 1–4 alerts: fill evenly */
.alert {
  flex: 1;
  min-width: 200px;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  display: grid;
  gap: 6px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
/* 5+ alerts: fixed width, scroll horizontally */
.alert-scroll.overflow .alert {
  flex: 0 0 340px;
}
/* Empty state */
.alert-empty {
  align-self: center;
  color: #3a5060;
  font-size: 13px;
  font-style: italic;
  padding: 0 4px;
  white-space: nowrap;
}
.alert.high { background: rgba(239,68,68,.1);   border-color: rgba(239,68,68,.34); }
.alert.med  { background: rgba(251,146,60,.09); border-color: rgba(251,146,60,.28); }

.aline1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #d6e2ef;
}
.sev {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 4px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.alert.high .sev { background: var(--red);    color: white; }
.alert.med  .sev { background: var(--orange); color: white; }
/* action (4.7): accent token, solid fill, high-contrast dark label. The solid
   fill and the explicit ACTION label carry the urgency, not the hue alone.
   The high badge above is intentionally left unchanged. */
.alert.action { background: rgba(129,140,248,.16); border-color: rgba(129,140,248,.55); }
.alert.action .sev {
  background: var(--indigo);
  color: #0b1220;
  font-weight: 900;
  box-shadow: 0 0 0 2px rgba(129,140,248,.45);
}
.aline2 { font-size: 16px; line-height: 1.25; }
.aline3 { font-size: 12px; line-height: 1.2; color: #93a5b8; margin-top: 3px; font-style: italic; }

/* Admin recordings (playback) */
.rec-scope-note { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.rec-pager { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 12px; color: var(--muted); }
.rec-player { margin-top: 14px; padding: 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.03); }
/* Sticky player: stays pinned to the bottom while the recordings list scrolls,
   so Play and the player are never scroll-hunted apart. */
.rec-player:not(.hidden) { position: sticky; bottom: 0; z-index: 5; background: #0c1626; box-shadow: 0 -8px 20px rgba(0,0,0,.35); }
/* Active recording: the row currently loaded in the player. */
.rec-active { background: rgba(56,189,248,.14) !important; box-shadow: inset 3px 0 0 #38bdf8; }
.rec-active td { color: #dbeafe; }
.rec-speech-label { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.rec-player-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.rec-transcripts { margin-top: 10px; max-height: 220px; overflow-y: auto; }
.rec-tr { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; font-size: 13px; color: var(--text); }
.rec-tr-seek { flex-shrink: 0; padding: 1px 7px; border-radius: 5px; border: 1px solid rgba(56,189,248,.34); background: rgba(56,189,248,.12); color: #bfe6ff; font-size: 11px; font-weight: 700; cursor: pointer; }
.rec-tr-empty { font-size: 12px; color: var(--soft); }
.rec-markers { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rec-markers.hidden { display: none; }
.rec-markers-label { font-size: 12px; color: var(--soft); margin-right: 4px; }
.rec-marker { padding: 1px 7px; border-radius: 5px; border: 1px solid rgba(34,197,94,.34); background: rgba(34,197,94,.12); color: #a7f3c8; font-size: 11px; font-weight: 700; cursor: pointer; }
.rec-marker-nav { border-color: rgba(56,189,248,.4); background: rgba(56,189,248,.14); color: #bfe6ff; }
.status-live-label { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; margin-left: auto; margin-right: 10px; cursor: pointer; -webkit-user-select: none; user-select: none; }
/* Server-log list scrolls independently so a live refresh never yanks the page,
   and the reader's scroll position is preserved / auto-paused mid-read. */
.log-table-wrap { max-height: 440px; overflow-y: auto; }
/* Roles permission matrix form (BUILD 1) */
.roles-matrix { max-height: 520px; overflow: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; }
.roles-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.roles-table th { position: sticky; top: 0; background: #0d1826; color: #9fb4c8; text-align: center; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.1); font-weight: 700; white-space: nowrap; z-index: 1; }
.roles-table th:first-child { text-align: left; left: 0; z-index: 2; }
.roles-table td { padding: 4px 8px; border-bottom: 1px solid rgba(255,255,255,.04); }
.roles-table td.perm-name { color: #c8d8e8; white-space: nowrap; font-family: ui-monospace, monospace; position: sticky; left: 0; background: #0b1623; }
.roles-cell { width: 100%; min-width: 92px; background: #0b1623; color: #c8d8e8; border: 1px solid rgba(255,255,255,.12); border-radius: 5px; padding: 3px 6px; font-size: 12px; }
.roles-cell option { background: #0b1623; }
.roles-advanced { margin-top: 12px; font-size: 12px; color: var(--muted); }
.roles-advanced summary { cursor: pointer; }

/* Wall protocol banners: one per active protocol, colour-coded, name + progress. */
#protocol-banners { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.protocol-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; border-radius: 8px; font-weight: 800; letter-spacing: .04em;
  border: 1px solid transparent;
}
.protocol-banner-name { font-size: 14px; }
.protocol-banner-progress { font-size: 13px; font-variant-numeric: tabular-nums; }
.protocol-banner.pc-green { background: rgba(34,197,94,.16);  border-color: rgba(34,197,94,.4);  color: #9ff5c2; }
.protocol-banner.pc-blue  { background: rgba(56,189,248,.16); border-color: rgba(56,189,248,.4); color: #b9e8ff; }
.protocol-banner.pc-red   { background: rgba(239,68,68,.18);  border-color: rgba(239,68,68,.45); color: #ffc2c2; }

/* Loud, persistent banner while the Class B contextual classifier is unreachable. */
.classifier-banner {
  background: rgba(239,68,68,.92);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .03em;
  line-height: 1.3;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  text-align: center;
}

/* ── Dispatcher: 35/65 main layout ──────────────────────────────────────── */
.main {
  display: grid;
  grid-template-columns: 35fr 65fr;
  gap: 8px;
  padding: 8px;
  overflow: hidden;
}
/* Observer mode: no operator channel — collapse left panel, right takes full width */
.main.observer-mode {
  grid-template-columns: 1fr;
}
.main.observer-mode #focus-panel { display: none; }

/* ── Panel card (dispatcher) ─────────────────────────────────────────────── */
.panel {
  background: linear-gradient(180deg, rgba(13,24,36,.95), rgba(9,18,28,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
  min-width: 0;
  min-height: 0;
}

/* ── Focus panel (left) ──────────────────────────────────────────────────── */
.focus {
  display: grid;
  grid-template-rows: 72px 1fr;
  overflow: hidden;
}
.fhead {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: grid;
  gap: 7px;
  background: linear-gradient(180deg, rgba(56,189,248,.08), rgba(56,189,248,.02));
  border-radius: 18px 18px 0 0;
}
.act { font-size: 11px; color: #8edcff; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.row1 { display: flex; align-items: center; gap: 10px; }

/* Focus panel uses larger text */
.focus .title  { font-size: 26px; }
.focus .stream {
  padding: 10px 14px 0;
  overflow-y: auto;
}
.focus .block { margin-bottom: 10px; }
.focus .caller .text,
.focus .medical .text,
.focus .security .text,
.focus .radioseg .text,
.focus .emergency .text { font-size: 22px; line-height: 1.3; }
.focus .interim  { font-size: 18px; }
.focus .buffer { min-height: 64px; }

/* ── Right column — outer TCAS/BRIGID container ──────────────────────────── */
.right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* Outer tab bar: TCAS | BRIGID */
.outer-tab-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 5px 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(4,8,14,.75);
  flex-shrink: 0;
}

.outer-tab {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: rgba(255,255,255,.03);
  color: #b9c9da;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
  user-select: none;
}
.outer-tab:hover  { background: rgba(255,255,255,.06); }
.outer-tab.active { background: rgba(99,179,255,.12); color: #dff1ff; border-color: rgba(99,179,255,.22); }

/* Protocol tabs: colour is on the tab only; the page keeps the system theme. */
.outer-tab.protocol-tab { border-top: 3px solid transparent; }
.outer-tab.protocol-tab.pc-green { border-top-color: var(--green); color: #7ff0b4; }
.outer-tab.protocol-tab.pc-blue  { border-top-color: var(--blue);  color: #9fe0ff; }
.outer-tab.protocol-tab.pc-red   { border-top-color: var(--red);   color: #ffb0b0; }
.outer-tab.protocol-tab.active.pc-green { background: rgba(34,197,94,.14);  border-color: rgba(34,197,94,.3); }
.outer-tab.protocol-tab.active.pc-blue  { background: rgba(56,189,248,.14); border-color: rgba(56,189,248,.3); }
.outer-tab.protocol-tab.active.pc-red   { background: rgba(239,68,68,.14);  border-color: rgba(239,68,68,.3); }

/* Outer tab content pages */
.outer-tabpage         { display: none; flex: 1; flex-direction: column; overflow: hidden; min-height: 0; }
.outer-tabpage.visible { display: flex; }

/* Protocol checklist page (system theme; no full-screen border, no forced ack) */
.protocol-page { flex: 1; overflow-y: auto; padding: 16px 20px; }
.protocol-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.protocol-title { font-size: 18px; font-weight: 800; letter-spacing: .04em; color: var(--text); }
.protocol-page.pc-green .protocol-title { color: #7ff0b4; }
.protocol-page.pc-blue  .protocol-title { color: #9fe0ff; }
.protocol-page.pc-red   .protocol-title { color: #ffb0b0; }
.protocol-progress { font-size: 13px; font-weight: 700; color: var(--muted); }
.protocol-phase {
  font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--soft); margin: 14px 0 6px; border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 4px;
}
.protocol-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer;
}
.protocol-item:hover { background: rgba(255,255,255,.03); }
.protocol-item.done .protocol-text { color: var(--soft); text-decoration: line-through; }
.protocol-cb { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.protocol-owner {
  flex-shrink: 0; min-width: 128px; font-size: 10px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: #8fa3b3; padding-top: 2px;
}
.protocol-text { font-size: 14px; line-height: 1.35; color: var(--text); }
.protocol-meta { display: block; font-size: 11px; color: var(--soft); margin-top: 2px; }
.protocol-meta.unticked { color: var(--amber); }
.protocol-logfail { display: inline-block; font-size: 11px; font-weight: 700; color: #ff9191; margin-top: 2px; }
.protocol-logqueued { display: inline-block; font-size: 11px; font-weight: 700; color: var(--soft); margin-top: 2px; }

/* Call-form activation hook: sits immediately above Submit, hidden unless the
   EMS type matches a protocol. Default No. */
.brigid-activate {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0 0 8px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(129,140,248,.35); background: rgba(129,140,248,.1);
}
.brigid-activate.hidden { display: none; }
.brigid-activate-q { font-size: 13px; font-weight: 700; color: var(--text); }
.brigid-activate-q strong { color: #b9c2ff; }
.brigid-activate-opt { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.brigid-activate-opt input { cursor: pointer; }
.protocol-foot { margin-top: 18px; }
.protocol-close-btn {
  padding: 8px 14px; border-radius: 8px; border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.05); color: var(--text); font-weight: 800; font-size: 12px; cursor: pointer;
}
.protocol-close-btn:hover { background: rgba(255,255,255,.1); }
.protocol-close-panel {
  margin-top: 12px; max-width: 460px; padding: 14px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.03);
}
.pc-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.pc-row label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pc-req { color: var(--amber); }
.pc-row input {
  padding: 7px 9px; border-radius: 7px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.2); color: var(--text); font-size: 14px;
}
.protocol-close-err { font-size: 12px; color: #ff9191; margin-bottom: 10px; line-height: 1.35; }
.pc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pc-actions button { padding: 7px 12px; border-radius: 7px; font-weight: 800; font-size: 12px; cursor: pointer; border: 1px solid transparent; }
.pc-confirm  { background: rgba(56,189,248,.16); border-color: rgba(56,189,248,.34); color: #bfe6ff; }
.pc-confirm:hover { background: rgba(56,189,248,.24); }
.pc-override { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.4); color: #ffd58a; }
.pc-override:hover { background: rgba(245,158,11,.26); }
.pc-back { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.14); color: var(--muted); }

/* TCAS outer tab: phone panels top + sub-tabs bottom, 50/50 split */
#outer-tcas.visible {
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}
#outer-tcas > .topgrid,
#outer-tcas > .tabsPanel {
  flex: 1;
  min-height: 0;
}

/* BRIGID outer tab: content fills full height */
.brigid-outer-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.topgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  min-height: 0;
}

/* ── SOS phone-line card ─────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, rgba(13,24,36,.95), rgba(9,18,28,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.c1        { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cname     { font-weight: 800; letter-spacing: .05em; font-size: 18px; }
.stat      { font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.on        { color: #73f0a4; }
.alertflag { margin-top: 10px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #ff9191; }
.desc      { font-size: 14px; color: #afc0d1; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* ── Tabbed panel (bottom right) ─────────────────────────────────────────── */
.tabsPanel {
  background: linear-gradient(180deg, rgba(13,24,36,.95), rgba(9,18,28,.95));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
  display: grid;
  grid-template-rows: 54px 1fr;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.tabs {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  overflow-x: auto;
  scrollbar-width: thin;
  flex-shrink: 0;
}
.tab {
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  background: rgba(255,255,255,.03);
  color: #b9c9da;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.tab:hover  { background: rgba(255,255,255,.06); }
.tab.active { background: rgba(99,179,255,.12); color: #dff1ff; border-color: rgba(99,179,255,.22); }

.tabbody {
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  position: relative;
}
.tabpage         { display: none; height: 100%; flex-direction: column; }
.tabpage.visible { display: flex; }

/* Tab page channel header */
.tabpage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  font-size: 13px;
}
.tabpage-header .title { font-size: 14px; }

/* Tab channel streams */
.tabpage .stream {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 0;
}
.tabpage .text   { font-size: 14px; }
.tabpage .buffer { min-height: 32px; }

/* Tab empty state */
.tab-empty {
  padding: 14px 0;
  color: #38505e;
  font-size: 12px;
  font-style: italic;
  text-align: center;
  flex-shrink: 0;
}

/* ── Overview tab: 2×2 channel summary grid ──────────────────────────────── */
.overviewGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  height: 100%;
}
.ov {
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.025);
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  overflow: hidden;
}
.ov .cname     { font-size: 15px; }
.alertBadge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}
.alertBadge.action { background: var(--indigo); border: 1px solid rgba(129,140,248,.9); color: #0b1220; font-weight: 900; }
.alertBadge.high { background: rgba(239,68,68,.16);  border: 1px solid rgba(239,68,68,.34);  color: #ffd1d1; }
.alertBadge.med  { background: rgba(251,146,60,.12); border: 1px solid rgba(251,146,60,.28); color: #ffd8bd; }
.alertBadge.none { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); color: #adc0d3; }
.summaryLine     { margin-top: 6px; font-size: 13px; color: #a8bacd; }

/* ── Dispatcher history strip ────────────────────────────────────────────── */
.history {
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(5,9,14,.82);
  padding: 12px 14px;
  overflow: hidden;
}
.htitle { font-size: 12px; color: #9cb0c5; font-weight: 800; letter-spacing: .16em; margin-bottom: 10px; }
.rows   { display: grid; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: 150px 90px 100px 1fr 94px;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,.025);
  font-size: 14px;
}
.rch              { font-weight: 800; letter-spacing: .05em; }
.rt, .rdur, .rpath { color: #9fb3c8; }
.review {
  justify-self: end;
  border: 1px solid rgba(99,179,255,.3);
  color: #78c0ff;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.review:hover { background: rgba(99,179,255,.08); }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* RECEIVING: transcript activity indicator layered on top of ONLINE status.
   The ● dot and "ONLINE" text stay solid — only the waveform glyph pulses.
   Two selectors: focus/tab panels use .status.online; overview cards use .stat.on */
.status.online.receiving,
.stat.on.receiving {
  /* no animation on the container — dot and text must remain solid */
}
.status.online.receiving::after,
.stat.on.receiving::after {
  font-family: 'tabler-icons' !important;  /* Tabler ti-wave-sine \ecd4 */
  content: '\ecd4';
  font-size: 11px;
  font-style: normal;
  font-weight: normal;
  color: #6ee7a0;
  margin-left: 5px;
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
  animation: rxWave 1.2s ease-in-out infinite;
}
@keyframes rxWave {
  0%, 100% { opacity: 1;   }
  50%       { opacity: 0.3; }
}

/* ── BRIGID Dispatch Tab ─────────────────────────────────────────────────── */

.brigid-toolbar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px 3px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

/* Three equal-width action capture buttons */
.brigid-action-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.brigid-action-btn {
  padding: 7px 4px;
  border-radius: 7px;
  border: 1px solid rgba(99,179,255,.28);
  background: rgba(99,179,255,.07);
  color: #78c0ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brigid-action-btn:hover:not(:disabled):not(.recording) { background: rgba(99,179,255,.15); }
.brigid-action-btn.recording {
  background: rgba(239,68,68,.18);
  border-color: rgba(239,68,68,.5);
  color: #ff9191;
  animation: pulse 0.8s infinite;
}
.brigid-action-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Row below the action buttons: mode selector + status */
.brigid-toolbar-bottom { display: flex; align-items: center; gap: 10px; }

.brigid-mode        { display: flex; gap: 10px; }
.brigid-mode-label  { font-size: 11px; color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 4px; }
.brigid-mode-label input { cursor: pointer; accent-color: #63b3ff; }

/* Status text: visible by default, red on error */
.brigid-status       { font-size: 11px; color: #c8d8e8; margin-left: auto; white-space: nowrap; }
.brigid-status-error { color: #ff6b6b !important; font-weight: 700; }

/* Two-column main area below the header */
.brigid-main {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-height: 0;
}

/* Left column: transcript (top 50%) + shift log (bottom 50%) */
.brigid-left-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,.06);
}

/* Right column: Valor Call form at full height */
.brigid-right-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Transcript column — top half of left column */
.brigid-transcript-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Shift log column — bottom half of left column, separated by top border */
.brigid-shiftlog-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid rgba(255,255,255,.06);
}

.brigid-shiftlog-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 3px 6px 4px;
  gap: 3px;
  overflow: hidden;
  min-height: 0;
}

.brigid-sl-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.brigid-sl-code {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 5px;
  padding: 4px 6px;
  color: var(--text);
  font-size: 11px;
  font-family: inherit;
  outline: none;
}
.brigid-sl-code:focus { border-color: rgba(99,179,255,.38); }
/* Native select options do not inherit the page theme on Windows: without this the
   list renders as light text on the OS-default white popup and is invisible until
   hovered. Same fix the admin panel already uses. */
.brigid-sl-code option { background: #0b1623; color: var(--text); }

.brigid-sl-btn-row { display: flex; gap: 4px; flex-shrink: 0; }

.brigid-sl-note {
  flex: none;       /* fixed height — do not flex-grow; lets the table claim its space */
  height: 48px;
  min-height: 0;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 5px;
  padding: 5px 7px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.35;
}
.brigid-sl-note:focus { border-color: rgba(99,179,255,.38); background: rgba(99,179,255,.05); }

.brigid-sl-add-btn {
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid rgba(34,197,94,.35);
  background: rgba(34,197,94,.1);
  color: #6ee7a0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}
.brigid-sl-add-btn:hover:not(:disabled) { background: rgba(34,197,94,.18); }
/* Gated on code selection (4.3). Neutralise the green entirely when disabled: a
   dimmed green still reads as an active control, and a button that looks
   clickable but silently ignores clicks lets the dispatcher believe the entry
   was added. */
.brigid-sl-add-btn:disabled {
  border-color: rgba(255,255,255,.1);
  background: rgba(255,255,255,.03);
  color: var(--soft);
  cursor: not-allowed;
}

/* Shift log session table — scrolls internally; flex:1 takes remaining space after fixed-height note */
.brigid-sl-table-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 40px;   /* always shows at least one row even in tight space */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.06) transparent;
  border-top: 1px solid rgba(255,255,255,.05);
  margin-top: 2px;
}
.brigid-sl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
.brigid-sl-table th {
  text-align: left;
  color: #4a6070;
  font-weight: 800;
  letter-spacing: .05em;
  padding: 3px 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  background: rgba(9,18,28,.98);
  white-space: nowrap;
}
.brigid-sl-table td {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  color: var(--muted);
  vertical-align: top;
}
.brigid-sl-note-cell { color: var(--text); font-size: 11px; }

/* Bottom half: full-width Valor call form */
.brigid-bottom-half {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Clean up button (shift-log note + incident note) */
.brigid-cleanup-btn {
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid rgba(129,140,248,.28);
  background: rgba(129,140,248,.06);
  color: #a5b4fc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
  transition: background 0.1s;
}
.brigid-cleanup-btn:hover:not(:disabled) { background: rgba(129,140,248,.14); }
.brigid-cleanup-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Undo clean-up button — neutral/secondary, starts disabled */
.brigid-undo-btn {
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.12);
  background: transparent;
  color: var(--soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}
.brigid-undo-btn:hover:not(:disabled) { background: rgba(255,255,255,.06); color: var(--muted); }
.brigid-undo-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Wrapper for incident note textarea + cleanup/undo btn row */
.brigid-note-wrap {
  flex: 1;       /* carries the flex:1 from note-row down to the textarea */
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* Inline row for cleanup + undo buttons on the incident note */
.brigid-note-btns {
  display: flex;
  gap: 5px;
  align-items: center;
}

.brigid-col-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  color: #435a6a;
  padding: 3px 8px 2px;
  flex-shrink: 0;
}

.brigid-stream {
  flex: 1;
  overflow-y: auto;
  padding: 2px 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.06) transparent;
}

.brigid-fields {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;   /* spread fields down the column */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.06) transparent;
}

.brigid-field-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}
/* Note row grows to fill remaining column height */
.brigid-note-row  { align-items: flex-start; flex: 1; min-height: 0; }
.brigid-prio-row  { min-height: 22px; }

.brigid-label {
  font-size: 12px;
  color: var(--soft);
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
}

.brigid-input {
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 5px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  min-width: 0;
}
.brigid-input:focus {
  border-color: rgba(99,179,255,.38);
  background: rgba(99,179,255,.05);
}
/* Mandatory field: amber bottom underline, survives focus state */
.brigid-input.brigid-required,
.brigid-input.brigid-required:focus {
  border-bottom: 3px solid #EF9F27;
}

.brigid-textarea {
  flex: 1;       /* grows to fill the note-row's available height */
  min-height: 80px;
  width: 100%;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 5px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
  min-width: 0;
}
.brigid-textarea:focus {
  border-color: rgba(99,179,255,.38);
  background: rgba(99,179,255,.05);
}

.brigid-prio-val {
  font-size: 13px;
  font-weight: 700;
  color: #f3c46b;
}

.brigid-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.brigid-submit {
  padding: 5px 18px;
  border-radius: 7px;
  border: 1px solid rgba(34,197,94,.35);
  background: rgba(34,197,94,.1);
  color: #6ee7a0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.brigid-submit:hover:not(:disabled) { background: rgba(34,197,94,.18); }
.brigid-submit:disabled { opacity: 0.4; cursor: not-allowed; }

.brigid-clear {
  padding: 5px 14px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.14);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.brigid-clear:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.22); }

.brigid-msg      { font-size: 11px; color: var(--muted); }
.brigid-msg.ok   { color: #6ee7a0; }
.brigid-msg.err  { color: #ff9191; }
.brigid-msg.warn { color: #fbbf24; font-weight: 700; }

/* Copy button on transcript log entries */
.brigid-copy-btn {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 7px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 4px;
  background: transparent;
  color: var(--soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}
.brigid-copy-btn:hover { background: rgba(255,255,255,.07); color: var(--muted); }

/* Amber required-field dot in label */
.brigid-req-dot { color: #EF9F27; font-weight: 800; margin-left: 2px; }

/* Call-origin button group */
.brigid-origin-section {
  padding: 8px 0 6px;
}
.brigid-origin-section-label {
  font-size: 12px;
  color: var(--soft);
  font-weight: 700;
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.brigid-origin-group {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.brigid-origin-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 11px 2px 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .03em;
  gap: 5px;
  transition: background 0.1s, border-color 0.1s;
  min-width: 0;
  word-break: break-word;
  text-align: center;
  line-height: 1.2;
}
.brigid-origin-btn:hover:not(.selected) {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.18);
}
.brigid-origin-btn .ti {
  font-size: 20px;
  line-height: 1;
}
.brigid-origin-btn.selected {
  background: rgba(99,179,255,.14);
  border-color: rgba(99,179,255,.45);
  color: #dff1ff;
}

/* ── BRIGID multi-select log ─────────────────────────────────────────────── */

/* Action bar — hidden until multi-select mode */
.brigid-multiselect-bar {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: rgba(99,179,255,.08);
  border-bottom: 1px solid rgba(99,179,255,.15);
}
.brigid-multiselect-bar.visible { display: flex; }

.brigid-ms-count {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.brigid-ms-btn {
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}
.brigid-ms-make-incident {
  border: 1px solid rgba(99,179,255,.3);
  background: rgba(99,179,255,.08);
  color: #78c0ff;
}
.brigid-ms-make-incident:hover:not(:disabled) { background: rgba(99,179,255,.16); }
.brigid-ms-edit-shiftlog {
  border: 1px solid rgba(34,197,94,.3);
  background: rgba(34,197,94,.08);
  color: #6ee7a0;
}
.brigid-ms-edit-shiftlog:hover:not(:disabled) { background: rgba(34,197,94,.16); }
.brigid-ms-commit-shiftlog {
  border: 1px solid rgba(251,146,60,.28);
  background: rgba(251,146,60,.07);
  color: #fb923c;
}
.brigid-ms-commit-shiftlog:hover:not(:disabled) { background: rgba(251,146,60,.15); }
.brigid-ms-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Allow the bar to wrap on narrow transcript columns */
.brigid-multiselect-bar { flex-wrap: wrap; }
.brigid-ms-cancel {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: var(--soft);
}
.brigid-ms-cancel:hover { background: rgba(255,255,255,.06); }

/* All BRIGID log blocks are clickable (enter multi-select) */
#brigid-stream .block { cursor: pointer; }

/* Per-entry checkbox — hidden until multi-select mode activates */
.brigid-block-cb {
  display: none;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #63b3ff;
  margin-right: 5px;
  align-self: center;
}
#brigid-stream.multi-select .brigid-block-cb { display: inline-flex; }
#brigid-stream.multi-select .block          { cursor: pointer; }

/* Checked block highlight (Chrome 105+, which is the required browser) */
#brigid-stream.multi-select .block:has(.brigid-block-cb:checked) {
  background: rgba(99,179,255,.09);
  border-left-color: #63b3ff;
}

/* ── Toast notification ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,18,28,.96);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 11px 20px;
  color: #8ca0b0;
  font-size: 13px;
  z-index: 300;
  pointer-events: none;
  animation: toastIn 0.18s ease-out;
  white-space: nowrap;
}
.toast.fade-out { animation: toastOut 0.25s ease-in forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(-50%) translateY(8px); } }
