/* ============================================================================
   Hire — Recruitment Dashboard
   Design tokens + admin layout + auth screens
   Supports LTR + RTL (auto via html[dir])
   ============================================================================ */

:root {
    --bg: #f6f7f9;
    --bg-2: #ffffff;
    --panel: #ffffff;
    --panel-2: #f4f2ea;
    --border: #e6e3d8;
    --border-2: #d8d3c2;
    --text: #262a33;
    --text-dim: #5b6472;
    --text-mute: #8a93a3;
    --accent: #c9a227;
    --accent-2: #a67c00;
    --accent-glow: rgba(201, 162, 39, 0.30);
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --sidebar-w: 240px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-lg: 0 12px 30px rgba(38, 42, 51, 0.10);
    --shadow-sm: 0 1px 2px rgba(38, 42, 51, 0.06);
    --font: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Heebo', 'Assistant', system-ui, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code,
pre {
    font-family: var(--mono);
    background: rgba(0, 0, 0, 0.05);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

h1,
h2,
h3,
h4 {
    margin: 0 0 0.6em;
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.6rem;
}

h2 {
    font-size: 1.15rem;
}

h3 {
    font-size: 1rem;
}

.muted {
    color: var(--text-dim);
}

.small {
    font-size: 0.85em;
}

.stack>*+* {
    margin-top: 12px;
}

/* ============================================================================
   Buttons + fields
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--border-2);
    background: var(--panel-2);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
    text-decoration: none;
}

.btn:hover {
    background: var(--panel-2);
    border-color: var(--accent);
}

.btn:active {
    transform: translateY(1px);
}

.btn.primary {
    background: linear-gradient(180deg, #e6c34d, var(--accent));
    color: #3a2e00;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn.primary:hover {
    filter: brightness(1.08);
}

.btn.ghost {
    background: transparent;
}

.btn.danger {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

.btn.small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn.block {
    width: 100%;
}

.field {
    display: block;
}

.field .label {
    display: block;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=tel],
input[type=url],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color .12s, background .12s;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: #fffdf5;
}

.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert.error {
    background: #fef2f2;
    border-color: var(--danger);
    color: #991b1b;
}

.alert.success {
    background: #f0fdf4;
    border-color: var(--success);
    color: #166534;
}

.alert.warning {
    background: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

/* ============================================================================
   Auth (login) screen
   ============================================================================ */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 20% -10%, rgba(201, 162, 39, 0.14), transparent 60%),
        radial-gradient(900px 500px at 100% 100%, rgba(230, 195, 77, 0.10), transparent 60%),
        var(--bg);
}

/* ---- Candidate test-taking body ------------------------------------------
   The take/* pages were designed for a light background (white qcards, gray
   pill badges, subtle borders). Rendered on the app-wide dark navy body they
   looked broken. This block gives them a proper light canvas without touching
   the admin/auth themes. We also re-map the design-token custom properties
   so nested rules that use var(--text)/var(--border)/var(--panel) inherit
   light-theme values automatically. */
.take-body {
    --bg: #f5f7fb;
    --bg-2: #ffffff;
    --panel: #ffffff;
    --panel-2: #f3f4f6;
    --border: #e5e7eb;
    --border-2: #d1d5db;
    --text: #1f2937;
    --text-dim: #4b5563;
    --text-mute: #6b7280;
    --accent: #c9a227;
    --accent-2: #a67c00;
    --shadow-lg: 0 6px 16px rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);

    background: #f5f7fb;
    color: #1f2937;
    min-height: 100vh;
}

.take-body a {
    color: #a67c00;
}

.take-body a:hover {
    color: #8a6a00;
}

.auth-shell {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    width: 100%;
}

.auth-card h1 {
    margin-top: 8px;
    margin-bottom: 4px;
}

.brand-lg {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 12px var(--accent-glow);
    display: inline-block;
}

.auth-lang {
    color: var(--text-mute);
    font-size: 0.85rem;
}

.auth-lang a {
    color: var(--text-mute);
}

.auth-lang a.active {
    color: var(--accent);
    font-weight: 600;
}

.auth-lang .sep {
    margin: 0 6px;
}

/* ============================================================================
   Admin layout: sidebar + main
   ============================================================================ */

.admin-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

html[dir="rtl"] .admin-body {
    direction: rtl;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--panel);
    border-inline-end: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 4px 8px 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .12s, color .12s;
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
    text-decoration: none;
}

.nav-item.active {
    background: var(--panel-2);
    color: var(--text);
    box-shadow: inset 3px 0 0 var(--accent);
}

html[dir="rtl"] .nav-item.active {
    box-shadow: inset -3px 0 0 var(--accent);
}

.nav-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 0.9rem;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.lang-switch {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
}

.lang-switch a {
    flex: 1;
    text-align: center;
    padding: 6px;
    font-size: 0.8rem;
    color: var(--text-mute);
    border-radius: 4px;
}

