/* ── Variables ────────────────────────────────────────────────────── */

:root {
    --bg: #fbf7f0;
    --bg-subtle: #f3ede4;
    --text: #1a1a1a;
    --text-secondary: #5c5c5c;
    --text-dim: #8a8a8a;
    --rule: #c8bfb0;
    --rule-light: #ddd5c8;
    --accent: #8b2500;
    --accent-hover: #a83000;
    --green: #2d6a30;
    --red: #9b2c2c;
    --serif: 'Libre Baskerville', 'Georgia', serif;
    --display: 'Playfair Display', 'Georgia', serif;
}

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

body {
    font-family: var(--serif);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ── Buttons ── */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.5rem 1.2rem; border: 1px solid var(--rule);
    font-family: var(--serif); font-size: 0.82rem;
    background: var(--bg); color: var(--text);
    cursor: pointer; letter-spacing: 0.02em;
    text-decoration: none; transition: all .15s;
}
.btn:hover { background: var(--bg-subtle); border-color: var(--text-secondary); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { opacity: .85; background: var(--text); }
.btn-secondary { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--red); color: var(--bg); border-color: var(--red); }
.btn-danger:hover { opacity: .85; }
.btn-ghost { background: none; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { border-color: var(--rule); background: var(--bg-subtle); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; }
.btn-lg { padding: 0.7rem 2rem; font-size: 0.88rem; }

/* ── Navbar ── */

.navbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.2rem 2rem;
    border-bottom: 2px solid var(--text);
}
.nav-brand {
    font-family: var(--display); font-size: 1.1rem; font-weight: 700;
    color: var(--text); text-decoration: none; letter-spacing: -0.01em;
}
.nav-right { display: flex; align-items: center; gap: 0.8rem; }
.nav-tab {
    font-family: var(--serif); font-size: 0.82rem;
    color: var(--text-secondary); text-decoration: none;
    padding: 0.3rem 0; border-bottom: 2px solid transparent;
}
.nav-tab:hover { color: var(--text); }
.nav-tab-active { color: var(--text); border-bottom-color: var(--text); }
.nav-tab-disabled { color: var(--rule); cursor: default; }
.avatar { width: 24px; height: 24px; border-radius: 50%; }
.nav-name { font-size: 0.72rem; color: var(--text-dim); }

/* ── Login ── */

.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
.login-card {
    text-align: center; padding: 2rem; max-width: 600px;
}
.login-icon {
    font-family: var(--display); font-size: 1.1rem; font-weight: 700;
    color: var(--text); margin-bottom: 3rem;
}
.login-card h1 {
    font-family: var(--display); font-size: 3.5rem; font-weight: 900;
    line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 3rem;
}
.login-sub {
    color: var(--text-secondary); margin-bottom: 2.5rem;
    font-size: 0.92rem; line-height: 1.7;
}
.login-card .btn-lg { width: auto; }

/* ── Container / Layout ── */

.container { max-width: 1000px; margin: 0 auto; padding: 2rem; }

.dash-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--rule);
}
.dash-right { display: flex; align-items: center; gap: 0.8rem; }

.sub-tabs { display: flex; gap: 0; }
.sub-tab {
    font-family: var(--serif); font-size: 0.78rem;
    padding: 0.35rem 0.8rem; border: 1px solid var(--rule);
    background: var(--bg); color: var(--text-secondary); cursor: pointer;
}
.sub-tab:first-child { border-right: none; }
.sub-tab-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.sub-tab:hover:not(.sub-tab-active) { background: var(--bg-subtle); }

.summary-overview {
    font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 1.5rem;
}
.dash-header h2 {
    font-family: var(--display); font-size: 1.3rem; font-weight: 700;
}

.page-header {
    display: flex; align-items: center; gap: 0.8rem;
    margin-bottom: 1.5rem; padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--rule);
}
.page-header h2 { font-family: var(--display); font-size: 1.3rem; font-weight: 700; }

/* ── Cards ── */

