/* Call Intelligence — design system.
   Switchboard palette: blue-grey paper, navy ink, two fixed party colours.
   Data colours validated with the dataviz skill's validator (2026-10-25). */

@font-face { font-family: "Plex"; src: url("/static/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/static/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/static/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --line: #dce1e7;
  --line-strong: #c4ccd6;
  --ink: #14213d;
  --ink-2: #44506a;
  --ink-3: #6b7686;
  --focus: #2a78d6;
  --nav: #14213d;
  --nav-ink: #c9d2e3;
  --nav-ink-active: #ffffff;
  --button: #14213d;
  --button-ink: #ffffff;
  /* data */
  --customer: #2a78d6;
  --csr: #eb6834;
  --answered: #6250d6;
  --missed: #eda100;
  --positive: #1baf7a;
  --negative: #e34948;
  --neutral: #9aa0a8;
  --bar: #3d4f6e;
  --warning: #fab219;
  --critical: #d03b3b;
  --customer-tint: #e8f1fc;
  --csr-tint: #fdeee7;
  --warning-tint: #fff4dc;
  --mark: #fff1c2;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .05);
  --radius-l: 12px;
  --radius-m: 8px;
  --radius-s: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --paper: #0f1621; --surface: #172131; --surface-2: #1d2939; --line: #2a3648; --line-strong: #3a475b;
    --ink: #e6ebf2; --ink-2: #aeb8c6; --ink-3: #8693a5; --focus: #3987e5;
    --nav: #0b111a; --nav-ink: #9aa8bd; --nav-ink-active: #ffffff; --button: #e6ebf2; --button-ink: #0f1621;
    --customer: #3987e5; --csr: #d95926; --answered: #9085e9; --missed: #c98500;
    --positive: #199e70; --negative: #e66767; --neutral: #77808c; --bar: #8fa3c0;
    --customer-tint: #17304d; --csr-tint: #3a2419; --warning-tint: #3a2d10; --mark: #4a3b0c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1621; --surface: #172131; --surface-2: #1d2939; --line: #2a3648; --line-strong: #3a475b;
  --ink: #e6ebf2; --ink-2: #aeb8c6; --ink-3: #8693a5; --focus: #3987e5;
  --nav: #0b111a; --nav-ink: #9aa8bd; --nav-ink-active: #ffffff; --button: #e6ebf2; --button-ink: #0f1621;
  --customer: #3987e5; --csr: #d95926; --answered: #9085e9; --missed: #c98500;
  --positive: #199e70; --negative: #e66767; --neutral: #77808c; --bar: #8fa3c0;
  --customer-tint: #17304d; --csr-tint: #3a2419; --warning-tint: #3a2d10; --mark: #4a3b0c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.55 "Plex", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 15px; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--nav) 228px, transparent 228px); }
.nav { background: var(--nav); color: var(--nav-ink); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: var(--nav-ink-active); text-decoration: none; font-weight: 600; font-size: 15px; }
.brand svg { flex: none; }
.nav a.item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-s); text-decoration: none; color: var(--nav-ink); font-weight: 500; }
.nav a.item:hover { background: rgba(255, 255, 255, .06); color: var(--nav-ink-active); }
.nav a.item[aria-current="page"] { background: rgba(255, 255, 255, .1); color: var(--nav-ink-active); }
.nav a.item .count { margin-left: auto; background: var(--warning); color: #14213d; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 20px; }
.nav .spacer { flex: 1; }
.nav .foot { display: flex; flex-direction: column; gap: 6px; padding: 0 4px; }
.nav .foot button { width: 100%; justify-content: flex-start; background: transparent; color: var(--nav-ink); border-color: rgba(255, 255, 255, .14); }
.nav .foot button:hover { color: var(--nav-ink-active); border-color: rgba(255, 255, 255, .3); }
.main { padding: 28px 32px 48px; max-width: 1360px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-weight: 500; font-size: 14px; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: var(--radius-s); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.3;
}
button:hover, .btn:hover { border-color: var(--ink-3); }
button.primary { background: var(--button); color: var(--button-ink); border-color: var(--button); }
button.primary:hover { filter: brightness(1.12); }
button.warn { background: var(--warning); border-color: var(--warning); color: #14213d; }
button:disabled { opacity: .5; cursor: not-allowed; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.segmented button { border: 0; border-radius: 0; border-right: 1px solid var(--line); padding: 6px 12px; background: transparent; }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
select, input[type="search"], input[type="text"], input[type="password"] {
  font: inherit; font-size: 14px; padding: 7px 10px; border-radius: var(--radius-s); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); min-width: 0;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }

/* ---------- figures band (headline numbers, one band, not tiles) ---------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); margin-bottom: 20px; box-shadow: var(--shadow); }
.figure { padding: 16px 20px; border-left: 1px solid var(--line); }
.figure:first-child { border-left: 0; }
.figure .label { color: var(--ink-3); font-size: 13px; }
.figure .value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin-top: 2px; }
.figure .note { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.figure .live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--critical); margin-right: 6px; vertical-align: middle; }

/* ---------- panels ---------- */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); min-width: 0; }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.panel > header .hint { color: var(--ink-3); font-size: 13px; }
.panel .body { padding: 14px 20px 18px; }
.panel .chart { position: relative; height: 240px; }
.panel .chart.tall { height: 300px; }
.panel .chart.short { height: 180px; }
.table-toggle { font-size: 12.5px; padding: 3px 8px; }
.panel table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
.panel table.data th, .panel table.data td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.panel table.data td.n, .panel table.data th.n { text-align: right; }

