/* ─────────────────────────────────────────────────────────────
   Interview System — Shared Styles
   Matches J1 Dashboard design system
───────────────────────────────────────────────────────────── */
:root {
  --accent:    #B01A18;
  --accent-dk: #8c1412;
  --bg:        #0F172A;
  --card:      #1E293B;
  --card-2:    #263348;
  --border:    #334155;
  --text:      #F1F5F9;
  --text-2:    #CBD5E1;
  --muted:     #94A3B8;
  --green:     #22c55e;
  --yellow:    #f59e0b;
  --red:       #ef4444;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 4px 16px rgba(0,0,0,0.4);
  --sidebar-bg: #0C1420;
  --sidebar-hover: rgba(255,255,255,0.04);
}

/* ── Light theme ── (toggled by setting <html data-theme="light">) */
html[data-theme="light"] {
  --bg:        #f1f5f9;
  --card:      #ffffff;
  --card-2:    #f8fafc;
  --border:    #d8dee9;
  --text:      #0f172a;
  --text-2:    #334155;
  --muted:     #64748b;
  --shadow:    0 4px 16px rgba(15,23,42,0.12);
  --sidebar-bg: #ffffff;
  --sidebar-hover: rgba(15,23,42,0.05);
}
html[data-theme="light"] body { background: var(--bg); }
/* Inputs use color-scheme so native date/time pickers match the theme. */
html[data-theme="light"] input[type="date"],
html[data-theme="light"] input[type="time"],
html[data-theme="light"] input[type="datetime-local"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ── */
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p  { color: var(--text-2); }

/* ── Layout ── */
.page-center {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px;
}

.page-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card + .card { margin-top: 16px; }

/* ── Topbar ── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.topbar-brand .dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

/* Mobile nav controls — hidden on desktop, shown in the ≤640px media query. */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-backdrop { display: none; }

/*
 * ── Universal Ghost-Hover Button System ──────────────────────
 * Identical design language as the Review Outcome buttons,
 * applied to every interactive button and chip in the app.
 *
 *   Default   transparent bg, invisible border (pre-seeded to the hover
 *             hue at alpha=0 — avoids the rgba(0,0,0,0) black-bleed
 *             anti-aliasing artifact on dark backgrounds), muted text.
 *             Buttons read as labelled text glyphs at rest.
 *
 *   Hover     border alpha-fades in, text brightens, scale(1.03) lift,
 *             soft layered outer glow (3px halo + 16-18px blur).
 *             Background max 10% opacity tint — no solid fills.
 *
 *   Active /  Bright text + soft persistent border + 8-10% tint.
 *   Selected  State communicated through colour, never a filled box.
 *
 * transition: 0.2s ease-in-out on all animating properties.
 * will-change promotes transform + box-shadow to GPU layer.
 * ──────────────────────────────────────────────────────────── */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  text-decoration: none;
  transform-origin: center;
  will-change: transform, box-shadow;
  transition:
    color            0.2s ease-in-out,
    background-color 0.2s ease-in-out,
    border-color     0.2s ease-in-out,
    transform        0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow       0.25s cubic-bezier(0.16, 1, 0.3, 1),
    opacity          0.2s ease-in-out;
}

.btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Primary (accent red) ── */
.btn-primary {
  color:        var(--text);
  border-color: rgba(176, 26, 24, 0);
}
.btn-primary:hover:not(:disabled) {
  color:        var(--text);
  border-color: rgba(176, 26, 24, 0.55);
  background:   rgba(176, 26, 24, 0.10);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(176, 26, 24, 0.08),
                0 0 18px  rgba(176, 26, 24, 0.28);
}

/* ── Outline (neutral slate) ── */
.btn-outline {
  color:        var(--text-2);
  border-color: rgba(148, 163, 184, 0);
}
.btn-outline:hover:not(:disabled) {
  color:        var(--text);
  border-color: rgba(148, 163, 184, 0.50);
  background:   rgba(241, 245, 249, 0.05);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(148, 163, 184, 0.06),
                0 0 16px  rgba(148, 163, 184, 0.12);
}