.card-grid {
    display: flex; flex-direction: column; gap: 0;
}
.card {
    padding: 1rem 0; border-bottom: 1px solid var(--rule-light);
}
.card:last-child { border-bottom: none; }
.card-top {
    display: flex; justify-content: space-between; align-items: start;
    margin-bottom: 0.2rem;
}
.card-top h3 {
    font-family: var(--display); font-size: 1rem; font-weight: 700;
}
.card-role { color: var(--text-secondary); font-size: 0.82rem; margin-bottom: 0.2rem; }
.card-meta { color: var(--text-dim); font-size: 0.72rem; margin-bottom: 0.6rem; }
.card-actions { display: flex; gap: 0.5rem; }

.badge {
    display: inline-block; padding: 0.1rem 0.5rem;
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    border: 1px solid; flex-shrink: 0;
}
.badge-success { color: var(--green); border-color: var(--green); }
.spinner-xs {
    display: inline-block; width: 8px; height: 8px;
    border: 1.5px solid var(--rule); border-top-color: var(--text-dim);
    border-radius: 50%; animation: spin .7s linear infinite;
    vertical-align: baseline; margin-left: 0.3rem;
}
.badge-warning { color: #c65d07; border-color: #c65d07; }
.badge-default { color: var(--text-dim); border-color: var(--rule); }

/* ── Forms ── */

.form-card {
    border: 1px solid var(--rule); padding: 1.5rem;
}
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block; font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-secondary); margin-bottom: 0.4rem;
}
.input, .textarea {
    width: 100%; padding: 0.5rem 0.6rem;
    border: 1px solid var(--rule); background: #fff;
    font-family: var(--serif); font-size: 0.88rem; color: var(--text);
    outline: none; transition: border-color .15s;
}
.input:focus, .textarea:focus { border-color: var(--text-secondary); }
.input.invalid, .textarea.invalid {
    border-color: var(--red); animation: shake .3s ease;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.close-btn {
    position: absolute; top: 0.5rem; right: 0.6rem;
    background: none; border: none; font-size: 1.3rem;
    color: var(--text-dim); cursor: pointer; line-height: 1; padding: 0.2rem;
}
.close-btn:hover { color: var(--text); }

.form-error {
    margin-top: 0.6rem; font-size: 0.8rem; color: var(--red);
}

.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.8rem;
}
.section-header h3 {
    font-family: var(--display); font-size: 1rem; font-weight: 700;
}

.role-archived {
    color: var(--text-dim);
    text-decoration: line-through;
    text-decoration-style: solid;
}

.role-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.role-chip {
    padding: 0.3rem 0.8rem; font-size: 0.8rem;
    border: 1px solid var(--rule); background: var(--bg);
}
.role-ready { border-color: var(--green); color: var(--green); }
.role-pending { border-color: var(--rule); color: var(--text-dim); font-style: italic; }

/* ── Custom Dropdown ── */
.dropdown { position: relative; }
.dropdown-trigger {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; text-align: left;
}
.dropdown-arrow {
    width: 0; height: 0; flex-shrink: 0; margin-left: 0.5rem;
    border-left: 4px solid transparent; border-right: 4px solid transparent;
    border-top: 5px solid var(--text-secondary);
    transition: transform 0.15s;
}
.dropdown-open .dropdown-arrow { transform: rotate(180deg); }
.dropdown-menu {
    display: none; position: absolute; z-index: 100;
    top: 100%; left: 0; right: 0; margin-top: 2px;
    background: #fff; border: 1px solid var(--rule);
    max-height: 240px; overflow-y: auto;
}
.dropdown-open .dropdown-menu { display: block; }
.dropdown-item {
    padding: 0.45rem 0.7rem; cursor: pointer;
    font-family: var(--serif); font-size: 0.88rem; color: var(--text);
    transition: background 0.1s;
}
.dropdown-item:hover { background: var(--bg-subtle); }
.dropdown-item-active { font-weight: 700; }
.dropdown-item-disabled {
    color: var(--text-dim); cursor: default; font-style: italic;
}
.dropdown-item-disabled:hover { background: none; }

.scenario-preview {
    border: 1px solid var(--rule); padding: 1.5rem; margin-top: 1rem;
    position: relative;
}
.scenario-preview h4 {
    font-family: var(--display); font-size: 1rem; margin-bottom: 1rem;
    padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule-light);
}
.scenario-section { margin-bottom: 1.2rem; }
.scenario-section strong {
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-secondary); display: block; margin-bottom: 0.4rem;
}
.scenario-text {
    font-size: 0.85rem; line-height: 1.75; color: var(--text);
    max-height: 600px; overflow-y: auto;
}
textarea, .textarea { resize: none; min-height: 80px; line-height: 1.6; }