/* legends: identity never colour-alone */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin: 10px 0 0; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* meters: share bars with labels */
.split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.split > span { display: block; min-width: 2px; }
.split-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-top: 6px; }

/* ranked lists (topics, reasons, entities) */
.ranked { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.ranked li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: 14px; }
.ranked .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranked .count { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ranked .track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ranked .track span { display: block; height: 100%; background: var(--bar); border-radius: 3px; }
.ranked a { text-decoration: none; }
.ranked a:hover .name { text-decoration: underline; }
.empty { color: var(--ink-3); font-size: 14px; padding: 6px 0; }
.empty strong { color: var(--ink-2); font-weight: 500; }

/* ---------- pills & tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; line-height: 20px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; background: var(--surface); }
.pill.live { background: var(--critical); border-color: var(--critical); color: #fff; }
.pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.pill.positive { color: var(--ink); border-color: var(--positive); }
.pill.positive::before { content: "▲"; color: var(--positive); font-size: 9px; }
.pill.negative { color: var(--ink); border-color: var(--negative); }
.pill.negative::before { content: "▼"; color: var(--negative); font-size: 9px; }
.pill.neutral::before { content: "●"; color: var(--neutral); font-size: 8px; }
.pill.needed { background: var(--warning-tint); border-color: var(--warning); color: var(--ink); }
.pill.needed::before { content: "↩"; font-weight: 600; }
.pill.called_back { border-color: var(--positive); color: var(--ink); }
.pill.called_back::before { content: "✓"; color: var(--positive); }
.pill.missed { background: var(--warning-tint); border-color: var(--warning); color: var(--ink); }
.tag { display: inline-block; font-size: 12.5px; padding: 1px 8px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); margin: 0 4px 4px 0; }
.tag.intent { border-color: var(--line-strong); color: var(--ink); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: var(--surface-2); }
table.list .caller { font-weight: 500; }
table.list .sub { color: var(--ink-3); font-size: 12.5px; }

/* ---------- call page ---------- */
.call-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-bottom: 18px; }
.call-head h1 { font-size: 24px; }
.call-head .meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 14px; }
.back { color: var(--ink-3); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--ink); }
.layout-call { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.rail { display: grid; gap: 20px; }
.summary { font-size: 16px; line-height: 1.6; max-width: 70ch; }
.summary-meta { margin-top: 10px; font-size: 13px; color: var(--ink-3); }

/* the conversation ribbon: who spoke when, coloured by sentiment */
.ribbon { width: 100%; height: 64px; display: block; }
.ribbon .lane-label { font-size: 12px; fill: var(--ink-3); }
.ribbon rect.turn { rx: 3; }
.ribbon-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-3); margin: 8px 0 14px; }