/* ── Ghost (minimal — scale only, no border / glow) ── */
.btn-ghost {
  color:   var(--muted);
  padding: 6px 10px;
}
.btn-ghost:hover {
  color:     var(--text);
  transform: scale(1.03);
}
/* Red "remove/delete" ghost button — danger hover (red fill) */
.btn-rm:hover:not(:disabled) {
  color:      #fff !important;
  background: #dc2626;
}

/* ── Danger (destructive red) ── */
.btn-danger {
  color:        var(--muted);
  border-color: rgba(239, 68, 68, 0);
}
.btn-danger:hover {
  color:        #f87171;
  border-color: rgba(239, 68, 68, 0.55);
  background:   rgba(239, 68, 68, 0.05);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(239, 68, 68, 0.07),
                0 0 16px  rgba(239, 68, 68, 0.20);
}

.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 8px;
}

/* ── Form ── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input[type="time"],
input[type="date"] {
  color-scheme: dark;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

/* ── Badge / Status ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-pending     { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-in_progress { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-completed   { background: rgba(34,197,94,0.15);  color: var(--green); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  color: var(--text-2);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--card-2); }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 9999;
  pointer-events: none;
  max-width: 320px;
}

#toast.show { opacity: 1; }
#toast.success  { background: #166534; color: #bbf7d0; border: 1px solid #22c55e; }
#toast.error    { background: #7f1d1d; color: #fecaca; border: 1px solid var(--red); }
#toast.info     { background: #1e3a5f; color: #bfdbfe; border: 1px solid #3b82f6; }
#toast.warning  { background: #78350f; color: #fde68a; border: 1px solid #f59e0b; }

/* ── Review Outcome decision buttons ────────────────────────── */
/*
 * Three states — none ever use a solid background fill:
 *
 *  Default   no border, no fill, muted gray-blue text
 *  Hover     border fades in, text brightens, scale(1.03) lift, soft glow
 *  Selected  bright text + soft persistent border + 8% tint — no solid fill.
 *            A saved decision is signalled by the colour alone, not a box.
 *
 * The border-color on each variant is pre-seeded with alpha=0 of the hover
 * colour (not CSS 'transparent' = rgba(0,0,0,0)) to prevent the black-bleed
 * anti-aliasing artifact that shows a faint line on dark backgrounds.
 *
 * Single symmetric ease-in-out 0.2s. will-change puts transform + box-shadow
 * on their own GPU compositing layer for zero-jank animation.
 */
.btn-outcome {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transform-origin: center;
  will-change: transform, box-shadow;
  transition:
    color            0.2s ease-in-out,
    background-color 0.2s ease-in-out,
    border-color     0.2s ease-in-out,
    transform        0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow       0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Move Forward ── */
.btn-outcome-fwd {
  color:        var(--muted);
  border-color: rgba(22, 163, 74, 0);   /* green at alpha=0 → prevents black-bleed */
}

.btn-outcome-fwd:hover {
  color:        #4ade80;
  border-color: rgba(22, 163, 74, 0.55);
  background:   rgba(22, 163, 74, 0.05);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(22, 163, 74, 0.08),
                0 0 18px  rgba(22, 163, 74, 0.18);
}

/* selected: bright text + soft border + 8% tint — zero solid fill */
.btn-outcome-fwd.selected {
  color:        #4ade80;
  border-color: rgba(22, 163, 74, 0.50);
  background:   rgba(22, 163, 74, 0.08);
}
.btn-outcome-fwd.selected:hover {
  border-color: rgba(22, 163, 74, 0.65);
  background:   rgba(22, 163, 74, 0.10);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(22, 163, 74, 0.12),
                0 0 22px  rgba(22, 163, 74, 0.28);
}

/* ── Not Moving Forward ── */
.btn-outcome-rej {
  color:        var(--muted);
  border-color: rgba(220, 38, 38, 0);   /* red at alpha=0 → prevents black-bleed */
}

.btn-outcome-rej:hover {
  color:        #f87171;
  border-color: rgba(220, 38, 38, 0.58);
  background:   rgba(220, 38, 38, 0.04);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(220, 38, 38, 0.07),
                0 0 18px  rgba(220, 38, 38, 0.16);
}

/* selected: bright text + soft border + 7% tint — zero solid fill */
.btn-outcome-rej.selected {
  color:        #f87171;
  border-color: rgba(220, 38, 38, 0.52);
  background:   rgba(220, 38, 38, 0.07);
}
.btn-outcome-rej.selected:hover {
  border-color: rgba(220, 38, 38, 0.65);
  background:   rgba(220, 38, 38, 0.10);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(220, 38, 38, 0.10),
                0 0 22px  rgba(220, 38, 38, 0.26);
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  /* Scroll internally when content (e.g. many questions) exceeds the viewport.
     Full-screen modals override overflow:hidden inline and manage their own scroll. */
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  /* Stay frozen at the top while the modal body scrolls. Harmless on
     fixed-layout modals (padding:0 / overflow:hidden) where there's no
     internal scroll to stick to. */
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
}

/* ── Misc ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.text-muted { color: var(--muted); font-size: 12px; }
.text-sm    { font-size: 12px; }
.text-center { text-align: center; }

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Login gate ── */
#login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 380px;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-ring {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 12px;
}

