:root {
  --bg: #0b0f19;
  --card: #131a2a;
  --card-border: #232d45;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #3b82f6;
  --accent: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.hidden { display: none !important; }

/* Auth */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 28px;
}
.brand-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(139, 92, 246, 0.14);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.subtitle { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

.tab-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.tab-switch button {
  padding: 10px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.tab-switch button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-group input, textarea {
  width: 100%;
  background: #0d1322;
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.error-msg {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  color: #fff;
}
.btn-full { width: 100%; }
.btn-primary { background: var(--primary); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--primary)); }
.btn-success { background: var(--success); }
.btn-ghost { background: transparent; border: 1px solid var(--card-border); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Topbar & Dashboard */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
  gap: 12px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.logo { font-weight: 800; font-size: 18px; }
.user-pill {
  font-size: 13px;
  color: var(--muted);
  background: #0d1322;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
}

.container { max-width: 1120px; margin: 24px auto; padding: 0 20px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 6px; }

.section-title { font-size: 18px; margin: 0 0 14px; }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
}
.module-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.module-card.locked { opacity: 0.65; }
.module-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.module-title { font-size: 16px; font-weight: 700; margin: 0; }
.module-meta { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-passed { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.badge-progress { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.badge-locked { background: rgba(156, 163, 175, 0.15); color: var(--muted); }

.progress-bar {
  height: 6px;
  background: #0d1322;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-fill { height: 100%; background: var(--primary); transition: width 0.2s; }

.checklist { list-style: none; padding: 0; margin: 0 0 14px; }
.checklist li { margin-bottom: 8px; font-size: 13px; }
.checklist label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.checklist input[type="checkbox"] { margin-top: 3px; accent-color: var(--primary); }

/* History */
.history-section { margin-top: 36px; }
.history-list { display: grid; gap: 12px; }
.history-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 14px 18px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-card {
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--card-border);
}
.modal-actions { display: flex; align-items: center; gap: 12px; }
.tts-toggle { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.live-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--success);
  border-radius: 50%;
  margin-right: 6px;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
  max-height: 360px;
}
.msg {
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 88%;
  font-size: 14px;
}
.msg-interviewer { background: #1e293b; align-self: flex-start; border-left: 3px solid var(--accent); }
.msg-candidate { background: #1d4ed8; align-self: flex-end; }

.interview-controls {
  padding: 14px 18px;
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.voice-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-mic { background: #dc2626; }
.btn-mic.listening { animation: pulse 1.2s infinite; background: #ef4444; }
.mic-status { font-size: 12px; color: var(--muted); }
.control-buttons { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.review-panel { padding: 18px; overflow-y: auto; border-top: 1px solid var(--card-border); }
.review-panel h3 { margin-top: 0; }
.review-panel ul { margin: 6px 0 14px; padding-left: 20px; font-size: 14px; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
