/* Next Home Voice Ops. Brand tokens follow webapp/DESIGN.md (nextdirect.com); the layout is a sidebar
   app shell (dark navigation, content in a raised panel, slide-over call detail). */
:root {
  --ink: #111111; --black: #000000; --ink-2: #424242; --muted: #767676;
  --line: #dddddd; --line-soft: #eeeeee; --surface: #f7f7f7; --stone: #eee7dc; --stone-2: #e3d9c8; --white: #ffffff;
  --red: #d01a42; --green: #1e7a46; --amber: #9a6200; --blue: #1d89dd;
  --side-bg: #000000; --side-ink: #f2f2f2; --side-muted: #8a8a8a; --side-line: #1f1f1f; --side-hover: #161616;
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Cormorant Garamond", "Times New Roman", serif;
  --font-text: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --track: .14em; --ease: 150ms ease-out; --side-w: 252px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 400 14px/1.5 var(--font-text);
  font-variation-settings: "wdth" 100; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.caps { font-family: var(--font-display); font-variation-settings: "wdth" 125; text-transform: uppercase;
  letter-spacing: var(--track); font-size: 10.5px; font-weight: 600; }
svg { flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-ink); position: sticky; top: 0; height: 100vh; display: flex;
  flex-direction: column; padding: var(--s5) var(--s3) var(--s3); overflow: hidden; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s2) var(--s5); }
.brand { text-decoration: none; line-height: 1; display: inline-block; }
.brand .w { display: block; font-family: var(--font-display); font-variation-settings: "wdth" 125; font-weight: 500;
  font-size: 24px; letter-spacing: .3em; color: var(--white); }
.brand .sub { display: block; margin-top: 7px; font-family: var(--font-display); font-variation-settings: "wdth" 125;
  font-size: 8.5px; letter-spacing: .3em; color: var(--side-muted); text-transform: uppercase; }
.brand.dark .w { color: var(--black); font-size: 19px; }
.brand.dark .sub { color: var(--ink-2); font-size: 7.5px; margin-top: 5px; }
.side-close { display: none; background: none; border: 0; color: var(--side-ink); padding: 6px; cursor: pointer; }
.side-close svg { width: 18px; height: 18px; }
.create { display: flex; align-items: center; gap: 10px; background: var(--white); color: var(--black); text-decoration: none;
  min-height: 44px; padding: 0 var(--s3); font-family: var(--font-display); font-variation-settings: "wdth" 125;
  text-transform: uppercase; letter-spacing: .12em; font-size: 11.5px; font-weight: 700; border: 1px solid var(--white);
  transition: background var(--ease), color var(--ease); }
.create:hover { background: var(--black); color: var(--white); }
.create svg { width: 15px; height: 15px; }
.create .chev { margin-left: auto; width: 13px; height: 13px; }
.side-nav { margin-top: var(--s4); flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #333 transparent;
  padding-bottom: var(--s3); }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 0 var(--s3); text-decoration: none;
  color: #d6d6d6; font-size: 14px; position: relative; border-left: 2px solid transparent; transition: background var(--ease), color var(--ease); }
.side-nav a svg { width: 16px; height: 16px; color: var(--side-muted); }
.side-nav a:hover { background: var(--side-hover); color: var(--white); }
.side-nav a[aria-current="page"] { background: var(--side-hover); color: var(--white); border-left-color: var(--white); }
.side-nav a[aria-current="page"] svg { color: var(--white); }
.side-nav .badge { margin-left: auto; background: var(--red); color: var(--white); font-size: 10.5px; font-weight: 700;
  min-width: 20px; height: 18px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; }
.side-nav .grp { margin: var(--s5) 0 var(--s2); padding: 0 var(--s3); font-family: var(--font-display);
  font-variation-settings: "wdth" 125; text-transform: uppercase; letter-spacing: .2em; font-size: 9.5px; font-weight: 600;
  color: var(--side-muted); }