/* ── Take page specific ── */
.take-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.take-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.question-card {
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.question-header {
  background: var(--card-2);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-body {
  padding: 28px 24px;
}

.question-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* ── Camera preview ── */
.camera-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.camera-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Canvas uses contain so portrait mobile cameras display without stretching.
   object-fit:fill/cover distorts or crops non-16:9 video; contain preserves
   the aspect ratio and shows black bars (camera-wrap bg:#000) for the gaps. */
.camera-wrap canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.timer-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer-overlay.warning { color: var(--yellow); }
.timer-overlay.danger  { color: var(--red); }

.rec-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}

.countdown-number {
  font-size: 72px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.countdown-label {
  color: var(--muted);
  font-size: 14px;
}

/* ── Progress bar ── */
.progress-bar-wrap {
  background: var(--bg);
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s;
}

/* ── Upload overlay ── */
.upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: #fff;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── Thank you screen ── */
.thankyou-screen {
  text-align: center;
  max-width: 480px;
  margin: auto;
  padding: 40px 20px;
}

.thankyou-icon {
  font-size: 56px;
  margin-bottom: 20px;
}

/* ── Questions builder ── */
.question-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: start;
}

.q-num {
  width: 26px;
  height: 26px;
  background: var(--card-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.q-fields { display: flex; flex-direction: column; gap: 6px; }

.q-fields input,
.q-fields select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.q-fields input:focus,
.q-fields select:focus { border-color: var(--accent); }

.q-selects {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.q-selects select {
  flex: 1 1 110px;
  min-width: 100px;
}

/* ── Session list ── */
.sessions-table-header {
  display: grid;
  grid-template-columns: 32px 3fr minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);
  gap: 12px;
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--bg);
}

.session-row {
  display: grid;
  grid-template-columns: 32px 3fr minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  font-size: 13px;
}

.session-row:last-child { border-bottom: none; }
.session-row:hover { background: var(--card-2); }

.filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(176, 26, 24, 0);  /* accent-at-zero to prevent black-bleed */
  background: transparent;
  color: var(--muted);
  transform-origin: center;
  will-change: transform, box-shadow;
  transition:
    color            0.2s ease-in-out,
    background-color 0.2s ease-in-out,
    border-color     0.2s ease-in-out,
    transform        0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow       0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
/* active = currently selected filter — bright text + soft border, no solid fill */
.filter-chip.active {
  color:        var(--text);
  border-color: rgba(176, 26, 24, 0.50);
  background:   rgba(176, 26, 24, 0.10);
}
.filter-chip:hover {
  color:        var(--text);
  border-color: rgba(176, 26, 24, 0.50);
  background:   rgba(176, 26, 24, 0.06);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(176, 26, 24, 0.06),
                0 0 14px  rgba(176, 26, 24, 0.18);
}
.filter-chip.active:hover {
  border-color: rgba(176, 26, 24, 0.65);
  background:   rgba(176, 26, 24, 0.12);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(176, 26, 24, 0.10),
                0 0 16px  rgba(176, 26, 24, 0.25);
}
/* Compact chips in the candidates toolbar so the whole row fits on one line */
#session-pane-candidates .filter-chip { padding: 4px 8px; }

/* ── Video review ── */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.review-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.review-item video {
  width: 100%;
  display: block;
  background: #000;
}

.review-item-label {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
}

/* ── Copy link ── */
.link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
  margin-top: 12px;
  word-break: break-all;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;   /* underline nav pattern — kept intentionally */
  margin-bottom: -1px;
  transition:
    color        0.2s ease-in-out,
    border-color 0.2s ease-in-out;
}

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-btn:hover:not(.active) { color: var(--text-2); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Admin sidebar layout ── */
.admin-body {
  display: flex;
  height: calc(100vh - 54px);
  overflow: hidden;
}

.admin-sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-group { padding-bottom: 8px; }

.sidebar-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 14px 16px 4px;
}

.sidebar-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px 8px 20px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: all 0.15s;
}

.sidebar-parent-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
  padding: 18px 16px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
}

