:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #111a2c;
  --panel2: #16213a;
  --border: #24304a;
  --text: #e5eaf3;
  --muted: #8b97ad;
  --primary: #3b82f6;
  --primary-h: #2f6fd6;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.wrap { max-width: 1400px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
h1 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 8px; }
.sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.card-h { padding: 14px 16px 8px; }
.card-t { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; margin: 0; }
.card-d { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.card-c { padding: 10px 16px 16px; display: flex; flex-direction: column; gap: 10px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 260px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 1024px) { .grid2 { grid-template-columns: 1fr 1fr; } }

input[type="text"], input[type="email"], textarea, select {
  width: 100%;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}
textarea { resize: vertical; }
textarea.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
label.small { display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: #fff; border: none;
  padding: 8px 14px; border-radius: 6px; font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--primary-h); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.outline:hover { background: var(--panel2); }
.btn.danger { background: var(--red); }
.btn.ghost { background: transparent; color: var(--muted); padding: 4px 8px; }
.btn.ghost:hover { color: var(--text); background: var(--panel2); }
.btn.sm { padding: 5px 10px; font-size: 13px; }

.badge {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 600;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--border);
}
.badge.blue { background: rgba(59,130,246,.15); color: #7fb0ff; border-color: transparent; }
.badge.green { background: rgba(34,197,94,.15); color: #5fd98a; border-color: transparent; }
.badge.amber { background: rgba(245,158,11,.15); color: #fbc35c; border-color: transparent; }
.badge.red { background: rgba(239,68,68,.15); color: #f58a8a; border-color: transparent; }
.badge.solid { background: var(--primary); color: #fff; border-color: transparent; }

.session-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px;
  cursor: pointer;
}
.session-row:hover { background: var(--panel2); }
.session-row.active { border-color: var(--primary); }
.session-row .meta { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.transcript { height: 480px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 6px; }
.transcript .t { color: var(--muted); font-size: 11px; margin-right: 8px; }
.transcript .sp { font-weight: 600; }
.transcript .interim { opacity: .5; font-style: italic; }
.empty { color: var(--muted); font-style: italic; }

.answer { background: var(--panel2); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; }
pre.recap-body { white-space: pre-wrap; font-family: inherit; background: var(--panel2); border-radius: 6px; padding: 12px; margin: 0; }

.mem-row { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; }
.mem-row .fact { flex: 1; }
.mem-row .src { color: var(--muted); font-size: 11.5px; margin-top: 2px; white-space: nowrap; }

.hist-row { border: 1px solid var(--border); border-radius: 6px; }
.hist-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.hist-head:hover { background: var(--panel2); }
.hist-head .subj { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-body { border-top: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.tiny { color: var(--muted); font-size: 12px; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: 380px; }
.toast { background: var(--panel2); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 6px; padding: 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.err { border-left-color: var(--red); }
.toast .tt { font-weight: 600; font-size: 13.5px; }
.toast .td { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.signin .box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 40px 44px; text-align: center; max-width: 420px; }
.signin h1 { justify-content: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.live { background: var(--green); animation: pulse 1.6s infinite; }
.dot.idle { background: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.switch { position: relative; width: 34px; height: 19px; background: var(--border); border-radius: 999px; cursor: pointer; transition: background .15s; flex: none; }
.switch.on { background: var(--primary); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on::after { left: 17px; }
.hidden { display: none; }
