/* Supervisor wallboard — matches the palette/typography of /validation/. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --ink: #16233b;
  --muted: #5d6b82;
  --line: #e3e8f0;
  --line-strong: #c9d4e8;
  --brand: #1f55d6;
  --brand-soft: #eaf0fe;
  --ok: #178a50;
  --ok-soft: #e7f5ee;
  --busy: #1f55d6;
  --busy-soft: #eaf0fe;
  --wrap: #b26a05;
  --wrap-soft: #fcf3e3;
  --away: #69758a;
  --away-soft: #eef1f5;
  --alert: #c92a2a;
  --alert-soft: #fbeaea;
  --alert-border: #f0c4c4;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(22, 35, 59, 0.06), 0 4px 14px rgba(22, 35, 59, 0.05);
  --shadow-hover: 0 6px 20px rgba(22, 35, 59, 0.12);
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.dim {
  color: var(--muted);
}

/* --------------------------------- topbar -------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 8px 20px;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-copy small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.4px;
}

.brand-copy .customer-name {
  max-width: min(42vw, 320px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.validation-badge {
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

.customer-picker,
.scope {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scope {
  position: relative;
}

.scope-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  min-width: 140px;
  justify-content: space-between;
}

.scope-caret {
  color: var(--muted);
  font-size: 0.7rem;
}

.scope-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 10px 12px;
  z-index: 40;
}

.scope-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
}

.scope-popover-head strong {
  font-weight: 600;
  color: var(--ink);
}

.scope-popover-actions {
  display: flex;
  gap: 8px;
}

.scope-link {
  background: transparent;
  border: none;
  color: var(--brand);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.scope-link:hover {
  text-decoration: underline;
}

.scope-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scope-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  border-radius: 6px;
}

.scope-item:hover {
  background: var(--bg);
}

.scope-item input {
  accent-color: var(--brand);
  cursor: pointer;
}

.scope-item .name {
  flex: 1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
}

.scope-item .hint {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--muted);
}

.qcard-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.qcard:hover .qcard-close,
.qcard-close:focus-visible {
  opacity: 1;
}

.qcard-close:hover {
  background: var(--alert-soft);
  color: var(--alert);
}

.picker-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.customer-picker input,
select {
  font: inherit;
  font-size: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--ink);
}

.customer-picker input {
  width: 140px;
  font-family: "IBM Plex Mono", monospace;
}

.customer-picker input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
}

select {
  min-width: 130px;
  max-width: 180px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.live-status .pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--away);
}

.live-status[data-mode="live"] {
  color: var(--ok);
}

.live-status[data-mode="live"] .pip {
  background: var(--ok);
}

.live-status[data-mode="polling"] {
  color: var(--wrap);
}

.live-status[data-mode="polling"] .pip {
  background: var(--wrap);
}

.live-status[data-mode="error"] {
  color: var(--alert);
}

.live-status[data-mode="error"] .pip {
  background: var(--alert);
}

.clock {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.chip-btn {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.chip-btn--primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-weight: 600;
}

.chip-btn--primary:hover {
  filter: brightness(1.05);
  color: #fff;
}

/* --------------------------------- ribbon -------------------------------- */

.ribbon {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--alert-soft);
  color: var(--alert);
  border-bottom: 1px solid var(--alert-border);
  padding: 10px 26px;
  font-size: 0.85rem;
}

.ribbon-label {
  background: var(--alert);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
}

.ribbon-msg {
  flex: 1;
  color: var(--ink);
  font-weight: 500;
}

.ribbon-since {
  color: var(--muted);
  font-size: 0.75rem;
}

/* --------------------------------- wrap ---------------------------------- */

.wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* --------------------------------- KPI ----------------------------------- */

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.kpi-strip--secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 12px;
  position: relative;
  overflow: hidden;
}

.kpi.breach {
  border-left: 4px solid var(--alert);
  padding-left: 12px;
}

.kpi.breach .kpi-val {
  color: var(--alert);
}