.sidebar-parent-btn:hover { color: var(--accent); }

.sidebar-chevron {
  font-size: 11px;
  transition: transform 0.2s ease;
  color: var(--muted);
}

.sidebar-parent-btn[aria-expanded="false"] .sidebar-chevron {
  transform: rotate(-90deg);
}

.sidebar-children {
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.35s ease, opacity 0.2s ease;
  opacity: 1;
}

.sidebar-children.collapsed {
  max-height: 0;
  opacity: 0;
}

.sidebar-item.sidebar-child {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 7px 16px 7px 28px;
}

.sidebar-item.sidebar-child.active {
  padding-left: 25px;
}

.sidebar-item:hover { background: var(--sidebar-hover); color: var(--text); }

.sidebar-item.active {
  background: rgba(176,26,24,0.15);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 17px;
}

.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 72px;
  display: flex;
  flex-direction: column;
}

/* ── Two-way session table ── */
.tw-table-header {
  display: grid;
  grid-template-columns: 34px minmax(0,1.5fr) minmax(0,1.5fr) minmax(0,1.2fr) 110px 160px;
  gap: 12px;
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--bg);
}

.tw-session-row {
  display: grid;
  grid-template-columns: 34px minmax(0,1.5fr) minmax(0,1.5fr) minmax(0,1.2fr) 110px 160px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  font-size: 13px;
}

.tw-session-row:last-child { border-bottom: none; }
.tw-session-row:hover { background: none; }

/* Sticky column headers for <table>-based lists (Team page, modal tables) so
   the header row stays visible while the body scrolls. */
.table-wrap table thead th,
.modal table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--card);
}

/* Freeze a list page's ENTIRE top section (title + filters + column header)
   while the rows scroll beneath it. The page removes .admin-main's top padding
   (.flush-top) so the head can pin flush at top:0 with NO row peeking above; the
   head itself supplies the top spacing via padding-top. */
.admin-main.flush-top { padding-top: 0; }
.list-sticky-head {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--bg);
  padding-top: 28px;
  padding-bottom: 4px;
}
/* The whole head is already sticky — don't let the inner column header
   double-stick (which caused it to detach/peek). */
.list-sticky-head .tw-table-header,
.list-sticky-head .sessions-table-header {
  position: static;
}

/* Frozen toolbar + column header inside the candidates modal's scroll body.
   The body has no top padding so this pins flush; the header supplies the
   spacing via padding-top. */
.modal-list-sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
  padding-top: 20px;
}
.modal-list-sticky .sessions-table-header {
  position: static;
  background: var(--card);
}

/* ── Setup screen ── */
.bg-opt {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(176, 26, 24, 0);   /* accent-at-zero */
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transform-origin: center;
  will-change: transform, box-shadow;
  transition:
    color            0.2s ease-in-out,
    background-color 0.2s ease-in-out,
    border-color     0.2s ease-in-out,
    transform        0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow       0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.bg-opt:hover {
  color:        var(--text);
  border-color: rgba(176, 26, 24, 0.50);
  background:   rgba(176, 26, 24, 0.06);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(176, 26, 24, 0.06),
                0 0 14px  rgba(176, 26, 24, 0.18);
}
.bg-opt.active {
  color:        var(--text);
  border-color: rgba(176, 26, 24, 0.50);
  background:   rgba(176, 26, 24, 0.10);
  font-weight:  600;
}
.bg-opt.active:hover {
  border-color: rgba(176, 26, 24, 0.65);
  background:   rgba(176, 26, 24, 0.12);
  transform:    scale(1.03);
  box-shadow:   0 0 0 3px rgba(176, 26, 24, 0.10),
                0 0 16px  rgba(176, 26, 24, 0.22);
}

.bg-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, transform 0.1s;
}
.bg-swatch:hover { transform: scale(1.1); }
.bg-swatch.active { border-color: var(--accent); }