.status-msg {
    margin-top: 1rem; font-size: 0.85rem; padding: 0.6rem 0.8rem;
    border: 1px solid;
}
.status-msg.loading { border-color: var(--rule); color: var(--text-secondary); font-style: italic; }
.status-msg.error { border-color: var(--red); color: var(--red); }

/* ── Assessment page (generating/building) ── */

.assess-page { display: flex; flex-direction: column; height: 100vh; }

.assess-header {
    display: flex; align-items: center; gap: 1rem; padding: 0.8rem 2rem;
    border-bottom: 2px solid var(--text); flex-shrink: 0;
}
.assess-info {
    flex: 1; font-size: 0.85rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Assessment split layout (brief left, chat right) ── */

.assess-split { display: flex; height: 100vh; }

.assess-brief {
    width: 38%; min-width: 300px; max-width: 480px;
    display: flex; flex-direction: column;
    border-right: 2px solid var(--text);
    background: var(--bg-subtle);
}
.assess-brief-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.8rem 1.5rem; border-bottom: 1px solid var(--rule);
}
.assess-brief-title {
    font-family: var(--display); font-size: 0.9rem; font-weight: 700;
}
.assess-brief-body {
    flex: 1; overflow-y: auto; padding: 1.5rem;
    font-size: 0.88rem; line-height: 1.8;
}
.assess-brief-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.6rem 1.5rem; border-top: 1px solid var(--rule);
    font-size: 0.75rem;
}

.assess-chat {
    flex: 1; display: flex; flex-direction: column; min-width: 0;
}