.lang-switch a.active {
    background: var(--panel-2);
    color: var(--text);
}

.lang-switch a:hover {
    text-decoration: none;
    color: var(--text);
}

.admin-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-meta {
    text-align: end;
    line-height: 1.2;
}

.user-name {
    font-weight: 500;
}

.user-role {
    color: var(--text-mute);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.logout-form {
    margin: 0;
}

.content {
    padding: 28px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    margin-bottom: 4px;
}

/* ============================================================================
   KPI grid + panels + tables
   ============================================================================ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.kpi-label {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.kpi-sub {
    font-size: 0.78rem;
    margin-top: 4px;
}

.kpi-card.kpi-warn {
    border-color: #fcd34d;
    background: #fffbeb;
}

.kpi-card.kpi-warn .kpi-value {
    color: #92400e;
}

.kpi-card.kpi-danger {
    border-color: #fca5a5;
    background: #fef2f2;
}

.kpi-card.kpi-danger .kpi-value {
    color: #991b1b;
}

/* ---- Inline status text ------------------------------------------------- */
.txt-ok {
    color: #166534;
    font-weight: 600;
}

.txt-err {
    color: #b91c1c;
    font-weight: 600;
}

.txt-muted {
    color: var(--text-dim);
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 900px) {
    .two-col {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
}

.panel-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.panel-body {
    padding: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: start;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.data-table th {
    background: var(--bg-2);
    color: var(--text-dim);
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-mute);
    font-size: 0.9rem;
}

/* ============================================================================
   RTL polish
   ============================================================================ */
html[dir="rtl"] body {
    font-family: 'Heebo', 'Assistant', var(--font);
}

html[dir="rtl"] .user-meta {
    text-align: start;
}

html[dir="rtl"] .data-table th,
html[dir="rtl"] .data-table td {
    text-align: right;
}

/* ============================================================================
   Page actions bar + forms + detail views
   ============================================================================ */
.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-actions .spacer {
    flex: 1;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.search-bar input[type=search] {
    min-width: 240px;
}

.search-bar select {
    min-width: 140px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.form-grid .span-2 {
    grid-column: span 2;
}

.form-grid .form-footer {
    display: flex;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .span-2 {
        grid-column: auto;
    }
}

label.inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-inline-start: 12px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.cv-current {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 8px;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

input[type=file] {
    padding: 8px;
    background: var(--bg-2);
    border: 1px dashed var(--border-2);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
}

.detail-list {
    display: grid;
    grid-template-columns: minmax(140px, auto) 1fr;
    gap: 8px 16px;
    margin: 0;
}

.detail-list dt {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    align-self: center;
}

.detail-list dd {
    margin: 0;
}

.panel-body-padded {
    padding: 18px;
}

.notes-block {
    background: var(--bg-2);
    padding: 12px;
    border-radius: var(--radius-sm);
    white-space: pre-wrap;
    font-family: var(--font);
    margin: 0;
}

.cv-block {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}

.cv-block .cv-icon {
    font-size: 2rem;
}

.stage-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--panel-2);
    color: var(--text-dim);
    border: 1px solid var(--border-2);
}

.stage-badge.stage-new {
    color: #1d4ed8;
    background: rgba(147, 197, 253, 0.18);
    border-color: rgba(147, 197, 253, 0.55);
}

.stage-badge.stage-in_progress {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.35);
}

.stage-badge.stage-hired {
    color: var(--success);
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.35);
}

.stage-badge.stage-rejected {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.35);
}

.stage-badge.stage-pending {
    color: #1d4ed8;
    background: rgba(147, 197, 253, 0.18);
    border-color: rgba(147, 197, 253, 0.55);
}

.stage-badge.stage-submitted {
    color: var(--success);
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.35);
}

.stage-badge.stage-expired {
    color: var(--text-mute);
    background: rgba(108, 126, 166, 0.12);
    border-color: rgba(108, 126, 166, 0.35);
}

.stage-badge.stage-cancelled {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.35);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

/* Direction-aware pagination arrows: LTR prev=‹ next=›, RTL mirrored. */
.page-prev::before {
    content: "\2039";
}

.page-next::before {
    content: "\203a";
}

html[dir="rtl"] .page-prev::before {
    content: "\203a";
}

html[dir="rtl"] .page-next::before {
    content: "\2039";
}

.actions-cell {
    white-space: nowrap;
}

form.inline {
    display: inline-block;
    margin: 0;
}

/* ============================================================================
   Questions bank
   ============================================================================ */
.type-badge,
.diff-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border-2);
    background: var(--panel-2);
    color: var(--text-dim);
}

.type-badge.type-mcq {
    color: #4338ca;
    background: rgba(165, 180, 252, 0.18);
    border-color: rgba(165, 180, 252, 0.55);
}

.type-badge.type-free_text {
    color: #92400e;
    background: rgba(252, 211, 77, 0.20);
    border-color: rgba(252, 211, 77, 0.6);
}