.setup-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── Invite mode toggle ── */
.invite-mode-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(148, 163, 184, 0);  /* slate-at-zero */
  background: transparent;
  color: var(--muted);
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transform-origin: center;
  will-change: transform, box-shadow;
  transition:
    color            0.2s ease-in-out,
    background-color 0.2s ease-in-out,
    border-color     0.2s ease-in-out,
    transform        0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow       0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.invite-mode-btn.active {
  color:        var(--text);
  border-color: rgba(148, 163, 184, 0.40);
  background:   rgba(241, 245, 249, 0.07);
}
.invite-mode-btn:hover {
  color:        var(--text-2);
  border-color: rgba(148, 163, 184, 0.35);
  background:   rgba(241, 245, 249, 0.04);
  transform:    scale(1.03);
}
.invite-mode-btn.active:hover {
  border-color: rgba(148, 163, 184, 0.55);
  background:   rgba(241, 245, 249, 0.09);
  transform:    scale(1.03);
  box-shadow:   0 0 12px rgba(148, 163, 184, 0.08);
}

/* ── Bulk drop zone ── */
#bulk-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
#bulk-drop-zone:hover,
#bulk-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(176,26,24,0.05);
}

/* ── Candidate avatar (circular photo / initials) ── */
.candidate-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ── Profile upload step (take page) ── */
#photo-circle:hover { border-color: var(--accent) !important; }
#resume-drop:hover  { border-color: var(--accent) !important; }

