:root {
  --bg: #f6f6f4; --panel: #ffffff; --text: #1c1c1a; --muted: #6b6b66; --line: #e3e2dd;
  --accent: #2f6fde; --accent-text: #ffffff; --danger: #c8372d; --ok: #2e9a5b; --warn: #b7791f;
  --user: #eef3fd; --agent: #f3f2ee; --write: #fdf5e7; --error: #fbecea;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514; --panel: #1e1e1c; --text: #ecebe6; --muted: #9a9993; --line: #33332f;
    --accent: #5a8ff0; --accent-text: #0f1420; --danger: #e5675d; --ok: #4cc283; --warn: #e0a548;
    --user: #1d2a42; --agent: #262623; --write: #3a2f1c; --error: #43231f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; height: 100%; padding: 16px; }
.control, .timeline {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; min-height: 0;
}
.control { padding: 20px; display: flex; flex-direction: column; gap: 16px; overflow: auto; }
h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0; }
.lead, .hint { color: var(--muted); margin: 0; }
.hint { font-size: 13px; }
.caller { display: grid; justify-items: center; gap: 4px; padding: 12px 0 4px; text-align: center; }
.caller h1 { font-size: 26px; margin: 0; }
.company { color: var(--muted); margin: 8px 0 0; }
.avatar {
  width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-size: 40px; font-weight: 600;
}
.caller.ringing .avatar { animation: ring 1.6s ease-out infinite; }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  100% { box-shadow: 0 0 0 22px transparent; }
}
.clock { margin: 0; font-size: 18px; font-variant-numeric: tabular-nums; }
.actions { display: flex; justify-content: center; gap: 48px; min-height: 92px; align-items: start; }
.round {
  appearance: none; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px;
  display: grid; justify-items: center; gap: 8px; cursor: pointer; padding: 0;
}
.round svg {
  width: 64px; height: 64px; padding: 18px; border-radius: 50%; fill: #fff; box-sizing: border-box;
}
.round.accept svg { background: var(--ok); }
.round.decline svg { background: var(--danger); transform: rotate(135deg); }
.round:disabled { opacity: .5; cursor: default; }
.round[hidden], .again[hidden] { display: none; }
.again {
  appearance: none; border: 1px solid var(--line); border-radius: 999px; padding: 12px 18px;
  font: inherit; font-weight: 600; background: var(--panel); color: var(--text); cursor: pointer;
}
.state { display: flex; align-items: center; gap: 8px; margin: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.idle, .dot.ringing { background: var(--ok); }
.dot.ringing { animation: pulse 1s infinite; }
.dot.connecting, .dot.closing { background: var(--warn); }
.dot.live { background: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.meters { display: grid; gap: 8px; }
.meter { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 80ms linear; }
.facts { display: grid; grid-template-columns: 64px 1fr; gap: 4px 8px; margin: 0; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.timeline { display: flex; flex-direction: column; overflow: hidden; position: relative; }
.timeline-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.toggle { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.feed { list-style: none; margin: 0; padding: 14px 18px; overflow-y: auto; flex: 1; display: grid; gap: 8px; align-content: start; }
.empty { position: absolute; inset: 60px 18px auto; color: var(--muted); text-align: center; margin: 0; }
.turn { padding: 10px 12px; border-radius: 12px; max-width: 78%; }
.turn.user { background: var(--user); justify-self: end; }
.turn.agent { background: var(--agent); justify-self: start; }
.turn.unheard { opacity: .55; }
.turn p { margin: 2px 0 0; white-space: pre-wrap; }
.who { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.who b { color: var(--text); font-weight: 600; }
time, .offset { font-variant-numeric: tabular-nums; }
.work {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline;
  font-size: 13px; padding: 4px 8px; border-radius: 8px; color: var(--muted);
}
.work .text { color: var(--text); overflow-wrap: anywhere; }
.work.write { background: var(--write); }
.work.error { background: var(--error); }
.tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: 6px; padding: 0 6px;
}
.work .detail { grid-column: 1 / -1; display: none; margin: 2px 0 0; font: 12px/1.4 ui-monospace, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed.details .work .detail { display: block; }
.mark { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(420px, 1fr); height: auto; min-height: 100%; }
  .turn { max-width: 92%; }
  .work { grid-template-columns: auto 1fr; }
  .work .offset { grid-column: 2; }
}