.type-badge.type-coding {
    color: #047857;
    background: rgba(110, 231, 183, 0.18);
    border-color: rgba(110, 231, 183, 0.55);
}

.diff-badge.diff-easy {
    color: var(--success);
}

.diff-badge.diff-medium {
    color: var(--warning);
}

.diff-badge.diff-hard {
    color: var(--danger);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

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

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* MCQ choice rows (form) */
.choice-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.choice-row:last-child {
    border-bottom: none;
}

.check-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-dim);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* MCQ choices (view) */
.choices-view {
    list-style: none;
    padding: 0;
    margin: 0;
}

.choice-view {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    margin-bottom: 6px;
    border: 1px solid var(--border);
}

.choice-view.correct {
    background: rgba(74, 222, 128, 0.12);
    border-color: rgba(74, 222, 128, 0.45);
    color: #166534;
}

.choice-view .marker {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Coding test cases (form) */
.tc-row {
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
}

.tc-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.tc-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: end;
}

.tc-row textarea {
    font-family: var(--mono);
    font-size: 0.85rem;
}

@media (max-width: 720px) {
    .tc-fields {
        grid-template-columns: 1fr;
    }

    .tc-row {
        grid-template-columns: 1fr;
    }
}

/* Coding test cases (view) */
.tc-view {
    padding: 12px;
    margin-bottom: 12px;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.tc-view-head {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.tc-view-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 720px) {
    .tc-view-body {
        grid-template-columns: 1fr;
    }
}

.tc-view-body pre {
    font-family: var(--mono);
    font-size: 0.85rem;
}

/* ============================================================================
   Assessments: pick form + assign form + assignment cards
   ============================================================================ */
.pick-form,
.assign-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pick-form {
    flex-direction: row;
    align-items: end;
    flex-wrap: wrap;
}

.pick-form select {
    flex: 1;
    min-width: 240px;
}

.two-col-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: end;
}

.field-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 10px;
}