/* ── Take page: setup screen desktop grid ───────────────────── */
.setup-screen-wrap {
  max-width: 1080px;
  width: 100%;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE LAYOUT  —  phones only (≤ 640 px viewport)
   Portrait-first: full-width modals, vertical stacking,
   large camera, edge-to-edge buttons.
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Topbar: compact ──────────────────────────────────────── */
  .topbar       { padding: 0 12px; height: 46px; flex-shrink: 0; }
  .topbar-brand { font-size: 13px; gap: 8px; }
  .topbar-brand img { height: 26px !important; }

  /* ── Full-viewport height chain ───────────────────────────── */
  .take-container {
    height: 100vh;
    height: 100dvh;          /* dynamic: excludes browser address bar */
    overflow: hidden;
  }

  .take-main {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Intro / error / thank-you cards (direct .card children) ─ */
  .take-main > .card {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    border-left: none;
    border-right: none;
    padding: 20px 16px 28px;
  }

  /* ── Setup screen wrapper ─────────────────────────────────── */
  .setup-screen-wrap {
    max-width: 100% !important;
    width: 100% !important;
    padding: 12px 10px 24px;
  }

  /* Compact the "Setup & Preview" header so it doesn't eat vertical space */
  .setup-head { margin-bottom: 10px !important; }
  .setup-head h2 { font-size: 18px; line-height: 1.2; }
  .setup-head p { font-size: 11px !important; margin-top: 2px !important; line-height: 1.3; }

  /* Setup grid: SINGLE column on phone — camera on top, controls stacked
     directly beneath it (clean portrait preview flow). */
  .setup-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
  }

  /* Setup camera: tall 9:16 portrait box, height-driven and centred so it never
     overflows the viewport. The whole frame is shown via object-fit:contain;
     any letterbox/gutter shows the dark-blue camera-wrap background. */
  .setup-grid .camera-wrap {
    aspect-ratio: 9 / 16 !important;
    height: 62vh;
    height: 62dvh;          /* definite height drives the box… */
    width: auto;            /* …width derived from 9:16; dark-blue page gutters fill the sides */
    max-width: 100%;
    margin: 0 auto;
    background: var(--bg);  /* #0F172A dark blue letterbox/gutter fill */
  }

  /* Controls row: the 3 utility panels sit beneath the camera, side by side,
     and stretch to a single shared height. */
  .setup-grid > div:last-child {
    flex-direction: row !important;
    flex-wrap: nowrap;
    align-items: stretch !important;   /* all 3 cards = same height */
    gap: 8px !important;
  }
  .setup-grid > div:last-child > .card {
    flex: 1 1 0;
    min-width: 0;
    margin-top: 0 !important;   /* cancel .card + .card top margin so all 3 align & match height */
  }

  /* Shrink the three panels (only the panels — layout untouched) */
  .setup-grid .card { padding: 8px 8px 9px !important; }
  .setup-grid .setup-section-label { font-size: 8px !important; margin-bottom: 5px !important; letter-spacing: 0.01em; }
  .setup-grid .card p { font-size: 8px !important; line-height: 1.25; }
  .setup-grid .card .btn { font-size: 9px !important; padding: 6px 7px !important; }

  /* Compact the Virtual Background controls so its card isn't the tall one */
  .setup-grid #bg-opts { gap: 3px !important; margin-bottom: 0 !important; }
  .bg-opt { font-size: 8px !important; padding: 2px 5px !important; transform: scale(0.9); }
  .bg-swatch { width: 14px !important; height: 14px !important; border-width: 1.5px !important; transform: scale(0.9); }

  /* ── Interview question card: full-screen portrait modal ──── */
  .question-card {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    border-left: none;
    border-right: none;
    display: flex;
    flex-direction: column;
    /* Lock to exactly one viewport (minus topbar) — never scroll */
    height: calc(100vh - 46px);
    height: calc(100dvh - 46px);
    max-height: calc(100vh - 46px);
    max-height: calc(100dvh - 46px);
    overflow: hidden;
  }

  .question-header {
    padding: 10px 14px;
    flex-shrink: 0;
  }

  /* Body: flex column so the camera can grow to fill remaining space */
  .question-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 12px 14px;
    gap: 8px;
    min-height: 0;       /* needed for flex children to shrink below content size */
    overflow: hidden;
  }

  /* Progress bar */
  .progress-bar-wrap { flex-shrink: 0; }

  /* Question text: compact */
  .question-text {
    font-size: 15px;
    margin-bottom: 0;
    line-height: 1.4;
  }

  /* Camera in the interview body: portrait box, shrinks to fit, never
     forces a scroll. A moderate 3:4 ratio keeps cover-crop gentle so the
     face isn't over-zoomed. It can shrink below 3:4 if vertical space is
     tight (min-height:0), but is capped so it doesn't dominate. */
  .question-body .camera-wrap {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    aspect-ratio: 9 / 16 !important;
    max-height: 58vh;
    max-height: 58dvh;
    width: auto;          /* height-driven so the 9:16 box stays on screen */
    margin: 0 auto;
    border-radius: 10px;
    margin-bottom: 0;
    background: var(--bg); /* dark-blue letterbox/gutter fill */
  }

  /* Show the whole native (landscape) camera frame with NO crop/zoom; the dark
     camera-wrap background fills the gutters above/below the fitted frame. */
  .camera-wrap canvas,
  .camera-wrap video {
    object-fit: contain !important;
  }

  /* Controls row: stack text + buttons vertically */
  #controls {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px;
    flex-shrink: 0;
  }

  /* After-recording flex buttons row */
  #controls .flex {
    flex-direction: column;
    gap: 8px;
  }

  /* All primary action buttons → full width */
  .take-main .btn-lg,
  #controls .btn-lg,
  #controls .btn-outline {
    width: 100% !important;
    justify-content: center;
    padding: 14px 20px;
    font-size: 15px;
    text-align: center;
  }
}

/* ═══════════════ ADMIN PANEL — MOBILE & LANDSCAPE PHONE ═══════════════
   Applies on narrow phones AND on short-but-wide landscape phones (height
   ≤540px). Tablets/desktops in landscape (taller) keep the desktop layout. */
