/* ToolTalk samples viewer. Palette roles follow the data-viz reference palette:
   series 1 blue = agent, series 2 orange = customer, series 3 aqua = tool-call marks,
   status critical = errors (always with the "!" glyph and the word Error). */
:root {
  color-scheme: light;
  --surface-1: #fcfcfb; --page: #f9f9f7;
  --text-primary: #0b0b0b; --text-secondary: #52514e; --text-muted: #898781;
  --gridline: #e1e0d9; --baseline: #c3c2b7; --border: rgba(11,11,11,0.10);
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --series-noise: #898781;
  --status-critical: #d03b3b;
  --wash-1: rgba(42,120,214,0.10);
  --wash-3: rgba(27,175,122,0.14);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19; --page: #0d0d0d;
    --text-primary: #ffffff; --text-secondary: #c3c2b7; --text-muted: #898781;
    --gridline: #2c2c2a; --baseline: #383835; --border: rgba(255,255,255,0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --series-noise: #898781;
    --status-critical: #d03b3b;
    --wash-1: rgba(57,135,229,0.14);
    --wash-3: rgba(25,158,112,0.22);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* author display rules must not defeat the hidden attribute */
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text-primary); background: var(--page); }
.muted { color: var(--text-muted); }
.small { font-size: 13px; max-width: 80ch; }
.error { color: var(--status-critical); }
a { color: inherit; }
pre { white-space: pre-wrap; word-break: break-word; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; }
code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* header: the set's title and blurb, links to the sibling sets and the dataset */
.top { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 8px 20px; border-bottom: 1px solid var(--gridline); background: var(--surface-1); }
.brand { min-width: 0; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.brand .title { font-size: 16px; font-weight: 600; margin: 1px 0 0; line-height: 1.3; }
.links { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px 16px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; padding-top: 2px; }
.links a { text-decoration: none; }
.links a:hover { text-decoration: underline; }
.siblings a.sibling { padding: 4px 12px; border: 1px solid var(--series-1); color: var(--series-1); border-radius: 14px; font-weight: 600; margin-left: 6px; }
.siblings a.sibling:hover { background: var(--wash-1); text-decoration: none; }
.set-switch select { font: inherit; font-size: 13px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); }

.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100% - 46px); }
.takes { border-right: 1px solid var(--gridline); background: var(--surface-1); overflow: auto; max-height: calc(100vh - 46px); position: sticky; top: 0; }
.panel-head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); padding: 12px 16px 6px; }
#take-list { list-style: none; margin: 0; padding: 0 8px 12px; }
#take-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
#take-list li:hover { background: var(--wash-1); }
#take-list li[aria-selected="true"] { border-color: var(--series-1); background: var(--wash-1); }
#take-list .t1 { font-weight: 600; }
#take-list .t2 { color: var(--text-secondary); font-size: 12px; }
#take-list .dom { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-right: 6px; }
#take-list .sid { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-muted); margin-right: 6px; white-space: nowrap; }

.player { padding: 16px 20px 32px; min-width: 0; }
.empty { padding: 40px 20px; }
.empty p { max-width: 70ch; font-size: 15px; line-height: 1.5; }
.call-head h2 { font-size: 18px; margin: 0 0 2px; font-weight: 600; }
.call-head p { margin: 0 0 4px; }
.about { margin: 2px 0 0; max-width: 100ch; }
.about summary { cursor: pointer; color: var(--text-secondary); }
.about summary span { margin-left: 2px; }
.about[open] summary span { color: var(--text-muted); font-size: 12px; }
.about p { margin: 8px 0 4px; }
#call-desc { color: var(--text-primary); }
.about h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); margin: 12px 0 4px; }
.about pre { color: var(--text-secondary); }

