:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2330;
  --line: #263041;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #2ea043;
  --accent2: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --wait: #58a6ff;
  --arch: #a371f7;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--wait); text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.danger { color: var(--danger); }
.center { text-align: center; display: block; }

/* layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(13,17,23,.9);
  backdrop-filter: blur(8px); z-index: 5;
}
.brand, .logo { font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent2);
  box-shadow: 0 0 10px var(--accent2); display: inline-block; }
.topnav a { margin-left: 16px; color: var(--muted); font-size: 14px; }
.topnav a:hover { color: var(--text); }
.wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.wrap.narrow { max-width: 400px; }
body.centered { min-height: 100vh; display: flex; align-items: center; }
body.centered .wrap { width: 100%; }

/* cards */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px; margin: 14px 0;
}
h1, h2 { line-height: 1.2; }
.rec-h1 { margin: 6px 0 2px; font-size: 24px; }
.card h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 0 0 10px; }

/* flashes */
.flashes { margin-bottom: 12px; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; }
.flash-error, .flash-ok, .flash-warn { border: 1px solid var(--line); }
.flash-error { background: rgba(248,81,73,.12); color: #ffb4ae; }
.flash-ok { background: rgba(46,160,67,.12); color: #7ee787; }

/* login */
.login-card { text-align: center; }
.login-card .logo { justify-content: center; font-size: 22px; margin-bottom: 4px; }
.stack { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 18px; }
label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  font-size: 16px;
}
input:focus { outline: none; border-color: var(--accent2); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-size: 15px; cursor: pointer;
}
.btn:hover { border-color: #3a475c; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #04140a; font-weight: 600; }
.btn-primary:hover { background: var(--accent2); }
.btn-danger { color: #ffb4ae; border-color: rgba(248,81,73,.4); }
.btn-danger:hover { background: rgba(248,81,73,.14); }
.btn-small { padding: 7px 12px; font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* dashboard */
.record-cta {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: linear-gradient(135deg, var(--accent), #1a7f37);
  color: #04140a; font-weight: 700; font-size: 18px;
  padding: 20px; border-radius: 16px; margin: 4px 0 18px;
}
.record-cta .mic { font-size: 24px; }
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px;
}
.banner.ok { border-color: rgba(46,160,67,.4); }
.empty { text-align: center; padding: 40px 0; }

.rec-list { list-style: none; margin: 0; padding: 0; }
.rec-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
}
.rec-main { flex: 1; min-width: 0; color: var(--text); }
.rec-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

.pill { font-size: 12px; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.pill-ok { background: rgba(46,160,67,.15); color: #7ee787; }
.pill-warn { background: rgba(210,153,34,.16); color: #e3b341; }
.pill-bad { background: rgba(248,81,73,.15); color: #ffb4ae; }
.pill-wait { background: rgba(88,166,255,.15); color: #79c0ff; }
.pill-arch { background: rgba(163,113,247,.15); color: #d2b4fb; }

/* recording detail */
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.notes { white-space: pre-wrap; }
.followups ul { margin: 0; padding-left: 20px; }
.followups li { margin: 6px 0; }
.transcript { white-space: pre-wrap; color: var(--muted); font-size: 14px; margin-top: 10px; }
details.card summary { cursor: pointer; color: var(--muted); }
.audio-box .actions { margin-top: 10px; }
.processing { text-align: center; padding: 30px; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 14px;
  border: 3px solid var(--line); border-top-color: var(--accent2);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.danger-zone { margin-top: 24px; }
.danger-zone summary { color: var(--muted); font-size: 14px; cursor: pointer; }

/* recorder */
.recorder-wrap { text-align: center; }
.recorder { display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 30px 0; }
.rec-timer { font-size: 44px; font-variant-numeric: tabular-nums; font-weight: 300; }
.rec-big {
  width: 150px; height: 150px; border-radius: 50%; cursor: pointer;
  border: 4px solid var(--line); background: var(--panel2);
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s, border-color .2s;
}
.rec-big:active { transform: scale(.96); }
.rec-ico { width: 54px; height: 54px; border-radius: 50%; background: var(--danger);
  transition: all .2s; }
.is-recording .rec-big { border-color: var(--danger); box-shadow: 0 0 30px rgba(248,81,73,.4); }
.is-recording .rec-ico { width: 40px; height: 40px; border-radius: 8px; }
.is-busy .rec-big { opacity: .5; pointer-events: none; }
.rec-hint { color: var(--muted); }
.rec-status { color: var(--warn); min-height: 20px; font-size: 14px; }
.enroll-script {
  background: var(--panel2); border-left: 3px solid var(--accent);
  padding: 14px 16px; border-radius: 8px; margin: 16px 0; color: var(--text); font-style: italic;
}