@media (max-width: 640px), (max-width: 1024px) and (max-height: 540px) {

  /* Topbar: compact (matches the 46px assumed by the drawer below) */
  .topbar { padding: 0 12px; height: 46px; flex-shrink: 0; }
  .topbar-brand img { height: 26px !important; }

  /* Topbar: show hamburger, hide the long company name, keep it compact */
  .hamburger-btn { display: inline-flex; align-items: center; }
  .topbar-company { display: none; }
  #topbar-info { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Layout height tracks the 46px mobile topbar */
  .admin-body { height: calc(100vh - 46px); height: calc(100dvh - 46px); position: relative; }

  /* Sidebar → off-canvas drawer */
  .admin-sidebar {
    position: fixed;
    top: 46px;
    left: 0;
    bottom: 0;
    width: 250px;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 500;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .admin-body.sidebar-open .admin-sidebar { transform: none; }
  .sidebar-backdrop {
    position: fixed;
    inset: 46px 0 0 0;
    background: rgba(0,0,0,0.5);
    z-index: 400;
  }
  .admin-body.sidebar-open .sidebar-backdrop { display: block; }

  .admin-main { padding: 14px 12px 56px; }
  .admin-main.flush-top { padding-top: 14px; }

  /* Sticky headers OFF on mobile (they overlapped rows). Headers scroll normally. */
  .list-sticky-head,
  .modal-list-sticky { position: static; padding-top: 0; }

  /* Page title rows wrap so the action button drops below the title */
  .list-sticky-head .flex.justify-between { flex-wrap: wrap; gap: 8px; }
  .list-sticky-head .flex.justify-between h2 { font-size: 20px; }
  /* Toolbars / filter chip rows wrap instead of overflowing */
  .list-sticky-head .flex,
  .modal-list-sticky > div { flex-wrap: wrap !important; }

  /* Modals → near full screen */
  .modal {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 16px;
  }
  #modal-sessions .modal,
  #modal-review .modal,
  #modal-compare .modal {
    width: calc(100vw - 8px) !important;
    max-width: calc(100vw - 8px) !important;
    height: calc(100dvh - 8px) !important;
    padding: 0;
  }
  .modal-header { padding: 12px 16px !important; }

  /* Review modal: stack the responses + résumé panes vertically */
  #review-content { flex-direction: column !important; overflow-y: auto; }
  #review-content > * { width: 100% !important; flex: none !important; }

  /* Login card full-bleed */
  #login-gate .card,
  .login-card { max-width: 100% !important; width: 100% !important; }
}

/* ═══════════════ PORTRAIT PHONES ONLY — CARD/STACK STYLE ═══════════════
   In portrait the screen is too narrow for table columns, so rows + cards
   stack vertically. In LANDSCAPE (wider) the normal list/grid style is kept. */
@media (max-width: 640px) and (orientation: portrait) {

  /* Grid TABLES → stacked cards: hide column headers, stack each row's cells */
  .tw-table-header, .sessions-table-header { display: none; }
  .tw-session-row, .session-row {
    display: block;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
    gap: 0;
  }
  .tw-session-row > div, .session-row > div {
    text-align: left !important;
    margin-bottom: 6px;
  }
  .tw-session-row > div:last-child, .session-row > div:last-child {
    margin-bottom: 0;
    justify-content: flex-start !important;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* List cards (One-Way / Premium / Booking): stack text above the buttons */
  #interviews-list   .card > .flex.justify-between,
  #premium-list      .card .flex.justify-between,
  #booking-links-list .card > .flex.justify-between {
    flex-direction: column;
    align-items: stretch !important;
    gap: 12px;
  }
  #interviews-list .card .flex.gap-8,
  #premium-list  .card .flex.gap-8 { flex-wrap: wrap; }
  #booking-links-list .card > .flex.justify-between > div:last-child {
    align-items: stretch !important;
  }
  #booking-links-list .card > .flex.justify-between > div:last-child > div {
    justify-content: flex-start !important;
  }

  /* Team / card <table> lists → stacked cards (dropdowns no longer overflow) */
  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td { display: block; width: auto; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 8px;
    padding: 10px 12px;
  }
  .table-wrap td {
    border: none !important;
    padding: 5px 0 !important;
    text-align: left !important;
  }
  .table-wrap td select,
  .table-wrap td input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* In LANDSCAPE phones, table lists may exceed the width — let them scroll
   horizontally rather than crush, keeping the desktop list/grid style. */
@media (max-width: 1024px) and (max-height: 540px) and (orientation: landscape) {
  .admin-main { overflow-x: auto; }
  .tw-table-header, .tw-session-row,
  .sessions-table-header, .session-row { min-width: 680px; }
}