.kpi-label {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi-val {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kpi--secondary .kpi-val {
  font-size: 1.35rem;
}

.kpi-foot {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.35;
  font-family: "IBM Plex Mono", monospace;
  min-height: 1em;
}

/* --------------------------------- panels -------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.panel-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0;
}

.panel-quiet {
  opacity: 0.85;
}

.hollow {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

/* -------------------------------- queues --------------------------------- */

.queue-grid {
  padding: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}

.qcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.qcard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
}

.qcard:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.qcard.status-breach {
  border-left: 4px solid var(--alert);
  padding-left: 14px;
}

.qcard.status-warn {
  border-left: 4px solid var(--wrap);
  padding-left: 14px;
}

.qcard.status-ok {
  border-left: 4px solid var(--ok);
  padding-left: 14px;
}

.qcard-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.qcard-eyebrow {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.qcard-name {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.qcard-day {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.qcard-primary-row {
  display: flex;
  align-items: flex-end;
  gap: 22px;
}

.qcard-primary-row > div:last-child {
  margin-left: auto;
  text-align: right;
}

.qcard-metric-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
  order: 2;
}

.qcard-primary-row > div {
  display: flex;
  flex-direction: column;
}

.qcard-metric-val {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  order: 1;
}

.qcard-primary-row > div:last-child .qcard-metric-val {
  font-size: 1.15rem;
}

.qcard-metric-val.breach {
  color: var(--alert);
}

.qcard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 0;
  margin: 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
}

.qcard-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qcard-stats div + div {
  border-left: 1px solid var(--line);
}

.qcard-stats dt {
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  order: 2;
}

.qcard-stats dd {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  margin: 0;
  order: 1;
}

.qcard-sla {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qbar {
  height: 4px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.qbar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--ok);
}

.qbar-fill.warn {
  background: var(--wrap);
}

.qbar-empty {
  background: repeating-linear-gradient(
    90deg,
    var(--bg) 0 6px,
    var(--surface) 6px 12px
  );
}

.qbar-cap {
  display: flex;
  justify-content: space-between;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--muted);
}

.qcard-agents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
}

.agent-tag {
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.72rem;
}

.agent-tag--on {
  background: var(--busy-soft);
  color: var(--busy);
}

.agent-tag--idle {
  background: var(--ok-soft);
  color: var(--ok);
}

.agent-tag--wrap {
  background: var(--wrap-soft);
  color: var(--wrap);
}

.agent-tag--away {
  background: var(--away-soft);
  color: var(--away);
}

/* --------------------------------- split --------------------------------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
}

@media (max-width: 1080px) {
  .split {
    grid-template-columns: 1fr;
  }
  .kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .kpi-strip,
  .kpi-strip--secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .wrap {
    padding: 16px;
  }
  .topbar {
    padding: 8px 14px;
  }
}

/* -------------------------------- agents --------------------------------- */

.agent-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--away);
}

.legend-on .legend-dot {
  background: var(--busy);
}

.legend-idle .legend-dot {
  background: var(--ok);
}

.legend-wrap .legend-dot {
  background: var(--wrap);
}

.legend-away .legend-dot {
  background: var(--away);
}

.agent-groups {
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.agent-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.agent-group-head .serif-em {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-style: normal;
  font-family: inherit;
}

.agent-group-head .mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.agent-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.agent-tile {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.agent-tile:hover {
  border-color: var(--line-strong);
}

.agent-tile.agent-on {
  border-left: 3px solid var(--busy);
  padding-left: 10px;
}

.agent-tile.agent-idle {
  border-left: 3px solid var(--ok);
  padding-left: 10px;
}

.agent-tile.agent-wrap {
  border-left: 3px solid var(--wrap);
  padding-left: 10px;
}

.agent-tile.agent-away {
  border-left: 3px solid var(--away);
  padding-left: 10px;
  opacity: 0.8;
}

.agent-mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  letter-spacing: 0.02em;
}

.agent-on .agent-mark {
  color: var(--busy);
  background: var(--busy-soft);
  border-color: transparent;
}

.agent-idle .agent-mark {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: transparent;
}

.agent-wrap .agent-mark {
  color: var(--wrap);
  background: var(--wrap-soft);
  border-color: transparent;
}

.agent-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.15;
}

.agent-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  gap: 4px;
}

.agent-caller {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  margin-top: 3px;
  color: var(--busy);
}