.side-foot { border-top: 1px solid var(--side-line); padding-top: var(--s3); display: grid; gap: var(--s3); }
.search { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 38px; padding: 0 var(--s3); background: none;
  border: 0; color: #d6d6d6; cursor: pointer; text-align: left; font-size: 14px; }
.search:hover { background: var(--side-hover); color: var(--white); }
.search svg { width: 16px; height: 16px; color: var(--side-muted); }
.search kbd { margin-left: auto; font: 11px var(--font-text); color: var(--side-muted); border: 1px solid #333; padding: 1px 5px; }
.me { display: flex; align-items: center; gap: 10px; padding: var(--s1) var(--s2); }
.avatar { width: 32px; height: 32px; background: var(--stone); color: var(--black); display: inline-flex; align-items: center;
  justify-content: center; font-family: var(--font-display); font-variation-settings: "wdth" 125; font-weight: 600; font-size: 13px; }
.me .who { display: grid; min-width: 0; line-height: 1.25; }
.me .who b { font-weight: 500; font-size: 13px; color: var(--white); }
.conn { display: inline-flex; align-items: center; gap: 6px; color: var(--side-muted); font-size: 11.5px; white-space: nowrap; }
.signout { margin-left: auto; background: none; border: 0; color: var(--side-muted); font-size: 11.5px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; }
.signout:hover { color: var(--white); }
.side-scrim { display: none; }

.stage { padding: var(--s3); min-width: 0; overflow-x: clip; }
.mobilebar { display: none; }
.panel-main { background: var(--white); border: 1px solid var(--line); min-height: calc(100vh - 24px); min-width: 0; outline: 0; }

/* ---------- page header ---------- */
.ph { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  padding: var(--s4) var(--s6); border-bottom: 1px solid var(--line); min-height: 68px; }
.ph-title { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; min-width: 0; }
.ph h1 { font-family: var(--font-serif); font-weight: 500; text-transform: uppercase; letter-spacing: .07em; font-size: 26px;
  line-height: 1.1; margin: 0; }
.ph .lede { color: var(--muted); font-size: 13px; }
.ph .actions { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.body { padding: var(--s5) var(--s6) var(--s7); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px;
  padding: 0 var(--s4); border: 1px solid var(--ink); background: var(--white); color: var(--ink); cursor: pointer;
  border-radius: 0; text-decoration: none; font-family: var(--font-display); font-variation-settings: "wdth" 125;
  text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 700; transition: background var(--ease), color var(--ease); white-space: nowrap; }
.btn:hover { background: var(--ink); color: var(--white); }
.btn.primary { background: var(--ink); color: var(--white); }
.btn.primary:hover { background: var(--white); color: var(--ink); }
.btn.danger { background: var(--red); border-color: var(--red); color: var(--white); }
.btn.danger:hover { background: var(--white); color: var(--red); }
.btn.ghost { border-color: transparent; padding: 0 var(--s2); background: transparent; }
.btn.ghost:hover { background: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.btn.line { border-color: var(--line); }
.btn.line:hover { border-color: var(--ink); }
.btn.sm { min-height: 32px; padding: 0 var(--s3); font-size: 10.5px; }
.btn.icon { width: 38px; padding: 0; border-color: var(--line); }
.btn.icon:hover { border-color: var(--ink); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 14px; height: 14px; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.link-arrow:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.link-arrow svg { width: 12px; height: 12px; }

/* ---------- segmented tabs ---------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); padding: 3px; gap: 2px; }
.seg button { border: 1px solid transparent; background: transparent; padding: 0 var(--s3); min-height: 30px; cursor: pointer;
  font-family: var(--font-display); font-variation-settings: "wdth" 125; text-transform: uppercase; letter-spacing: .1em;
  font-size: 10.5px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--white); border-color: var(--ink); color: var(--ink); }
.seg .n { color: var(--muted); font-weight: 500; letter-spacing: 0; }

/* ---------- status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.live .dot, .dot.live { background: var(--red); animation: pulse 1.4s infinite; }
.pill.ringing .dot { background: var(--amber); }
.pill.ok .dot, .dot.ok { background: var(--green); }
.pill.fail .dot { background: var(--red); }
.pill.fail { color: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .pill.live .dot, .dot.live { animation: none; } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line); font-size: 11px;
  font-family: var(--font-display); font-variation-settings: "wdth" 125; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 600; color: var(--ink-2); white-space: nowrap; background: var(--white); }
.chip svg { width: 11px; height: 11px; }
.chip.in svg { color: var(--blue); }
.chip.stone { background: var(--stone); border-color: var(--stone); color: var(--ink); }
.chip.dark { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chip.redline { border-color: var(--red); color: var(--red); }
.tag { display: inline-block; padding: 2px 6px; background: var(--surface); font-size: 11px; color: var(--ink-2); font-family: var(--font-mono); }
.tag.src-livekit, .tag.src-orchestrator { background: #eef4fb; } .tag.src-plivo { background: #f3eefb; } .tag.src-agent { background: var(--stone); }
.tag.src-recorder { background: #eef7f1; } .tag.src-app { background: var(--surface); }

/* ---------- cards ---------- */
.card { border: 1px solid var(--line); background: var(--white); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line-soft); }
.card-h h2 { margin: 0; font-family: var(--font-display); font-variation-settings: "wdth" 125; text-transform: uppercase;
  letter-spacing: var(--track); font-size: 11.5px; font-weight: 700; }
.card-h p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.card-b { padding: var(--s4) var(--s5); }
.grid { display: grid; gap: var(--s4); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack > * + * { margin-top: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.spacer { flex: 1; }

/* overview hero */
.hero { padding: var(--s6) var(--s6) var(--s5); border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(0deg, transparent 0 55px, #f3f3f3 55px 56px),
    repeating-linear-gradient(90deg, transparent 0 55px, #f3f3f3 55px 56px), var(--white); }
.hero .greet { color: var(--ink-2); font-size: 13px; }
.hero h1 { font-family: var(--font-serif); font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
  font-size: 44px; line-height: 1.02; margin: var(--s2) 0 0; max-width: 24ch; }
.hero p { margin: var(--s3) 0 var(--s5); color: var(--ink-2); max-width: 62ch; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s5); }
.quick.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qcard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px var(--s3); align-items: start; padding: var(--s4);
  border: 1px solid var(--line); background: var(--white); text-decoration: none; transition: border-color var(--ease); }
.qcard:hover { border-color: var(--ink); }
.qcard .ico { grid-row: span 2; width: 32px; height: 32px; background: var(--stone); display: inline-flex; align-items: center; justify-content: center; }
.qcard .ico svg { width: 15px; height: 15px; }
.qcard .ico.red { background: #fbe9ed; color: var(--red); }
.qcard b { font-weight: 600; font-size: 14px; }
.qcard span { color: var(--muted); font-size: 12.5px; line-height: 1.4; }

/* stats strip */
.strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto; align-items: stretch; border: 1px solid var(--line); }
.strip .st { padding: var(--s4) var(--s5); border-right: 1px solid var(--line-soft); min-width: 0; }
.strip .v { font-family: var(--font-serif); font-weight: 500; font-size: 34px; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.strip .v small { font-size: 17px; margin-left: 2px; }
.strip .l { margin-top: var(--s2); font-family: var(--font-display); font-variation-settings: "wdth" 125; text-transform: uppercase;
  letter-spacing: .12em; font-size: 9.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.strip .side-ctl { display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: var(--s2); padding: var(--s3) var(--s4); }
.spark { width: 120px; height: 34px; display: block; }

/* KPI cards (calls page) */
.kcards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.kcard { border: 1px solid var(--line); padding: var(--s4); min-width: 0; }
.kcard .k { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--font-display);
  font-variation-settings: "wdth" 125; text-transform: uppercase; letter-spacing: .12em; font-size: 9.5px; font-weight: 600; }
.kcard .k svg { width: 13px; height: 13px; }
.kcard .v { font-family: var(--font-serif); font-weight: 500; font-size: 34px; line-height: 1; margin-top: var(--s3); font-variant-numeric: lining-nums tabular-nums; }
.kcard .v small { font-size: 17px; }
.kcard .d { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* list rows (recent calls) */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line-soft); }
.lrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5);
  text-decoration: none; }
a.lrow:hover { background: var(--surface); }
.lrow .ico { width: 34px; height: 34px; background: var(--surface); border: 1px solid var(--line-soft); display: inline-flex; align-items: center; justify-content: center; }
.lrow .ico svg { width: 14px; height: 14px; }
.lrow .ico.in svg { color: var(--blue); }
.lrow b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .s { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.lrow .when { color: var(--muted); font-size: 12.5px; white-space: nowrap; text-align: right; min-width: 74px; }

/* live cards */
.live-list { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.live-card { border: 1px solid var(--ink); padding: var(--s4); display: grid; grid-template-columns: 1fr auto; gap: var(--s3); align-items: center; }
.live-card .num { font-family: var(--font-mono); font-size: 14px; margin-top: 8px; }
.live-card .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.live-card .timer { font-family: var(--font-serif); font-size: 28px; font-variant-numeric: tabular-nums; text-align: right; }
.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--ink-2); }
.empty.boxed { border: 1px dashed var(--line); }
.empty b { display: block; font-family: var(--font-serif); font-size: 22px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink); margin-bottom: 6px; }

/* chart + breakdown */
.chart svg { width: 100%; height: 180px; display: block; }
.chart .legend { display: flex; gap: var(--s4); font-size: 12px; color: var(--ink-2); margin-top: var(--s2); }
.chart .sw { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.bars { display: grid; gap: var(--s3); }
.bars .b { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--s3); align-items: center; font-size: 13px; }
.bars .track { grid-column: 1 / -1; height: 4px; background: var(--line-soft); }
.bars .fill { height: 100%; background: var(--ink); }
.bars .fill.fail { background: var(--red); }
.bars .fill.ok { background: var(--green); }

/* ---------- filters + table ---------- */
.filters { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s3); }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 8px var(--s3); border: 1px solid var(--line);
  background: var(--white); border-radius: 0; outline-offset: 0; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); outline: 1px solid var(--ink); }
.filters select.input { width: auto; min-width: 170px; }
.filters .searchbox { position: relative; flex: 1 1 280px; max-width: 420px; }
.filters .searchbox svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.filters .searchbox .input { padding-left: 34px; }
.tablebox { border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; position: relative; } /* relative: keeps absolutely-positioned .sr-only headers inside the scroller */
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px var(--s4); background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap;
  font-family: var(--font-display); font-variation-settings: "wdth" 125; text-transform: uppercase; letter-spacing: .12em;
  font-size: 9.5px; font-weight: 600; color: var(--ink-2); }
