/* ===== Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy:          #1b3a5c;
    --navy-d:        #122840;
    --navy-l:        #234a73;
    --accent:        #2f80ed;
    --accent-h:      #1a6fd4;
    --accent-l:      #ebf3fd;
    --bg:            #f2f1ee;
    --surface:       #ffffff;
    --border:        #dddbd7;
    --border-l:      #eae8e4;
    --text:          #18181b;
    --muted:         #71706c;
    --muted-l:       #a8a7a4;
    --success:       #166534;
    --success-bg:    #f0fdf4;
    --success-b:     #bbf7d0;
    --error:         #b91c1c;
    --error-bg:      #fef2f2;
    --error-b:       #fecaca;
    --radius:        10px;
    --radius-s:      6px;
}

html { font-size: 15px; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Top bar ===== */
.topbar {
    background: var(--navy);
    border-bottom: 1px solid var(--navy-d);
}

.topbar-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-logo {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,.12);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-logo svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topbar-name {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.2px;
}

.topbar-tag {
    font-size: .72rem;
    font-weight: 500;
    color: rgba(255,255,255,.45);
    letter-spacing: .3px;
    text-transform: uppercase;
}

.topbar-back {
    font-size: .8rem;
    font-weight: 500;
    color: rgba(255,255,255,.6);
    text-decoration: none;
    transition: color .15s;
}

.topbar-back:hover { color: #fff; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-auth {
    display: flex;
    align-items: center;
}

.btn-auth-signin {
    font-family: inherit;
    font-size: .78rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255,255,255,.13);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: var(--radius-s);
    padding: 5px 12px;
    cursor: pointer;
    transition: background .15s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.btn-auth-signin:hover { background: rgba(255,255,255,.22); }

.auth-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-name {
    font-size: .82rem;
    font-weight: 500;
    color: rgba(255,255,255,.85);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-credits {
    font-size: .72rem;
    font-weight: 600;
    color: #fff;
    background: rgba(47,128,237,.55);
    border: 1px solid rgba(47,128,237,.7);
    border-radius: 20px;
    padding: 2px 9px;
    white-space: nowrap;
}

.btn-signout {
    font-family: inherit;
    font-size: .75rem;
    font-weight: 400;
    color: rgba(255,255,255,.4);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0;
    white-space: nowrap;
}
.btn-signout:hover { color: rgba(255,255,255,.65); }

.btn-buy-credits {
    font-family: inherit;
    font-size: .72rem;
    font-weight: 600;
    color: var(--navy);
    background: #fff;
    border: none;
    border-radius: var(--radius-s);
    padding: 4px 10px;
    cursor: pointer;
    transition: opacity .15s;
    white-space: nowrap;
}
.btn-buy-credits:hover { opacity: .85; }
.btn-buy-credits:disabled { opacity: .5; cursor: default; }

/* ===== Hero ===== */
.hero {
    background: var(--navy);
    padding: 48px 0 52px;
}

.hero-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 32px;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.5px;
    line-height: 1.2;
    margin-bottom: 10px;
}

.hero p {
    font-size: 1rem;
    color: rgba(255,255,255,.6);
    max-width: 480px;
    line-height: 1.6;
}

/* ===== Page body ===== */
.page-body {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 32px 32px 64px;
}

/* ===== Card ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 36px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.card-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .9px;
    color: var(--muted-l);
    margin-bottom: 6px;
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -.2px;
}

.card-error {
    border-color: var(--error-b);
    background: var(--error-bg);
}

/* ===== Instruction ===== */
.instruction {
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 24px;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius-s);
    border: 1px solid var(--border-l);
}

/* ===== Drop zone ===== */
.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-s);
    padding: 44px 24px;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s;
    background: var(--bg);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-l);
}

.drop-zone input[type="file"] { display: none; }

.drop-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.drop-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--navy);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.drop-text {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
}

.drop-hint {
    font-size: .8rem;
    color: var(--muted-l);
}

