:root {
  --bg: #11151c;
  --panel: #1a202b;
  --panel-2: #222a38;
  --line: #2e3748;
  --text: #e8ecf3;
  --muted: #94a0b4;
  --accent: #6ea8fe;
  --accent-ink: #0b1a33;
  --good: #58c98b;
  --warn: #f2b84b;
  --bad: #f07178;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.15rem; }
p { margin: 0.4em 0; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--bad); min-height: 1.3em; font-size: 0.9rem; }

input, textarea, select, button { font: inherit; color: inherit; }
input[type=text], input[type=password], textarea, select {
  width: 100%;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 12px 16px; background: var(--panel-2); }
button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
button.primary.live { background: var(--bad); color: #2a0b0e; }
button.big { width: 100%; padding: 16px; font-size: 1.05rem; border-radius: var(--radius); }
button.link { background: none; color: var(--muted); text-decoration: underline; padding: 8px 0; }
button:disabled { opacity: 0.55; cursor: default; }

.screen { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); text-align: center; display: grid; gap: 6px; justify-items: center; }
.login-card form { width: 100%; display: grid; gap: 10px; margin-top: 18px; }

#app { height: 100dvh; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }
.tab { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 16px 0; }
.bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 10px; }
.timer { font-variant-numeric: tabular-nums; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }

.transcript { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0 12px; }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; margin: auto 0; }
.bubble { max-width: 86%; padding: 10px 13px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.bubble.caller { align-self: flex-end; background: #233149; border-color: #31456a; border-bottom-right-radius: 5px; }
.bubble.assistant { align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble.partial { opacity: 0.6; }
.bubble .who { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 2px; }
.bubble .en { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
.chip { align-self: center; font-size: 0.82rem; padding: 5px 12px; border-radius: 999px; background: var(--panel-2); color: var(--muted); max-width: 92%; text-align: center; }
.chip.message { color: var(--good); }
.chip.suspicious { color: var(--bad); }
.chip.note { color: var(--warn); }

.call-controls { display: grid; gap: 8px; padding: 10px 0 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 8px; }
.card h3 { margin: 0 0 4px; font-size: 1rem; }
.card ul { margin: 6px 0 0; padding-left: 20px; }
.risk-high { border-color: var(--bad); }
.badge { display: inline-block; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); margin-left: 6px; vertical-align: middle; }
.badge.high { background: #4a1f24; color: var(--bad); }

.list { overflow-y: auto; display: grid; gap: 8px; padding-bottom: 12px; align-content: start; flex: 1; min-height: 0; }
.row { text-align: left; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.row strong { display: block; }
#history-detail { overflow-y: auto; flex: 1; min-height: 0; padding-bottom: 12px; }
#history-detail .transcript { overflow: visible; }
.detail-actions { display: flex; justify-content: space-between; margin-bottom: 8px; }

.form { display: grid; gap: 14px; overflow-y: auto; padding-bottom: 8px; }
.form label { display: grid; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.form label.check { grid-template-columns: auto 1fr; align-items: start; gap: 10px; color: var(--text); }
.form input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; }
#tab-settings { overflow-y: auto; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { background: none; border-radius: 0; padding: 14px 0; color: var(--muted); }
.tabs button.active { color: var(--accent); font-weight: 650; }