.agent-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.agent-state {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

.agent-tile.agent-on .agent-state {
  color: var(--busy);
}

.agent-tile.agent-idle .agent-state {
  color: var(--ok);
}

.agent-tile.agent-wrap .agent-state {
  color: var(--wrap);
}

.agent-timer {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.agent-today {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  color: var(--muted);
}

/* ------------------------------- sidebar --------------------------------- */

.side {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.row:last-child {
  border-bottom: none;
}

.row-title {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
}

.row-sub {
  font-size: 0.7rem;
  margin-top: 2px;
  color: var(--muted);
  letter-spacing: 0;
}

.row-cnam {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  margin-top: 2px;
  line-height: 1.25;
}

.row-metric {
  text-align: right;
  align-self: start;
  padding-top: 2px;
}

.row-timer {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Time-of-day stamp on recently completed (smaller than live wait timers). */
.row-timer--clock {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.row-cap {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}

/* --- Recently completed: 3-col top + full-width meta ---
 *
 *  | icon | caller number     | clock |
 *  | queue · agent · Wait · Talk (full width under all cols) |
 */

.row--recent {
  display: block;
  padding: 10px 16px;
}

.recent-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
  width: 100%;
}

.recent-icon {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
}

.recent-caller {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.recent-caller .row-title {
  font-size: 0.85rem;
  line-height: 1.25;
}

.recent-clock {
  grid-column: 3;
  grid-row: 1;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.01em;
  align-self: center;
}

.recent-meta {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 6px;
  font-size: 0.72rem;
  line-height: 1.35;
  min-width: 0;
  /* Align meta text under caller column (past icon width + gap). */
  padding-left: calc(22px + 10px);
}

/* Outcome badge: disposition SVG (img) or glyph fallback. */
.outcome-badge {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1.5px solid transparent;
  box-sizing: border-box;
  overflow: hidden;
}

.outcome-badge.outcome-svg {
  border: none;
  background: transparent;
  /* SVG files use CSS vars when inlined; as <img> they use file defaults.
     Override theme by recoloring via mask if needed:
     --icon-bg / --icon-fg / --icon-ring live in the SVG sources. */
}

.outcome-badge-img {
  width: 22px;
  height: 22px;
  display: block;
}

.outcome-badge-glyph {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  display: block;
}

.outcome-badge.outcome-ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 35%, transparent);
}

.outcome-badge.outcome-alert {
  color: var(--alert);
  background: var(--alert-soft);
  border-color: color-mix(in srgb, var(--alert) 35%, transparent);
}

.outcome-badge.outcome-wrap {
  color: var(--wrap);
  background: var(--wrap-soft);
  border-color: color-mix(in srgb, var(--wrap) 35%, transparent);
}

.outcome-badge.outcome-muted {
  color: var(--muted);
  background: var(--bg);
  border-color: var(--line);
}

.row-meta-queue {
  font-size: 0.7rem;
}

.row-meta-agent {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 500;
  color: var(--ink);
  opacity: 0.85;
}

.row-meta-sep {
  opacity: 0.45;
}

.recent-meta .row-stat {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-stat-label {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-right: 3px;
}

/* Tone status borders still apply via .row.status-* on the list item */
.row--recent.status-answered,
.row--recent.status-callback_fulfilled {
  /* optional left accent reserved for later */
}

@media (max-width: 420px) {
  .recent-meta {
    padding-left: 0;
  }
}

.row--waiting.breach {
  background: var(--alert-soft);
  border-left: 3px solid var(--alert);
}

.row--waiting.breach .row-timer {
  color: var(--alert);
}

.row.status-answered .row-timer:not(.row-timer--clock),
.row.status-callback_fulfilled .row-timer:not(.row-timer--clock) {
  color: var(--ok);
}

.row.status-abandoned .row-timer:not(.row-timer--clock),
.row.status-timeout .row-timer:not(.row-timer--clock),
.row.status-callback_not_fulfilled .row-timer:not(.row-timer--clock) {
  color: var(--alert);
}

.row.status-breakout .row-timer:not(.row-timer--clock),
.row.status-exit_with_key .row-timer:not(.row-timer--clock) {
  color: var(--wrap);
}

/* ------------------------------ access gate ------------------------------ */
/* Shown when the user hits the public URL without a portal/TV session. */

body[data-auth="pending"] .auth-only,
body[data-auth="anonymous"] .auth-only {
  display: none !important;
}

body[data-auth="signed-in"] .access-gate {
  display: none !important;
}

.access-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 440px;
  margin: 0 auto;
  padding: 72px 24px 96px;
  color: var(--muted);
  text-align: center;
}

.access-gate-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: block;
  object-fit: contain;
  margin-bottom: 4px;
}

.access-gate-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.access-gate-body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--muted);
}