.file-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--success-bg);
    border: 1px solid var(--success-b);
    border-radius: var(--radius-s);
    font-size: .875rem;
}

#file-name {
    flex: 1;
    font-weight: 600;
    color: var(--success);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 11px 24px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-s);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    font-family: inherit;
    letter-spacing: -.1px;
}

.btn-primary:hover:not(:disabled) { background: var(--navy-l); }

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    background: var(--surface);
    color: var(--navy);
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    font-family: inherit;
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--navy);
}

.btn-link {
    background: none;
    border: none;
    color: var(--error);
    font-size: .8rem;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ===== Welcome overlay ===== */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.welcome-overlay.hidden { display: none; }

.welcome-modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 36px 32px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.welcome-tag {
    font-size: .72rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: .3px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.welcome-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.3;
    margin-bottom: 10px;
}

.welcome-sub {
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

.welcome-tiers {
    list-style: none;
    border-top: 1px solid var(--border-l);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.welcome-tiers li {
    font-size: .875rem;
    line-height: 1.5;
    padding-left: 18px;
    position: relative;
}

.welcome-tiers li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.welcome-modal .btn-primary {
    width: 100%;
    justify-content: center;
    margin-top: 24px;
}

/* ===== Bundle modal ===== */
.bundle-modal {
    max-width: 400px;
}

.bundle-options {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.bundle-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 20px 12px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-family: inherit;
    position: relative;
}

.bundle-option:hover {
    border-color: var(--navy);
    background: var(--accent-l);
}

.bundle-option-featured {
    border-color: var(--accent);
    background: var(--accent-l);
}

.bundle-badge {
    position: absolute;
    top: -10px;
    background: var(--accent);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: .2px;
}

.bundle-price {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
}

.bundle-amount {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
}

.bundle-desc {
    font-size: .78rem;
    color: var(--muted);
}

/* ===== Test name input ===== */
.test-name-wrap {
    margin-top: 16px;
}

.test-name-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}

.test-name-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    font-family: inherit;
    font-size: .875rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s;
}

.test-name-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== Progress ===== */
.progress-bar-wrap {
    height: 4px;
    background: var(--border-l);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 16px;
}

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

.status-message {
    color: var(--muted);
    font-size: .875rem;
    margin-bottom: 20px;
    font-weight: 500;
}

/* ===== Spinner ===== */
.spinner {
    width: 26px;
    height: 26px;
    border: 2.5px solid var(--border);
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin .75s linear infinite;
    margin: 0 auto;
}

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

/* ===== Results ===== */
.results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.results-meta { flex: 1; }

.results-count {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 500;
    margin-top: 2px;
}

.results-list {
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    overflow: hidden;
}

.result-item { border-bottom: 1px solid var(--border-l); }
.result-item:last-child { border-bottom: none; }

.result-summary {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background .1s;
    gap: 12px;
}

.result-summary:hover { background: var(--bg); }

.result-index {
    font-size: .75rem;
    font-weight: 700;
    color: var(--muted-l);
    width: 22px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.result-name {
    flex: 1;
    font-weight: 600;
    font-size: .9rem;
}

.result-score {
    font-weight: 700;
    color: var(--navy);
    font-size: .95rem;
    font-variant-numeric: tabular-nums;
    min-width: 56px;
    text-align: right;
}

.result-pct {
    font-size: .78rem;
    color: var(--muted);
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.result-toggle {
    color: var(--border);
    font-size: .65rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.result-summary:hover .result-toggle { color: var(--muted); }

.result-detail {
    display: none;
    padding: 0 18px 16px 52px;
    background: var(--bg);
    border-top: 1px solid var(--border-l);
}

.result-detail.open { display: block; }

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    margin-top: 12px;
}

.detail-table th {
    padding: 7px 10px;
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
}

.detail-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border-l);
    vertical-align: top;
    line-height: 1.5;
}

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

.badge-correct {
    display: inline-block;
    padding: 2px 8px;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-b);
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 700;
}

