:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --line: #e3e6ea;
  --primary: #1f6feb;
  --primary-text: #ffffff;
  --danger: #d1242f;
  --good: #1a7f37;
  --warn: #9a6700;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --card: #182029;
    --text: #e6edf3;
    --muted: #8b949e;
    --line: #2d3742;
    --primary: #4493f8;
    --danger: #f85149;
    --good: #3fb950;
    --warn: #d29922;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }

button, .button {
  font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.link { border: 0; background: none; color: var(--muted); padding: 4px; }
button:disabled { opacity: .5; cursor: default; }
input, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
label { display: block; margin-bottom: 12px; font-weight: 600; }
label input { margin-top: 4px; font-weight: 400; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; }
.login-card button { width: 100%; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; flex-wrap: wrap; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.topbar nav a.active { background: var(--bg); color: var(--text); }

main { max-width: 960px; margin: 0 auto; padding: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row .info { min-width: 0; }
.row .info .sub { color: var(--muted); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; font-weight: 600; }
td.num, th.num { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--bg); }
td input { min-width: 70px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; }
.badge.analyzed, .badge.approved { color: var(--good); }
.badge.started, .badge.ended, .badge.draft { color: var(--warn); }
.badge.error, .badge.cancelled, .badge.human { color: var(--danger); }

.transcript { max-height: 45vh; overflow-y: auto; display: grid; gap: 8px; margin: 12px 0; }
.bubble { padding: 8px 12px; border-radius: 10px; max-width: 85%; white-space: pre-wrap; }
.bubble.agent { background: var(--bg); justify-self: start; }
.bubble.user { background: var(--primary); color: var(--primary-text); justify-self: end; }
.bubble .who { font-size: 12px; opacity: .7; display: block; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-card { width: 100%; max-width: 560px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.talking::after { content: " ●"; color: var(--good); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

@media print {
  .topbar, .actions, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; }
}