.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0 8px; }
.btn { font: inherit; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--baseline); }
.btn.play { width: 44px; height: 34px; font-size: 15px; }
.clock { font-variant-numeric: tabular-nums; color: var(--text-secondary); min-width: 96px; }
.listen { display: inline-flex; align-items: center; gap: 6px; }
.seg { font: inherit; font-size: 13px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); padding: 4px 10px; cursor: pointer; }
.seg:first-of-type { border-radius: 6px 0 0 6px; } .seg:last-of-type { border-radius: 0 6px 6px 0; margin-left: -1px; }
.seg.on { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); }
/* transcript: both speakers merged by time; the current lines are highlighted during playback */
.transcript { margin-top: 10px; background: var(--surface-1); border: 1px solid var(--gridline); border-radius: 8px; padding: 0 0 8px; }
.transcript .note { font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 8px; }
.turns { list-style: none; margin: 0; padding: 0 8px; max-height: 260px; overflow: auto; font-size: 13px; }
.turn { display: grid; grid-template-columns: 44px 72px minmax(0, 1fr); gap: 0 10px; padding: 3px 8px; border-radius: 6px; cursor: pointer; line-height: 1.4; }
.turn:hover { background: var(--wash-1); }
.turn .t { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 12px; padding-top: 1px; }
.turn .who { font-weight: 600; font-size: 12px; padding-top: 1px; }
.turn.agent .who { color: var(--series-1); } .turn.customer .who { color: var(--series-2); }
.turn .words { color: var(--text-secondary); }
.turn.current { background: var(--wash-3); } .turn.current .words { color: var(--text-primary); }
.turn.has-call { box-shadow: inset 2px 0 0 var(--series-3); }
.calltag { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; vertical-align: 1px; font: 600 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--series-3); background: none; border: 1px solid var(--series-3); border-radius: 10px; padding: 0 7px 0 6px; line-height: 16px; cursor: pointer; }
.calltag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.calltag:hover { background: var(--wash-3); }
.calltag.err { color: var(--status-critical); border-color: var(--status-critical); }
.specs { margin-top: 10px; background: var(--surface-1); border: 1px solid var(--gridline); border-radius: 8px; }
.specs summary { cursor: pointer; padding: 8px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.specs dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; padding: 2px 16px 12px; font-size: 12px; }
.specs dt { color: var(--text-primary); font-weight: 600; }
.specs dd { margin: 0; color: var(--text-secondary); max-width: 130ch; }

/* waveforms left, tool-call panels right when the window is wide enough; stacked otherwise */
.work { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.left { min-width: 0; }
.right { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); gap: 16px; min-width: 0; }
@media (min-width: 1400px) {
  .work { grid-template-columns: minmax(0, 1fr) minmax(400px, 36%); }
  .right { grid-template-columns: 1fr; align-content: start; }
  .right .table-wrap { max-height: 360px; }
}
@media (max-width: 1100px) { .right { grid-template-columns: 1fr; } .layout { grid-template-columns: 240px minmax(0, 1fr); } }