.badge-wrong {
    display: inline-block;
    padding: 2px 8px;
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid var(--error-b);
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 700;
}

/* ===== Legal page ===== */
.legal-card { max-width: 720px; }

.legal-section {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-l);
}

.legal-section:last-child { border-bottom: none; }

.legal-section h2 {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--navy);
}

.legal-section p {
    font-size: .875rem;
    color: var(--text);
    line-height: 1.7;
    margin-bottom: 8px;
}

.legal-section p:last-child { margin-bottom: 0; }

.legal-section ul {
    margin: 8px 0 0 20px;
    font-size: .875rem;
    color: var(--text);
    line-height: 1.7;
}

/* ===== Footer ===== */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 20px;
    color: var(--muted-l);
    font-size: .78rem;
    letter-spacing: .1px;
}

.site-footer a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ===== Upload questions ===== */
.upload-questions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-l);
}

.questions-label {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    margin-bottom: 16px;
}

.questions-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted-l);
    font-size: .8rem;
}

.question-block {
    margin-bottom: 16px;
}

.question-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.question-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.qbtn {
    padding: 7px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--surface);
    color: var(--text);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .12s, background .12s, color .12s;
}

.qbtn:hover {
    border-color: var(--navy);
    background: var(--bg);
}

.qbtn.selected {
    border-color: var(--navy);
    background: var(--navy);
    color: #fff;
}

.qbtn-skip {
    color: var(--muted-l);
    border-style: dashed;
}

.qbtn-skip:hover {
    border-color: var(--muted);
    color: var(--muted);
    background: var(--bg);
}

.qbtn-skip.selected {
    background: var(--bg);
    border-color: var(--muted);
    color: var(--muted);
    border-style: dashed;
}

/* ===== Preview banner ===== */
.preview-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-s);
    flex-wrap: wrap;
}

.preview-banner-text {
    font-size: .875rem;
    color: #1e40af;
    line-height: 1.5;
}

.preview-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-preview-cta {
    display: inline-block;
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-s);
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}

.btn-preview-cta:hover { background: var(--accent-h); }

.preview-banner-sub {
    font-size: .8rem;
    color: #3b82f6;
}

/* ===== Sort control ===== */
.results-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.results-controls .btn-secondary {
    margin-left: auto;
    margin-top: 0;
    padding: 7px 14px;
    font-size: .8rem;
}

.sort-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
}