.access-gate-body strong {
  color: var(--ink);
  font-weight: 600;
}

.access-gate-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.access-gate-link:hover {
  background: #1846b5;
  box-shadow: var(--shadow-hover);
}

.access-gate-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.access-gate-footnote {
  margin: 8px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  max-width: 36em;
}

.dash-live {
  display: block;
}

.dash-live[hidden] {
  display: none !important;
}

.serif-em {
  font-style: normal;
}

/* -------------------------------- dialog --------------------------------- */

.dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  max-width: 460px;
  width: calc(100vw - 40px);
  box-shadow: var(--shadow-hover);
}

.dialog::backdrop {
  background: rgba(22, 35, 59, 0.4);
  backdrop-filter: blur(2px);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 26px 20px;
}

.dialog-form h3 {
  margin: 0 0 4px;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  font-style: normal;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.dialog-form p {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.dialog-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: "IBM Plex Sans", sans-serif;
  font-style: normal;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}

.dialog-form .row {
  display: flex;
  gap: 8px;
  padding: 0;
  border: none;
  align-items: center;
}

.dialog-form input {
  flex: 0 0 90px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 6px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  outline: none;
}

.dialog-form input:focus {
  border-color: var(--brand);
}

.dialog-form .unit {
  color: var(--muted);
  font-family: "IBM Plex Sans", sans-serif;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
  font-weight: 500;
}

.dialog-form footer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.dialog-form .spacer {
  flex: 1;
}

/* --------------------------- public mode (session) ----------------------- */

body[data-mode="public"] .customer-picker,
body[data-mode="public"] .customer-picker[hidden] {
  display: none !important;
}

/* TV permalink panel */
.tv-panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 1rem;
}
.tv-panel.hidden {
  display: none;
}
.tv-panel-inner {
  background: var(--surface, #fff);
  color: inherit;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  max-width: 560px;
  width: 100%;
  padding: 1rem 1.25rem 1.25rem;
}
.tv-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.tv-help {
  font-size: 0.85rem;
  margin: 0 0 1rem;
  line-height: 1.4;
}
.tv-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.tv-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.tv-form .tv-grow {
  flex: 1 1 12rem;
}
.tv-form input {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
  min-width: 4rem;
}
.tv-created {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--muted-bg, #f1f5f9);
  border-radius: 8px;
}
.tv-created.hidden {
  display: none;
}
.tv-created label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.tv-url-row {
  display: flex;
  gap: 0.5rem;
}
.tv-url-row input {
  flex: 1;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.75rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 6px;
}
.tv-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow: auto;
}
.tv-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border, #e2e8f0);
  font-size: 0.85rem;
}
.tv-list .tv-meta {
  flex: 1;
  min-width: 0;
}
.tv-list .tv-meta strong {
  display: block;
}
body[data-mode="wallboard"] #tvLinksBtn,
body[data-mode="wallboard"] .tv-panel {
  display: none !important;
}

/* --------------------------- wallboard TV mode --------------------------- */

body[data-mode="wallboard"] .customer-picker,
body[data-mode="wallboard"] .scope,
/* Keep Thresholds available so longest-wait target can be set on this browser. */
body[data-mode="wallboard"] .chip-btn:not(#wallboardBtn):not(#settingsBtn),
body[data-mode="wallboard"] .validation-badge,
body[data-mode="wallboard"] .qcard-close {
  display: none;
}

body[data-mode="wallboard"] #settingsBtn {
  display: inline-flex;
}

/* Keep an obvious exit control on screen in TV mode. */
body[data-mode="wallboard"] #wallboardBtn {
  display: inline-flex;
}

body[data-mode="wallboard"] {
  font-size: 16px;
}

body[data-mode="wallboard"] .wrap {
  padding: 26px 32px 40px;
  gap: 24px;
  max-width: none;
}

body[data-mode="wallboard"] .kpi-val {
  font-size: 2.2rem;
}

body[data-mode="wallboard"] .qcard-name {
  font-size: 1.15rem;
}

body[data-mode="wallboard"] .qcard-metric-val {
  font-size: 2.6rem;
}
