:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1b1f24;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --user: #eef2ff;
  --agent: #f0fdf4;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); }
.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; }
.tabs { display: flex; gap: 4px; }
.tab { background: none; border: 1px solid transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font: inherit; text-decoration: none; }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.health { margin-left: auto; font-size: 12px; }
main { padding: 16px 20px; max-width: 1400px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.grid-2 { display: grid; grid-template-columns: 380px 1fr; gap: 16px; }
.grid-2.profiles { grid-template-columns: 320px 1fr; }
@media (max-width: 900px) { .grid-2, .grid-2.profiles { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 15px; }
label { display: block; margin-bottom: 10px; font-weight: 600; font-size: 13px; }
input, select, textarea { width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
textarea { font-family: var(--mono); font-size: 12.5px; }
button { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.row.between { justify-content: space-between; margin-top: 0; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.error { color: var(--danger); margin-top: 8px; min-height: 1em; white-space: pre-wrap; }
.hidden { display: none !important; }
details { margin: 8px 0; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; }

.pill { padding: 3px 10px; border-radius: 999px; background: #e5e7eb; font-size: 12px; font-weight: 600; }
.pill.live { background: #dcfce7; color: var(--ok); }
.pill.dialing, .pill.ringing, .pill.answered { background: #fef3c7; color: var(--warn); }
.pill.ended, .pill.failed { background: #fee2e2; color: var(--danger); }

.stats { display: flex; gap: 18px; flex-wrap: wrap; padding: 8px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.stats .k { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stats .v { font-weight: 700; font-size: 15px; font-family: var(--mono); }

.transcript { height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.transcript.tall { height: 520px; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); position: relative; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 3px; }
.bubble.agent { align-self: flex-start; background: var(--agent); border-bottom-left-radius: 3px; }
.bubble.partial { opacity: .65; font-style: italic; }
.bubble .meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-family: var(--mono); font-size: 11px; font-weight: 700; background: #e5e7eb; color: #374151; }
.badge.fast { background: #dcfce7; color: var(--ok); }
.badge.mid { background: #fef3c7; color: var(--warn); }
.badge.slow { background: #fee2e2; color: var(--danger); }
.badge.interrupted { background: #fde68a; color: #92400e; }
.breakdown { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 3px; }
.tool { align-self: center; width: 90%; border: 1px dashed #c7d2fe; background: #f5f3ff; border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.tool .name { font-weight: 700; font-family: var(--mono); }
.tool pre { margin: 4px 0 0; font-size: 11px; white-space: pre-wrap; }
.sys { align-self: center; font-size: 11px; color: var(--muted); }

.log { max-height: 260px; overflow: auto; background: #0f172a; color: #e2e8f0; padding: 10px; border-radius: 6px; font-size: 11px; font-family: var(--mono); white-space: pre-wrap; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #f3f4f6; }
.summary { background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.list { list-style: none; padding: 0; margin: 0 0 10px; }
.list li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.list li.active { border-color: var(--accent); background: var(--accent-soft); }
.list li .st { font-size: 11px; }
.ok { color: var(--ok); } .bad { color: var(--danger); }