.sort-select {
    font-family: inherit;
    font-size: .82rem;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.sort-select:focus {
    outline: none;
    border-color: var(--navy);
}

/* ===== Badges: partial & blank ===== */
.badge-partial {
    display: inline-block;
    padding: 2px 8px;
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 700;
}

.badge-blank {
    display: inline-block;
    padding: 2px 8px;
    background: #f9fafb;
    color: var(--muted-l);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 700;
}

/* ===== Student number chip ===== */
.result-student-number {
    display: inline-block;
    font-size: .7rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ===== Warnings block ===== */
.warnings-block {
    margin-bottom: 12px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-s);
    font-size: .85rem;
    color: #78350f;
    line-height: 1.5;
}

.warnings-block ul {
    margin: 6px 0 0 16px;
}

/* ===== Structure review table ===== */
.structure-table {
    margin-bottom: 20px;
}
.structure-table .structure-label-text {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
}
.structure-table .structure-type {
    width: 100%;
    padding: 4px 6px;
    font-size: .85rem;
    font-family: inherit;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fafafa;
}
.structure-table .structure-max {
    width: 70px;
    padding: 4px 6px;
    font-size: .85rem;
    font-family: inherit;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fafafa;
    text-align: right;
}
.structure-subject {
    font-size: .8rem;
    color: var(--muted);
}
.structure-hint {
    font-size: .8rem;
    color: var(--muted);
    margin: -8px 0 16px;
}
.btn-remove-row {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
}
.btn-remove-row:hover {
    color: var(--error);
    background: #fee2e2;
}
.structure-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ===== Question type badges ===== */
.qtype-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.qtype-open            { background: #ede9fe; color: #5b21b6; }
.qtype-closed          { background: #dbeafe; color: #1e40af; }
.qtype-multiple_choice { background: #dcfce7; color: #166534; }

/* ===== Score override input ===== */
.score-cell {
    white-space: nowrap;
}
.score-override {
    width: 52px;
    padding: 2px 4px;
    font-size: .85rem;
    font-family: inherit;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    text-align: right;
    background: #fafafa;
}
.score-override:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}
.score-max {
    font-size: .8rem;
    color: var(--muted);
    margin-left: 3px;
}
.score-modified-row td {
    background: #fefce8;
}
.score-modified-row .score-override {
    border-color: #ca8a04;
    background: #fef9c3;
    font-weight: 600;
}
.result-modified .result-score {
    color: #b45309;
    font-weight: 700;
}
.result-modified .result-score::after {
    content: ' *';
    font-size: .75rem;
}

/* ===== Teacher note textarea in detail table ===== */
.teacher-note {
    width: 100%;
    min-width: 120px;
    padding: 3px 6px;
    font-size: .8rem;
    font-family: inherit;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    resize: vertical;
    background: #fafafa;
    color: var(--text);
    line-height: 1.4;
}
.teacher-note:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}

/* ===== Per-student warning icon + block ===== */
.student-warning-icon {
    color: #b45309;
    font-size: .85rem;
    cursor: help;
    margin-left: 4px;
}

.student-warnings-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-s);
    font-size: .82rem;
    color: #78350f;
}

/* ===== Question type label ===== */
.results-qtype {
    font-size: .78rem;
    color: var(--muted);
    margin-top: 2px;
    font-weight: 500;
}

/* ===== Error hint ===== */
.error-hint {
    display: block;
    margin-top: 8px;
    font-size: .82rem;
    color: var(--muted);
}

/* ===== Question analysis ===== */
.question-analysis {
    margin-top: 20px;
    border: 1px solid var(--border-l);
    border-radius: var(--radius-s);
    overflow: hidden;
}

.analysis-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg);
    border: none;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.analysis-toggle:hover { background: #e8e7e4; }

.analysis-toggle-icon {
    font-size: .65rem;
    color: var(--border);
}

.analysis-body {
    padding: 0 16px 16px;
    background: var(--surface);
}

.analysis-table {
    margin-top: 12px;
}

.excluded-row td {
    opacity: .45;
    text-decoration: line-through;
}

.btn-exclude {
    font-family: inherit;
    font-size: .75rem;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: background .1s, border-color .1s;
}

.btn-exclude:hover {
    background: var(--bg);
    border-color: var(--navy);
    color: var(--navy);
}

.excluded-note {
    margin-top: 10px;
    font-size: .8rem;
    color: var(--muted);
    font-style: italic;
}

/* ===== Export buttons ===== */
.export-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== History section ===== */
.history-list {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.history-info { flex: 1; min-width: 0; }

.history-name {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: .78rem;
    color: var(--muted);
    margin-top: 2px;
}

.history-detail {
    font-size: .85rem;
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-history-view {
    font-family: inherit;
    font-size: .8rem;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--navy);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .1s, border-color .1s;
}

.btn-history-view:hover {
    background: var(--accent-l);
    border-color: var(--navy);
}

/* ===== Print styles ===== */
@media print {
    .topbar,
    .hero,
    #section-history,
    #section-upload,
    #section-structure,
    #section-status,
    #section-error,
    .results-controls,
    .export-buttons,
    .site-footer { display: none !important; }

    body { background: #fff; }
    .page-body { max-width: 100%; padding: 0; }
    .card { border: none; box-shadow: none; padding: 0; margin: 0; }

    .result-item { break-inside: avoid; }
    details[open] summary::after { content: none; }
}

/* ===== Utility ===== */
.hidden { display: none !important; }