.table td { padding: 11px var(--s4); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface); }
.table tr.sel td { background: var(--stone); }
.table td a.rowlink { text-decoration: none; font-weight: 500; }
.table td a.rowlink:hover { text-decoration: underline; }
.table .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cust b { display: block; font-weight: 500; }
.cust span { color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.icons { display: inline-flex; gap: 8px; color: #c4c4c4; }
.icons svg { width: 15px; height: 15px; }
.icons .on { color: var(--ink); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) var(--s4);
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.pager .row { gap: var(--s2); }
.pager select { min-height: 32px; width: auto; padding: 4px 8px; }
.pager .nav { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--white); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pager .nav:hover:not([disabled]) { border-color: var(--ink); }
.pager .nav[disabled] { opacity: .35; cursor: not-allowed; }
.pager .nav svg { width: 12px; height: 12px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: var(--s4); }
.field label, .field .lbl { display: block; margin-bottom: 6px; font-family: var(--font-display); font-variation-settings: "wdth" 125;
  text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 600; }
.field input, .field select, .field textarea { min-height: 44px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.field .err { color: var(--red); font-size: 12px; margin-top: 6px; }
.field input[aria-invalid="true"] { border-color: var(--red); }
.pw { position: relative; }
.pw input { padding-right: 44px; }
.pw button { position: absolute; right: 0; top: 0; height: 100%; width: 44px; background: none; border: 0; cursor: pointer; color: var(--muted); }
.pw button:hover { color: var(--ink); }
.pw svg { width: 17px; height: 17px; }

/* ---------- drawer (call detail) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; animation: fade .15s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); background: var(--white); z-index: 41;
  display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0, 0, 0, .12); animation: slide .2s ease-out; outline: 0; }
@keyframes slide { from { transform: translateX(32px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim { animation: none; } }
.dr-h { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--s5) var(--s4); border-bottom: 1px solid var(--line-soft); }
.dr-h h2 { margin: 0; font-family: var(--font-serif); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; font-size: 26px; line-height: 1.1; }
.dr-h .meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: 12.5px; }
.dr-close { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--white); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.dr-close:hover { border-color: var(--ink); }
.dr-close svg { width: 14px; height: 14px; }
.dr-b { flex: 1; overflow-y: auto; padding: var(--s4) var(--s5) var(--s5); }
.dr-f { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s3) var(--s5); border-top: 1px solid var(--line); background: var(--white); }
.player { border: 1px solid var(--line); padding: var(--s3); background: var(--surface); }
.player audio { width: 100%; height: 40px; display: block; }
.player .row { margin-top: var(--s2); font-size: 12px; color: var(--muted); }
.player .note { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); margin: var(--s3) 0 var(--s4); }
.cells > div { padding: var(--s3) var(--s4); min-width: 0; }
.cells > div + div { border-left: 1px solid var(--line-soft); }
.cells .k { color: var(--muted); font-size: 11.5px; }
.cells .v { font-weight: 500; margin-top: 2px; overflow-wrap: anywhere; }
.transcript { display: grid; gap: var(--s3); }
.bubble { max-width: 82%; }
.bubble .who { font-size: 11px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; }
.bubble .txt { padding: 10px 14px; background: var(--stone); line-height: 1.45; overflow-wrap: anywhere; }
.bubble.caller, .bubble.colleague { justify-self: end; }
.bubble.caller .who, .bubble.colleague .who { justify-content: flex-end; }
.bubble.caller .txt { background: var(--ink); color: var(--white); }
.bubble.colleague .txt { background: var(--white); border: 1px solid var(--ink); }
.bubble.interim .txt { opacity: .6; font-style: italic; }
.bubble.tool { max-width: 100%; justify-self: center; text-align: center; }
.bubble.tool .txt { display: inline-flex; gap: 6px; align-items: center; background: transparent; border: 1px dashed var(--line);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); padding: 4px 10px; max-width: 100%;
  text-align: left; overflow-wrap: anywhere; }
.bubble.tool .txt svg { width: 12px; height: 12px; flex: none; } /* without a size the icon fills the transcript */
.sec { border-top: 1px solid var(--line); margin-top: var(--s5); }
.sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: var(--s3) 0;
  font-family: var(--font-display); font-variation-settings: "wdth" 125; text-transform: uppercase; letter-spacing: var(--track); font-size: 11px; font-weight: 700; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "+"; font-family: var(--font-text); font-size: 16px; font-weight: 400; }
.sec[open] > summary::after { content: "−"; }
.sec > div { padding-bottom: var(--s3); }
.h-sec { display: flex; align-items: center; justify-content: space-between; margin: var(--s4) 0 var(--s3);
  font-family: var(--font-display); font-variation-settings: "wdth" 125; text-transform: uppercase; letter-spacing: var(--track); font-size: 11px; font-weight: 700; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px var(--s4); margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.outcome { border-left: 3px solid var(--ink); padding: var(--s3) var(--s4); background: var(--surface); margin-bottom: var(--s3); }
.outcome b { font-family: var(--font-serif); font-size: 21px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; display: block; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 64px 100px minmax(0, 1fr); gap: var(--s2); padding: var(--s2) 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; align-items: start; }
.tl.wide li { grid-template-columns: 150px 108px minmax(0, 1fr); padding: 10px var(--s4); }
.tl.wide li:last-child { border-bottom: 0; }
.tl time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.tl details summary { cursor: pointer; list-style: none; }
.tl details summary::-webkit-details-marker { display: none; }
.tl details summary::after { content: " +"; color: var(--muted); }
.tl details[open] summary::after { content: " −"; }
pre.json { background: var(--surface); padding: var(--s3); font: 11.5px/1.45 var(--font-mono); overflow-x: auto; max-height: 280px;
  margin: var(--s2) 0 0; white-space: pre-wrap; word-break: break-all; }

/* ---------- integrations ---------- */
.status-line { display: flex; align-items: center; gap: var(--s2); }
.status-line b { font-family: var(--font-serif); font-size: 22px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.copy { display: flex; gap: 0; }
.copy input { flex: 1; min-height: 36px; border: 1px solid var(--line); border-right: 0; padding: 0 var(--s3); font-family: var(--font-mono);
  font-size: 12px; background: var(--surface); min-width: 0; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 var(--s4) 40px; }
.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: -4px; font-family: var(--font-serif); font-size: 24px; }
.steps li b { display: block; font-weight: 600; }
.steps li span { color: var(--ink-2); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s5) var(--s4); background: var(--white); }
.login .inner { width: min(400px, 100%); }
.login .brand .w { color: var(--black); font-size: 26px; }
.login .brand .sub { color: var(--ink-2); }
.login h1 { font-family: var(--font-serif); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; font-size: 38px; line-height: 1; margin: var(--s7) 0 var(--s2); }
.login p.lede { color: var(--ink-2); margin: 0 0 var(--s5); }
.login .btn { width: 100%; min-height: 46px; }
.login .help { color: var(--muted); font-size: 12.5px; margin-top: var(--s4); }

/* ---------- toast ---------- */
.toasts { position: fixed; right: var(--s4); bottom: var(--s4); display: grid; gap: var(--s2); z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--white); padding: var(--s3) var(--s4); font-size: 13px; border-left: 4px solid var(--green); }
.toast.fail { border-left-color: var(--red); }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .strip .st:nth-child(3n) { border-right: 0; }
  .strip .st:nth-child(-n+3) { border-bottom: 1px solid var(--line-soft); }
  .strip .side-ctl { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; border-top: 1px solid var(--line-soft); }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .cols-main, .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .kcards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 45; transform: translateX(-100%);
    transition: transform .2s ease-out; }
  .shell.nav-open .side { transform: none; }
  .side-close { display: inline-flex; }
  .side-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 44; }
  .stage { padding: 0; }
  .mobilebar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--white);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .mobilebar .menu { background: none; border: 1px solid var(--line); width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
  .mobilebar .menu svg { width: 16px; height: 16px; }
  .mobilebar .btn { margin-left: auto; }
  .panel-main { border: 0; min-height: calc(100vh - 63px); }
  .ph { padding: var(--s4); min-height: 0; }
  .body { padding: var(--s4) var(--s4) var(--s7); }
  .hero { padding: var(--s5) var(--s4); }
  .hero h1 { font-size: 32px; }
}
@media (max-width: 600px) {
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .qcard { grid-template-columns: auto minmax(0, 1fr); align-items: center; padding: var(--s3); }
  .qcard .ico { grid-row: auto; }
  .qcard span:not(.ico) { display: none; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip .st { border-right: 0 !important; border-bottom: 1px solid var(--line-soft); padding: var(--s3) var(--s4); }
  .strip .st:nth-child(odd) { border-right: 1px solid var(--line-soft) !important; }
  .strip .v { font-size: 28px; }
  .kcards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kcard .v { font-size: 28px; }
  .filters select.input, .filters .searchbox { flex: 1 1 100%; max-width: none; min-width: 0; }
  .hide-sm { display: none; }
  .lrow { grid-template-columns: auto minmax(0, 1fr) auto; padding: var(--s3) var(--s4); }
  .lrow .chip { display: none; }
  .card-h, .card-b { padding-left: var(--s4); padding-right: var(--s4); }
  .cells { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cells > div:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line-soft); }
  .dr-h, .dr-b, .dr-f { padding-left: var(--s4); padding-right: var(--s4); }
  .bubble { max-width: 92%; }
  .tl li { grid-template-columns: 56px minmax(0, 1fr); }
  .tl li .tag { grid-column: 2; justify-self: start; }
  .tl li > :last-child { grid-column: 2; }
  .tl.wide li { grid-template-columns: minmax(0, 1fr); }
  .tl.wide li > * { grid-column: 1 !important; }
  .live-list { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- agent page ---------- */
.agent-page > * + * { margin-top: var(--s4); }
.ag-statusbar { justify-content: space-between; }
#ag-status { gap: var(--s3); }
#ag-warn:empty, #ag-publish-panel:empty { display: none; }
.ag-tabs { flex-wrap: wrap; }
.ag-body { margin-top: var(--s4); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field textarea.prompt { min-height: 520px; font-size: 12.5px; line-height: 1.6; resize: vertical; }
.field.dial label { display: flex; justify-content: space-between; align-items: baseline; }
.field.dial output { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0; text-transform: none; font-weight: 500; color: var(--ink); }
.field input[type="range"], .segrow input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; min-height: 0; height: 2px;
  padding: 0; border: 0; background: var(--line); outline: none; margin: 14px 0 8px; }
.field input[type="range"]::-webkit-slider-thumb, .segrow input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px;
  background: var(--ink); border: 0; cursor: pointer; }
.field input[type="range"]::-moz-range-thumb, .segrow input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; background: var(--ink); border: 0; border-radius: 0; cursor: pointer; }
.field input[type="range"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.field input[type="range"]:disabled { opacity: .35; }
.field.toggle label { display: flex; align-items: center; gap: var(--s2); text-transform: none; letter-spacing: 0; font-family: var(--font-text);
  font-variation-settings: "wdth" 100; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; }
.field.toggle input { width: 16px; height: 16px; min-height: 0; accent-color: var(--ink); margin: 0; }
.current-voice { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); background: var(--stone); margin-bottom: var(--s4); }
.current-voice b { font-family: var(--font-serif); font-size: 22px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.voice-search .input { flex: 1 1 200px; width: auto; }
.voice-search select.input { flex: 0 0 auto; }
.vlist { list-style: none; margin: var(--s4) 0 0; padding: 0; max-height: 560px; overflow: auto; border-top: 1px solid var(--line); }
.vlist li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line-soft); }
.vlist li.sel { background: var(--stone); padding-left: var(--s3); padding-right: var(--s3); }
.vlist li p { margin: 2px 0 0; color: var(--ink-2); font-size: 12.5px; }
.vlist li .muted { font-size: 12px; margin-left: 6px; }
.vlist li .row { flex-wrap: nowrap; }
.segs { margin-top: var(--s4); }
.segrow { display: grid; grid-template-columns: minmax(0, 1fr) 200px auto; gap: var(--s3); align-items: center; margin-bottom: var(--s2); }
.seg-speed { display: grid; grid-template-columns: auto 1fr 40px; gap: var(--s2); align-items: center; font-size: 12px; color: var(--muted); }
.seg-speed input[type="range"] { margin: 0; }
.seg-speed output { font-family: var(--font-mono); color: var(--ink); }
#ag-audio { flex: 1 1 240px; height: 36px; }
.karaoke { margin-top: var(--s4); font-size: 17px; line-height: 1.9; min-height: 1.9em; }
.karaoke span.on { background: var(--stone-2); }
details.events { margin-top: var(--s3); font-size: 12.5px; color: var(--muted); }
details.events ol { font-family: var(--font-mono); margin: var(--s2) 0 0; }
.rendered { margin: 0; padding: var(--s3); background: var(--stone); }
.publish-card { border-color: var(--ink); }
ul.changes { list-style: none; margin: 0 0 var(--s4); padding: 0; max-height: 280px; overflow: auto; }
ul.changes li { display: grid; grid-template-columns: minmax(140px, 240px) minmax(0, 1fr); gap: var(--s3); padding: 6px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 13px; }
ul.changes .k { color: var(--muted); }
ul.changes .v { overflow-wrap: anywhere; }
ul.changes s { color: var(--muted); margin-right: 6px; }
.table td.right { text-align: right; }
@media (max-width: 900px) {
  .cols-3 { grid-template-columns: 1fr; }
  .segrow { grid-template-columns: 1fr; }
  ul.changes li { grid-template-columns: 1fr; }
  .field textarea.prompt { min-height: 360px; }
}
.agent-page .seg { flex-wrap: wrap; max-width: 100%; }
.builtin-note { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; width: 100%;
  padding: var(--s3) var(--s4); border: 1px solid var(--ink); background: var(--stone); font-size: 13px; }