.stage { position: relative; background: var(--surface-1); border: 1px solid var(--gridline); border-radius: 8px; padding: 4px 12px 6px 0; }
.group-wrap { border-top: 3px solid var(--baseline); margin-top: 14px; padding-top: 4px; }   /* the example combined render, under the sources */
.group-wrap summary { cursor: pointer; list-style: none; }
.group-wrap summary::-webkit-details-marker { display: none; }
.group-wrap summary::before { content: '▸'; color: var(--text-muted); font-size: 11px; }
.group-wrap[open] summary::before { content: '▾'; }
.group-head { display: flex; align-items: baseline; gap: 10px; padding: 6px 12px 2px; font-size: 12px; }
.group-head .group-name { text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); font-weight: 600; }
.group.inactive .row { opacity: .5; }
.group.inactive .row.tools, .group.inactive .row.axis-row { opacity: 1; }   /* the tool calls and the time axis belong to every group */
.badge.listening { margin-left: auto; color: var(--text-primary); border-color: var(--baseline); }
.badge.listening::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--text-primary); }
.row { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; }
.row + .row { margin-top: 2px; }
.row-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); padding-left: 12px; align-self: start; padding-top: 4px; line-height: 1.25; }
.row-label.lab-1 { color: var(--series-1); } .row-label.lab-2 { color: var(--series-2); } .row-label.lab-n { color: var(--series-noise); } .row-label.lab-3 { color: var(--series-3); }
.row-label .chan { font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.row-mute { display: block; margin-top: 4px; font: inherit; font-weight: 400; font-size: 11px; line-height: 1.3; padding: 0 7px; border-radius: 10px; border: 1px solid var(--baseline); background: var(--surface-1); color: var(--text-primary); cursor: pointer; }
.row-mute:hover { background: var(--wash-1); }
.row-mute[aria-pressed="true"] { color: var(--text-muted); border-style: dashed; }
.row-mute:disabled { opacity: .45; cursor: default; }
.wave { display: block; width: 100%; height: 64px; cursor: pointer; }
.wave.lane { height: 52px; }
.markers { display: block; width: 100%; height: 40px; overflow: visible; cursor: pointer; }
.axis { display: block; width: 100%; height: 22px; overflow: visible; }
.axis text { font: 11px system-ui, sans-serif; fill: var(--text-muted); font-variant-numeric: tabular-nums; }
.axis line { stroke: var(--baseline); stroke-width: 1; }
.markers .hit { fill: transparent; }
.markers .tick { stroke: var(--series-3); stroke-width: 2; stroke-linecap: round; }
.markers .dot { fill: var(--series-3); stroke: var(--surface-1); stroke-width: 2; }
.markers .span { fill: var(--series-3); opacity: .35; }
.markers .ret { stroke: var(--series-3); stroke-width: 2; }
.markers .err .tick, .markers .err .ret { stroke: var(--status-critical); }
.markers .err .span { fill: var(--status-critical); }
.markers g:hover .span, .markers g.current .span { opacity: .6; }
.markers .err .dot { fill: var(--status-critical); }
.markers .glyph { font: 700 9px system-ui, sans-serif; fill: #fff; text-anchor: middle; pointer-events: none; }
.markers g:hover .dot, .markers g.current .dot { r: 7; }
.markers g:hover .tick, .markers g.current .tick { stroke-width: 3; }
.calllines { position: absolute; pointer-events: none; }
.callline { position: absolute; width: 1px; background: var(--series-3); opacity: .4; transform: translateX(-50%); }   /* centered on its time, like the marker tick */
.callline.err { background: var(--status-critical); }
.callline.ret { width: 0; background: none; border-left: 1px dashed var(--series-3); opacity: .5; }
.callline.ret.err { border-left-color: var(--status-critical); }
.callline.current { opacity: .9; width: 2px; }
.playhead { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; }
.playhead .ph { position: absolute; left: -1px; width: 2px; background: var(--text-primary); opacity: .5; }
.tip { position: absolute; z-index: 2; pointer-events: none; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,.12); border-radius: 6px; padding: 6px 8px; font-size: 12px; max-width: 360px; }
.tip .v { font-weight: 600; }
.tip .k { color: var(--text-secondary); }
.tip code { font-size: 11px; }

/* tool-call panels: the function signature is the primary text */
.now, .log { background: var(--surface-1); border: 1px solid var(--gridline); border-radius: 8px; padding: 0 0 12px; min-width: 0; }
.now-body { padding: 4px 16px 0; }
.now-body .when { color: var(--text-secondary); font-variant-numeric: tabular-nums; font-size: 12px; display: block; margin-bottom: 6px; }
.sig { padding: 8px 10px; border-radius: 6px; background: var(--page); border: 1px solid var(--gridline); font-size: 12.5px; }
.sig .fn { font-weight: 700; color: var(--text-primary); }
.now-body .sig { border-left: 3px solid var(--series-3); }
.now-body .sig .fn { color: var(--series-3); }
.now-body .when::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--series-3); margin-right: 6px; vertical-align: 0; }
.now-body details.result { margin-top: 8px; }
.now-body details.result summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); }
.now-body details.result .preview { margin-left: 8px; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-muted); }
.now-body details.result[open] .preview { display: none; }
.now-body details.result pre { margin-top: 6px; padding: 8px; border-radius: 6px; background: var(--page); max-height: 220px; overflow: auto; }
.now-body.changed { animation: lift .6s ease-out; }
@keyframes lift { from { background: var(--wash-1); } to { background: transparent; } }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 1px 6px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-secondary); }
.badge.err { color: var(--status-critical); border-color: var(--status-critical); font-weight: 600; }
.table-wrap { overflow: auto; max-height: 420px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--text-secondary); font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--gridline); position: sticky; top: 0; background: var(--surface-1); }
td { padding: 6px 10px; border-bottom: 1px solid var(--gridline); vertical-align: top; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--wash-1); }
tbody tr[aria-current="true"] { background: var(--wash-3); box-shadow: inset 3px 0 0 var(--series-3); }
tbody tr[aria-current="true"] .fn { color: var(--series-3); }
tbody tr[aria-current="true"] td.num, tbody tr[aria-current="true"] td.time { color: var(--text-primary); font-weight: 600; }
td.num, td.time { font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
td.call { width: 100%; }
td.call .fn { font: 600 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; }
td.status { white-space: nowrap; }
tr.detail td { background: var(--page); cursor: default; }
tr.detail pre { max-height: 260px; overflow: auto; }
.account { display: inline-flex; align-items: center; gap: 8px; }
button.signin { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--series-1); background: var(--series-1); color: #fff; cursor: pointer; }
button.signin:hover { filter: brightness(1.08); }
button.signout { font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); cursor: pointer; }
#access-note { max-width: 70ch; font-size: 15px; line-height: 1.5; }
#access-note button.signin { vertical-align: baseline; }

/* the call to action: header pill + the card at the foot of the call list ("Discuss the full dataset") */
.cta { display: flex; align-items: center; gap: 10px; margin: 6px 8px 16px; padding: 8px 10px; border: 1px dashed var(--series-1); border-radius: 8px; color: inherit; text-decoration: none; background: var(--wash-1); }
.cta:hover { border-style: solid; }
.cta-top { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--series-1); color: #fff; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; }
.cta-top:hover { filter: brightness(1.08); }
.cta-tile { width: 84px; height: 56px; flex: none; display: grid; place-items: center; font-size: 30px; line-height: 1; color: var(--series-1); border: 1px dashed var(--gridline); border-radius: 4px; background: #fff; }
.cta-col { min-width: 0; display: grid; gap: 2px; }
.cta .t1 { font-weight: 600; } .cta .t2 { color: var(--text-secondary); font-size: 12px; line-height: 1.35; } .cta .cta-action { color: var(--series-1); font-weight: 600; font-size: 12px; }

/* the raw-audio note under the contact card */
.audio-note { margin: 10px 12px 14px; font-size: 12px; line-height: 1.4; }