/* two-lane transcript */
.transcript { height: 62vh; min-height: 320px; overflow-y: auto; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.turn-msg { max-width: 78%; padding: 9px 13px 10px; border-radius: 12px; position: relative; }
.turn-msg.customer { align-self: flex-start; background: var(--customer-tint); border-top-left-radius: 4px; }
.turn-msg.csr { align-self: flex-end; background: var(--csr-tint); border-top-right-radius: 4px; }
.turn-msg.unknown { align-self: center; background: var(--surface-2); }
.turn-msg .who { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 2px; }
.turn-msg .who b { font-weight: 600; color: var(--ink-2); }
.turn-msg.customer .who b::before, .turn-msg.csr .who b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.turn-msg.customer .who b::before { background: var(--customer); }
.turn-msg.csr .who b::before { background: var(--csr); }
.turn-msg.interim { opacity: .62; }
.turn-msg.interim .text::after { content: " …"; }
.turn-msg .low-conf { color: var(--ink-3); font-size: 12px; }
.entity { background: transparent; border-bottom: 2px solid var(--answered); padding: 0 1px; cursor: help; }
.keyterm { background: var(--mark); border-radius: 3px; padding: 0 2px; font-weight: 500; }
.transcript .status-line { align-self: center; font-size: 13px; color: var(--ink-3); padding: 4px 10px; }
.transcript.empty-transcript { height: auto; min-height: 0; padding: 18px 20px 22px; }
[hidden] { display: none !important; }

/* callback panel */
.callback-box { border-left: 4px solid var(--warning); }
.callback-box.done { border-left-color: var(--positive); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.history { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.history li { display: flex; justify-content: space-between; gap: 10px; }

/* sentiment detail */
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.stat-row .k { font-size: 12.5px; color: var(--ink-3); }
.stat-row .v { font-weight: 600; }
.compare { font-size: 13px; color: var(--ink-2); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* toasts */
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: var(--radius-m); font-size: 14px; box-shadow: var(--shadow); max-width: 380px; }
.toast.error { background: var(--critical); color: #fff; }
.banner { padding: 10px 14px; border-radius: var(--radius-m); background: var(--warning-tint); border: 1px solid var(--warning); color: var(--ink); font-size: 14px; margin-bottom: 16px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 30px 28px; }
.login-card .brand { color: var(--ink); padding: 0 0 18px; }
.login-card label { display: block; font-weight: 500; margin: 18px 0 6px; }
.login-card input { width: 100%; padding: 10px 12px; }
.login-card .hint { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.login-card .error { color: var(--critical); margin-top: 12px; min-height: 1.4em; font-size: 14px; }
.login-card button { width: 100%; justify-content: center; margin-top: 18px; padding: 10px; }

/* skeleton while loading */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; color: transparent !important; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout-call { grid-template-columns: minmax(0, 1fr); }
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .nav { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; overflow-x: auto; }
  .brand { padding: 4px 8px 4px 0; }
  .brand span { display: none; }
  .nav .spacer, .nav .foot .theme-label { display: none; }
  .nav .foot { flex-direction: row; }
  .nav .foot button { width: auto; }
  .main { padding: 18px 16px 40px; }
  .figure { border-left: 0; border-top: 1px solid var(--line); }
  .figure:first-child { border-top: 0; }
  .turn-msg { max-width: 92%; }
  .transcript { height: 55vh; }
}
@media (max-width: 520px) {
  .nav { gap: 2px; }
  .nav a.item { padding: 9px 10px; }
  .nav a.item .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav a.item .count { margin-left: 2px; }
  .nav .foot button { padding: 7px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .swatch, .split > span, .ranked .track span { forced-color-adjust: none; }
}

/* ---------- agent workspace ---------- */
.main.ws-main { max-width: none; padding: 0; }
.ws { display: grid; grid-template-columns: 300px minmax(0, 1fr) 400px; height: 100vh; }
.ws-col { min-height: 0; display: flex; flex-direction: column; }
.ws-queue { background: var(--surface); border-right: 1px solid var(--line); }
.ws-center { background: var(--paper); }
.ws-side { background: var(--surface); border-left: 1px solid var(--line); }
.ws-head { padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.ws-head h1 { font-size: 19px; }
.ws-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.ws-scroll { overflow-y: auto; min-height: 0; flex: 1; }
.q-section { padding: 12px 10px 4px; }
.q-section h2 { font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 0 8px 6px; letter-spacing: 0; }
.q-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 10px 10px 12px; border-radius: var(--radius-m); cursor: pointer; border: 1px solid transparent; position: relative; text-align: left; width: 100%; background: none; font: inherit; color: inherit; }
.q-item:hover { background: var(--surface-2); }
.q-item[aria-selected="true"] { background: var(--surface-2); border-color: var(--line-strong); }
.q-item[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--focus); }
.q-item .num { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item .when { color: var(--ink-3); font-size: 12.5px; text-align: right; white-space: nowrap; }
.q-item .what { grid-column: 1 / -1; color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.q-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--neutral); }
.q-item .dot.positive { background: var(--positive); }
.q-item .dot.negative { background: var(--negative); }
.q-item .dot.live { background: var(--critical); animation: pulse 1.4s ease-in-out infinite; }
.q-empty { color: var(--ink-3); font-size: 13.5px; padding: 4px 10px 10px; }
.q-foot { border-top: 1px solid var(--line); padding: 12px 18px; font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.q-foot a { color: var(--ink); }

.ws-call-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ws-call-head .who { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.ws-call-head .timer { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 14px; }
.ws-call-head .spacer { flex: 1; }
.ws-call-head > span:empty:not(.spacer) { display: none; }
.ws-summary { margin: 16px 22px 0; padding: 12px 16px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; }
.ws-summary .k { font-size: 12.5px; color: var(--ink-3); margin-bottom: 2px; }
.ws-center .transcript { height: auto; flex: 1; min-height: 0; padding: 16px 22px 24px; }
.ws-empty { margin: auto; text-align: center; color: var(--ink-3); max-width: 34ch; padding: 40px 20px; }
.ws-empty h2 { color: var(--ink); margin-bottom: 6px; }

.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 9px 10px 10px; color: var(--ink-3); font-weight: 500; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button .badge { font-size: 11.5px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.tab-body { padding: 16px 18px 24px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: flex; justify-content: space-between; gap: 8px; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.field > span small { color: var(--ink-3); font-weight: 400; font-size: 12.5px; }
.field textarea, .field input[type="text"] { width: 100%; font: inherit; font-size: 14px; padding: 9px 11px; border-radius: var(--radius-s); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); resize: vertical; }
.field textarea { min-height: 92px; line-height: 1.5; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; }
.codes label { position: relative; }
.codes input { position: absolute; opacity: 0; pointer-events: none; }
.codes label > span { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-strong); cursor: pointer; background: var(--surface); }
.codes input:checked + span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.codes input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.codes .suggested { font-size: 11px; font-weight: 600; color: var(--answered); }
.codes input:checked + span .suggested { color: inherit; }
.ai-note { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--answered); font-weight: 500; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 18px; }
.done-row { display: flex; gap: 8px; align-items: center; }
.done-row .primary { padding: 9px 18px; }
.saved-card { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px; }
.saved-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 10px 0 0; font-size: 14px; }
.saved-card dt { color: var(--ink-3); }
.saved-card dd { margin: 0; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline .node { position: absolute; left: 3px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); background: var(--neutral); }
.timeline .node.positive { background: var(--positive); }
.timeline .node.negative { background: var(--negative); }
.timeline .node.missed { background: var(--missed); }
.timeline .node.live { background: var(--critical); }
.timeline .row1 { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-3); }
.timeline .row2 { font-weight: 500; margin-top: 1px; }
.timeline .row3 { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.timeline li.current .row2::after { content: "This call"; margin-left: 8px; font-size: 11.5px; font-weight: 600; color: var(--focus); }
.timeline a { text-decoration: none; }
.timeline a:hover .row2 { text-decoration: underline; }

.snip-search { width: 100%; margin-bottom: 14px; }
.snip-group h3 { font-size: 12.5px; color: var(--ink-3); font-weight: 600; margin: 14px 0 6px; }
.snip { border: 1px solid var(--line); border-radius: var(--radius-m); margin-bottom: 8px; background: var(--surface); }
.snip > button { width: 100%; border: 0; background: none; text-align: left; padding: 10px 12px; display: flex; justify-content: space-between; gap: 8px; font-weight: 500; }
.snip > button::after { content: "+"; color: var(--ink-3); font-weight: 400; }
.snip.open > button::after { content: "−"; }
.snip .snip-body { padding: 0 12px 12px; font-size: 14px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; }
.snip .snip-actions { display: flex; gap: 6px; margin-top: 10px; }
.snip .snip-actions button { font-size: 12.5px; padding: 4px 10px; }
.snip.suggested { border-color: var(--answered); }
.add-snippet { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.add-snippet summary { cursor: pointer; font-weight: 500; }
.add-snippet form { margin-top: 12px; }

@media (max-width: 1280px) { .ws { grid-template-columns: 270px minmax(0, 1fr) 360px; } }
@media (max-width: 1100px) {
  .ws { display: block; height: auto; }
  .ws-col { min-height: auto; }
  .ws-queue .ws-scroll { max-height: 40vh; }
  .ws-center .transcript { height: 60vh; flex: none; }
  .ws-side { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- text messages ---------- */
.msg { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: 100vh; }
.msg-thread { background: var(--paper); }
.msg-banner { margin: 16px 22px 0; }
.new-text { display: flex; gap: 8px; margin-top: 12px; }
.new-text input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 7px 10px; border-radius: var(--radius-s); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
#convos { padding: 8px 10px; }
.q-item .preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.q-item .unread { flex: none; font-size: 11.5px; font-weight: 600; color: var(--button-ink); background: var(--focus); border-radius: 999px; padding: 0 7px; line-height: 18px; }

.sms { display: flex; flex-direction: column; min-height: 0; }
.sms-page { flex: 1; }
.sms-log { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; }
.sms-empty { margin: auto; }
.sms-msg { max-width: min(520px, 78%); }
.sms-msg.out { align-self: flex-end; text-align: right; }
.sms-msg .sms-body { display: inline-block; text-align: left; padding: 9px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.sms-msg.in .sms-body { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.sms-msg.out .sms-body { background: var(--button); color: var(--button-ink); border-bottom-right-radius: 4px; }
.sms-msg.bad .sms-body { box-shadow: inset 3px 0 0 var(--negative); }
.sms-msg .sms-meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.sms-msg.bad .sms-meta { color: var(--negative); }
.sms-msg .sms-meta a { color: inherit; }
.sms > .banner { margin: 0 22px 10px; }
.sms-compose { border-top: 1px solid var(--line); background: var(--surface); padding: 12px 22px 14px; }
.sms-compose textarea { width: 100%; font: inherit; font-size: 14.5px; line-height: 1.45; padding: 9px 11px; border-radius: var(--radius-s); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); resize: vertical; min-height: 64px; }
.sms-compose-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.sms-compose-row select { font: inherit; font-size: 13.5px; padding: 6px 8px; border-radius: var(--radius-s); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); max-width: 260px; }
.sms-meter { flex: 1; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.sms-dialog { width: min(560px, calc(100vw - 32px)); height: min(640px, calc(100vh - 48px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--paper); color: var(--ink); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.sms-dialog[open] { display: flex; flex-direction: column; }
.sms-dialog::backdrop { background: rgba(10, 16, 26, .45); }
.sms-dialog > header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.sms-dialog > header h2 { font-size: 17px; flex: 1; }
.sms-dialog > header .close { border: 0; background: none; font-size: 22px; line-height: 1; padding: 2px 8px; color: var(--ink-3); }
.sms-dialog > .sms { flex: 1; }

@media (max-width: 1100px) {
  .msg { display: block; height: auto; }
  #convos { max-height: 36vh; }
  .sms-page .sms-log { height: 55vh; flex: none; }
}
.timeline .node.text { border-radius: 3px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink-3); }
.timeline .node.text.out { box-shadow: none; background: var(--button); }
/* Header buttons wrap as one group, right-aligned, rather than one by one. */
.ws-call-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
#c-actions { display: flex; gap: 8px; }
#c-actions:empty { display: none; }
