/* Transcriber — slim dark UI (tokens + recorder from Hub design) */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --bg-base: #0E0F13;
  --bg-surface: #16181D;
  --bg-elevated: #1C1F26;
  --bg-inset: #0A0B0F;
  --border-subtle: rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.16);
  --text-primary: #E8EAED;
  --text-secondary: #9096A2;
  --text-tertiary: #5A5F6A;
  --accent: #3D9B8F;
  --accent-hover: #4DB3A5;
  --accent-soft: rgba(61,155,143,0.12);
  --accent-glow: rgba(61,155,143,0.18);
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --font-ui: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--text-secondary); }
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }

/* shell */
.shell { max-width: 1180px; margin: 0 auto; padding: 24px 28px 48px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.brand { font-weight: var(--fw-bold); font-size: 18px; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.user-chip { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 12px; }

.page-header { margin-bottom: 24px; }
.page-title {
  font-size: 28px; font-weight: var(--fw-bold); margin: 0 0 6px;
  display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em;
}
.page-subtitle { color: var(--text-secondary); margin: 0; max-width: 640px; }

.grid-2-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-title { font-size: 16px; font-weight: var(--fw-semibold); margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: var(--fw-semibold);
  transition: all 150ms ease; white-space: nowrap;
  border: 1px solid transparent;
}
.btn:disabled { opacity: 0.6; cursor: wait; pointer-events: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-glow); }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover { background: var(--bg-elevated); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-warning { background: var(--warning); color: #111; }

.icon-btn {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md); color: var(--text-secondary);
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }

.status-pill { font-size: 11px; font-weight: var(--fw-semibold); padding: 3px 8px; border-radius: var(--radius-full); }
.status-pill.active { background: rgba(16,185,129,0.15); color: var(--success); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 20px; }
.tab {
  padding: 10px 14px; font-size: 13px; font-weight: var(--fw-semibold);
  color: var(--text-tertiary); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.dropzone {
  border: 2px dashed var(--border-default); border-radius: var(--radius-lg);
  padding: 48px 24px; text-align: center; transition: all 200ms ease;
  background: var(--bg-surface);
}
.dropzone:hover, .dropzone.drop-hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-icon {
  width: 64px; height: 64px; border-radius: 50%; background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 28px;
}
.dropzone h3 { margin: 0 0 6px; font-size: 16px; }
.dropzone p { margin: 0 0 18px; font-size: 12px; color: var(--text-tertiary); }

.recorder { text-align: center; padding: 28px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.record-btn {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--accent); color: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; margin: 0 auto;
  transition: all 200ms ease;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.record-btn:hover { transform: scale(1.03); box-shadow: 0 0 0 12px var(--accent-glow); }
.record-btn .lbl { font-size: 11px; font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.08em; }
.record-timer { font-family: var(--font-mono); font-size: 42px; font-weight: var(--fw-bold); margin: 20px 0 8px; letter-spacing: 0.02em; }
.record-status { font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 16px; }
.equalizer { display: flex; gap: 3px; height: 48px; align-items: center; justify-content: center; margin: 12px 0; }
.eq-bar { width: 3px; height: 4px; background: var(--accent); border-radius: 2px; }
.equalizer.eq-live .eq-bar { animation: none; transition: height 0.07s ease-out; will-change: height; }
.recorder.paused .eq-bar, .equalizer.paused .eq-bar { opacity: 0.5; }
.record-controls { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
#rec-signal.ok { color: var(--success); }
#rec-signal.warn { color: var(--warning); }

.event-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 8px;
  border-bottom: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
}
.event-item:last-child { border-bottom: none; }
.event-item:hover { background: var(--bg-elevated); }
.event-icon {
  width: 28px; height: 28px; border-radius: var(--radius-md);
  background: var(--bg-elevated); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.event-body { flex: 1; min-width: 0; }
.event-title { font-size: 13px; font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* auth */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(61,155,143,0.18), transparent),
    var(--bg-base);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 32px 28px;
}
.auth-title { font-size: 22px; font-weight: var(--fw-bold); margin: 0 0 4px; text-align: center; }
.auth-subtitle { font-size: 13px; color: var(--text-secondary); margin: 0 0 24px; text-align: center; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: var(--fw-semibold); }
.field input {
  width: 100%; padding: 11px 12px; border-radius: var(--radius-md);
  background: var(--bg-inset); border: 1px solid var(--border-default);
  outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.auth-error {
  margin-bottom: 14px; padding: 10px 12px; border-radius: 8px;
  background: rgba(239,68,68,0.1); color: var(--danger); font-size: 13px;
}

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  color: var(--text-primary); padding: 10px 18px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: var(--fw-semibold); opacity: 0; pointer-events: none;
  transition: all 200ms ease; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: rgba(239,68,68,0.15); color: var(--danger); border-color: rgba(239,68,68,0.3); }

@keyframes spin { to { transform: rotate(360deg); } }

/* Modern UI enhancements */
.pulse-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background-color: var(--success); margin-right: 6px; vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(16,185,129,0.7);
  animation: pulse-dot 1.8s infinite;
}
@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129,0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

.rec-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background-color: var(--danger); margin-right: 6px; vertical-align: middle;
  animation: rec-blink 1s infinite;
}
@keyframes rec-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.recorder.recording .record-btn {
  animation: rec-pulse 1.5s infinite;
}
.recorder.processing .record-status {
  color: var(--accent);
}
.recorder.processing .record-timer {
  opacity: 0.45;
}
@keyframes rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 18px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.input-sm {
  background: var(--bg-inset); border: 1px solid var(--border-default);
  color: var(--text-primary); border-radius: var(--radius-md);
  padding: 8px 12px; font-size: 13px; outline: none; transition: all 150ms ease;
}
.input-sm:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.view-toggle {
  display: inline-flex; background: var(--bg-inset); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 2px; gap: 2px;
}
.view-btn {
  padding: 4px 10px; font-size: 12px; font-weight: var(--fw-semibold);
  border-radius: var(--radius-sm); color: var(--text-secondary); transition: all 150ms ease;
}
.view-btn.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.2); }

