:root {
    color-scheme: light;
    --ink: #252126;
    --muted: #685e62;
    --primary: #cb2638;
    --primary-dark: #a82030;
    --tint: #fae9ec;
    --line: #ebdce0;
    --border: #cbbcc1;
    --paper: #fff;
    --background: #fcf6f7;
    --surface-soft: #fff8f9;
    --shadow-soft: 0 10px 35px #78212f0c;
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--background);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; font-size: 15px; line-height: 1.55; }
[hidden] { display: none !important; }
a { color: var(--primary-dark); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
h1, h2, h3, p { margin: 0 0 .75rem; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.2; letter-spacing: -.03em; }
h2 { font-size: 1.15rem; line-height: 1.35; }
h3 { font-size: 1rem; }
p:last-child, h2:last-child { margin-bottom: 0; }
.topbar { min-height: 74px; display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .7rem clamp(1rem, 4vw, 2.6rem); background: #fff; color: var(--ink); border-bottom: 3px solid var(--primary); }
.brand, .top-actions { display: flex; align-items: center; gap: .8rem; }
.brand { color: inherit; text-decoration: none; }
.brand span { display: grid; }
.brand strong { color: var(--primary-dark); font-size: 1.08rem; }
.brand small { color: var(--muted); }
.brand img { object-fit: contain; flex-shrink: 0; }
.top-user { color: var(--ink); overflow-wrap: anywhere; }
.workspace { display: grid; grid-template-columns: 225px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.sidebar { display: grid; align-content: start; gap: .75rem; background: #fff; padding: 1.4rem .85rem; border-right: 1px solid var(--line); }
.sidebar-section { display: grid; align-content: start; gap: .3rem; }
.sidebar-label { padding: .2rem .8rem .45rem; color: var(--muted); font-size: .81rem; font-weight: 700; }
.sidebar a { display: block; padding: .63rem .72rem; border-radius: .45rem; text-decoration: none; color: var(--ink); }
.sidebar a:hover, .sidebar a.current { color: var(--primary-dark); background: var(--tint); }
.sidebar a.current { font-weight: 700; }
.sidebar-section + .sidebar-section { padding-top: .75rem; border-top: 1px solid var(--line); }
.content { width: 100%; max-width: 1500px; padding: clamp(1rem, 3vw, 2.65rem); }
.workspace--admin {
    grid-template-columns: clamp(13.25rem, 18vw, 16rem) minmax(0, 1fr);
    background: radial-gradient(ellipse at 86% 0%, #f8e5e9, transparent 44rem), var(--background);
}
.workspace--admin .sidebar { padding: 1.6rem 1rem; background: #fffcfd; }
.workspace--admin .sidebar a { border-inline-start: 3px solid transparent; border-radius: .6rem; }
.workspace--admin .sidebar a.current { border-inline-start-color: var(--primary); }
.workspace--admin .content { min-width: 0; }
.workspace--admin h1 { color: var(--primary-dark); }
.workspace--admin .page-heading {
    gap: 1rem 1.5rem;
    padding: clamp(1rem, 2.4vw, 1.7rem);
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: linear-gradient(112deg, var(--paper), var(--surface-soft));
}
.workspace--admin .panel { border-radius: 1rem; box-shadow: var(--shadow-soft); }
.workspace--admin .button { border-radius: .55rem; }
.workspace--admin .table-wrap { border: 1px solid var(--line); border-radius: .7rem; }
.workspace--admin table tbody tr:hover { background: var(--surface-soft); }
.workspace--admin .toolbar label { min-width: 0; }
.dashboard-filter label { flex: 1 1 18rem; max-width: 36rem; }
.dashboard-filter select { text-overflow: ellipsis; }
.stats.dashboard-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
.dashboard-stats .stat {
    align-content: start;
    min-height: 6.6rem;
    border-radius: .8rem;
    box-shadow: var(--shadow-soft);
}
.dashboard-stats .stat:first-child { background: #fae9ec; border-color: #edcbd2; }
.dashboard-stats .stat strong { color: var(--primary-dark); font-size: 1.85rem; line-height: 1.15; }
.dashboard-progress table { min-width: 41rem; }
.progress-cell { display: flex; align-items: center; gap: .6rem; }
.progress-cell progress { width: 5.5rem; height: .5rem; accent-color: var(--primary); }
.progress-cell strong { color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.guest {
    --primary: #d70e33;
    --primary-dark: #b80d2d;
    position: relative;
    isolation: isolate;
    display: grid;
    min-height: 100svh;
    place-items: center;
    overflow: hidden;
    background: radial-gradient(ellipse at 16% 78%, #ffd6df, transparent 48%), linear-gradient(125deg, #fde9ed, #fff5f6 58%, #fce6eb);
}
.guest::before,
.guest::after {
    position: absolute;
    z-index: -1;
    bottom: -5.4rem;
    width: 125%;
    height: 8rem;
    pointer-events: none;
    content: "";
}
.guest::before { left: -23%; border-radius: 47% 55% 0 0; background: linear-gradient(90deg, #d91031, #ed5b74 68%, #ffd0d9); transform: rotate(2deg); }
.guest::after { right: -44%; bottom: -5.6rem; border-radius: 60% 42% 0 0; background: #ee577061; transform: rotate(-7deg); }
.guest .content { max-width: 1740px; padding: clamp(1rem, 5.4vh, 4.4rem) clamp(1.2rem, 4.2vw, 4.6rem); }
.login-field { display: grid; gap: .35rem; }
.login-field label { font-size: clamp(.96rem, 1.55vw, 1.45rem); font-weight: 750; }
.login-input { position: relative; color: var(--primary); }
.login-input > input:not([type=checkbox]):not([type=radio]) { min-height: clamp(3rem, 4vw, 4.2rem); padding-inline: 3rem 2.9rem; border: 2px solid #dfcbd0; border-radius: .7rem; background: var(--paper); }
.login-input > .login-icon { position: absolute; inset-inline-start: 1.05rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.login-icon { display: block; position: relative; width: 1.22rem; height: 1.22rem; }
.login-icon--person::before,
.login-icon--person::after,
.login-icon--lock::before,
.login-icon--lock::after,
.login-icon--eye::after { position: absolute; content: ""; }
.login-icon--person::before { inset: 0 .32rem auto; height: .56rem; border: 2px solid currentColor; border-radius: 50%; }
.login-icon--person::after { inset: .63rem .04rem 0; border: 2px solid currentColor; border-radius: .65rem .65rem .08rem .08rem; }
.login-icon--lock::before { inset: 0 .29rem .47rem; border: 2px solid currentColor; border-radius: .6rem .6rem 0 0; }
.login-icon--lock::after { inset: .43rem .05rem 0; border: 2px solid currentColor; border-radius: .17rem; background: radial-gradient(circle, currentColor 0 2px, transparent 2.5px); }
.login-icon--eye { width: 1rem; height: 1rem; border: 2px solid currentColor; border-radius: 75% 0 75% 0; transform: rotate(45deg); }
.login-icon--eye::after { inset: 23%; border: 1.5px solid currentColor; border-radius: 50%; }
.password-toggle { position: absolute; top: 50%; inset-inline-end: .25rem; transform: translateY(-50%); display: grid; width: 2.5rem; height: 2.5rem; place-items: center; padding: 0; border: 0; border-radius: .4rem; background: transparent; color: var(--primary); }
.password-toggle:hover, .password-toggle[aria-pressed=true] { background: var(--tint); }
.panel { padding: clamp(.9rem, 2vw, 1.45rem); background: var(--paper); border: 1px solid var(--line); border-radius: .8rem; margin-bottom: 1rem; min-width: 0; }
.empty { text-align: center; padding: 3rem 1rem; }
.narrow { max-width: 650px; }
.muted, small { color: var(--muted); }
.preserve { white-space: pre-wrap; }
.page-heading, .section-heading, .attempt-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.page-heading { margin-bottom: 1.2rem; }
.page-heading p, .section-heading p, .section-heading h2, .section-heading h3 { margin: 0; }
.page-heading p { color: var(--muted); }
.back { display: inline-block; margin-bottom: .65rem; }
.actions, .toolbar { display: flex; gap: .65rem; align-items: end; flex-wrap: wrap; }
.toolbar { margin: .6rem 0; }
.toolbar.panel { margin-bottom: 1rem; }
.stack { display: grid; gap: .85rem; }
.stack > .panel { margin: 0; }
.compact { margin-top: .65rem; min-width: 230px; }
.form-grid, .facts, .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: .9rem; }
.form-grid { margin-bottom: .8rem; }
label { display: grid; gap: .28rem; font-weight: 600; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-width: 0; padding: .47rem .64rem; border: 1px solid var(--border); border-radius: .38rem; color: var(--ink); background: #fff; }
textarea { resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 1rem; height: 1rem; flex-shrink: 0; }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 500; }
.button { border: 1px solid var(--border); border-radius: .43rem; background: white; display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: .45rem .82rem; color: var(--primary-dark); text-decoration: none; font-weight: 650; white-space: nowrap; }
.button:hover { background: var(--tint); }
.button.primary { background: var(--primary); border-color: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); }
.button.light { color: var(--primary-dark); background: transparent; }
.button.light:hover { background: var(--tint); }
.button.danger { color: #8f2929; border-color: #d9b5b3; }
.button.small { min-height: 33px; padding: .26rem .55rem; font-size: .9rem; }
.button:disabled { opacity: .45; cursor: default; }
.file-button { cursor: pointer; }
.file-button input { position: absolute; width: 1px !important; height: 1px; opacity: 0; padding: 0 !important; }
.file-button:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; }
#import-status { white-space: pre-line; }
.notice { padding: .75rem 1rem; margin-bottom: 1rem; border-radius: .5rem; border: 1px solid var(--line); }
.success { background: #e7f3e8; }
.error { background: #fce9e6; color: #7a2828; }
.notice ul { margin: .35rem 0 0; }
.badge { display: inline-block; background: #f2edef; border-radius: 2rem; padding: .1rem .6rem; font-size: .83rem; color: var(--muted); font-weight: 650; }
.badge.active { background: var(--tint); color: var(--primary-dark); }
.stats { margin: 1rem 0; }
.stat { display: grid; gap: .22rem; background: #fff; border: 1px solid var(--line); border-radius: .7rem; padding: 1rem; }
.stat span, .facts dt { color: var(--muted); }
.stat strong { font-size: 1.6rem; }
.stat small { font-size: .75rem; }
.facts dd { font-weight: 650; margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .77rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fcf2f4; color: #624e54; font-size: .89rem; white-space: nowrap; }
td small { display: block; margin-top: .2rem; }
tr:last-child td { border-bottom: 0; }
.pagination { margin-top: 1rem; }
.split { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 3fr); gap: 1rem; align-items: start; }
details { margin: .6rem 0; }
summary { font-weight: 650; }
details > form { margin: .7rem 0; }
.tabs { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { color: var(--muted); text-decoration: none; padding: .55rem .2rem; }
.tabs .current { border-bottom: 3px solid var(--primary); color: var(--primary-dark); font-weight: 700; }
.question.editor-card { padding: 1rem; border: 1px solid var(--line); border-radius: .55rem; margin: .75rem 0; background: #fffbfc; }
.question-options, .question .form-grid { margin-top: .65rem; }
.option { display: flex; gap: .7rem; align-items: baseline; border: 1px solid var(--line); border-radius: .45rem; padding: .65rem .75rem; margin-bottom: .5rem; font-weight: 500; overflow-wrap: anywhere; }
.option:has(input:checked) { background: var(--tint); border-color: #ce7b87; }
.option.correct { background: #eaf4eb; border-color: #8cad94; }
.option strong { margin-left: auto; }
:is(.workspace--attempt, .workspace--participant) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    background: radial-gradient(ellipse at 16% 0%, #f9e7eb, transparent 42rem), var(--background);
}
:is(.workspace--attempt, .workspace--participant) .content { max-width: 1200px; min-width: 0; margin-inline: auto; }
:is(.workspace--attempt, .workspace--participant) .sidebar,
:is(.workspace--attempt, .workspace--participant) .sidebar-section { display: flex; flex-wrap: wrap; }
:is(.workspace--attempt, .workspace--participant) .sidebar {
    justify-content: center;
    padding: .4rem 1rem;
    border: 0;
    border-bottom: 1px solid var(--line);
}
:is(.workspace--attempt, .workspace--participant) .sidebar-label { align-self: center; padding: 0 .5rem; }
:is(.workspace--attempt, .workspace--participant) .sidebar-section + .sidebar-section { padding: 0; border: 0; }
:is(.workspace--attempt, .workspace--participant) .sidebar a { padding-block: .4rem; }
.participant-heading,
.workspace--participant .participant-card {
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--paper);
    box-shadow: var(--shadow-soft);
}
.participant-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.15rem;
    padding: clamp(1rem, 2.5vw, 1.8rem);
    background: linear-gradient(110deg, var(--paper), var(--surface-soft));
}
.participant-heading h1 { margin-bottom: .35rem; color: var(--primary-dark); }
.participant-heading p { margin: 0; color: var(--muted); }
.participant-list { display: grid; gap: .85rem; }
.participant-list .participant-card { margin: 0; }
.participant-card h2 { margin: .3rem 0 .65rem; }
.participant-card.empty h2 { margin-top: 0; }
.participant-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem; margin: 0; color: var(--muted); font-size: .875rem; }
.participant-meta .badge, .history-outcome .badge { white-space: nowrap; }
.badge-outline { border: 1px solid #d9a3ae; background: var(--paper); color: var(--primary-dark); }
.my-exam-jumps { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.25rem; }
.my-exam-jumps .button { gap: .5rem; min-height: 44px; white-space: normal; text-align: center; }
.my-exam-jumps span { min-width: 1.5rem; padding: .1rem .25rem; border-radius: .4rem; background: var(--tint); }
.my-exam-group { margin-bottom: 1.35rem; scroll-margin-top: .75rem; }
.my-exam-group > h2 { margin-bottom: .65rem; color: var(--primary-dark); }
.my-exam-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; }
.my-exam-card h3 { margin: .45rem 0 .8rem; font-size: clamp(1.05rem, 2vw, 1.3rem); overflow-wrap: anywhere; }
.my-exam-card .participant-meta > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.my-exam-actions { display: grid; gap: .45rem; }
.workspace--participant .exam-card--running { border-inline-start: 4px solid var(--primary); }
.exam-card-info, .history-info { min-width: 0; }
.participant-action { min-height: 44px; border-radius: .55rem; }
.participant-facts { display: grid; gap: .55rem; margin: 0; }
.exam-facts { display: flex; flex-wrap: wrap; gap: .55rem 1.5rem; }
.participant-facts dt { color: var(--muted); font-size: .82rem; }
.participant-facts dd { margin: .15rem 0 0; font-weight: 650; overflow-wrap: anywhere; }
.history-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(8rem, auto) auto; align-items: center; gap: .85rem 1.35rem; }
.history-card h2 { margin-block: .25rem .4rem; }
.history-outcome { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: .6rem; }
.history-score small, .history-score strong { display: block; }
.history-score strong { color: var(--primary-dark); font-size: 1.23rem; font-variant-numeric: tabular-nums; }
.result-receipt { margin-bottom: 1rem; }
.result-receipt h2 { margin: 0 0 .25rem; }
.result-facts { grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr)); }
.result-facts > div, .result-pending, .intro-facts > div { padding: .75rem 1rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface-soft); }
.result-facts .result-score, .intro-facts .intro-duration { border-color: #e7c1cb; background: var(--tint); }
.result-facts dd { color: var(--primary-dark); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.result-score dd { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.2; }
.result-pending p { margin: .35rem 0 0; overflow-wrap: anywhere; }
.result-review h2 { margin-top: 1.25rem; color: var(--primary-dark); }
.result-question h3 { color: var(--primary-dark); }
.review-options { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.review-option { display: flex; align-items: baseline; gap: .7rem; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .65rem; }
.review-option--selected { background: var(--surface-soft); }
.review-option--correct { border-color: #c98798; background: var(--tint); }
.review-option-content { display: flex; flex: 1; min-width: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .3rem .7rem; overflow-wrap: anywhere; }
.review-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.review-blank { margin: .65rem 0 0; }
.intro-card h2, .account-grid h2 { margin-top: 0; margin-bottom: 1rem; }
.intro-facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); }
.intro-facts dd { color: var(--primary-dark); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.intro-instructions { margin-top: 1.25rem; }
.intro-instructions h3 { margin-bottom: .35rem; }
.intro-footer { display: flex; justify-content: space-between; align-items: center; gap: .85rem 1.2rem; margin-top: 1.15rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.intro-footer p { margin: 0; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); align-items: start; gap: .9rem; }
.account-grid .panel { margin: 0; }
.workspace--participant .account-profile { background: linear-gradient(120deg, var(--paper), var(--surface-soft)); }
.account-profile dl { gap: .85rem; }
.account-profile dd { color: var(--primary-dark); }
.account-password .stack { max-width: 32rem; }
.account-password .stack > button { justify-self: start; }
.account-password input { min-height: 46px; }
.attempt-header {
    position: sticky;
    top: .5rem;
    z-index: 2;
    align-items: center;
    margin-bottom: 1rem;
    padding: clamp(.8rem, 2vw, 1.4rem);
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--paper);
    box-shadow: var(--shadow-soft);
}
.attempt-title { min-width: 0; }
.attempt-title h1 { color: var(--primary-dark); font-size: clamp(1.35rem, 2.6vw, 2.1rem); }
.attempt-title p { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; margin: 0; color: var(--muted); font-size: .9rem; }
.time-box { flex: none; min-width: 7.3rem; padding: .45rem .8rem; border-radius: .7rem; background: var(--primary-dark); color: white; text-align: center; }
.time-box small, .time-box span { display: block; max-width: 11rem; color: #ffedf0; font-size: .77rem; }
.time-box strong { display: block; font-size: 1.6rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.attempt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem); gap: 1rem; align-items: start; }
.attempt-grid .panel { margin: 0; border-radius: 1rem; box-shadow: var(--shadow-soft); }
.question-stage { padding: clamp(1rem, 2.5vw, 1.7rem); }
.attempt-question .section-heading { margin-bottom: 1rem; }
.attempt-question .section-heading h2 { color: var(--primary-dark); }
.attempt-question .section-heading h2 span { color: var(--muted); font-weight: 500; }
.question-text { margin-bottom: 1.15rem; font-size: clamp(1.04rem, 2vw, 1.22rem); font-weight: 650; }
.answer-options { display: grid; gap: .55rem; }
.answer-options .option { align-items: center; min-height: 3.25rem; margin: 0; border-radius: .65rem; }
.answer-options .option:hover { border-color: #cf9ba6; background: var(--surface-soft); }
.answer-options .option:has(input:checked) { border-color: #c86b7d; background: var(--tint); }
.answer-letter { display: grid; flex: 0 0 1.7rem; height: 1.7rem; place-items: center; border-radius: .4rem; background: #f8edf0; color: var(--primary-dark); font-size: .82rem; font-weight: 700; }
.option:has(input:checked) .answer-letter { background: var(--primary-dark); color: white; }
.mark-review[aria-pressed=true] { border-color: #c86b7d; background: var(--tint); }
.attempt-controls { justify-content: space-between; padding-top: .9rem; border-top: 1px solid var(--line); margin: .95rem 0 0; }
.attempt-navigation details { margin-top: 0; }
.attempt-navigation summary { color: var(--primary-dark); }
.question-numbers { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0; }
.question-number { min-width: 2.65rem; min-height: 2.65rem; padding: .3rem; font-variant-numeric: tabular-nums; }
.question-number.answered { border-color: #dba3ae; background: var(--tint); }
.question-number[aria-current=true] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
#submit-attempt { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line); }
#submit-attempt .button { width: 100%; }
.submit-dialog {
    width: min(27rem, calc(100% - 2rem));
    max-width: none;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 16px 45px #78212f24;
}
.submit-dialog::backdrop { background: #26181d68; }
.submit-dialog h2 { color: var(--primary-dark); }
.submit-dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .6rem; margin-top: 1rem; }
.submit-dialog-actions .button { min-height: 44px; }
.skip-link {
    position: fixed;
    z-index: 20;
    top: .75rem;
    left: .75rem;
    transform: translateY(-200%);
    padding: .65rem 1rem;
    border-radius: .45rem;
    background: var(--paper);
}
.skip-link:focus { transform: translateY(0); }
.participant-nav-icon { display: none; }
.directory-filters { display: flex; flex-wrap: wrap; align-items: end; gap: .7rem; margin-bottom: 1rem; }
.directory-filters label { flex: 1 1 9rem; min-width: 0; }
.directory-filters label:has(input[type=search]) { flex-basis: 14rem; }
.directory-filters .directory-check { flex: 0 1 auto; min-height: 44px; }
.directory-filters input, .directory-filters select, .directory-filters .button { min-height: 44px; }
.directory-filters input, .directory-filters select { max-width: 100%; }
.dashboard-filter label { flex-basis: 18rem; }
.directory-actions, .directory-filter-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.directory-actions .button, .directory-filter-buttons .button { min-height: 44px; }
.directory-panel .directory-filters {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, .8fr);
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: var(--surface-soft);
}
.directory-tabs { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .85rem; }
.directory-tabs a {
    display: inline-flex; align-items: center; min-height: 44px; padding: .45rem .85rem;
    background: var(--paper); border: 1px solid var(--line); border-radius: .55rem; font-weight: 650; text-decoration: none;
}
.directory-tabs a[aria-current=page] { background: var(--tint); color: var(--primary-dark); border-color: #dba3ae; }
.directory-filter-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: start;
    gap: .65rem;
}
.directory-filter-options { grid-column: 1 / -1; }
.directory-filters .directory-check input { min-height: 0; }
.directory-check:has(input:disabled) { color: var(--muted); }
.directory-row-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.directory-panel .directory-row-controls .button, .directory-panel .directory-dialog .button { min-height: 44px; }
.directory-actions .button { gap: .4rem; }
.directory-icon { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.directory-icon-button { width: 44px; padding: 0; color: var(--primary-dark); }
.directory-delete { background: var(--surface-soft); }
.directory-dialog { width: min(35rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 1.5rem); overflow: auto; }
.directory-dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: .65rem; margin-bottom: 1rem; overflow-wrap: anywhere; }
.directory-dialog-heading h2 { margin: 0; }
.directory-close { min-width: 44px; min-height: 44px; padding: 0; font-size: 1.4rem; }
.directory-dialog .notice { max-height: 12rem; overflow: auto; }
.directory-import-note { margin-bottom: 1rem; padding: .75rem; border-radius: .65rem; background: var(--surface-soft); }
.directory-import-note p { margin: 0 0 .45rem; }
.directory-dialog input[type=file] { min-width: 0; }
.directory-dialog .submit-dialog-actions { border-top: 1px solid var(--line); padding-top: .85rem; }
.directory-dialog-secondary { border-top: 1px solid var(--line); margin-top: .85rem; padding-top: .85rem; }
.record-action {
    border: 1px solid var(--line);
    border-radius: .65rem;
    padding: .55rem .8rem;
    background: var(--surface-soft);
}
.record-action summary { color: var(--primary-dark); }
.record-action > form { margin-top: .8rem; }
.list-count { margin: .9rem 0 .45rem; color: var(--muted); font-size: .85rem; }
.responsive-table td { overflow-wrap: anywhere; }
.row-identity a { text-decoration: none; }
.row-identity a:hover { text-decoration: underline; }
.row-actions .button { min-height: 36px; }
.admin-section-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.admin-section-links a { display: inline-flex; align-items: center; min-height: 40px; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--paper); text-decoration: none; font-weight: 650; }
.admin-section-links a:hover { background: var(--tint); }
.admin-editor section[id] { scroll-margin-top: .75rem; }
.exam-editor { display: grid; gap: 1rem; align-items: start; }
.exam-editor-column { display: grid; gap: 1rem; min-width: 0; }
.exam-editor-column > .panel { margin: 0; }
.exam-editor-column h2 { margin-bottom: .95rem; }
.exam-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.exam-editor-grid label, .exam-editor-grid input, .exam-editor-grid select { min-width: 0; }
.exam-editor-grid input, .exam-editor-grid select, .exam-editor-grid textarea { min-height: 44px; }
.exam-editor-wide, .exam-editor > .editor-footer { grid-column: 1 / -1; }
.exam-editor .check { gap: .65rem; min-height: 44px; cursor: pointer; }
.exam-editor .check input { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; accent-color: var(--primary); }
.exam-visibility { min-width: 0; margin: 1rem 0 0; padding: .3rem .8rem .45rem; border: 1px solid var(--line); border-radius: .7rem; }
.exam-visibility legend { padding: 0 .35rem; font-weight: 650; }
.exam-selection-status, .exam-editor-empty { margin: 0 0 .75rem; padding: .6rem .75rem; border-radius: .6rem; background: var(--surface-soft); color: var(--primary-dark); }
.exam-selection-status:empty { display: none; }
.exam-editor-empty:last-child { margin-bottom: 0; }
.exam-paper-options, .exam-editor .unit-tree { display: grid; gap: .45rem; list-style: none; margin: 0; padding: 0; }
.exam-paper-option, .exam-editor .unit-tree .check { padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .6rem; overflow-wrap: anywhere; }
.exam-paper-option:hover, .exam-editor .unit-tree .check:hover { background: var(--surface-soft); }
.exam-paper-option:has(input:checked), .exam-editor .unit-tree .check:has(input:checked) { background: var(--tint); border-color: #dba3ae; }
.exam-paper-option small { display: block; font-weight: 500; }
.exam-editor .unit-tree .unit-tree { margin-block-start: .45rem; margin-inline-start: .6rem; padding-inline-start: .6rem; border-inline-start: 1px solid var(--line); }

@media (min-width: 1120px) {
    .exam-editor { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}

@media (max-width: 540px) {
    .exam-editor-grid { grid-template-columns: minmax(0, 1fr); }
    .exam-editor-grid input, .exam-editor-grid select, .exam-editor-grid textarea { font-size: 1rem; }
    .exam-editor-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .exam-editor-links a { min-height: 44px; }
}
.paper-preview-question .section-heading { margin-bottom: .9rem; }
.paper-preview-question h2, .preview-key summary { color: var(--primary-dark); }
.preview-key { margin: .85rem 0 0; }
.preview-key p { margin-top: .4rem; }
.editor-tools { align-items: center; }
.editor-empty { margin-top: .75rem; padding: .9rem; border: 1px dashed var(--border); border-radius: .65rem; color: var(--muted); }
.editor-footer {
    position: sticky;
    z-index: 2;
    bottom: .5rem;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .55rem;
    padding: .7rem;
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: var(--paper);
    box-shadow: 0 4px 20px #78212f18;
}
.editor-footer .button { min-height: 44px; white-space: normal; text-align: center; }
@media (min-width: 851px) {
    .workspace--learner:is(.workspace--attempt, .workspace--participant) {
        grid-template-columns: 215px minmax(0, 1fr);
        grid-template-rows: auto;
    }
    .workspace--learner:is(.workspace--attempt, .workspace--participant) .sidebar,
    .workspace--learner:is(.workspace--attempt, .workspace--participant) .sidebar-section { display: grid; }
    .workspace--learner:is(.workspace--attempt, .workspace--participant) .sidebar {
        justify-content: stretch;
        padding: 1.4rem .85rem;
        border-right: 1px solid var(--line);
        border-bottom: 0;
    }
    .workspace--learner:is(.workspace--attempt, .workspace--participant) .sidebar a { padding-block: .65rem; }
}
@media (max-width: 850px) {
    .workspace { grid-template-columns: minmax(0, 1fr); }
    .sidebar { gap: .35rem; padding: .5rem .85rem; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar-section { display: flex; flex-wrap: wrap; gap: .3rem; }
    .sidebar-section + .sidebar-section { padding-top: .35rem; }
    .sidebar-label { width: 100%; padding: .2rem .5rem 0; }
    .sidebar a { padding: .37rem .5rem; font-size: .9rem; }
    .workspace--admin .sidebar { padding: .65rem 1rem; }
    :is(.workspace--attempt, .workspace--participant) .sidebar-label { width: auto; }
    .top-user { display: none; }
    .admin-menu-toggle { justify-self: start; align-self: center; }
}
@media (max-width: 760px) {
    .guest { align-items: start; }
    .guest .content { max-width: 570px; padding-block: 1rem; }
    :is(.workspace--learner, .workspace--participant, .workspace--attempt) .content { padding-bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px)); }
    .workspace.workspace--learner .sidebar { height: 0; padding: 0; border: 0; }
    .workspace :is(.sidebar-section.participant-navigation) {
        position: fixed;
        z-index: 5;
        inset: auto 0 0;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .25rem;
        padding: .45rem .65rem calc(.45rem + env(safe-area-inset-bottom, 0px));
        border: 0;
        border-top: 1px solid var(--line);
        background: var(--paper);
        box-shadow: 0 -5px 22px #78212f17;
    }
    .workspace--admin .sidebar-section.participant-navigation { position: static; display: flex; padding: .35rem 0 0; border-top: 1px solid var(--line); box-shadow: none; }
    .workspace:not(.workspace--admin) .participant-navigation a {
        display: grid;
        min-width: 0;
        min-height: 49px;
        justify-items: center;
        align-content: center;
        gap: .22rem;
        padding: .25rem .1rem;
        text-align: center;
        line-height: 1.15;
        font-size: .78rem;
    }
    .workspace:not(.workspace--admin) .participant-nav-icon { position: relative; display: block; width: 1.18rem; height: 1.18rem; }
    .participant-nav-icon--exams { border: 1.6px solid currentColor; border-radius: .27rem; background: linear-gradient(currentColor,currentColor) center 37%/.56rem 1px no-repeat, linear-gradient(currentColor,currentColor) center 67%/.56rem 1px no-repeat; }
    .participant-nav-icon--history { border: 1.6px solid currentColor; border-radius: 50%; }
    .participant-nav-icon--history::before { position: absolute; top: .18rem; left: .4rem; width: .31rem; height: .35rem; border-bottom: 1.5px solid currentColor; border-left: 1.5px solid currentColor; content: ""; }
    .workspace--admin .table-wrap:has(.responsive-table) { overflow: visible; border: 0; border-radius: 0; }
    .responsive-table, .responsive-table tbody, .dashboard-progress .responsive-table { display: block; min-width: 0; }
    .responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .responsive-table tbody tr { display: grid; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: .65rem; margin: 0 0 .6rem; background: var(--paper); }
    .responsive-table tbody tr:last-child { margin-bottom: 0; }
    .responsive-table tbody tr td { display: block; min-width: 0; padding: .35rem 0; border: 0; }
    .responsive-table td[data-label] { display: flex; align-items: start; justify-content: space-between; gap: .7rem; }
    .responsive-table td[data-label]::before { flex: 0 0 6.4rem; color: var(--muted); font-size: .82rem; content: attr(data-label); }
    .responsive-table td.row-identity { padding-bottom: .55rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }
    .responsive-table td.row-actions:empty { display: none; }
    .topbar .brand strong { overflow-wrap: anywhere; }
}
@media (max-width: 640px) {
    .submit-dialog-actions > button { flex: 1 1 auto; }
    .split, .attempt-grid { grid-template-columns: minmax(0, 1fr); }
    .attempt-header { top: .25rem; gap: .55rem; }
    .attempt-title h1 { font-size: clamp(1.06rem, 4vw, 1.4rem); }
    .time-box { min-width: 6rem; max-width: 7rem; padding-inline: .38rem; }
    .time-box strong { font-size: 1.38rem; }
    .attempt-grid { gap: .75rem; }
    .page-heading { flex-wrap: wrap; }
    .participant-heading { align-items: flex-start; flex-wrap: wrap; gap: .65rem; }
    .participant-heading h1 { font-size: clamp(1.35rem, 6vw, 1.85rem); }
    .my-exam-card { grid-template-columns: minmax(0, 1fr); }
    .my-exam-actions { padding-top: .7rem; border-top: 1px solid var(--line); }
    .my-exam-jumps .button { flex: 1 1 auto; }
    .exam-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .exam-facts > div:first-child { grid-column: 1 / -1; }
    .history-card { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
    .history-outcome { justify-content: flex-start; padding-top: .65rem; border-top: 1px solid var(--line); }
    .result-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .result-facts > div { padding: .65rem; }
    .intro-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .intro-facts > div { padding: .65rem; }
    .intro-facts > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
    .intro-footer, .account-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
    .intro-footer .button, .account-password .stack > button { width: 100%; }
    .directory-filters label:has(input[type=search]) { flex-basis: 100%; }
    .directory-panel .directory-filters { grid-template-columns: minmax(0, 1fr); }
    .directory-dialog input, .directory-dialog select { min-height: 44px; font-size: 1rem; }
    .directory-actions, .directory-filter-buttons { width: 100%; }
    .directory-actions > .button, .directory-filter-buttons > .button { flex: 1 0 auto; }
    .editor-footer { justify-content: stretch; }
    .editor-footer > .button { flex: 1 1 auto; }
}

/* ===== Đăng nhập: giao diện công nghệ – chuyển đổi số ===== */
.guest:has(.tech-login) {
    --tl-bg: #070b18;
    --tl-red: #e11d3a;
    --tl-red-2: #ff4d63;
    --tl-gold: #f6c453;
    --tl-cyan: #5eead4;
    --tl-text: #eef2ff;
    --tl-dim: #aab3cc;
    --primary: #d3122f;
    --primary-dark: #b00e27;
    --tint: #fde8eb;
    place-items: stretch;
    background: radial-gradient(ellipse at 20% 0%, #1b2448 0%, transparent 55%), radial-gradient(ellipse at 100% 100%, #3a0b18 0%, transparent 50%), var(--tl-bg);
    color: var(--tl-text);
}
.guest:has(.tech-login)::before, .guest:has(.tech-login)::after { content: none; }
.guest:has(.tech-login) .content { display: grid; max-width: 1320px; margin-inline: auto; padding: clamp(1rem, 4vh, 3rem) clamp(1rem, 4vw, 3.5rem); }
.tech-login {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 30rem);
    grid-template-areas: "hero card" "foot foot";
    align-items: center;
    align-content: center;
    gap: clamp(1.25rem, 4vw, 4.5rem);
    min-height: 100%;
}
.tl-backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.tl-grid {
    position: absolute; inset: -2px;
    background-image: linear-gradient(#ffffff0b 1px, transparent 1px), linear-gradient(90deg, #ffffff0b 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at 35% 45%, #000 20%, transparent 75%);
    animation: tl-grid 22s linear infinite;
}
.tl-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.tl-glow--red { width: 34rem; height: 34rem; left: -8rem; top: 30%; background: #c8102e; }
.tl-glow--gold { width: 22rem; height: 22rem; right: 8%; top: -6rem; background: #b8860b; opacity: .28; }
.tl-scan { position: absolute; inset-inline: 0; height: 30%; background: linear-gradient(180deg, transparent, #5eead40d 70%, #5eead41f); animation: tl-scan 7s ease-in-out infinite; }

.tl-hero { grid-area: hero; min-width: 0; }
.tl-eyebrow {
    display: inline-flex; align-items: center; gap: .6rem;
    margin-bottom: 1.1rem; padding: .38rem .9rem .38rem .7rem;
    border: 1px solid #f6c45359; border-radius: 99px; background: #f6c4530f;
    color: var(--tl-gold); font-size: .82rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.tl-pulse { position: relative; width: .55rem; height: .55rem; border-radius: 50%; background: var(--tl-cyan); box-shadow: 0 0 0 0 #5eead499; animation: tl-pulse 2s infinite; }
.tl-hero h1 {
    max-width: 13em; margin: 0 0 1rem;
    color: #fff; font-size: clamp(2.1rem, 4.4vw, 4rem); font-weight: 800; line-height: 1.08; letter-spacing: -.03em;
}
.tl-hero h1 span {
    display: block;
    background: linear-gradient(90deg, var(--tl-red-2), var(--tl-gold) 85%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tl-lead { max-width: 34rem; margin-bottom: 0; color: var(--tl-dim); font-size: clamp(1rem, 1.3vw, 1.15rem); }

.tl-emblem { position: relative; width: clamp(11rem, 19vw, 15rem); aspect-ratio: 1; margin: clamp(1.4rem, 4vh, 2.6rem) 0; display: grid; place-items: center; }
.tl-emblem img { position: relative; width: 52%; height: auto; filter: drop-shadow(0 0 22px #e11d3a88); }
.tl-ring { position: absolute; border-radius: 50%; }
.tl-ring--outer { inset: 0; border: 1px dashed #f6c45366; animation: tl-spin 40s linear infinite; }
.tl-ring--mid { inset: 11%; border: 2px solid transparent; border-top-color: var(--tl-red-2); border-right-color: #ff4d6355; animation: tl-spin 9s linear infinite reverse; }
.tl-ring--inner { inset: 22%; border: 1px solid #5eead44d; background: radial-gradient(circle, #e11d3a2e, transparent 70%); box-shadow: inset 0 0 30px #5eead41a; }
.tl-node { position: absolute; width: .5rem; height: .5rem; border-radius: 50%; background: var(--tl-cyan); box-shadow: 0 0 12px var(--tl-cyan); }
.tl-node--a { top: 6%; left: 50%; }
.tl-node--b { bottom: 18%; right: 3%; background: var(--tl-gold); box-shadow: 0 0 12px var(--tl-gold); }
.tl-node--c { bottom: 14%; left: 8%; }

.tl-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; max-width: 40rem; margin: 0; padding: 0; list-style: none; }
.tl-features li {
    display: grid; gap: .55rem; align-content: start;
    padding: .9rem; border: 1px solid #ffffff14; border-radius: .9rem;
    background: linear-gradient(160deg, #ffffff0d, #ffffff03); backdrop-filter: blur(6px);
    color: var(--tl-dim); font-size: .85rem; line-height: 1.35;
}
.tl-features strong { display: block; margin-bottom: .15rem; color: #fff; font-size: .95rem; }
.tl-features svg, .tl-submit svg, .tl-secure svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tl-features svg { width: 1.6rem; height: 1.6rem; color: var(--tl-gold); }

.tl-card {
    grid-area: card; position: relative; min-width: 0;
    padding: clamp(1.4rem, 3vw, 2.4rem);
    border-radius: 1.4rem;
    background: #fffffff7;
    color: var(--ink);
    box-shadow: 0 30px 80px #0009, 0 0 0 1px #ffffff26;
}
.tl-card::before {
    content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; padding: 1px;
    background: linear-gradient(135deg, var(--tl-red-2), transparent 40%, transparent 60%, var(--tl-gold));
    filter: blur(14px); opacity: .7;
}
.tl-card-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; padding-bottom: 1.2rem; border-bottom: 1px solid #eadfe2; }
.tl-card-logo { width: 4rem; height: auto; flex-shrink: 0; }
.tl-card h2 { margin: 0 0 .15rem; font-size: clamp(1.5rem, 2.2vw, 1.9rem); letter-spacing: -.02em; }
.tl-card-head .muted { margin: 0; font-size: .92rem; }
.tl-card .notice { margin-bottom: 1rem; }
.tl-form { gap: 1.1rem; }
.tl-card .login-field label { font-size: .92rem; font-weight: 700; }
.tl-card .login-input > input:not([type=checkbox]):not([type=radio]) {
    min-height: 3.25rem; padding-inline: 3rem 3rem;
    border: 1.5px solid #e2d6d9; border-radius: .8rem; background: #faf7f8;
    font-size: 1rem; transition: border-color .2s, box-shadow .2s, background .2s;
}
.tl-card .login-input > input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px #d3122f22; }
.tl-card .login-input > input::placeholder { color: #a99ca0; }
.tl-submit {
    position: relative; overflow: hidden; gap: .6rem;
    min-height: 3.35rem; margin-top: .35rem; border: 0; border-radius: .8rem;
    background: linear-gradient(100deg, #b00e27, #e11d3a 55%, #ff4d63);
    font-size: 1.08rem; font-weight: 750; box-shadow: 0 10px 25px #d3122f40;
    transition: transform .15s, box-shadow .2s;
}
.tl-submit:hover { transform: translateY(-1px); box-shadow: 0 14px 30px #d3122f59; background: linear-gradient(100deg, #a00c23, #d3122f 55%, #f43f57); }
.tl-submit::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, #ffffff40 50%, transparent 70%); transform: translateX(-100%); animation: tl-shine 4.5s ease-in-out infinite; }
.tl-submit svg { width: 1.2rem; height: 1.2rem; transition: transform .2s; }
.tl-submit:hover svg { transform: translateX(3px); }
.tl-secure { display: flex; align-items: center; gap: .5rem; margin: 1.2rem 0 0; color: var(--muted); font-size: .84rem; }
.tl-secure svg { width: 1rem; height: 1rem; flex-shrink: 0; color: #1f9d7a; }
.tl-footer { grid-area: foot; margin: 0; text-align: center; color: #7d86a3; font-size: .8rem; }

@keyframes tl-spin { to { transform: rotate(360deg); } }
@keyframes tl-pulse { 70% { box-shadow: 0 0 0 .55rem #5eead400; } 100% { box-shadow: 0 0 0 0 #5eead400; } }
@keyframes tl-scan { 0% { transform: translateY(-40vh); } 100% { transform: translateY(140vh); } }
@keyframes tl-grid { to { background-position: 44px 44px; } }
@keyframes tl-shine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
    .tech-login *, .tech-login *::before, .tech-login *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 980px) {
    .tech-login { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "card" "foot"; max-width: 34rem; margin-inline: auto; gap: 1.4rem; }
    .tl-emblem { display: none; }
    .tl-hero { text-align: center; }
    .tl-hero h1, .tl-lead { margin-inline: auto; }
    .tl-features { margin: 1.3rem auto 0; }
}
@media (max-width: 560px) {
    .guest:has(.tech-login) .content { padding: 1rem .9rem calc(1rem + env(safe-area-inset-bottom, 0px)); }
    .tech-login { gap: 1.1rem; }
    .tl-eyebrow { margin-bottom: .8rem; font-size: .7rem; letter-spacing: .1em; }
    .tl-hero h1 { margin-bottom: .6rem; font-size: clamp(1.6rem, 7.4vw, 2rem); }
    .tl-lead { font-size: .92rem; }
    .tl-features { gap: .45rem; margin-top: 1rem; }
    .tl-features li { justify-items: center; gap: .35rem; padding: .65rem .35rem; text-align: center; font-size: .68rem; line-height: 1.3; }
    .tl-features strong { margin: 0 0 .1rem; font-size: .74rem; }
    .tl-features svg { width: 1.3rem; height: 1.3rem; }
    .tl-card { padding: 1.25rem 1.1rem 1.15rem; border-radius: 1.1rem; }
    .tl-card-head { gap: .8rem; margin-bottom: 1.1rem; padding-bottom: 1rem; }
    .tl-card-logo { width: 3.2rem; }
    .tl-card h2 { font-size: 1.4rem; }
    .tl-card .login-input > input:not([type=checkbox]):not([type=radio]) { font-size: 16px; }
}

/* ===== Giao diện công nghệ cho khu vực đã đăng nhập ===== */
.topbar {
    position: relative;
    min-height: 68px;
    background: linear-gradient(100deg, #0b1124 0%, #141c3a 55%, #3a0d1a 100%);
    color: #eef2ff;
    border-bottom: 0;
    box-shadow: 0 6px 24px #0b112430;
}
.topbar::after { content: ""; position: absolute; inset: auto 0 0; height: 3px; background: linear-gradient(90deg, #d3122f, #f6c453 50%, #d3122f); }
.topbar .brand img { width: 44px; height: 44px; filter: drop-shadow(0 0 10px #e11d3a66); }
.brand strong { color: #fff; font-size: 1.02rem; letter-spacing: .01em; }
.top-user { color: #dfe4f5; text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .7rem; border: 1px solid #ffffff22; border-radius: 99px; background: #ffffff0d; }
.top-user::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: #5eead4; box-shadow: 0 0 8px #5eead4; }
.top-user:hover { background: #ffffff1a; }
.topbar .button.light { color: #fff; border-color: #ffffff40; background: #ffffff0f; }
.topbar .button.light:hover { background: #d3122f; border-color: #d3122f; }

.participant-heading {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border: 0;
    color: #e6eaf7;
    background: linear-gradient(115deg, #0e1530 0%, #1a2350 50%, #5a0f22 100%);
    box-shadow: 0 14px 34px #0e153026;
}
.participant-heading::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background-image: linear-gradient(#ffffff0d 1px, transparent 1px), linear-gradient(90deg, #ffffff0d 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.participant-heading::after {
    content: ""; position: absolute; z-index: -1; right: -4rem; top: -5rem; width: 16rem; height: 16rem; border-radius: 50%;
    background: radial-gradient(circle, #f6c45333, transparent 70%);
}
.participant-heading h1 { color: #fff; }
.participant-heading p, .participant-heading .participant-meta { color: #b9c1db; }
.participant-heading .participant-meta span:not(.badge) { color: #d6dcef; }
.participant-heading .button { color: #fff; border-color: #ffffff45; background: #ffffff12; backdrop-filter: blur(4px); }
.participant-heading .button:hover { background: #ffffff26; }
.participant-heading .badge { background: #ffffff1f; color: #fff; }
.participant-heading .badge.active { background: #f6c453; color: #3a2400; }
.hero-eyebrow { margin: 0 0 .35rem !important; color: #f6c453 !important; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

.p-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.p-stat {
    display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .8rem; align-items: center;
    padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--paper); box-shadow: var(--shadow-soft);
}
.p-stat-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: .7rem; background: #eef1fb; color: #24306a; }
.p-stat-icon svg, .empty-icon svg, .result-check svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.p-stat strong { font-size: 1.5rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.p-stat > span:last-child { color: var(--muted); font-size: .83rem; }
.p-stat--ready .p-stat-icon { background: var(--tint); color: var(--primary-dark); }
.p-stat--pass .p-stat-icon { background: #e6f5ee; color: #17784f; }
.empty-icon { display: inline-grid; place-items: center; width: 3.4rem; height: 3.4rem; margin-bottom: .8rem; border-radius: 1rem; background: #eef1fb; color: #24306a; }
.empty-icon svg { width: 1.7rem; height: 1.7rem; }

.countdown-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .55rem; border-radius: 99px; background: #eef1fb; color: #24306a; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.countdown-chip::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; opacity: .6; }
.badge-live { position: relative; padding-left: 1.2rem; background: var(--primary) !important; color: #fff !important; }
.badge-live::before { content: ""; position: absolute; left: .45rem; top: 50%; width: .4rem; height: .4rem; margin-top: -.2rem; border-radius: 50%; background: #fff; animation: p-blink 1.2s infinite; }
.my-exam-card { transition: transform .15s, box-shadow .2s; }
.my-exam-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px #78212f17; }
.workspace--participant .my-exam-card--ready { border-inline-start: 4px solid var(--primary); }
.workspace--participant .my-exam-card--upcoming { border-inline-start: 4px solid #3b4a8f; }
.exam-facts dd .badge { margin-left: .3rem; vertical-align: 1px; }

/* Hướng dẫn */
.intro-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.intro-facts dd small { color: var(--muted); font-size: .85rem; font-weight: 600; }
.intro-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; margin-top: 1.25rem; }
.intro-columns .intro-instructions { margin: 0; }
.intro-instructions, .intro-rules { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface-soft); }
.intro-rules ul { display: grid; gap: .45rem; margin: 0; padding-left: 1.1rem; }
.intro-rules li::marker { color: var(--primary); }
kbd { display: inline-block; min-width: 1.4em; padding: 0 .3em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: .3rem; background: #fff; font: 600 .8em/1.5 ui-monospace, Consolas, monospace; text-align: center; }
.intro-start { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem 1.2rem; width: 100%; }
.intro-confirm { font-weight: 600; }
.intro-confirm input { width: 1.2rem; height: 1.2rem; }

/* Làm bài */
.workspace--attempt .attempt-header { border: 0; background: linear-gradient(110deg, #0e1530, #1a2350 60%, #4a0d1d); color: #e6eaf7; box-shadow: 0 12px 30px #0e153033; }
.workspace--attempt .attempt-title h1 { color: #fff; }
.workspace--attempt .attempt-title p { color: #b9c1db; }
.workspace--attempt .attempt-title .badge.active { background: #f6c453; color: #3a2400; }
.attempt-progress { height: .4rem; max-width: 26rem; margin-top: .7rem; border-radius: 99px; background: #ffffff1f; overflow: hidden; }
.attempt-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff4d63, #f6c453); transition: width .3s; }
.attempt-progress-label { display: block; margin-top: .3rem; color: #b9c1db; font-size: .78rem; }
.time-box { min-width: 8rem; border: 1px solid #ffffff2e; background: #ffffff12; transition: background .3s; }
.time-box strong { font-size: 1.75rem; letter-spacing: .02em; }
.time-box[data-level=warning] { background: #b7791f; border-color: #f6c453; }
.time-box[data-level=critical] { background: #d3122f; border-color: #ff8a99; animation: p-pulse 1s infinite; }
#save-status { display: inline-flex; align-items: center; gap: .35rem; justify-content: center; }
.save-dot { width: .45rem; height: .45rem; border-radius: 50%; background: #5eead4; }
#save-status[data-state=saving] .save-dot { background: #f6c453; animation: p-blink .8s infinite; }
#save-status[data-state=offline] .save-dot, #save-status[data-state=error] .save-dot { background: #ff8a99; }
.attempt-alert { margin: -.4rem 0 1rem; padding: .7rem 1rem; border-radius: .7rem; font-weight: 600; box-shadow: var(--shadow-soft); }
.attempt-alert[data-tone=warning] { background: #fff4d6; color: #7a5200; border: 1px solid #f2d08a; }
.attempt-alert[data-tone=danger] { background: #fde3e6; color: #8f1024; border: 1px solid #f3a5b0; }
.attempt-alert[data-tone=info] { background: #e6f5ee; color: #17603f; border: 1px solid #a8dcc2; }
.option-input { position: absolute; opacity: 0; width: 1px !important; height: 1px !important; pointer-events: none; }
.answer-options .option { position: relative; cursor: pointer; gap: .85rem; padding: .75rem .9rem; border-width: 1.5px; transition: border-color .15s, background .15s, transform .1s; }
.answer-options .option:active { transform: scale(.995); }
.answer-options .option:has(.option-input:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.answer-letter { flex: 0 0 2rem; height: 2rem; border-radius: .55rem; font-size: .9rem; }
.option-text { flex: 1; min-width: 0; }
.option-check { flex: 0 0 1.35rem; height: 1.35rem; border: 2px solid #d9c9cd; border-radius: 50%; }
.option:has(.option-input:checked) .option-check { border-color: var(--primary); background: radial-gradient(circle, var(--primary) 0 45%, transparent 50%); }
.question-tools .button { gap: .35rem; }
.flag-icon { width: .8rem; height: .9rem; border-left: 2px solid currentColor; position: relative; }
.flag-icon::after { content: ""; position: absolute; left: 0; top: 0; width: .65rem; height: .5rem; background: currentColor; clip-path: polygon(0 0, 100% 0, 70% 50%, 100% 100%, 0 100%); }
.mark-review[aria-pressed=true] { border-color: #e0a526; background: #fff4d6; color: #7a5200; }
#next-question.is-finish { background: #17784f; border-color: #17784f; }
.attempt-navigation summary { display: flex; justify-content: space-between; align-items: center; }
#nav-count { padding: .05rem .5rem; border-radius: 99px; background: var(--tint); font-size: .82rem; font-variant-numeric: tabular-nums; }
.question-numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); }
.question-number { position: relative; }
.question-number.answered { border-color: var(--primary); background: var(--primary); color: #fff; }
.question-number.marked::after { content: ""; position: absolute; top: -4px; right: -4px; width: .7rem; height: .7rem; border: 2px solid #fff; border-radius: 50%; background: #e0a526; }
.question-number[aria-current=true] { box-shadow: 0 0 0 3px #24306a; }
.nav-legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: .78rem; }
.nav-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.nav-legend i { width: .8rem; height: .8rem; border-radius: .25rem; border: 1px solid var(--border); }
.nav-legend .legend-answered { background: var(--primary); border-color: var(--primary); }
.nav-legend .legend-marked { background: #e0a526; border-color: #e0a526; border-radius: 50%; }
.submit-jump { margin: .7rem 0; }
.submit-jump strong { display: block; margin-bottom: .35rem; font-size: .9rem; }
.submit-jump div { display: flex; flex-wrap: wrap; gap: .35rem; }
.submit-jump .button { min-width: 2.4rem; }
.submit-note { font-size: .85rem; }

/* Kết quả */
.result-receipt { display: flex; align-items: center; gap: .9rem; }
.result-check { display: grid; flex: none; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 50%; background: #e6f5ee; color: #17784f; }
.result-board { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 1.2rem; }
.score-ring {
    --tone: var(--primary);
    display: grid; place-content: center; justify-items: center; width: 8.5rem; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(closest-side, var(--paper) 78%, transparent 80% 100%), conic-gradient(var(--tone) calc(var(--value) * 1%), #f1e6e9 0);
}
.result-board--pass .score-ring { --tone: #17945f; }
.score-ring strong { font-size: 2.1rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.score-ring span { color: var(--muted); font-size: .85rem; }
.result-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-next { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .7rem 1rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.result-next p { margin: 0; }
.result-review-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; margin: 1.25rem 0 .75rem; }
.result-review-heading h2 { margin: 0 !important; }
.review-filter { display: flex; gap: .35rem; }
.review-filter .button[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: #fff; }
.result-question-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.result-question-head h3 { margin: 0; }
.workspace--participant .result-question--right { border-inline-start: 4px solid #17945f; }
.workspace--participant .result-question--wrong { border-inline-start: 4px solid var(--primary); }
.review-option--correct { border-color: #8fcfae; background: #eaf7f0; }
.review-option--correct .answer-letter { background: #17945f; color: #fff; }
.review-option--correct .badge.active { background: #17945f; color: #fff; }
.review-option--missed { border-color: #f0a6b1; background: #fdecee; }

.workspace--participant .history-card--pass { border-inline-start: 4px solid #17945f; }
.workspace--participant .history-card--fail { border-inline-start: 4px solid var(--primary); }

@keyframes p-blink { 50% { opacity: .25; } }
@keyframes p-pulse { 50% { box-shadow: 0 0 0 6px #d3122f40; } }
@media (prefers-reduced-motion: reduce) {
    .badge-live::before, .time-box, #save-status .save-dot { animation: none !important; }
    .my-exam-card { transition: none; }
}

@media (max-width: 850px) {
    .p-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .top-user { display: none; }
}
@media (max-width: 640px) {
    .topbar { min-height: 56px; padding-block: .5rem; }
    .topbar .brand img { width: 36px; height: 36px; }
    .topbar .brand strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .86rem; line-height: 1.25; }
    .topbar .button.light { min-height: 36px; padding: .3rem .65rem; font-size: .85rem; }
    .participant-heading { padding: 1.1rem 1rem; border-radius: .9rem; }
    .participant-heading > .button, .participant-heading > a.button { min-height: 40px; }
    .p-stats { gap: .55rem; margin-bottom: 1rem; }
    .p-stat { padding: .7rem .75rem; column-gap: .6rem; }
    .p-stat-icon { width: 2.2rem; height: 2.2rem; }
    .p-stat strong { font-size: 1.25rem; }
    .p-stat > span:last-child { font-size: .76rem; }
    .intro-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .intro-facts > div:nth-child(2) { grid-column: 1 / -1; grid-row: auto; }
    .intro-start .button { width: 100%; }
    .attempt-progress { margin-top: .5rem; }
    .time-box { min-width: 6.2rem; }
    .time-box strong { font-size: 1.4rem; }
    .answer-options .option { padding: .7rem .75rem; min-height: 3.4rem; }
    .result-board { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    .result-board .result-facts { width: 100%; }
    .result-next .button { width: 100%; }
}
/* Quản trị: tiêu đề trang đồng bộ phong cách công nghệ */
.workspace--admin .page-heading {
    position: relative; overflow: hidden; isolation: isolate; border: 0; color: #e6eaf7;
    background: linear-gradient(115deg, #0e1530 0%, #1a2350 55%, #5a0f22 100%);
    box-shadow: 0 14px 34px #0e153026;
}
.workspace--admin .page-heading::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background-image: linear-gradient(#ffffff0d 1px, transparent 1px), linear-gradient(90deg, #ffffff0d 1px, transparent 1px);
    background-size: 32px 32px; mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.workspace--admin .page-heading h1 { color: #fff; }
.workspace--admin .page-heading p, .workspace--admin .page-heading small { color: #b9c1db; }
.workspace--admin .page-heading a:not(.button) { color: #f6c453; }
.workspace--admin .page-heading .button:not(.primary) { color: #fff; border-color: #ffffff45; background: #ffffff12; }
.workspace--admin .page-heading .button:not(.primary):hover { background: #ffffff26; }
.workspace--admin .page-heading .badge { background: #ffffff1f; color: #fff; }
.workspace--admin .page-heading .badge.active { background: #f6c453; color: #3a2400; }
.workspace--admin .sidebar a.current { border-inline-start-color: var(--primary); background: linear-gradient(90deg, var(--tint), transparent); }
/* ===== Quản trị: bảng điều khiển, phân tích ===== */
.nav-icon { width: 1.1rem; height: 1.1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.workspace--admin .sidebar-section a:has(.nav-icon) { display: flex; align-items: center; gap: .6rem; }
.a-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.a-kpi { position: relative; display: flex; gap: .85rem; align-items: center; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); box-shadow: var(--shadow-soft); transition: transform .15s, box-shadow .2s; }
.a-kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 30px #0e153018; }
.a-kpi > div { display: grid; min-width: 0; }
.a-kpi strong { font-size: 1.7rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.a-kpi > div > span { font-weight: 650; color: var(--ink); }
.a-kpi small { font-size: .78rem; overflow-wrap: anywhere; }
.a-kpi-icon { display: grid; flex: none; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: .8rem; background: linear-gradient(135deg, #1a2350, #2c3a7a); color: #f6c453; }
.a-kpi-icon svg, .a-kpi-icon { font-size: 0; }
.a-kpi-icon svg { width: 1.45rem; height: 1.45rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.a-kpi--live .a-kpi-icon { background: linear-gradient(135deg, #b00e27, #e11d3a); color: #fff; }
.a-kpi-link { position: absolute; inset: 0; border-radius: inherit; }
.a-kpi-link:focus-visible { outline: 3px solid var(--primary); }

.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 21rem); gap: 1rem; align-items: start; }
.dashboard-main > .panel, .dashboard-side > .panel { margin-bottom: 1rem; }
.dashboard-exam-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.dashboard-exam-head h2 { margin-bottom: .2rem; }
.completion { flex: none; display: grid; place-content: center; justify-items: center; width: 6.2rem; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(closest-side, var(--paper) 76%, transparent 78% 100%), conic-gradient(#17945f calc(var(--value) * 1%), #ece4e7 0); }
.completion strong { font-size: 1.35rem; line-height: 1; }
.completion span { color: var(--muted); font-size: .7rem; }
.stacked-bar { display: flex; height: .7rem; margin-top: .2rem; border-radius: 99px; background: #ece4e7; overflow: hidden; }
.stacked-bar span { display: block; height: 100%; }
.seg-done { background: #17945f; }
.seg-running { background: #e0a526; }
.bar-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .5rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .8rem; }
.bar-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.bar-legend i { width: .75rem; height: .75rem; border-radius: .2rem; background: #ece4e7; }
.bar-legend i.seg-done { background: #17945f; }
.bar-legend i.seg-running { background: #e0a526; }
.progress-cell--low strong { color: #b00e27; }
.progress-cell--high strong { color: #17784f; }
.progress-cell--high progress { accent-color: #17945f; }
.table-note { margin: .7rem 0 0; font-size: .82rem; }

.side-card h2 { margin-bottom: .8rem; }
.side-item { display: flex; gap: .75rem; align-items: center; padding: .6rem; margin: 0 -.6rem; border-radius: .6rem; color: var(--ink); text-decoration: none; }
.side-item:hover { background: var(--surface-soft); }
.side-item > span:last-child { display: grid; min-width: 0; }
.side-item strong { overflow-wrap: anywhere; }
.side-date { display: grid; flex: none; place-items: center; width: 3rem; padding: .3rem 0; border-radius: .6rem; background: linear-gradient(135deg, #1a2350, #2c3a7a); color: #c9d0ea; font-size: .7rem; line-height: 1.1; }
.side-date strong { color: #fff; font-size: 1.15rem; }
.side-log { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.side-log:last-of-type { border-bottom: 0; }
.side-log p { margin: .35rem 0 .15rem; font-size: .88rem; overflow-wrap: anywhere; }
.side-log small { font-size: .76rem; }
.side-more { display: inline-block; margin-top: .6rem; font-weight: 650; font-size: .88rem; }

.score-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1.2rem; align-items: end; }
.score-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 0; }
.score-figures > div { padding: .7rem .85rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--surface-soft); }
.score-figures dt { color: var(--muted); font-size: .8rem; }
.score-figures dd { margin: .1rem 0 0; font-size: 1.35rem; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.score-figures dd small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.score-figures .score-pass { border-color: #a8dcc2; background: #eaf7f0; }
.score-figures .score-pass dd { color: #17784f; }
.histogram { margin: 0; }
.histogram figcaption { margin-bottom: .5rem; color: var(--muted); font-size: .82rem; }
.histogram-bars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; height: 10rem; align-items: end; }
.histogram-col { display: grid; grid-template-rows: auto 1fr auto; height: 100%; align-items: end; justify-items: center; gap: .25rem; }
.histogram-value { font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.histogram-bar { width: 100%; min-height: 3px; border-radius: .4rem .4rem 0 0; background: linear-gradient(180deg, #3b4a8f, #1a2350); align-self: end; }
.histogram-col:last-child .histogram-bar, .histogram-col:nth-child(4) .histogram-bar { background: linear-gradient(180deg, #2fb37a, #17784f); }
.histogram-col:first-child .histogram-bar { background: linear-gradient(180deg, #ff4d63, #b00e27); }
.histogram-label { color: var(--muted); font-size: .72rem; white-space: nowrap; }

.question-analysis > summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; cursor: pointer; }
.question-analysis[open] > summary { margin-bottom: .6rem; }
.analysis-list { display: grid; gap: .7rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.analysis-item { padding: .85rem 1rem; border: 1px solid var(--line); border-inline-start: 4px solid #3b4a8f; border-radius: .7rem; background: var(--paper); }
.analysis-item--hard { border-inline-start-color: var(--primary); background: #fffafb; }
.analysis-item--easy { border-inline-start-color: #17945f; }
.analysis-head { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; }
.analysis-code { color: var(--muted); font-size: .82rem; font-weight: 650; }
.analysis-rate { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.analysis-item--hard .analysis-rate { color: var(--primary-dark); }
.analysis-item--easy .analysis-rate { color: #17784f; }
.analysis-text { margin: .3rem 0 .5rem; font-weight: 650; }
.analysis-bar { height: .45rem; border-radius: 99px; background: #ece4e7; overflow: hidden; }
.analysis-bar span { display: block; height: 100%; background: linear-gradient(90deg, #b00e27, #e0a526 50%, #17945f); background-size: 200% 100%; }
.analysis-choices { display: grid; gap: .3rem; margin: .6rem 0 0; padding: 0; list-style: none; font-size: .88rem; }
.analysis-choices li { display: flex; align-items: center; gap: .55rem; padding: .25rem .4rem; border-radius: .45rem; }
.analysis-choices li.is-correct { background: #eaf7f0; }
.analysis-choices li.is-correct .answer-letter { background: #17945f; color: #fff; }
.analysis-choices .answer-letter { flex: 0 0 1.5rem; height: 1.5rem; font-size: .75rem; }
.analysis-option { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.analysis-count { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge-pass { background: #e6f5ee !important; color: #17784f !important; }
.badge-draft { background: #fff4d6; color: #7a5200; }

.status-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.status-chips a { display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: .35rem .85rem; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--ink); font-weight: 650; text-decoration: none; }
.status-chips a span { min-width: 1.6rem; padding: 0 .4rem; border-radius: 99px; background: #eef1fb; color: #24306a; font-size: .8rem; text-align: center; }
.status-chips a:hover { border-color: #b9c1db; }
.status-chips a[aria-current=page] { border-color: #1a2350; background: #1a2350; color: #fff; }
.status-chips a[aria-current=page] span { background: #f6c453; color: #3a2400; }

@media (max-width: 1180px) {
    .dashboard-layout { grid-template-columns: minmax(0, 1fr); }
    .dashboard-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; }
    .dashboard-side > .panel { margin: 0; }
}
@media (max-width: 1000px) {
    .a-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .score-summary { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
    .a-kpis { gap: .55rem; }
    .a-kpi { flex-direction: column; align-items: flex-start; gap: .5rem; padding: .8rem; }
    .a-kpi-icon { width: 2.3rem; height: 2.3rem; }
    .a-kpi strong { font-size: 1.35rem; }
    .a-kpi > div > span { font-size: .85rem; }
    .dashboard-exam-head { align-items: flex-start; }
    .completion { width: 5rem; }
    .histogram-label { font-size: .62rem; }
    .status-chips a { flex: 1 1 auto; justify-content: center; }
}
.progress-cell strong { white-space: nowrap; }

/* =====================================================================
   WOW: nền lưới số, menu kính tối, hiệu ứng xuất hiện, ánh sáng theo con trỏ
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.workspace {
    background:
        radial-gradient(ellipse 60rem 30rem at 100% -10%, #1a235014, transparent 70%),
        radial-gradient(ellipse 40rem 24rem at -10% 110%, #d3122f10, transparent 70%),
        linear-gradient(#24306a06 1px, transparent 1px) 0 0 / 40px 40px,
        linear-gradient(90deg, #24306a06 1px, transparent 1px) 0 0 / 40px 40px,
        var(--background);
}
.topbar { position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(1.4) blur(10px); background: linear-gradient(100deg, #0b1124f2 0%, #141c3af2 55%, #3a0d1af2 100%); }
.workspace--attempt .attempt-header { top: 76px; }
.role-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; border-radius: 99px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; border: 1px solid #ffffff2e; color: #fff; background: #ffffff14; }
.role-chip::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.role-chip--headquarters { color: #f6c453; border-color: #f6c45366; background: #f6c45314; }
.role-chip--company_admin { color: #ff8a99; border-color: #ff8a9966; background: #ff4d6314; }
.role-chip--general_manager { color: #c4b5fd; border-color: #c4b5fd66; background: #c4b5fd14; }
.role-chip--manager { color: #7dd3fc; border-color: #7dd3fc66; background: #7dd3fc14; }
.role-chip--participant { color: #5eead4; border-color: #5eead466; background: #5eead414; }
.sidebar-label small { display: block; margin-top: .15rem; font-weight: 500; font-size: .75rem; opacity: .8; overflow-wrap: anywhere; }

@media (min-width: 851px) {
    .workspace > .sidebar {
        position: sticky; top: 68px; align-self: start; height: calc(100vh - 68px); overflow-y: auto;
        background: linear-gradient(180deg, #0e1530 0%, #121a3d 60%, #2a0c19 100%);
        border-right: 0; box-shadow: 6px 0 24px #0e15301f;
    }
    .workspace > .sidebar .sidebar-label { color: #f6c453; letter-spacing: .06em; text-transform: uppercase; font-size: .72rem; }
    .workspace > .sidebar .sidebar-label small { color: #b9c1db; text-transform: none; letter-spacing: 0; }
    .workspace > .sidebar a { position: relative; color: #c9d0ea; border-inline-start-color: transparent !important; transition: background .2s, color .2s, transform .15s; }
    .workspace > .sidebar a:hover { color: #fff; background: #ffffff12; transform: translateX(2px); }
    .workspace > .sidebar a.current { color: #fff; background: linear-gradient(90deg, #d3122f59, #d3122f14) !important; box-shadow: inset 3px 0 0 #ff4d63, 0 0 22px #d3122f33; }
    .workspace > .sidebar a.current .nav-icon { color: #f6c453; opacity: 1; }
    .workspace > .sidebar .sidebar-section + .sidebar-section { border-top-color: #ffffff1a; }
    .workspace > .sidebar .participant-navigation a { display: flex; align-items: center; gap: .6rem; }
    .workspace > .sidebar .participant-nav-icon { display: block; position: relative; width: 1.05rem; height: 1.05rem; flex: none; opacity: .85; }
}

/* Hiệu ứng xuất hiện tuần tự */
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
/* Chỉ áp dụng trong khu vực đã đăng nhập: transform trên khối đăng nhập sẽ làm lớp nền cố định (.tl-backdrop) bị cắt theo khung. */
.workspace .content > *, .a-kpis > li, .p-stats > li, .library-grid > *, .participant-list > * { animation: rise-in .55s cubic-bezier(.2, .7, .2, 1) both; }
.workspace .content > *:nth-child(2) { animation-delay: .05s; } .workspace .content > *:nth-child(3) { animation-delay: .1s; }
.workspace .content > *:nth-child(4) { animation-delay: .15s; } .workspace .content > *:nth-child(n+5) { animation-delay: .2s; }
.workspace--attempt .content > * { animation: none; }
.a-kpis > li:nth-child(2), .p-stats > li:nth-child(2), .library-grid > *:nth-child(2) { animation-delay: .08s; }
.a-kpis > li:nth-child(3), .p-stats > li:nth-child(3), .library-grid > *:nth-child(3) { animation-delay: .16s; }
.a-kpis > li:nth-child(4), .p-stats > li:nth-child(4), .library-grid > *:nth-child(4) { animation-delay: .24s; }
.library-grid > *:nth-child(n+5) { animation-delay: .3s; }

/* Tiêu đề trang: viền sáng chạy */
.participant-heading, .workspace--admin .page-heading { position: relative; }
.participant-heading > *, .workspace--admin .page-heading > * { position: relative; z-index: 1; }
.workspace--admin .page-heading::after, .participant-heading::after {
    content: ""; position: absolute; z-index: 0; inset: auto 0 0 0; width: auto; height: 3px; top: auto; right: 0; border-radius: 0;
    background: linear-gradient(90deg, transparent, #ff4d63, #f6c453, transparent) 0 0 / 50% 100% no-repeat;
    animation: edge-run 4.5s linear infinite;
}
@keyframes edge-run { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* Ánh sáng theo con trỏ */
.a-kpi, .p-stat, .doc-card { isolation: isolate; overflow: hidden; }
.a-kpi::before, .p-stat::before, .doc-card::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .25s; pointer-events: none;
    background: radial-gradient(16rem circle at var(--mx, 50%) var(--my, 50%), #f6c45324, transparent 60%);
}
.a-kpi:hover::before, .p-stat:hover::before, .doc-card:hover::before { opacity: 1; }
.p-stat { position: relative; }

/* Nút chính phát sáng */
.button.primary { background: linear-gradient(100deg, #b00e27, #d3122f 55%, #e8344d); border-color: #c0112b; box-shadow: 0 6px 16px #d3122f2e; transition: box-shadow .2s, transform .12s, filter .2s; }
.button.primary:hover { filter: brightness(1.06); box-shadow: 0 10px 24px #d3122f45; transform: translateY(-1px); }
.button.primary:active { transform: none; }
.panel { transition: box-shadow .25s; }

/* Nhãn vai trò trong bảng */
.role-badge.role-super { background: #fff4d6; color: #7a5200; }
.role-badge.role-admin { background: #fde8eb; color: #a00c23; }
.role-badge.role-manager { background: #e0f2fe; color: #075985; }
.role-badge.role-general { background: #ede9fe; color: #5b21b6; }
.role-badge.role-user { background: #eef1fb; color: #24306a; }

/* Thanh điều hướng dưới trên điện thoại: 4 mục */
@media (max-width: 760px) {
    .workspace :is(.sidebar-section.participant-navigation) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        background: #ffffffeb; backdrop-filter: blur(12px) saturate(1.4);
    }
    .workspace:not(.workspace--admin) .participant-navigation a.current { color: var(--primary-dark); background: linear-gradient(180deg, var(--tint), transparent); }
    .role-chip { display: none; }
}
.participant-nav-icon--book { border: 1.6px solid currentColor; border-radius: .2rem .3rem .3rem .2rem; }
.participant-nav-icon--book::before { content: ""; position: absolute; left: .28rem; top: .1rem; bottom: .1rem; border-left: 1.5px solid currentColor; }
@media (min-width: 851px) {
    .workspace > .sidebar .participant-nav-icon--exams { border: 1.6px solid currentColor; border-radius: .27rem; background: linear-gradient(currentColor,currentColor) center 37%/.5rem 1px no-repeat, linear-gradient(currentColor,currentColor) center 67%/.5rem 1px no-repeat; }
    .workspace > .sidebar .participant-nav-icon--history { border: 1.6px solid currentColor; border-radius: 50%; }
    .workspace > .sidebar .participant-nav-icon--history::before { position: absolute; top: .15rem; left: .36rem; width: .28rem; height: .32rem; border-bottom: 1.5px solid currentColor; border-left: 1.5px solid currentColor; content: ""; }
}

/* =====================================================================
   Tài liệu học tập
   ===================================================================== */
.library-heading { align-items: center; }
.library-progress { flex: none; display: grid; place-content: center; justify-items: center; width: 6rem; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(closest-side, #141c3a 78%, transparent 80% 100%), conic-gradient(#f6c453 calc(var(--value) * 1%), #ffffff26 0); }
.library-progress strong { color: #fff; font-size: 1.2rem; line-height: 1; }
.library-progress span { color: #b9c1db; font-size: .72rem; }
.library-search { display: flex; gap: .5rem; margin-bottom: .8rem; }
.library-search input { flex: 1; min-height: 48px; padding-inline: 1rem; border-radius: .8rem; border: 1.5px solid var(--line); box-shadow: var(--shadow-soft); font-size: 1rem; }
.library-search input:focus { outline: none; border-color: #3b4a8f; box-shadow: 0 0 0 4px #3b4a8f22; }
.library-search .button { min-height: 48px; border-radius: .8rem; padding-inline: 1.2rem; }
.category-chips { display: flex; gap: .45rem; margin-bottom: 1.1rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
.category-chips a { flex: none; padding: .4rem .9rem; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--ink); font-weight: 650; font-size: .88rem; text-decoration: none; white-space: nowrap; }
.category-chips a[aria-current=page] { background: #1a2350; border-color: #1a2350; color: #fff; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.doc-card { position: relative; display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-soft); transition: transform .18s, box-shadow .25s; }
.doc-card:hover { transform: translateY(-4px); box-shadow: 0 18px 38px #0e153022; }
.doc-card:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.doc-card-cover { position: relative; display: grid; place-items: center; height: 7.5rem; overflow: hidden; color: #fff;
    background: linear-gradient(135deg, #1a2350, #3b4a8f); }
.doc-card-cover::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(#ffffff12 1px, transparent 1px), linear-gradient(90deg, #ffffff12 1px, transparent 1px); background-size: 18px 18px; mask-image: linear-gradient(180deg, #000, transparent); }
.doc-card-cover svg { position: relative; z-index: 1; width: 2.8rem; height: 2.8rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 4px 12px #0006); transition: transform .3s; }
.doc-card:hover .doc-card-cover svg { transform: scale(1.12) rotate(-4deg); }
.doc-card--pdf .doc-card-cover { background: linear-gradient(135deg, #7a0a1c, #d3122f); }
.doc-card--video .doc-card-cover { background: linear-gradient(135deg, #0e1530, #6d28d9); }
.doc-card--image .doc-card-cover { background: linear-gradient(135deg, #0f5132, #17945f); }
.doc-card--audio .doc-card-cover { background: linear-gradient(135deg, #7c4a03, #e0a526); }
.doc-card--file .doc-card-cover { background: linear-gradient(135deg, #0c4a6e, #0284c7); }
.doc-card-type { position: absolute; z-index: 2; top: .6rem; left: .6rem; padding: .1rem .55rem; border-radius: 99px; background: #0006; backdrop-filter: blur(4px); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.doc-card--pinned { border-color: #f2d08a; box-shadow: 0 0 0 1px #f6c45366, var(--shadow-soft); }
.doc-card-body { display: grid; align-content: start; gap: .45rem; padding: .9rem 1rem 1rem; }
.doc-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.badge-pin { background: #fff4d6; color: #7a5200; }
.doc-read { color: #17784f; font-size: .78rem; font-weight: 700; }
.doc-new { padding: .05rem .5rem; border-radius: 99px; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700; }
.doc-card-title { font-size: 1.05rem; line-height: 1.35; overflow-wrap: anywhere; }
.doc-card-summary { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: .9rem; }
.doc-card-date { color: var(--muted); font-size: .78rem; }
.doc-card--read .doc-card-cover { filter: saturate(.75); }

.doc-reader { max-width: 52rem; margin-inline: auto; }
.doc-reader-head h1 { font-size: clamp(1.5rem, 3.4vw, 2.3rem); }
.doc-summary { margin: 0 0 1.2rem; padding: 1rem 1.2rem; border-inline-start: 4px solid #f6c453; border-radius: .7rem; background: #fffbea; font-size: 1.05rem; font-weight: 600; color: #3f3416; }
.doc-media { margin: 0 0 1.2rem; border-radius: 1rem; overflow: hidden; background: #0e1530; box-shadow: 0 14px 34px #0e153026; }
.doc-media img { display: block; width: 100%; height: auto; background: #fff; }
.doc-media audio { display: block; width: 100%; padding: 1rem; }
.doc-media--video { aspect-ratio: 16 / 9; }
.doc-media--video iframe, .doc-media--video video { display: block; width: 100%; height: 100%; border: 0; }
.doc-media--pdf { height: min(80vh, 60rem); background: #525659; }
.doc-media--pdf iframe { display: block; width: 100%; height: 100%; border: 0; }
.doc-file { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem 1rem; margin-bottom: 1.4rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--paper); box-shadow: var(--shadow-soft); }
.doc-file-icon { font-size: 1.4rem; }
.doc-file-name { display: grid; flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.doc-file-name small { font-size: .8rem; }
.doc-file-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.doc-file-actions .button { min-height: 44px; }
.doc-content { padding: clamp(1.1rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); box-shadow: var(--shadow-soft); font-size: 1.06rem; line-height: 1.8; color: #2b2629; }
.doc-content h2 { margin: 1.6rem 0 .6rem; color: #1a2350; font-size: 1.35rem; }
.doc-content h3 { margin: 1.3rem 0 .5rem; color: var(--primary-dark); font-size: 1.12rem; }
.doc-content > :first-child { margin-top: 0; }
.doc-content p { margin: 0 0 1rem; }
.doc-content ul { margin: 0 0 1rem; padding-left: 1.3rem; }
.doc-content li { margin-bottom: .35rem; }
.doc-content li::marker { color: var(--primary); }
.doc-content strong { color: #1a2350; }
.doc-related { max-width: 52rem; margin: 1.6rem auto 0; }
.doc-related h2 { color: var(--primary-dark); }
.doc-related-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .6rem; }
.doc-related-list a { display: grid; gap: .2rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--paper); color: var(--ink); text-decoration: none; }
.doc-related-list a:hover { border-color: #b9c1db; }
.doc-preview-note { background: #fff4d6; border-color: #f2d08a; color: #7a5200; }

.doc-editor .doc-body-input { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; line-height: 1.6; }
.doc-editor code { padding: 0 .25rem; border-radius: .25rem; background: #eef1fb; }
.doc-pin { align-self: end; min-height: 44px; }
.doc-current-file { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .8rem; border-radius: .6rem; background: var(--surface-soft); }
.doc-unit-tools { display: flex; gap: .4rem; margin-bottom: .6rem; }
.pin-mark { color: #e0a526; }
.danger-zone { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; border-color: #f3c4cb; }
.danger-zone h2 { color: var(--primary-dark); }

@media (max-width: 640px) {
    .library-heading { flex-wrap: nowrap; }
    .library-progress { width: 4.6rem; }
    .library-progress strong { font-size: .95rem; }
    .doc-card-cover { height: 5.5rem; }
    .doc-media--pdf { height: 70vh; border-radius: .7rem; }
    .doc-content { font-size: 1.02rem; padding: 1rem; }
    .doc-file-actions { width: 100%; }
    .doc-file-actions .button { flex: 1; }
    .workspace--attempt .attempt-header { top: 62px; }
}
@media (prefers-reduced-motion: reduce) {
    .workspace .content > *, .a-kpis > li, .p-stats > li, .library-grid > *, .participant-list > * { animation: none !important; }
    .workspace--admin .page-heading::after, .participant-heading::after { animation: none; }
    .doc-card, .doc-card-cover svg, .button.primary { transition: none; }
}
/* ===== Đăng nhập: co giãn theo chiều cao màn hình để không xuất hiện thanh cuộn ===== */
.guest:has(.tech-login) { height: 100svh; min-height: 0; overflow: hidden auto; }
.guest:has(.tech-login) .content { min-height: 100%; padding-block: clamp(.6rem, 3vh, 3rem); }
.tech-login { min-height: 0; }

@media (min-width: 981px) {
    .tech-login { row-gap: clamp(.5rem, 2.2vh, 2rem); column-gap: clamp(1.25rem, 4vw, 4.5rem); }
    .tl-eyebrow { margin-bottom: clamp(.5rem, 1.8vh, 1.1rem); padding-block: clamp(.2rem, .6vh, .38rem); }
    .tl-hero h1 { margin-bottom: clamp(.4rem, 1.5vh, 1rem); font-size: clamp(1.7rem, min(4.4vw, 6vh), 4rem); }
    .tl-lead { font-size: clamp(.88rem, min(1.3vw, 1.9vh), 1.15rem); line-height: 1.5; }
    .tl-emblem { width: clamp(5.5rem, min(19vw, 22vh), 15rem); margin: clamp(.5rem, 3vh, 2.6rem) 0; }
    .tl-features li { gap: clamp(.25rem, .8vh, .55rem); padding: clamp(.45rem, 1.4vh, .9rem) clamp(.6rem, 1.2vw, .9rem); font-size: clamp(.76rem, 1.5vh, .85rem); }
    .tl-features strong { font-size: clamp(.84rem, 1.7vh, .95rem); }
    .tl-features svg { width: clamp(1.15rem, 2.6vh, 1.6rem); height: clamp(1.15rem, 2.6vh, 1.6rem); }
    .tl-card { padding: clamp(1rem, 3.4vh, 2.4rem) clamp(1.2rem, 2.4vw, 2.4rem); }
    .tl-card-head { margin-bottom: clamp(.6rem, 2vh, 1.4rem); padding-bottom: clamp(.5rem, 1.8vh, 1.2rem); }
    .tl-card-logo { width: clamp(2.8rem, 7vh, 4rem); }
    .tl-card h2 { font-size: clamp(1.25rem, 3.4vh, 1.9rem); }
    .tl-form { gap: clamp(.55rem, 1.8vh, 1.1rem); }
    .tl-card .login-input > input:not([type=checkbox]):not([type=radio]) { min-height: clamp(2.5rem, 5.6vh, 3.25rem); }
    .tl-submit { min-height: clamp(2.6rem, 5.8vh, 3.35rem); margin-top: clamp(.1rem, .6vh, .35rem); }
    .tl-secure { margin-top: clamp(.5rem, 1.8vh, 1.2rem); }
    .tl-footer { font-size: clamp(.7rem, 1.4vh, .8rem); }
}
/* Màn hình thấp (laptop mở thanh công cụ, cửa sổ thu nhỏ): bỏ hình trang trí. */
@media (min-width: 981px) and (max-height: 640px) {
    .tl-emblem { display: none; }
    .tl-hero h1 + .tl-lead { margin-bottom: clamp(.6rem, 2.5vh, 1.2rem); }
}

@media (max-width: 980px) {
    .tech-login { gap: clamp(.6rem, 2vh, 1.4rem); }
    .tl-eyebrow { margin-bottom: clamp(.35rem, 1.4vh, .8rem); }
    .tl-hero h1 { margin-bottom: clamp(.3rem, 1vh, .6rem); font-size: clamp(1.35rem, min(7.4vw, 4.6vh), 2.6rem); }
    .tl-lead { font-size: clamp(.8rem, min(3.8vw, 2.1vh), 1.05rem); line-height: 1.45; }
    .tl-features { margin-top: clamp(.5rem, 1.6vh, 1.3rem); }
    .tl-features li { padding: clamp(.4rem, 1.1vh, .65rem) .35rem; }
    .tl-card { padding: clamp(.9rem, 2.4vh, 1.4rem) clamp(.9rem, 4vw, 1.4rem); }
    .tl-card-head { margin-bottom: clamp(.5rem, 1.6vh, 1.1rem); padding-bottom: clamp(.45rem, 1.4vh, 1rem); }
    .tl-card-logo { width: clamp(2.4rem, 6vh, 3.2rem); }
    .tl-card h2 { font-size: clamp(1.15rem, 3vh, 1.5rem); }
    .tl-form { gap: clamp(.5rem, 1.5vh, 1rem); }
    .tl-card .login-input > input:not([type=checkbox]):not([type=radio]) { min-height: clamp(2.6rem, 5.6vh, 3.25rem); }
    .tl-submit { min-height: clamp(2.7rem, 5.8vh, 3.35rem); }
    .tl-secure { margin-top: clamp(.45rem, 1.4vh, 1.2rem); font-size: .78rem; }
}
/* Điện thoại màn hình thấp: gọn thêm, bỏ chân trang. */
@media (max-width: 980px) and (max-height: 740px) {
    .tl-footer, .tl-secure { display: none; }
    .tl-card-head .muted { font-size: .8rem; }
    .tl-card .login-field label { font-size: .82rem; }
    .tl-features li { font-size: .62rem; }
    .tl-features strong { font-size: .7rem; }
    .tl-features svg { width: 1.05rem; height: 1.05rem; }
}
/* Điện thoại: ẩn ba ô chức năng trên trang đăng nhập. */
@media (max-width: 640px) { .tl-features { display: none; } }

/* Điện thoại: khung đăng nhập căn giữa theo chiều dọc, chân trang dính đáy màn hình. */
@media (max-width: 640px) {
    .guest:has(.tech-login) .content { align-content: stretch; }
    .tech-login {
        grid-template-rows: minmax(min-content, 1fr) auto minmax(min-content, 1fr);
        grid-template-areas: "hero" "card" "foot";
        align-content: stretch; align-items: stretch; height: 100%;
    }
    .tl-hero { align-self: end; }
    .tl-card { align-self: center; }
    .tl-footer { display: block; align-self: end; padding-bottom: env(safe-area-inset-bottom, 0px); }
}@media (max-width: 640px) { .guest:has(.tech-login) .content { padding-bottom: calc(.6rem + env(safe-area-inset-bottom, 0px)); } }
@media (max-width: 640px) { .guest:has(.tech-login) .content { padding-top: calc(.6rem + env(safe-area-inset-top, 0px)); } }

/* Dòng bản quyền luôn nằm sát chân trang đăng nhập; nội dung vẫn căn giữa phần còn lại. */
.guest:has(.tech-login) .content { align-content: stretch; }
.tech-login { height: 100%; align-content: stretch; }
.tl-footer { align-self: end; }
@media (min-width: 981px) {
    .tech-login { grid-template-rows: minmax(min-content, 1fr) auto; }
}
@media (min-width: 641px) and (max-width: 980px) {
    .tech-login { grid-template-rows: minmax(min-content, 1fr) auto minmax(min-content, 1fr); align-items: stretch; }
    .tl-hero { align-self: end; }
    .tl-card { align-self: center; }
}

/* ===== Trang tài khoản ===== */
.account-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 1rem; }
.account-profile { padding: 0 !important; overflow: hidden; }
.account-identity { position: relative; display: flex; align-items: center; gap: 1rem; padding: 1.4rem 1.3rem; color: #fff;
    background: linear-gradient(120deg, #141c3a, #24306a 60%, #6b1328); isolation: isolate; }
.account-identity::after { content: ""; position: absolute; inset: 0; z-index: -1;
    background-image: linear-gradient(#ffffff0f 1px, transparent 1px), linear-gradient(90deg, #ffffff0f 1px, transparent 1px); background-size: 22px 22px;
    mask-image: linear-gradient(90deg, transparent, #000); }
.account-avatar { display: grid; flex: none; place-items: center; width: 4.2rem; height: 4.2rem; border-radius: 50%;
    background: linear-gradient(135deg, #f6c453, #e11d3a); color: #fff; font-size: 1.45rem; font-weight: 800; letter-spacing: .02em;
    box-shadow: 0 0 0 3px #ffffff33, 0 10px 24px #0006; }
.account-identity-text { display: grid; gap: .2rem; min-width: 0; }
.account-identity h2 { margin: 0 !important; color: #fff; font-size: 1.25rem; overflow-wrap: anywhere; }
.account-identity p { margin: 0; color: #c9d0ea; font-size: .9rem; overflow-wrap: anywhere; }
.account-role { justify-self: start; margin-top: .25rem; }
.account-facts { display: grid; gap: 0; margin: 0; padding: .4rem 1.3rem 1rem; }
.account-facts > div { display: grid; gap: .25rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.account-facts > div:last-child { border-bottom: 0; }
.account-facts dt { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.account-facts dt svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.account-facts dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.account-section-head { display: flex; align-items: flex-start; gap: .8rem; margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.account-section-head h2 { margin: 0 0 .15rem !important; }
.account-section-head p { margin: 0; font-size: .88rem; }
.account-section-icon { display: grid; flex: none; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: .75rem; background: linear-gradient(135deg, #b00e27, #e11d3a); color: #fff; }
.account-section-icon svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.account-form { display: grid; gap: 1rem; }
.account-form .login-field label { font-size: .9rem; font-weight: 700; }
.account-form .login-input > input:not([type=checkbox]):not([type=radio]) { min-height: 3rem; padding-inline: 2.9rem 3rem; border: 1.5px solid #e2d6d9; border-radius: .75rem; background: #faf7f8; font-size: 1rem; }
.account-form .login-input > input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px #d3122f1f; }
.account-form .login-input > input[aria-invalid=true] { border-color: #d3122f; background: #fff5f6; }
.account-form .password-toggle { display: grid; }
.field-error { color: #a00c23; font-weight: 600; }
.password-strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; margin-top: .45rem; }
.password-strength span { height: .3rem; border-radius: 99px; background: #ece4e7; transition: background .25s; }
.password-strength[data-strength="1"] span:nth-child(-n+1) { background: #d3122f; }
.password-strength[data-strength="2"] span:nth-child(-n+2) { background: #e0a526; }
.password-strength[data-strength="3"] span:nth-child(-n+3) { background: #3b82f6; }
.password-strength[data-strength="4"] span { background: #17945f; }
.password-strength-label { display: block; margin-top: .3rem; font-size: .8rem; }
.password-match { min-height: 1.1em; font-size: .8rem; font-weight: 650; }
.password-match[data-state=ok] { color: #17784f; }
.password-match[data-state=error] { color: #a00c23; }
.account-form-footer { display: flex; justify-content: flex-end; padding-top: .3rem; }
.account-form-footer .button { min-width: 11rem; }
@media (max-width: 860px) {
    .account-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .account-identity { padding: 1.1rem 1rem; }
    .account-avatar { width: 3.4rem; height: 3.4rem; font-size: 1.2rem; }
    .account-facts { padding: .2rem 1rem .6rem; }
    .account-form-footer .button { width: 100%; }
    .account-form .login-input > input:not([type=checkbox]):not([type=radio]) { font-size: 16px; }
}
/* Quản trị/quản lý mở trang cá nhân (tài khoản, tài liệu, kỳ thi của tôi…): dùng menu dọc bên trái như các trang khác. */
@media (min-width: 851px) {
    .workspace:is(.workspace--attempt, .workspace--participant) { grid-template-columns: clamp(13.25rem, 18vw, 16rem) minmax(0, 1fr); grid-template-rows: auto; }
    .workspace:is(.workspace--attempt, .workspace--participant) > .sidebar { display: grid; align-content: start; justify-content: stretch; padding: 1.4rem .85rem; }
    .workspace:is(.workspace--attempt, .workspace--participant) > .sidebar .sidebar-section { display: grid; }
    .workspace:is(.workspace--attempt, .workspace--participant) > .sidebar .sidebar-label { width: auto; padding: .2rem .8rem .45rem; align-self: auto; }
    .workspace:is(.workspace--attempt, .workspace--participant) > .sidebar .sidebar-section + .sidebar-section { padding-top: .75rem; border-top: 1px solid #ffffff1a; }
    .workspace:is(.workspace--attempt, .workspace--participant) > .sidebar a { padding-block: .63rem; }
    .workspace:is(.workspace--attempt, .workspace--participant) > .sidebar .sidebar-section a:has(.nav-icon) { display: flex; align-items: center; gap: .6rem; }
    .workspace:is(.workspace--attempt, .workspace--participant) > .sidebar .admin-menu-toggle { display: none; }
}
/* ===== Kỳ thi của tôi: điện thoại chỉ hiện thông tin chính ===== */
.exam-brief { display: none; }
@media (max-width: 640px) {
    .hide-on-phone { display: none !important; }
    .my-exams-heading { padding: .9rem 1rem; margin-bottom: .9rem; }
    .my-exams-heading h1 { margin: 0; font-size: 1.45rem; }
    .my-exam-group { margin-bottom: 1rem; }
    .my-exam-group > h2 { margin-bottom: .5rem; font-size: 1rem; }
    .my-exam-card { gap: .7rem; padding: .95rem 1rem; }
    .my-exam-card .participant-meta { gap: .35rem; }
    .my-exam-card h3 { margin: .45rem 0 .4rem; font-size: 1.05rem; line-height: 1.35; }
    .exam-brief { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
    .exam-brief span { display: inline-flex; align-items: center; padding: .2rem .6rem; border-radius: .5rem; background: #eef1fb; color: #24306a; font-size: .85rem; font-weight: 700; }
    .exam-brief span + span::before { content: none; }
    .exam-brief--pass span { background: #e6f5ee; color: #17784f; }
    .exam-brief--fail span { background: #fde8eb; color: #a00c23; }
    .my-exam-actions { padding-top: 0; border-top: 0; gap: .4rem; }
    .my-exam-actions .button { width: 100%; min-height: 48px; font-size: 1rem; }
    .my-exam-actions .button:not(.primary) { min-height: 42px; font-size: .92rem; }
}
/* ===== Trang hướng dẫn trước khi thi ===== */
.intro-hero { align-items: flex-start; }
.intro-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem); gap: 1rem; align-items: start; }
.intro-main { display: grid; gap: 1rem; min-width: 0; }
.intro-main .panel, .intro-action { margin: 0; }
.intro-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin: 0; padding: 0; list-style: none; }
.intro-stats li { display: grid; justify-items: start; gap: .15rem; padding: .85rem .9rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface-soft); }
.intro-stats svg { width: 1.4rem; height: 1.4rem; margin-bottom: .25rem; fill: none; stroke: #3b4a8f; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.intro-stats strong { color: var(--ink); font-size: 1.35rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.intro-stats strong small { color: var(--muted); font-size: .85rem; font-weight: 600; }
.intro-stats span { color: var(--muted); font-size: .8rem; }
.intro-subnote { margin: .85rem 0 0; color: var(--muted); font-size: .9rem; }
.intro-guide h2 { margin: 0 0 .8rem; }
.intro-unit-note { display: grid; gap: .25rem; margin: 0 0 1rem; padding: .8rem 1rem; border-inline-start: 4px solid #f6c453; border-radius: .6rem; background: #fffbea; color: #3f3416; }
.intro-unit-note strong { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: #7a5200; }
.intro-steps { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.intro-steps li { position: relative; padding-left: 2.4rem; line-height: 1.5; counter-increment: step; }
.intro-steps li::before { content: counter(step); position: absolute; left: 0; top: -.05rem; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: #1a2350; color: #f6c453; font-size: .85rem; font-weight: 800; }
.intro-action { position: sticky; top: 84px; display: grid; gap: .9rem; }
.intro-action h2 { margin: 0; }
.intro-action p { margin: 0; }
.intro-deadline { display: grid; justify-items: center; gap: .1rem; padding: 1rem; border-radius: .9rem; text-align: center; color: #fff; background: linear-gradient(120deg, #141c3a, #24306a 60%, #6b1328); }
.intro-deadline span { color: #c9d0ea; font-size: .82rem; }
.intro-deadline strong { font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.intro-deadline small { color: #f6c453; font-weight: 700; }
.intro-action .intro-start { display: grid; gap: .8rem; }
.intro-confirm { align-items: flex-start; line-height: 1.4; }
.intro-start-button { width: 100%; min-height: 50px; font-size: 1.05rem; }

/* ===== Bài làm: tất cả câu trên một trang ===== */
.question-list { display: grid; gap: .9rem; min-width: 0; }
.question-list .attempt-question { margin: 0; padding: clamp(1rem, 2.4vw, 1.5rem); border-radius: 1rem; box-shadow: var(--shadow-soft); scroll-margin-top: 1rem; transition: border-color .2s, box-shadow .2s; }
.question-list .attempt-question.is-answered { border-inline-start: 4px solid var(--primary); }
.question-list .attempt-question.is-marked { border-inline-start: 4px solid #e0a526; box-shadow: 0 0 0 1px #f2d08a, var(--shadow-soft); }
.question-list .attempt-question.flash { animation: q-flash 1.2s ease; }
@keyframes q-flash { 0%, 40% { box-shadow: 0 0 0 4px #3b4a8f55, var(--shadow-soft); } 100% { box-shadow: var(--shadow-soft); } }
.question-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.question-head h2 { display: flex; align-items: center; gap: .55rem; margin: 0; color: var(--primary-dark); font-size: 1.05rem; }
.question-head h2 small { color: var(--muted); font-weight: 500; font-size: .85rem; }
.question-no { display: grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 .4rem; border-radius: .6rem; background: #1a2350; color: #f6c453; font-size: .9rem; }
.is-answered .question-no { background: var(--primary); color: #fff; }
.question-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.attempt-finish { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem 1rem; margin: 0; border-style: dashed; }
.attempt-finish h2 { margin: 0 0 .2rem; color: var(--primary-dark); font-size: 1.05rem; }
.attempt-finish p { margin: 0; }
.attempt-finish .button { min-height: 48px; min-width: 10rem; }
.nav-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .2rem; color: var(--primary-dark); }
a.question-number { text-decoration: none; }
.question-number[aria-current=true] { box-shadow: 0 0 0 3px #24306a; }
.nav-timer { display: none; }
@media (min-width: 981px) {
    .workspace--attempt .attempt-header { position: static; }
    .attempt-navigation { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
    .nav-timer { display: grid; justify-items: center; margin-bottom: .9rem; padding: .7rem; border-radius: .8rem; color: #fff; background: linear-gradient(120deg, #141c3a, #24306a); }
    .nav-timer span { color: #c9d0ea; font-size: .75rem; }
    .nav-timer strong { font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
    .nav-timer[data-level=warning] { background: #b7791f; }
    .nav-timer[data-level=critical] { background: #d3122f; animation: p-pulse 1s infinite; }
}
@media (max-width: 980px) {
    .intro-layout { grid-template-columns: minmax(0, 1fr); }
    .intro-action { position: static; }
}
@media (max-width: 640px) {
    .intro-hero { padding: .95rem 1rem; }
    .intro-hero h1 { font-size: 1.3rem; }
    .intro-hero p:not(.hero-eyebrow) { font-size: .82rem; }
    .intro-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .intro-stats li { padding: .65rem .75rem; }
    .intro-stats strong { font-size: 1.15rem; }
    .intro-subnote { font-size: .82rem; }
    .intro-steps li { font-size: .92rem; }
    .intro-deadline strong { font-size: 1.6rem; }
    .question-list .attempt-question { scroll-margin-top: 9rem; }
    .attempt-finish .button { width: 100%; }
    .question-tools .button { flex: 1; }
}
/* ===== Thống kê kết quả theo đơn vị ===== */
.unit-stats .panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .75rem 1rem; margin-bottom: .8rem; }
.unit-stats .panel-heading h2 { margin: 0 0 .2rem; }
.unit-stats .panel-heading p { margin: 0; font-size: .9rem; }
.unit-trail { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; margin: 0 0 .85rem; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--surface-soft); font-size: .92rem; }
.unit-trail span { color: var(--muted); }
.unit-trail strong { color: var(--primary-dark); }
.unit-stats-table td, .unit-stats-table th { vertical-align: middle; }
.unit-stats-table td:not(.row-identity), .unit-stats-table tfoot td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.unit-stats-table .row-identity a { text-decoration: none; }
.unit-stats-table .row-identity a:hover strong { text-decoration: underline; }
.unit-stats-table .row-identity small a { text-decoration: underline; }
.unit-row--own .row-identity strong { font-weight: 600; font-style: italic; }
.unit-stats-table tfoot tr { background: var(--surface-soft); border-top: 2px solid var(--line); }
.unit-stats-table tfoot th, .unit-stats-table tfoot td { padding: .7rem .75rem; font-weight: 700; text-align: left; }
.unit-meter { display: grid; gap: .3rem; min-width: 4.5rem; }
.unit-stats-table td:not(.row-identity) { white-space: normal; }
.unit-stats-table .row-identity { min-width: 10rem; }
.unit-meter small { color: var(--muted); font-weight: 400; }
.unit-meter i { display: block; height: .4rem; border-radius: 99px; background: var(--line); overflow: hidden; }
.unit-meter b { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.unit-meter--pass b { background: #1f8a5b; }
.unit-meter--low b { background: #d98a1c; }
@media (max-width: 760px) {
    .unit-stats .panel-heading .button { width: 100%; justify-content: center; }
    .unit-stats-table tbody tr { grid-template-columns: 1fr 1fr; gap: .45rem .8rem; }
    .unit-stats-table tbody td.row-identity { grid-column: 1 / -1; }
    .unit-stats-table tbody td[data-label] { display: block; overflow-wrap: normal; }
    .unit-stats-table tbody td[data-label]::before { display: block; margin-bottom: .15rem; }
    .unit-stats-table tfoot td small, .unit-meter small { white-space: nowrap; }
    .unit-stats-table tfoot { display: block; }
    .unit-stats-table tfoot tr { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .8rem; margin-top: .6rem; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: .65rem; }
    .unit-stats-table tfoot th { grid-column: 1 / -1; padding: 0; }
    .unit-stats-table tfoot td[data-label] { display: block; min-width: 0; padding: 0; font-weight: 600; }
    .unit-stats-table tfoot td[data-label]::before { flex: none; margin-bottom: .1rem; }
    .unit-stats-table tfoot td::before { content: attr(data-label); display: block; color: var(--muted); font-size: .78rem; font-weight: 600; }
    .unit-meter { min-width: 0; }
}

/* ===== Cảnh báo vi phạm khi rời trang làm bài ===== */
.violation-badge { display: inline-flex; align-items: center; padding: .12rem .55rem; border-radius: 99px; background: #fde8eb; color: #b3132b; border: 1px solid #f3b8c1; font-size: .8rem; font-weight: 700; }
.violation-badge[hidden] { display: none; }
.violation-dialog { border-top: 5px solid #c8102e; text-align: center; max-width: min(30rem, calc(100vw - 2rem)); }
.violation-dialog h2 { color: #b3132b; margin-top: .4rem; }
.violation-dialog #violation-text { font-weight: 600; color: var(--ink, #2a1d22); }
.violation-dialog .submit-dialog-actions { justify-content: center; }
.violation-icon { width: 3.2rem; height: 3.2rem; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: #c8102e; color: #fff; font-size: 1.9rem; font-weight: 800; box-shadow: 0 0 0 .45rem #fde8eb; animation: violation-pulse 1.2s ease-in-out 2; }
@keyframes violation-pulse { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .violation-icon { animation: none; } }
.violation-text { color: #b3132b; font-weight: 700; }
.stat--violation { border-color: #f3b8c1 !important; background: #fff5f6 !important; }
.stat--violation strong, .stat--violation strong a { color: #b3132b; }

/* ===== Lịch riêng theo đơn vị & sửa kỳ thi đang phát hành ===== */
.exam-schedules { display: grid; gap: .6rem; padding: .85rem; border: 1px dashed var(--line); border-radius: .7rem; background: var(--surface-soft); }
.exam-schedules-head { display: grid; gap: .15rem; }
.exam-schedules-head small { color: var(--muted); }
.exam-schedule-rows { display: grid; gap: .55rem; margin: 0; padding: 0; list-style: none; }
.exam-schedule-rows:empty { display: none; }
.exam-schedule-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem .6rem; align-items: end; padding: .65rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--paper, #fff); }
.exam-schedule-row label { display: grid; gap: .25rem; min-width: 0; font-size: .86rem; }
.exam-schedule-row select, .exam-schedule-row input { width: 100%; min-width: 0; }
.exam-schedule-remove { color: var(--primary-dark); }
.exam-schedules [data-schedule-add] { justify-self: start; }
.field-error { color: #b3132b; font-size: .82rem; }
.exam-live-notice { border-left: 4px solid #d98a1c; background: #fff8ec; padding: .8rem 1rem; border-radius: .6rem; margin-bottom: 1rem; }
.exam-live-notice ul { margin: .35rem 0 .2rem 1.1rem; padding: 0; }
.exam-live-notice li { margin: .15rem 0; }
.exam-paper-locked .exam-paper-option { display: flex; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--surface-soft); }
.exam-paper-locked .exam-paper-option > span { display: grid; }
.exam-paper-locked small { color: var(--muted); }
.schedule-table td small { color: var(--muted); display: block; }
@media (max-width: 760px) {
    .exam-schedule-row { grid-template-columns: 1fr 1fr; }
    .exam-schedule-row label:first-child { grid-column: 1 / -1; }
    .exam-schedule-remove { grid-column: 1 / -1; justify-self: end; }
}

/* ===== Cài đặt hệ thống: giới hạn truy cập ===== */
.settings-load-row { display: grid; gap: .55rem; }
.settings-load-number { display: flex; align-items: baseline; gap: .45rem; }
.settings-load-number strong { font-size: 2.2rem; line-height: 1; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.settings-load-number span { color: var(--muted); }
.settings-load-bar { height: .6rem; border-radius: 99px; background: var(--line); overflow: hidden; }
.settings-load-bar span { display: block; height: 100%; border-radius: inherit; background: #1f8a5b; transition: width .4s; }
.settings-load[data-level="warning"] .settings-load-bar span { background: #d98a1c; }
.settings-load[data-level="full"] .settings-load-bar span { background: #c8102e; }
.settings-load[data-level="full"] { border-color: #f3b8c1; }
.settings-note { margin-bottom: 0; font-size: .85rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: .8rem 0; }
.settings-grid label { display: grid; gap: .3rem; }
.settings-grid small { color: var(--muted); }
.settings-rules { margin: .4rem 0 0 1.1rem; padding: 0; color: var(--muted); font-size: .9rem; }
.settings-rules li { margin: .2rem 0; }
.login-busy { margin: 0 0 .9rem; padding: .65rem .8rem; border-radius: .6rem; border: 1px solid #f3b8c1; background: #fff1f3; color: #a3122a; font-size: .9rem; font-weight: 600; }

/* ===== Nhập tài khoản theo đợt ===== */
.account-import { border-left: 4px solid var(--primary); }
.account-import.is-done { border-left-color: #1f8a5b; }
.account-import-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.account-import-head h2 { margin: 0 0 .15rem; font-size: 1.05rem; }
.account-import-head p { margin: 0; }
.account-import-count { font-size: 1.35rem; color: var(--primary-dark); font-variant-numeric: tabular-nums; white-space: nowrap; }
.account-import-bar { height: .6rem; margin: .75rem 0 .5rem; border-radius: 99px; background: var(--line); overflow: hidden; }
.account-import-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .4s; }
.account-import.is-done .account-import-bar span { background: #1f8a5b; }
.account-import-status { margin: 0 0 .6rem; }

/* ===== Menu quản lý trên điện thoại / máy tính bảng: ngăn kéo trượt từ trái ===== */
.nav-drawer-toggle, .nav-backdrop, .drawer-head, .drawer-group, .drawer-foot, .staff-tabbar { display: none; }
@media (max-width: 850px) {
    /* Thanh đầu trang: [☰] [logo + tên hệ thống] [đăng xuất chuyển vào menu] */
    .topbar:has(.nav-drawer-toggle) { justify-content: flex-start; gap: .7rem; }
    .topbar:has(.nav-drawer-toggle) .brand { flex: 1; min-width: 0; }
    .topbar:has(.nav-drawer-toggle) .top-actions { display: none; }
    .nav-drawer-toggle {
        display: inline-grid; place-items: center; flex: none; width: 42px; height: 42px; padding: 0;
        border: 1px solid #ffffff2e; border-radius: .7rem; background: #ffffff12; color: #fff; cursor: pointer;
        transition: background .2s, border-color .2s;
    }
    .nav-drawer-toggle:hover, .nav-drawer-toggle:focus-visible { background: #d3122f; border-color: #d3122f; }
    .nav-drawer-toggle span, .nav-drawer-toggle span::before, .nav-drawer-toggle span::after {
        display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .25s, opacity .2s;
    }
    .nav-drawer-toggle span { position: relative; }
    .nav-drawer-toggle span::before, .nav-drawer-toggle span::after { content: ""; position: absolute; left: 0; }
    .nav-drawer-toggle span::before { top: -6px; }
    .nav-drawer-toggle span::after { top: 6px; }

    /* Nền mờ phía sau menu */
    .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: #070b18b8; animation: drawer-fade .25s ease both; }
    .nav-backdrop[hidden] { display: none; }
    body.nav-open { overflow: hidden; }

    /* Ngăn kéo */
    .workspace.workspace--staff > .sidebar {
        position: fixed; z-index: 40; inset: 0 auto 0 0; display: flex; flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; gap: 0;
        width: min(86vw, 340px); height: 100dvh; margin: 0; padding: 0 0 env(safe-area-inset-bottom, 0px);
        overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 0 1.1rem 1.1rem 0;
        background: linear-gradient(180deg, #0e1530 0%, #121a3d 62%, #2a0c19 100%); color: #c9d0ea;
        box-shadow: 18px 0 48px #0009; scrollbar-width: thin; scrollbar-color: #ffffff33 transparent;
        transform: translateX(-105%); visibility: hidden;
        transition: transform .3s cubic-bezier(.2, .75, .2, 1), visibility 0s linear .3s;
    }
    body.nav-open .workspace.workspace--staff > .sidebar { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2, .75, .2, 1); }

    .workspace--staff .drawer-head {
        position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .8rem;
        padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem 1rem; border-bottom: 1px solid #ffffff1a;
        background: linear-gradient(120deg, #0b1124, #1a2350 70%, #3a0d1a);
    }
    .workspace--staff .drawer-head::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: linear-gradient(90deg, #d3122f, #f6c453 50%, transparent); }
    .drawer-avatar {
        display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; font-weight: 800; font-size: 1.05rem; color: #fff;
        background: linear-gradient(135deg, #d3122f, #f6c453); box-shadow: 0 0 0 3px #ffffff1f, 0 6px 18px #d3122f55;
    }
    .drawer-user { display: grid; justify-items: start; gap: .28rem; min-width: 0; }
    .drawer-user strong { max-width: 100%; overflow: hidden; color: #fff; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
    .drawer-user .role-chip { display: inline-flex; padding: .12rem .55rem; font-size: .7rem; }
    .drawer-user small { max-width: 100%; color: #b9c1db; font-size: .75rem; overflow-wrap: anywhere; }
    .drawer-close {
        position: relative; align-self: start; width: 38px; height: 38px; padding: 0; border: 1px solid #ffffff26; border-radius: .65rem;
        background: #ffffff0f; color: #fff; cursor: pointer;
    }
    .drawer-close:hover, .drawer-close:focus-visible { background: #ffffff24; }
    .drawer-close span::before, .drawer-close span::after { content: ""; position: absolute; top: 50%; left: 50%; width: 16px; height: 2px; border-radius: 2px; background: currentColor; }
    .drawer-close span::before { transform: translate(-50%, -50%) rotate(45deg); }
    .drawer-close span::after { transform: translate(-50%, -50%) rotate(-45deg); }

    /* Nhóm mục */
    .workspace.workspace--staff > .sidebar > * { flex-shrink: 0; }
    .workspace.workspace--staff > .sidebar .sidebar-section {
        position: static; display: grid; width: auto; grid-template-columns: minmax(0, 1fr); gap: .2rem;
        padding: .9rem .75rem .5rem; margin: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none;
    }
    .workspace.workspace--staff > .sidebar .sidebar-section + .sidebar-section { border-top: 1px solid #ffffff14; }
    .workspace.workspace--staff > .sidebar .sidebar-label { display: none; }
    .workspace--staff .drawer-group { display: block; padding: 0 .75rem .35rem; color: #f6c453; font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

    /* Mục menu */
    .workspace.workspace--staff > .sidebar .sidebar-section a {
        display: flex; align-items: center; gap: .8rem; min-height: 48px; padding: .55rem .75rem;
        border: 0; border-radius: .7rem; color: #d3d9ef; font-size: .97rem; font-weight: 500; line-height: 1.25; text-align: start;
        text-decoration: none; background: none; box-shadow: none; transition: background .15s, color .15s;
    }
    .workspace.workspace--staff > .sidebar .sidebar-section a:active { background: #ffffff1f; }
    .workspace.workspace--staff > .sidebar .sidebar-section a:hover { color: #fff; background: #ffffff12; }
    .workspace.workspace--staff > .sidebar .sidebar-section a.current {
        color: #fff; font-weight: 700; background: linear-gradient(90deg, #d3122f66, #d3122f14);
        box-shadow: inset 3px 0 0 #ff4d63;
    }
    .workspace.workspace--staff > .sidebar .nav-icon { width: 1.25rem; height: 1.25rem; opacity: .9; }
    .workspace.workspace--staff > .sidebar a.current .nav-icon { color: #f6c453; opacity: 1; }
    .workspace.workspace--staff > .sidebar .participant-nav-icon { position: relative; display: block; flex: none; width: 1.15rem; height: 1.15rem; opacity: .9; }
    .workspace.workspace--staff > .sidebar .participant-nav-icon--exams { border: 1.6px solid currentColor; border-radius: .27rem; background: linear-gradient(currentColor,currentColor) center 37%/.52rem 1px no-repeat, linear-gradient(currentColor,currentColor) center 67%/.52rem 1px no-repeat; }
    .workspace.workspace--staff > .sidebar .participant-nav-icon--history { border: 1.6px solid currentColor; border-radius: 50%; }
    .workspace.workspace--staff > .sidebar .participant-nav-icon--history::before { position: absolute; top: .16rem; left: .38rem; width: .29rem; height: .33rem; border-bottom: 1.5px solid currentColor; border-left: 1.5px solid currentColor; content: ""; }

    /* Chân menu: đăng xuất */
    .workspace--staff .drawer-foot { display: block; margin-top: auto; padding: .75rem .75rem 1rem; border-top: 1px solid #ffffff14; }
    .drawer-logout {
        display: flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; min-height: 46px;
        border: 1px solid #ff4d6366; border-radius: .7rem; background: #d3122f1f; color: #ffd5db; font: inherit; font-weight: 700; cursor: pointer;
    }
    .drawer-logout:hover, .drawer-logout:focus-visible { background: #d3122f; color: #fff; }
    .drawer-logout .nav-icon { width: 1.1rem; height: 1.1rem; }

    /* Menu ☰ chỉ chứa phần quản lý; menu cá nhân chuyển xuống thanh dưới màn hình. */
    .workspace.workspace--staff > .sidebar .sidebar-section.participant-navigation { display: none; }

    /* Thanh menu cá nhân dưới màn hình (giống ứng dụng) cho cán bộ quản lý */
    .workspace--staff .staff-tabbar {
        position: fixed; z-index: 30; inset: auto 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem;
        padding: .45rem .65rem calc(.45rem + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--line); background: #ffffffeb; backdrop-filter: blur(12px) saturate(1.4);
        box-shadow: 0 -5px 22px #78212f17;
    }
    .staff-tabbar a {
        display: grid; min-width: 0; min-height: 49px; justify-items: center; align-content: center; gap: .22rem;
        padding: .25rem .1rem; border-radius: .6rem; color: var(--ink); font-size: .78rem; line-height: 1.15; text-align: center; text-decoration: none;
    }
    .staff-tabbar a.current { color: var(--primary-dark); font-weight: 700; background: linear-gradient(180deg, var(--tint), transparent); }
    .staff-tabbar .participant-nav-icon { position: relative; display: block; width: 1.18rem; height: 1.18rem; }
    .staff-tabbar .participant-nav-icon--exams { border: 1.6px solid currentColor; border-radius: .27rem; background: linear-gradient(currentColor,currentColor) center 37%/.56rem 1px no-repeat, linear-gradient(currentColor,currentColor) center 67%/.56rem 1px no-repeat; }
    .staff-tabbar .participant-nav-icon--history { border: 1.6px solid currentColor; border-radius: 50%; }
    .staff-tabbar .participant-nav-icon--history::before { position: absolute; top: .18rem; left: .4rem; width: .31rem; height: .35rem; border-bottom: 1.5px solid currentColor; border-left: 1.5px solid currentColor; content: ""; }
    /* Chừa chỗ cho thanh dưới để nội dung cuối trang không bị che. */
    .workspace.workspace--staff .content { padding-bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px)); }
}
@keyframes drawer-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .workspace.workspace--staff > .sidebar, .nav-backdrop { transition: none !important; animation: none !important; }
}