.timer {
    font-family: var(--display); font-size: 1.4rem; font-weight: 700;
    font-variant-numeric: tabular-nums; color: var(--text);
    min-width: 60px; text-align: center;
}
.timer-warn { color: var(--red); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.messages { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; }

.msg { margin-bottom: 1.5rem; }
.msg-label {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 0.3rem;
}
.msg-body { font-size: 0.9rem; line-height: 1.75; }
.msg-body h3, .msg-body h4, .msg-body h5 { font-family: var(--display); margin: 0.8rem 0 0.3rem; }
.msg-body h3 { font-size: 0.95rem; }
.msg-body h4 { font-size: 0.9rem; }
.msg-body h5 { font-size: 0.85rem; }
.msg-body p { margin-bottom: 0.4rem; }
.msg-body ul { margin: 0.3rem 0 0.5rem 1.2rem; }
.msg-body li { margin-bottom: 0.15rem; }
.msg-body code { background: var(--bg-subtle); padding: 0.1rem 0.3rem; font-size: 0.82rem; }
.msg-user .msg-body {
    border-left: 3px solid var(--text); padding-left: 1rem;
}
.msg-assistant .msg-body {
    border-left: 3px solid var(--rule); padding-left: 1rem;
    color: var(--text);
}

.time-warning {
    padding: 0.5rem 1.5rem; text-align: center;
    font-size: 0.78rem; font-weight: 700; color: var(--red);
    background: #fef2f2; border-bottom: 1px solid var(--red);
    animation: fadeIn .3s ease;
}

.typing { color: var(--text-dim); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

.input-area {
    padding: 0.8rem 1.5rem;
    border-top: 1px solid var(--rule); flex-shrink: 0;
}
.input-wrap { position: relative; border: 1px solid var(--rule); background: #fff; }
.input-wrap:focus-within { border-color: var(--text-secondary); }
.input-area textarea {
    width: 100%; padding: 0.5rem 0.6rem;
    border: none; background: transparent;
    font-family: var(--serif); font-size: 0.88rem; color: var(--text);
    resize: none; line-height: 1.5; outline: none;
    overflow: hidden; box-sizing: border-box;
}
.btn-send {
    position: absolute; right: 0.4rem; bottom: 0.4rem;
    width: 1.8rem; height: 1.8rem; border-radius: 50%;
    background: var(--text); color: #fff; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    padding: 0; transition: opacity 0.15s;
}
.btn-send:hover { opacity: 0.8; }
.btn-send:disabled { opacity: 0.3; cursor: default; }
.timer-display {
    position: fixed; top: 1rem; left: 1.5rem; z-index: 10;
    font-family: var(--display); font-size: 1.1rem; color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}
.timer-warning { color: var(--red); font-weight: 700; }

/* ── Generating view ── */

.gen-status {
    padding: 0.8rem 2rem; font-size: 0.85rem; font-style: italic;
    color: var(--text-secondary); border-bottom: 1px solid var(--rule-light);
    flex-shrink: 0; animation: fade-pulse 2s ease-in-out infinite;
}
@keyframes fade-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.gen-stream {
    flex: 1; overflow-y: auto; padding: 1.5rem 2rem;
    font-size: 0.82rem; line-height: 1.75; white-space: pre-wrap;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}
.spinner-sm {
    width: 16px; height: 16px;
    border: 2px solid var(--rule); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .8s linear infinite;
}

.search-event {
    padding: 0.4rem 0; border-bottom: 1px solid var(--rule-light);
    font-size: 0.78rem; line-height: 1.6;
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem;
    animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.search-query {
    color: var(--text); font-style: italic;
    flex-basis: 100%;
}
.search-source {
    color: var(--text-dim); text-decoration: none; font-size: 0.7rem;
}
.search-source:hover { color: var(--accent); text-decoration: underline; }
.search-source::before { content: '\2192 '; }

/* ── Report ── */

.report-top {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 1rem; margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--text);
}
.report-top h3 { font-family: var(--display); font-size: 1.15rem; font-weight: 700; }

.level {
    padding: 0.3rem 1rem; font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    border: 2px solid; flex-shrink: 0;
}
.level-foundational { color: #c65d07; border-color: #c65d07; }
.level-competent { color: var(--green); border-color: var(--green); }
.level-advanced { color: var(--accent); border-color: var(--accent); }

.scores-grid {
    display: grid; grid-template-columns: 1fr;
    gap: 0; margin-bottom: 1.5rem;
}
.score-card {
    padding: 1.2rem; border: 1px solid var(--rule-light);
    margin-right: -1px; margin-bottom: -1px;
}
.score-card h4 {
    font-family: var(--display); font-size: 0.92rem; font-weight: 700;
    margin-bottom: 0.1rem;
}
.score-desc { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 0.8rem; }
.score-num {
    font-family: var(--display); font-size: 2.2rem; font-weight: 700;
    color: var(--text); line-height: 1;
}
.score-num span { font-size: 0.9rem; color: var(--text-dim); font-weight: 400; }
.score-bar {
    height: 3px; background: var(--rule-light); margin: 0.8rem 0;
    overflow: hidden;
}
.score-fill {
    height: 100%; background: var(--text); transition: width .4s ease;
}
.score-rationale { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.65; }

.summary-card {
    padding: 0;
}
.summary-body { color: var(--text-secondary); line-height: 1.75; font-size: 0.9rem; }
.summary-body h3 { font-family: var(--display); font-size: 0.95rem; font-weight: 700; margin: 1.2rem 0 0.4rem; color: var(--text); }
.summary-body h4 { font-family: var(--display); font-size: 0.92rem; font-weight: 700; margin: 1rem 0 0.3rem; color: var(--text); }
.summary-body h5 { font-family: var(--display); font-size: 0.85rem; font-weight: 700; margin: 0.8rem 0 0.2rem; color: var(--text); }
.summary-body p { margin-bottom: 0.4rem; }
.summary-body ul { margin: 0.3rem 0 0.6rem 1.2rem; }
.summary-body li { margin-bottom: 0.2rem; }
.summary-body strong { color: var(--text); }

/* ── Report Tabs ── */
.report-tabs {
    display: flex; gap: 0; margin-top: 0.5rem;
}
.report-sidebar {
    display: flex; flex-direction: column; flex-shrink: 0;
    border-right: 1px solid var(--rule-light); padding-right: 0; min-width: 140px;
}
.report-tab {
    background: none; border: none; cursor: pointer;
    font-family: var(--serif); font-size: 0.82rem; color: var(--text-dim);
    text-align: left; padding: 0.6rem 1.2rem; border-left: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.report-tab:hover { color: var(--text); }
.report-tab-active {
    color: var(--text); font-weight: 700; border-left-color: var(--text);
}
.report-content { flex: 1; min-width: 0; padding-left: 1.5rem; }
.report-panel { display: none; }
.report-panel-active { display: block; }

/* ── Rich Markdown (scenario preview) ── */
.scenario-text h3 { font-family: var(--display); font-size: 0.95rem; font-weight: 700; margin: 1.2rem 0 0.4rem; }
.scenario-text h4 { font-family: var(--display); font-size: 0.88rem; font-weight: 700; margin: 1rem 0 0.3rem; }
.scenario-text h5 { font-family: var(--display); font-size: 0.82rem; font-weight: 700; margin: 0.8rem 0 0.2rem; }
.scenario-text p { margin-bottom: 0.5rem; }
.scenario-text ul { margin: 0.3rem 0 0.6rem 1.2rem; }
.scenario-text li { margin-bottom: 0.2rem; }
.scenario-text code { background: var(--bg-subtle); padding: 0.1rem 0.3rem; font-size: 0.8rem; }

/* ── Onboarding ── */
.onboarding-brand {
    font-family: var(--display); font-size: 1rem; font-weight: 700;
    text-align: center; padding: 0.8rem; flex-shrink: 0;
    border-bottom: 1px solid var(--rule-light);
}

.setup-page {
    min-height: 100vh; display: flex; justify-content: center;
    padding-top: 20vh; background: var(--bg);
}
.setup-card {
    text-align: center; max-width: 500px; padding: 0 3rem;
}
.setup-brand {
    font-family: var(--display); font-size: 1rem; font-weight: 700;
    color: var(--text); margin-bottom: 2rem;
}
.setup-card h2 {
    font-family: var(--display); font-size: 1.5rem; font-weight: 700;
    margin-bottom: 0.5rem;
}
.setup-items { margin-top: 2rem; text-align: left; }
.setup-item {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.5rem 0; font-size: 0.9rem;
}
.setup-spinner {
    width: 16px; height: 16px; flex-shrink: 0;
    border: 2px solid var(--rule-light); border-top-color: var(--text);
    border-radius: 50%; animation: spin 0.6s linear infinite;
}
.setup-check {
    width: 16px; height: 16px; flex-shrink: 0;
    color: var(--green); font-weight: 700; text-align: center;
    line-height: 16px; font-size: 0.85rem;
    animation: none;
}

.dialog-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.25); z-index: 100;
    display: flex; align-items: center; justify-content: center;
}
.dialog-card {
    background: var(--bg); border: 1px solid var(--rule);
    padding: 2rem; max-width: 420px; width: 90%;
}
.dialog-card p { font-size: 0.88rem; line-height: 1.7; margin-bottom: 1.5rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

.btn-icon {
    background: none; border: none; cursor: pointer; padding: 0.3rem;
    color: var(--text-dim); transition: color 0.15s; vertical-align: middle;
}
.btn-icon:hover { color: var(--text); }

.archive-tooltip {
    position: absolute; right: 0; top: 50%; transform: translateY(-50%);
    background: #fff; border: 1px solid var(--rule); padding: 0.35rem 0.6rem;
    font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap;
    z-index: 10; display: flex; align-items: center; gap: 0.3rem;
}
.archive-tooltip button {
    font-family: var(--serif); font-size: 0.75rem; cursor: pointer;
    background: none; border: none; padding: 0.1rem 0.3rem;
}
.archive-tooltip .confirm-yes { color: var(--red); font-weight: 700; }
.archive-tooltip .confirm-yes:hover { text-decoration: underline; }
.archive-tooltip .confirm-no { color: var(--text-dim); }
.archive-tooltip .confirm-no:hover { text-decoration: underline; }

/* ── Utilities ── */

.muted { color: var(--text-dim); font-size: 0.85rem; }
.error-text { color: var(--red); }

.loading-full {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.loading-card { text-align: center; }
.loading-card h2 {
    margin-top: 1rem; font-family: var(--display);
    font-size: 1.15rem; font-weight: 700;
}
.loading-card p { margin-top: 0.3rem; color: var(--text-dim); font-size: 0.88rem; }

.spinner {
    width: 32px; height: 32px; margin: 0 auto;
    border: 2px solid var(--rule); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-inline {
    display: inline-block; width: 10px; height: 10px;
    border: 1.5px solid var(--rule-light); border-top-color: var(--text-dim);
    border-radius: 50%; animation: spin 0.6s linear infinite;
    vertical-align: middle; margin-right: 0.3rem;
}

code {
    background: var(--bg-subtle); padding: 0.1rem 0.3rem;
    font-size: 0.82rem;
}

/* ── Admin tables ── */

.admin-table {
    width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.admin-table th {
    text-align: left; font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-dim); padding: 0.5rem 0.6rem;
    border-bottom: 2px solid var(--text);
}
.admin-table td {
    padding: 0.6rem; border-bottom: 1px solid var(--rule-light);
    vertical-align: middle;
}
.admin-table tr:hover td { background: var(--bg-subtle); }

.uid-link {
    font-size: 0.7rem; color: var(--text-dim);
    word-break: break-all;
}

.batch-summary {
    font-size: 0.82rem; color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ── Admin stats ── */

.stats-row {
    display: flex;
    gap: 0; margin-bottom: 1rem;
}
.stat-card {
    flex: 1 1 0; min-width: 120px;
    padding: 1rem; border: 1px solid var(--rule-light);
    text-align: center; margin-right: -1px;
}
.stat-num {
    font-family: var(--display); font-size: 1.8rem; font-weight: 700;
    color: var(--text);
}
.stat-label {
    font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-dim); margin-top: 0.2rem;
}

.level-dist {
    display: flex; gap: 0.8rem; margin-bottom: 1.5rem;
    font-size: 0.78rem;
}
.level-tag {
    padding: 0.2rem 0.6rem; font-weight: 700;
}
.level-tag.level-foundational { color: #c65d07; }
.level-tag.level-competent { color: var(--green); }
.level-tag.level-advanced { color: var(--accent); }

/* ── Interview layout (full-width single-column chat) ── */

.assess-interview {
    display: flex; flex-direction: column; height: 100vh;
}
.assess-interview .messages {
    flex: 1; overflow-y: auto; padding: 1.5rem 2rem;
    max-width: 720px; width: 100%; margin: 0 auto;
}
.assess-interview .input-area-wrap {
    border-top: 1px solid var(--rule);
    flex-shrink: 0;
}
.assess-interview .input-area {
    border-top: none;
    padding: 0.8rem 2rem;
    max-width: 720px; width: 100%; margin: 0 auto;
}

/* Transcript in admin view */
.transcript { margin-top: 1.5rem; }
.transcript h3 {
    font-family: var(--display); font-size: 1rem; font-weight: 700;
    margin-bottom: 0.8rem; padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--rule-light);
}
.transcript-msg { margin-bottom: 1.2rem; }
.transcript-label {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 0.3rem;
}
.transcript-label .response-time {
    font-weight: 400; color: var(--text-dim); text-transform: none;
    letter-spacing: 0; font-size: 0.6rem; margin-left: 0.4rem;
}
.transcript-body {
    font-size: 0.88rem; line-height: 1.75;
    border-left: 3px solid var(--rule-light); padding-left: 1rem;
}
.transcript-msg-user .transcript-body {
    border-left-color: var(--text);
}

/* ── Mobile ── */

@media (max-width: 700px) {
    .navbar { padding: 1rem; }
    .container { padding: 1.5rem 1rem; }
    .assess-header { padding: 0.8rem 1rem; }
    .messages { padding: 1rem; }
    .input-area { padding: 0.8rem 1rem; }
    .gen-stream { padding: 1rem; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .report-tabs { flex-direction: column; }
    .report-sidebar { flex-direction: row; border-right: none; border-bottom: 1px solid var(--rule-light); min-width: 0; margin-bottom: 1rem; }
    .report-tab { border-left: none; border-bottom: 2px solid transparent; padding: 0.5rem 0.8rem; }
    .report-tab-active { border-left-color: transparent; border-bottom-color: var(--text); }
    .report-content { padding-left: 0; }
    .login-card h1 { font-size: 2.2rem; }
    .assess-split { flex-direction: column; }
    .assess-brief {
        width: 100%; max-width: none; min-width: 0;
        max-height: 35vh; border-right: none;
        border-bottom: 2px solid var(--text);
    }
}
