@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* neutrals (cool slate) */
  --bg: #eef1f6;
  --bg-2: #e7ebf2;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #8a97a8;
  --line: #e8ebf1;
  --line-2: #f0f2f6;

  /* accents (used sparingly) */
  --primary: #4f46e5;
  --primary-ink: #4338ca;
  --primary-soft: #eef0fe;
  --green: #0d9488;
  --green-ink: #0b7268;
  --green-soft: #e6f6f3;
  --amber: #f59e0b;
  --amber-ink: #7c4a06;

  /* elevation (soft, low-opacity, consistent direction) */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.05), 0 14px 36px rgba(15, 23, 42, 0.08);

  --radius: 16px;
  --radius-sm: 11px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, #eaf0fb 0%, rgba(234, 240, 251, 0) 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--primary-soft); color: var(--primary-ink); }

/* scrollbars */
.transcript, .exchanges, textarea { scrollbar-width: thin; scrollbar-color: #cdd5e1 transparent; }
.transcript::-webkit-scrollbar, .exchanges::-webkit-scrollbar, textarea::-webkit-scrollbar { width: 9px; }
.transcript::-webkit-scrollbar-thumb, .exchanges::-webkit-scrollbar-thumb, textarea::-webkit-scrollbar-thumb {
  background: #cfd6e2; border-radius: 999px; border: 3px solid transparent; background-clip: content-box;
}
.transcript::-webkit-scrollbar-thumb:hover, .exchanges::-webkit-scrollbar-thumb:hover { background: #b6c0cf; background-clip: content-box; }

/* ---- top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(140deg, var(--primary) 0%, #6366f1 45%, var(--green) 120%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), var(--shadow-sm);
}
.sub-tag {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--green-ink); background: var(--green-soft);
  padding: 3px 8px; border-radius: 999px;
}

.nav { display: flex; align-items: center; gap: 2px; }
.nav-link {
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: none;
  padding: 8px 13px; border-radius: 9px; transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--line-2); color: var(--ink); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-ink); }
.nav-user { font-size: 13px; color: var(--ink-3); margin-left: 12px; font-weight: 500; }
#nav-logout { color: var(--ink-2); margin-left: 2px; }

/* ---- buttons ---- */
.controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.04s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79, 70, 229, 0.35); }
.btn.primary:hover:not(:disabled) { background: var(--primary-ink); }
.btn.accent { background: var(--amber); color: #3a2406; box-shadow: 0 1px 2px rgba(245, 158, 11, 0.4); }
.btn.accent:hover:not(:disabled) { background: #fbb024; }
.btn.ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: #dbe0e9; color: var(--ink); }

.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  padding: 8px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  cursor: pointer; user-select: none; transition: border-color 0.15s ease;
}
.toggle:hover { border-color: #dbe0e9; }
.toggle input { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

.model-select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.model-select span { font-weight: 600; }
.model-select select {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.model-select select:hover { border-color: #dbe0e9; }
.model-select select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---- status bar ---- */
.statusbar { padding: 10px 28px 2px; font-size: 13px; color: var(--ink-2); }
#status { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; }
#status::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-3); flex: none; transition: background 0.2s ease, box-shadow 0.2s ease;
}
#status.busy::before { background: var(--amber); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.14); }
#status.live::before { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
#status.error::before { background: #e0564f; box-shadow: 0 0 0 4px rgba(224, 86, 79, 0.12); }
#status.error { color: #c0443d; }

/* ---- layout (positions & sizes preserved) ---- */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  width: 100%;
  max-width: 1700px;
  margin: 0 auto;
  padding: 14px 28px 30px;
  min-height: 0;
}
.sidebar { display: flex; flex-direction: column; gap: 22px; min-height: 0; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.panel h2 { margin: 0; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.hint { font-size: 11.5px; color: var(--ink-3); }

textarea {
  flex: 1;
  min-height: 150px;
  resize: vertical;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  font-size: 14px;
  line-height: 1.6;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: #fff; }

/* left column: video on top (bigger), transcript below (smaller) */
.video-panel { flex: 1.35; min-height: 0; }
.video-panel video {
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 12px;
  background: #0b1220;
  object-fit: contain;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.transcript-panel { flex: 1; min-height: 0; }
.partial { color: var(--ink-3); font-style: italic; font-size: 16px; line-height: 1.5; min-height: 22px; margin-bottom: 10px; }
.transcript { flex: 1; overflow-y: auto; padding-right: 6px; }
.line {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-2);
}
.line:last-child { border-bottom: none; }
.line .text { font-size: 16px; line-height: 1.55; color: var(--ink-2); }
.line.question {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-bottom-color: transparent;
  padding: 11px 12px; margin: 5px -6px; border-radius: 10px;
}
.line.question .text { color: var(--primary-ink); font-weight: 600; }
.line.question .text::before {
  content: "Q"; display: inline-grid; place-items: center;
  width: 18px; height: 18px; margin-right: 8px; vertical-align: -4px;
  background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; border-radius: 6px;
}
.answer-btn {
  flex: none;
  background: var(--surface); color: var(--primary); border: 1px solid var(--line);
  padding: 5px 11px; font-size: 12px; font-weight: 600; border-radius: 8px; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.answer-btn:hover { background: var(--primary-soft); border-color: var(--primary); }

/* ---- stage / answers ---- */
.stage { min-height: 0; display: flex; }
.exchanges { flex: 1; overflow-y: auto; padding-right: 6px; }

.exchange {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 16px;
  animation: rise 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.exchange:last-child { margin-bottom: 0; }
.exchange.active { box-shadow: var(--shadow); border-color: #dfe3ee; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.q-tag { color: var(--primary-ink); }
.a-tag { color: var(--green-ink); }
.q-tag::before, .a-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.q-tag::before { background: var(--primary); }
.a-tag::before { background: var(--green); }
.cat-badge {
  margin-left: 9px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--ink-3); background: var(--line-2);
  padding: 2px 8px; border-radius: 999px; text-transform: capitalize;
}

.q-block {
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 13px 15px;
  margin-bottom: 18px;
}
.q-text { margin: 0; font-size: 18px; line-height: 1.45; color: var(--primary-ink); font-weight: 600; }

.a-block { border-left: 3px solid var(--green); padding-left: 18px; }
.a-text {
  font-size: 22px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  letter-spacing: -0.01em;
}
.a-text .tip {
  display: block; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line);
  font-size: 15px; color: var(--ink-2); line-height: 1.5; letter-spacing: 0;
}
.a-text.thinking::after { content: "thinking…"; color: var(--ink-3); font-size: 16px; font-style: italic; }

/* ---- empty state ---- */
.empty-state { margin: auto; text-align: center; max-width: 440px; padding: 48px 20px; color: var(--ink-2); }
.empty-mark {
  width: 60px; height: 60px; margin: 0 auto 20px; border-radius: 18px;
  background: linear-gradient(140deg, var(--primary-soft), var(--green-soft));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.empty-state h3 { margin: 0 0 8px; font-size: 19px; color: var(--ink); letter-spacing: -0.01em; }
.empty-state p { margin: 0; font-size: 14.5px; line-height: 1.65; }

/* ---- responsive ---- */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .transcript { max-height: 220px; }
  .controls { gap: 8px; }
  .topbar { padding: 12px 18px; }
}

/* ---- documents page ---- */
.docs { max-width: 800px; margin: 0 auto; padding: 18px 28px 56px; display: flex; flex-direction: column; gap: 20px; width: 100%; }
.docs .panel { min-height: auto; padding: 22px 24px; }
.docs h2 { font-size: 16px; text-transform: none; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 4px; font-weight: 700; }
.docs textarea { min-height: 220px; }
.row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.doc-meta { font-size: 14px; color: var(--ink-2); margin: 6px 0 14px; }
.doc-meta b { color: var(--ink); }
.docs input[type="file"] { font-size: 13.5px; color: var(--ink-2); }
.docs input[type="file"]::file-selector-button {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 13px; margin-right: 12px; cursor: pointer;
}
.docs input[type="file"]::file-selector-button:hover { background: var(--line-2); }

/* ---- auth: login page ---- */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 34px 32px; width: 100%; max-width: 390px;
}
.login-card h1 { font-size: 21px; margin: 6px 0 22px; text-align: center; letter-spacing: -0.02em; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-error { color: #c0443d; font-size: 13px; margin: 14px 0 0; min-height: 16px; text-align: center; }

/* ---- form fields (login + dashboard) ---- */
.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.field input, .field select {
  font-family: inherit; font-size: 15px; color: var(--ink); font-weight: 400;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: #fff; }
.docs .field { margin-bottom: 14px; }

/* ---- dashboard accounts list ---- */
.users-list { display: flex; flex-direction: column; gap: 10px; }
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.user-row b { font-size: 15px; }
.user-meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.role-tag {
  display: inline-block; margin-left: 9px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 3px 9px; border-radius: 999px; vertical-align: 1px;
}
.role-tag.admin { color: var(--amber-ink); background: #fdf0d8; }
.role-tag.interviewer { color: var(--green-ink); background: var(--green-soft); }

/* ---- teleprompter mode ---- */
.tp { position: fixed; inset: 0; z-index: 100; background: #000; overflow: hidden; --tp-dim: 0.55; }
.tp-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tp-scrim { position: absolute; inset: 0; background: #000; opacity: var(--tp-dim); pointer-events: none; }
.tp-answer {
  position: absolute; top: 11%; left: 50%; transform: translateX(-50%);
  width: min(1040px, 88vw); max-height: 66vh; overflow-y: auto;
  text-align: center;
  color: #ffffff; font-weight: 800; font-size: 32px; line-height: 1.42;
  letter-spacing: -0.01em; white-space: pre-wrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95), 0 0 3px rgba(0, 0, 0, 0.9);
}
.tp-answer::-webkit-scrollbar { width: 8px; }
.tp-answer::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); border-radius: 999px; }
.tp-controls {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 14px;
  background: rgba(15, 17, 22, 0.5); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0.4; transition: opacity 0.2s ease;
}
.tp-controls:hover { opacity: 1; }
.tp-controls .btn.ghost { background: rgba(255, 255, 255, 0.1); color: #e7eaf0; border-color: rgba(255, 255, 255, 0.12); }
.tp-controls .btn.ghost:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.tp-slider { display: flex; align-items: center; gap: 8px; color: #cfd6e2; font-size: 12px; font-weight: 600; }
.tp-slider input { accent-color: var(--amber); width: 110px; }