.assignment-card {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.assignment-card:last-child {
    border-bottom: none;
}

.assignment-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.candidate-name {
    font-weight: 600;
    color: var(--text);
}

.assignment-meta {
    margin-bottom: 8px;
}

.assignment-link {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.assignment-link .take-url {
    flex: 1;
    font-family: var(--mono);
    font-size: 0.8rem;
    padding: 6px 10px;
}

.assignment-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* =========================================================================
   TAKE (candidate test-taking UI)
   ========================================================================= */
.take-shell {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 32px;
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
}

/* Landing / done / error pages keep a narrower reading width so the
   card doesn't stretch awkwardly across a wide monitor. The question
   view (which needs room for MCQs, code editors, textareas) uses the
   full shell. */
.take-shell.take-landing,
.take-shell.take-done,
.take-shell.take-error {
    max-width: 960px;
}

/* Done / error are short-content pages — vertically center the card in
   the viewport so it doesn't float in a cramped column at the top. */
.take-shell.take-done,
.take-shell.take-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.take-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.take-brand {
    font-size: 1.15rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

/* Logo image variants shown to candidates. The source file is a plain JPG
   with a solid-ish background, so we give it a white pad + rounded corners
   to sit nicely on both the light take-body background and inside cards. */
.take-brand-img {
    display: block;
    height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    background: #fff;
    border-radius: 6px;
    padding: 3px 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.take-brand-img-lg {
    height: 72px;
    max-width: 260px;
    margin: 0 auto 12px auto;
    padding: 4px 8px;
}

.take-brand-inline {
    min-width: 0;
    max-width: 65%;
}

.take-brand-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.take-lang {
    font-size: 0.9rem;
    color: var(--muted, #6b7280);
}

.take-lang .sep {
    margin: 0 6px;
    opacity: 0.5;
}

.take-lang a {
    color: inherit;
    text-decoration: none;
}

.take-lang a.active {
    font-weight: 600;
    color: var(--fg, #111);
}

.take-status {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.95rem;
}

.take-timer {
    font-family: var(--mono, ui-monospace, monospace);
    background: #f3f4f6;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    min-width: 76px;
    text-align: center;
}

.take-timer.warn {
    background: #fef3c7;
    color: #92400e;
}

.take-timer.expired {
    background: #fee2e2;
    color: #991b1b;
}

.take-progress {
    color: var(--muted, #6b7280);
}

.take-saved {
    color: #059669;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

/* Landing / done / error cards */
.take-card {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 28px;
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Done / error cards are centered short-content — give them a bit more
   breathing room and a stronger shadow so they read as a focal panel. */
.take-done .take-card,
.take-error .take-card {
    width: 100%;
    max-width: 560px;
    padding: 48px 44px;
    box-shadow: 0 8px 30px rgba(17, 24, 39, 0.08);
}

.take-card h1 {
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.take-hello {
    color: var(--muted, #6b7280);
    margin: 0 0 20px;
}

.take-description {
    background: #f9fafb;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.take-meta {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    display: grid;
    gap: 8px;
    font-size: 0.95rem;
}

.take-meta .k {
    color: var(--muted, #6b7280);
    margin-inline-end: 6px;
}

.take-consent {
    background: #fef9c3;
    border: 1px solid #fde047;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 24px 0;
}

.take-consent h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.take-consent ul {
    margin: 8px 0;
    padding-inline-start: 20px;
}

.take-consent li {
    margin: 4px 0;
    line-height: 1.5;
}

.take-consent-ack {
    margin: 12px 0 0;
    font-size: 0.9rem;
    color: var(--muted, #6b7280);
}

.take-media-check {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 24px 0;
    text-align: center;
}

.take-media-check h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.take-media-check .muted {
    margin: 0 0 12px;
    color: #4b5563;
    font-size: 0.9rem;
    line-height: 1.5;
}

.take-media-preview {
    position: relative;
    display: inline-block;
    margin: 8px auto 12px;
    width: 100%;
    max-width: 320px;
    aspect-ratio: 4 / 3;
    background: #111827;
    border-radius: 8px;
    overflow: hidden;
}

.take-media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.take-media-status {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px 10px;
    background: rgba(17, 24, 39, 0.72);
    color: #e5e7eb;
    font-size: 0.85rem;
    text-align: center;
}

.take-media-status.ok {
    background: rgba(16, 185, 129, 0.85);
    color: #fff;
}

.take-media-status.error {
    background: rgba(220, 38, 38, 0.9);
    color: #fff;
}

.take-media-status.checking {
    background: rgba(59, 130, 246, 0.85);
    color: #fff;
}

.take-start-form {
    text-align: center;
    margin-top: 24px;
}

.take-start-form button[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-large {
    padding: 12px 32px;
    font-size: 1.05rem;
}

/* Question layout.
   NOTE: `.take-body` is also the class on the <body> element in the take
   layout, so this grid MUST be scoped to the inner question container
   (`.take-question > .take-body`). Otherwise it collapses the whole page
   into a 180px column on the done/error/landing pages.

   The question navigator sits as a horizontal strip ACROSS THE TOP (not a
   right/left rail) so the numbers read naturally above the question. */
.take-question>.take-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
}

.take-nav-side {
    position: static;
    background: var(--bg-2, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    padding: 12px 14px;
}

.take-qlist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.qbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background .12s, border-color .12s, transform .05s;
}

.qbtn:hover {
    background: #e9eaec;
    text-decoration: none;
}

.qbtn.answered {
    background: #d1fae5;
    color: #065f46;
}

.qbtn.current {
    border-color: var(--accent, #c9a227);
    background: #faf3d8;
    color: #7a5c00;
}

.take-main {
    min-width: 0;
}

.qcard {
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 20px;
}

.qcard-head {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.8rem;
}

.qtype {
    padding: 3px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.qtype-mcq {
    background: #eef2ff;
    color: #4338ca;
}

.qtype-free_text {
    background: #fef3c7;
    color: #92400e;
}

.qtype-coding {
    background: #d1fae5;
    color: #065f46;
}

.qdiff {
    padding: 3px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.qtitle {
    margin: 4px 0 16px;
    font-size: 1.25rem;
}

.qbody {
    line-height: 1.6;
    color: #1f2937;
    margin-bottom: 20px;
}

.qbody .qprose {
    margin: 0 0 12px;
    white-space: pre-wrap;
}

.qbody .qprose:last-child {
    margin-bottom: 0;
}

/* Inline/standalone code inside a question body: always left-to-right,
   monospace, left-aligned, regardless of the surrounding question language. */
.qbody .qcode {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
    font-family: var(--mono, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
    font-size: 0.9rem;
    line-height: 1.5;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0 0 14px;
    overflow-x: auto;
    white-space: pre;
    tab-size: 4;
}

.qbody .qcode:last-child {
    margin-bottom: 0;
}

.answer-form {
    margin-top: 16px;
}

.answer-dir-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.dir-toggle {
    font-size: 0.82rem;
    padding: 4px 12px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 999px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
}

.dir-toggle:hover {
    background: #f3f4f6;
}

.dir-toggle.is-rtl {
    background: #faf3d8;
    border-color: var(--accent, #c9a227);
    color: #7a5c00;
}

.mcq-choices {
    display: grid;
    gap: 8px;
    border: none;
    padding: 0;
    margin: 0;
}

.mcq-choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    cursor: pointer;
    line-height: 1.5;
}

.mcq-choice:hover {
    background: #f3f4f6;
}

.mcq-choice input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--accent, #c9a227);
}

.mcq-choice input[type="radio"]:checked+span {
    font-weight: 600;
}

.mcq-choice:has(input[type="radio"]:checked) {
    border-color: var(--accent, #c9a227);
    background: #faf7ec;
}

.answer-textarea,
.code-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.code-textarea {
    font-family: var(--mono, ui-monospace, monospace);
    font-size: 0.9rem;
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
    direction: ltr;
    text-align: left;
    unicode-bidi: plaintext;
    tab-size: 4;
}

.code-textarea:focus,
.answer-textarea:focus {
    outline: none;
    border-color: var(--accent, #c9a227);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18);
}

.coding-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.coding-toolbar select {
    padding: 4px 8px;
}

.coding-note {
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
}

.qnav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
}

/* Direction-aware prev/next arrows. LTR: prev=←, next=→. RTL: mirrored so
   "next" always points toward reading direction end. */
.qnav-prev::before {
    content: "\2190";
    margin-inline-end: 6px;
}

.qnav-next::after {
    content: "\2192";
    margin-inline-start: 6px;
}

html[dir="rtl"] .qnav-prev::before {
    content: "\2192";
}

html[dir="rtl"] .qnav-next::after {
    content: "\2190";
}

/* Done + error */
.take-done-icon,
.take-error-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    margin: 0 auto 16px;
}

.take-done-icon {
    background: #d1fae5;
    color: #065f46;
}

.take-error-icon {
    background: #fee2e2;
    color: #991b1b;
}

.take-done,
.take-error {
    text-align: center;
}

/* Meta list on the done page reads as a centered summary panel rather
   than a cramped left-aligned grid. */
.take-done .take-meta {
    margin: 24px auto;
    max-width: 420px;
    gap: 0;
    text-align: start;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    overflow: hidden;
    font-size: 1rem;
}

.take-done .take-meta li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 12px 18px;
}

.take-done .take-meta li+li {
    border-top: 1px solid var(--border, #e5e7eb);
}

.take-done .take-meta .k {
    color: var(--muted, #6b7280);
    margin: 0;
    white-space: nowrap;
}

.take-done-lead,
.take-error-msg {
    color: var(--muted, #6b7280);
    margin: 8px 0 20px;
}

.take-done-close {
    font-size: 0.9rem;
    color: var(--muted, #6b7280);
    margin-top: 24px;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    padding: 24px 28px;
    border-radius: 12px;
    max-width: 480px;
    width: calc(100% - 40px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal h2 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.modal p {
    margin: 0 0 20px;
    color: #374151;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* RTL adjustments */
[dir="rtl"] .take-nav-side {}

[dir="rtl"] .qnav-bar {
    direction: rtl;
}

/* Coding run-tests panel */
.coding-run-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.coding-run-hint {
    font-size: 0.85rem;
    color: var(--muted, #6b7280);
}

.btn-secondary {
    background: #334155;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-secondary:hover {
    background: #1e293b;
}

.btn-secondary:disabled {
    background: #94a3b8;
    cursor: wait;
}

.run-output {
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    direction: ltr;
    text-align: left;
}

.run-summary {
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    background: #f3f4f6;
    margin-bottom: 12px;
    display: inline-block;
}

.run-summary.run-pass {
    background: #d1fae5;
    color: #065f46;
}

.run-summary.run-fail {
    background: #fee2e2;
    color: #991b1b;
}

.run-case {
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    border-left: 4px solid #d1d5db;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.run-case-pass {
    border-left-color: #10b981;
}

.run-case-fail {
    border-left-color: #ef4444;
}

.run-case-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.run-case-pass .run-status {
    color: #065f46;
    font-weight: 600;
}

.run-case-fail .run-status {
    color: #991b1b;
    font-weight: 600;
}

.run-ms {
    color: var(--muted, #6b7280);
    font-size: 0.85rem;
}

.run-block {
    background: #1e293b;
    color: #f1f5f9;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: var(--mono, ui-monospace, monospace);
    font-size: 0.85rem;
    margin: 4px 0;
    max-height: 200px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.run-block .k {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.run-stderr {
    background: #7f1d1d;
}

color: #fecaca;
}

/* =========================================================================
   Proctor widget (candidate side) + interview watch page (viewer side)
   ========================================================================= */
.proctor-widget {
    /* The recording widget stays fully hidden from the candidate: recording
       and streaming still happen invisibly in the background. The browser's
       own OS-level camera indicator (tab dot, taskbar) is unavoidable and
       outside our control. */
    display: none !important;
}

.proctor-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 6px;
    color: #cbd5e1;
    font-size: 0.75rem;
}

.proctor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
    animation: proctor-pulse 1.6s ease-in-out infinite;
}

@keyframes proctor-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.35;
    }
}

.proctor-status.hidden {
    display: none;
}

.proctor-status.ok {
    color: #4ade80;
}

.proctor-status.warn {
    color: #fbbf24;
}

.proctor-status.error {
    color: #f87171;
}

.proctor-preview {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: 4px;
    display: block;
    object-fit: cover;
}

html[dir="rtl"] .proctor-widget {
    inset-inline-end: auto;
    left: 12px;
}

.viewer-status {
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--text-dim);
}

.viewer-status.ok {
    background: rgba(74, 222, 128, 0.15);
    color: #86efac;
}

.viewer-status.warn {
    background: rgba(251, 191, 36, 0.15);
    color: #fcd34d;
}

.viewer-status.error {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
}

/* ============================================================================
   Interviewer review UI
   ============================================================================ */
.code-block {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 0.85rem;
    max-height: 400px;
    overflow: auto;
    white-space: pre;
    border: 1px solid var(--border);
    margin: 8px 0;
    direction: ltr;
    text-align: left;
}

.code-block code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.review-score-form .form-grid {
    padding: 12px;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-top: 4px;
}

/* ---- Team + settings additions ---------------------------------------- */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.role-badge.role-super_admin {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.role-badge.role-admin {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.role-badge.role-editor {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.role-badge.role-viewer {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.role-badge.role-external {
    background: #f5f5f4;
    color: #57534e;
    border-color: #d6d3d1;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.status-badge.active {
    background: #dcfce7;
    color: #14532d;
    border-color: #86efac;
}

.status-badge.inactive {
    background: #f5f5f4;
    color: #57534e;
    border-color: #d6d3d1;
}

.status-badge.locked {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

.kv-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 18px;
    margin: 0 0 12px 0;
}

.kv-list dt {
    font-weight: 600;
    color: #475569;
    align-self: baseline;
}

.kv-list dd {
    margin: 0;
    color: #0f172a;
    align-self: baseline;
    word-break: break-word;
}

html[dir="rtl"] .kv-list {
    grid-template-columns: max-content 1fr;
}

.danger-panel {
    border: 1px solid #fca5a5;
    margin-top: 20px;
}

.danger-panel .panel-header h3 {
    color: #991b1b;
    margin: 0;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn.danger {
    background: #dc2626;
    color: #fff;
    border-color: #b91c1c;
}

.btn.danger:hover {
    background: #b91c1c;
}

.alert.ok {
    background: #dcfce7;
    color: #14532d;
    border: 1px solid #86efac;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.alert.warn {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* ---- Logo images -------------------------------------------------------- */
.brand-img {
    display: block;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.brand-img-sm {
    width: 28px;
    height: 28px;
    padding: 2px;
}

.brand-img-lg {
    width: 96px;
    height: 96px;
    margin: 0 auto 10px auto;
    padding: 4px;
}

.brand-lg {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.auth-card p.xsmall,
.auth-card .xsmall {
    font-size: 0.72rem;
    line-height: 1.35;
    margin-top: 8px;
}

/* ---- Assign form + SMS -------------------------------------------------- */
.assign-fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px 4px 14px;
    margin: 8px 0 10px 0;
}

.assign-fieldset legend {
    padding: 0 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-mute);
}

.assignment-sms {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
}

.assignment-sms input[type="tel"] {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    font-size: 0.9rem;
}

.rec-link {
    display: inline-block;
    margin-inline-end: 6px;
    font-size: 0.85rem;
}

/* Proctor event log timeline on the review page */
.event-log {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.event-log th,
.event-log td {
    padding: 6px 8px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    text-align: start;
}

.event-log th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.event-row.event-sev-warn td {
    background: #fffbeb;
}

.event-row.event-sev-warn strong {
    color: #b45309;
}

.event-row.event-sev-bad td {
    background: #fef2f2;
}

.event-row.event-sev-bad strong {
    color: #991b1b;
}

.event-row.event-sev-info strong {
    color: #1f2937;
}

/* ---- Interview watch page: video + activity layout ------------------- */
.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 14px;
    margin-top: 14px;
}

@media (max-width: 1100px) {
    .watch-layout {
        grid-template-columns: 1fr;
    }
}

.watch-activity {
    display: flex;
    flex-direction: column;
}

/* ---- Cheating summary panel ---- */
.cheat-panel {
    border-width: 1px;
    border-style: solid;
    border-color: var(--border);
}

.cheat-panel.cheat-clean {
    border-color: #86d9a6;
}

.cheat-panel.cheat-warn {
    border-color: #f0c674;
}

.cheat-panel.cheat-bad {
    border-color: #e79aa0;
}

.cheat-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cheat-score-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cheat-gauge {
    flex: 1;
    height: 10px;
    border-radius: 999px;
    background: #edeef1;
    overflow: hidden;
}

.cheat-gauge-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #16a34a 0%, #d97706 55%, #dc2626 100%);
    transition: width .4s ease;
}

.cheat-score-num {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
}

.cheat-score-num .muted {
    font-weight: 400;
    font-size: 0.8rem;
}

.cheat-verdict {
    font-size: 1.1rem;
    font-weight: 700;
}

.cheat-verdict.cheat-clean {
    color: #15803d;
}

.cheat-verdict.cheat-warn {
    color: #b45309;
}

.cheat-verdict.cheat-bad {
    color: #b91c1c;
}

.cheat-pending {
    font-style: italic;
}

.cheat-reasons {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cheat-reason {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    background: var(--bg-2);
    border-inline-start: 3px solid var(--border-2);
}

.cheat-reason.sev-warn {
    border-inline-start-color: #d97706;
    background: #fffaf0;
}

.cheat-reason.sev-bad {
    border-inline-start-color: #dc2626;
    background: #fef3f3;
}

.cheat-reason-count {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 34px;
    color: var(--text);
}

.cheat-reason-label {
    color: var(--text-dim);
}

.cheat-none {
    color: #15803d;
    font-weight: 600;
}

/* Two stacked video slots for live: screen (big) + camera (small) */
.viewer-slot {
    position: relative;
    background: #000;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.viewer-slot-screen video {
    width: 100%;
    max-height: 420px;
    display: block;
}

.viewer-slot-cam video {
    width: 100%;
    max-height: 220px;
    display: block;
    object-fit: cover;
}

.viewer-slot-label {
    position: absolute;
    top: 6px;
    left: 6px;
    right: auto;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 2;
    pointer-events: none;
}

html[dir="rtl"] .viewer-slot-label {
    left: auto;
    right: 6px;
}

.viewer-slot-waiting {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 0.85rem;
    pointer-events: none;
}

.viewer-slot.has-stream .viewer-slot-waiting {
    display: none;
}

/* Activity panels */
.activity-status {
    font-size: 0.8rem;
    color: #6b7280;
}

.activity-status.ok {
    color: #065f46;
}

.activity-status.warn {
    color: #b45309;
}

.activity-status.error {
    color: #991b1b;
}

.activity-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.activity-q {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #e5e7eb;
}

.activity-q.answered {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

.activity-q.current {
    background: #dbeafe;
    border-color: #60a5fa;
    color: #1e3a8a;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}

.activity-current-head {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.activity-current-title {
    margin: 4px 0 8px 0;
    font-size: 1rem;
    line-height: 1.35;
}

.activity-choices {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-choice {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.4;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.activity-choice .marker {
    display: inline-block;
    width: 14px;
    color: #9ca3af;
    text-align: center;
    flex-shrink: 0;
}

.activity-choice.selected {
    background: #eff6ff;
    color: #1e3a8a;
}

.activity-choice.selected .marker {
    color: #1e3a8a;
}

.activity-choice.correct {
    color: #065f46;
}

.activity-choice.selected.correct .marker {
    color: #065f46;
}

.activity-text,
.activity-code {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 10px;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

.activity-code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    background: #0f172a;
    color: #e2e8f0;
    border-color: #0f172a;
}

.activity-events {
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.4s;
}

.activity-events.flash {
    background: #fef3c7;
}

.activity-event {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.4;
    border-inline-start: 3px solid #e5e7eb;
}

.activity-event.event-sev-warn {
    border-inline-start-color: #f59e0b;
    background: #fffbeb;
}

.activity-event.event-sev-warn strong {
    color: #b45309;
}

.activity-event.event-sev-bad {
    border-inline-start-color: #dc2626;
    background: #fef2f2;
}

.activity-event.event-sev-bad strong {
    color: #991b1b;
}

.activity-event .tag {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    padding: 0 5px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-inline-end: 4px;
}

/* ============================================================================
   CONSISTENCY LAYER
   Unified page header, toast feedback, and spacing/utility helpers used
   across every admin page so the whole app shares one visual rhythm.
   ============================================================================ */

/* ---- Unified page header -------------------------------------------------
   One header pattern for list, detail and form pages:
     <div class="page-head">
        <div class="page-head-main">
           <nav class="crumbs">…</nav>          (optional)
           <h1>Title</h1>
           <p class="page-sub">subtitle</p>     (optional)
        </div>
        <div class="page-head-actions"> …buttons… </div>
     </div>
   Replaces the old ad-hoc mix of .page-header / .page-actions.            */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.page-head+.page-actions {
    margin-top: -4px;
}

.count-pill {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 10px;
}

/* Candidate behaviour timeline */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 10px;
    border-inline-start: 3px solid var(--accent);
    background: var(--bg-2);
    border-radius: var(--radius-sm);
}

.timeline-time {
    font-variant-numeric: tabular-nums;
    color: var(--text-mute);
    font-size: 0.8rem;
    white-space: nowrap;
}

.timeline-event {
    font-weight: 600;
    color: var(--text);
}

.page-head-main {
    min-width: 0;
}

.page-head h1 {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-head .page-sub {
    margin: 4px 0 0;
    color: var(--text-mute);
    font-size: 0.9rem;
}

.page-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Breadcrumb trail */
.crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: var(--text-mute);
    margin-bottom: 6px;
}

.crumbs a {
    color: var(--text-dim);
    text-decoration: none;
}

.crumbs a:hover {
    color: var(--accent);
}

.crumbs .sep {
    opacity: 0.5;
}

html[dir="rtl"] .crumbs .sep {
    transform: scaleX(-1);
    display: inline-block;
}

/* ---- Toast / flash feedback ---------------------------------------------
   Injected by the layout from ?ok= / ?err= query params after a redirect,
   and auto-dismissed. Fixed to the viewport corner so it never shifts layout. */
.toast-stack {
    position: fixed;
    top: 18px;
    inset-inline-end: 18px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 36px));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-2);
    background: var(--panel-2);
    color: var(--text);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    font-size: 0.9rem;
    line-height: 1.35;
    animation: toast-in 0.22s ease-out;
}

.toast.leaving {
    animation: toast-out 0.2s ease-in forwards;
}

.toast .toast-icon {
    font-weight: 700;
    line-height: 1.2;
}

.toast .toast-msg {
    flex: 1;
    min-width: 0;
}

.toast .toast-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
}

.toast .toast-close:hover {
    opacity: 1;
}

.toast.toast-ok {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.14);
}

.toast.toast-ok .toast-icon {
    color: var(--success);
}

.toast.toast-err {
    border-color: var(--danger);
    background: rgba(248, 113, 113, 0.14);
}

.toast.toast-err .toast-icon {
    color: var(--danger);
}

.toast.toast-info {
    border-color: var(--accent);
    background: rgba(110, 168, 255, 0.14);
}

.toast.toast-info .toast-icon {
    color: var(--accent);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* ---- Dismissible inline alerts ------------------------------------------ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.alert>.alert-body {
    flex: 1;
    min-width: 0;
}

/* ---- Section separator (replaces inline border-top on stacked headers) -- */
.sep-top {
    border-top: 1px solid var(--border);
}

/* ---- Spacing utilities (replace ad-hoc inline margins) ------------------ */
.mt-0 {
    margin-top: 0 !important;
}

.mt-sm {
    margin-top: 8px;
}

.mt-md {
    margin-top: 14px;
}

.mt-lg {
    margin-top: 18px;
}

.mb-sm {
    margin-bottom: 8px;
}

.mb-md {
    margin-bottom: 12px;
}

/* ---- Field width helpers ------------------------------------------------ */
.w-narrow {
    max-width: 140px;
}

/* ---- Media (recording playback) ----------------------------------------- */
.media-video {
    width: 100%;
    max-height: 420px;
    background: #000;
    border-radius: 8px;
}

.media-video.media-video-sm {
    max-height: 360px;
}

/* ---- Review form grid override (was inline grid-template-columns) -------- */
.form-grid.form-grid-label {
    grid-template-columns: 160px 1fr;
}

/* Differentiate near-duplicate stage colors so pending≠new and
   submitted≠hired read distinctly at a glance. */
.stage-badge.stage-pending {
    background: rgba(110, 168, 255, 0.14);
    color: #bcd4ff;
    border-color: rgba(110, 168, 255, 0.4);
}

.stage-badge.stage-submitted {
    background: rgba(45, 212, 191, 0.16);
    color: #99f6e4;
    border-color: rgba(45, 212, 191, 0.4);
}

/* ---------------------------------------------------------------------------
   Candidate intake questionnaire (B-008): public form at /intake/<token>
   (take layout, phone or desktop) + the panel on the candidate page.
   Logical properties (margin-inline / text-align: start) keep he/ar RTL.
   --------------------------------------------------------------------------- */
.intake-shell .take-card {
    max-width: 760px;
}

.intake-intro {
    margin: 4px 0 6px;
}

.intake-hint {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin: 4px 0 0;
}

.intake-alert {
    margin: 16px 0 0;
}

.intake-form {
    margin-top: 20px;
}

.intake-q {
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.intake-q fieldset {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.intake-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    padding: 0;
    text-align: start;
}

.intake-num {
    color: var(--text-dim);
    font-weight: 500;
}

.intake-req {
    color: var(--danger);
}

.intake-note {
    margin: 0 0 8px;
    padding: 8px 10px;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: var(--bg-2);
    border-inline-start: 3px solid var(--accent);
    border-radius: var(--radius-sm);
}

.intake-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.intake-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.intake-option input {
    margin: 0;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.intake-decline {
    margin-top: 8px;
}

.intake-form input[type=date] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
}

/* 16px inputs stop iOS Safari from zooming in on focus. */
.intake-form input,
.intake-form textarea {
    font-size: 1rem;
}

[dir=rtl] .intake-form input[dir=ltr] {
    text-align: right;
}

.intake-q.has-error input:not([type=radio]):not([type=checkbox]),
.intake-q.has-error textarea,
.intake-q.has-error .intake-option {
    border-color: var(--danger);
}

.intake-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin: 6px 0 0;
}

.intake-submit {
    margin-top: 20px;
}

.intake-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.intake-answers .intake-long {
    white-space: pre-wrap;
}

.intake-answers .intake-ltr {
    unicode-bidi: plaintext;
}

@media (max-width: 600px) {
    .take-shell.intake-shell {
        padding: 12px;
    }

    .intake-shell .take-card {
        padding: 20px 16px;
    }

    .intake-options {
        flex-direction: column;
    }

    .intake-option {
        width: 100%;
        box-sizing: border-box;
    }
}