.btn-success-flash { background: rgba(16,185,129,0.2) !important; color: var(--success) !important; border-color: rgba(16,185,129,0.4) !important; }

/* Formatted Transcript Reader */
.formatted-transcript {
  background: var(--bg-inset); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 20px;
  max-height: 540px; overflow-y: auto; font-size: 14px; line-height: 1.6;
}
.formatted-transcript h1, .formatted-transcript h2, .formatted-transcript h3 {
  margin: 0 0 12px; font-weight: var(--fw-bold); color: var(--text-primary);
}
.formatted-transcript .tr-date {
  display: inline-block; font-size: 12px; color: var(--text-secondary);
  font-style: italic; margin-bottom: 16px;
}
.formatted-transcript .utterance-block {
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle);
}
.formatted-transcript .utterance-block:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.formatted-transcript .speaker-line {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.speaker-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.04em;
}
.speaker-spk_A, .speaker-spk_0, .speaker-A { background: rgba(61,155,143,0.2); color: #4DB3A5; border: 1px solid rgba(61,155,143,0.3); }
.speaker-spk_B, .speaker-spk_1, .speaker-B { background: rgba(139,92,246,0.2); color: #A78BFA; border: 1px solid rgba(139,92,246,0.3); }
.speaker-spk_C, .speaker-spk_2, .speaker-C { background: rgba(245,158,11,0.2); color: #FBBF24; border: 1px solid rgba(245,158,11,0.3); }
.speaker-spk_D, .speaker-spk_3, .speaker-D { background: rgba(236,72,153,0.2); color: #F472B6; border: 1px solid rgba(236,72,153,0.3); }
.speaker-default { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border-default); }

.time-badge { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }
.speech-text { color: var(--text-primary); white-space: pre-wrap; margin: 0; font-size: 14px; }

.raw-transcript {
  background: var(--bg-inset); padding: 16px; border-radius: var(--radius-md);
  font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap;
  word-wrap: break-word; color: var(--text-primary); line-height: 1.6;
  max-height: 540px; overflow-y: auto; margin: 0; border: 1px solid var(--border-subtle);
}

mark.highlight {
  background: rgba(245,158,11,0.35); color: #FFF; border-radius: 2px; padding: 1px 3px;
}

.event-item.active {
  background: var(--bg-elevated); border-left: 3px solid var(--accent);
  padding-left: 9px;
}

