/* Web workspace: clear next steps, calm surfaces, and touch-friendly controls. */
.directory-layout { display:grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.5fr); gap:16px; margin-bottom:16px; }
.directory-layout textarea { display:block; width:100%; margin:12px 0; }
.directory-layout .optional-import { margin-top:16px; }
.directory-layout .optional-import input[type=file] { display:block; max-width:100%; margin:10px 0; }
.directory-layout input, .directory-layout select, #directory-search, #directory-filter { min-height:42px; }
#directory-group-search { width:100%; margin-top:12px; padding:9px 12px; border:1px solid #c6d2e4; border-radius:9px; }
.directory-groups { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }
.directory-group { display:flex; align-items:center; gap:8px; border:1px solid #d8e2f2; background:#f7f9fe; color:#294474; border-radius:10px; padding:9px 12px; }
.directory-group span { color:#64748b; }
.directory-group button { border:0; background:transparent; color:inherit; padding:2px; cursor:pointer; }
.directory-group button:first-child { font-weight:700; }
.directory-to-exam { border-top:1px solid #e1e7ef; margin-top:16px; padding-top:16px; }
.directory-to-exam p { color:#64748b; }
.directory-selection-bar,.directory-bulk { display:flex; align-items:center; flex-wrap:wrap; gap:10px; margin:12px 0; }
.directory-selection-bar { padding:12px; border:1px solid #d7e3f5; border-radius:10px; background:#f5f8ff; }
.directory-selection-bar span { flex:1 1 260px; color:#344769; font-size:13px; overflow-wrap:anywhere; }
.directory-bulk { padding:12px 0; border-top:1px solid #e1e7ef; border-bottom:1px solid #e1e7ef; }
.directory-bulk label { display:flex; align-items:center; flex-wrap:wrap; gap:8px; color:#344769; font-size:13px; font-weight:700; }
.directory-bulk select { min-height:42px; max-width:100%; }
.directory-layout label { display:grid; gap:6px; margin-top:10px; color:#344769; font-size:13px; font-weight:700; }
.directory-trash { margin:10px 0 18px; padding:12px 14px; border:1px solid #dbe3ee; border-radius:10px; }
.directory-trash summary { cursor:pointer; font-weight:700; color:#344769; }
.directory-trash p { color:#64748b; font-size:12px; }
.directory-trash-row { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid #edf1f6; }
.directory-trash-row span { overflow-wrap:anywhere; }
.directory-trash-row button { flex:none; }
.custom-fields { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:10px 0; }
.custom-fields input, .custom-fields select { width:100%; }
.title-scope { display:grid; gap:10px; margin:14px 0; max-width:650px; }
.title-scope select, #directory-add-group, #directory-edit-group { width:100%; min-height:44px; }
.title-student-list { max-height:220px; overflow:auto; border:1px solid #d8e2f2; border-radius:10px; padding:8px; }
.title-student-list label { display:flex; align-items:center; gap:8px; padding:6px; }
.title-student-list small { color:#64748b; margin-left:auto; }
.question-bank-panel { max-width:900px; border-color:#d6e1f2; }
.question-bank-panel .panel-head { margin-bottom:14px; }
.question-bank-panel .pill { background:#eef2f8; color:#53657f; }
.question-bank-panel .pill.ok { background:#e5f7ee; color:#187255; }
.dtm-main-names { display:grid; grid-template-columns:1fr 1fr auto; gap:12px; align-items:end; }
.dtm-format { margin:0 0 16px; border:1px solid #d8e1ee; border-radius:12px; padding:11px 14px; background:#f8faff; }
.dtm-format summary { cursor:pointer; font-weight:750; color:#355bd5; }
.dtm-format pre { white-space:pre-wrap; padding:12px; border-radius:9px; background:#17243a; color:#fff; line-height:1.55; }
.dtm-main-names label, .dtm-generate label { display:grid; gap:6px; font-weight:700; color:#243654; }
.dtm-bank-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.dtm-bank-card { border:1px solid #d8e1ee; border-radius:14px; padding:16px; display:grid; gap:12px; background:#fff; }
.dtm-bank-card.ready { border-color:#9bd8bf; background:#fbfffd; }
.dtm-bank-card h3,.dtm-bank-card p { margin:0; }
.dtm-bank-card small { display:block; margin-top:5px; color:#6d7c92; overflow-wrap:anywhere; }
.dtm-bank-preview { grid-column:1/-1; }
.dtm-bank-preview details { border-top:1px solid #e6ebf2; padding:8px 0; }
.dtm-bank-preview summary { cursor:pointer; font-weight:650; }
.dtm-bank-preview img { display:block; max-width:100%; max-height:260px; object-fit:contain; margin:10px auto; border-radius:8px; }
.dtm-bank-preview li { padding:3px 0; }
.correct-key { color:#17805d; }
.dtm-generations { display:grid; gap:10px; margin-top:16px; }
.dtm-generation { display:flex; justify-content:space-between; gap:16px; align-items:center; border:1px solid #d8e1ee; border-radius:12px; padding:13px; }
.dtm-generation small { display:block; color:#6d7c92; margin-top:3px; }
.bank-actions { display:flex; flex-wrap:wrap; gap:10px; margin:12px 0; }
.bank-actions label { cursor:pointer; }
@media(max-width:760px) {
  .directory-layout, .custom-fields { grid-template-columns:1fr; }
  .directory-to-exam .inline-actions { display:flex; flex-wrap:wrap; }
  #directory .table-scroll { overflow:visible; }
  #directory table, #directory tbody { display:block; width:100%; min-width:0; }
  #directory thead { display:none; }
  #directory tbody tr { display:grid; grid-template-columns:28px 1fr auto; gap:3px 8px; border-bottom:1px solid #e1e7ef; padding:12px 0; }
  #directory tbody td { border:0; padding:0; }
  #directory tbody td:nth-child(1) { grid-column:1; grid-row:1 / span 3; }
  #directory tbody td:nth-child(2) { grid-column:2 / span 2; font-weight:700; }
  #directory tbody td:nth-child(3) { grid-column:2; }
  #directory tbody td:nth-child(4) { grid-column:3; }
  #directory tbody td:nth-child(5) { grid-column:2 / span 2; }
}
:root {
  --ink: #17243a;
  --muted: #64748b;
  --line: #e1e7ef;
  --surface: #fff;
  --canvas: #f4f7fb;
  --accent: #355bd5;
  --accent-dark: #294ab7;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
}
body { background: var(--canvas); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid #89a8ff;
  outline-offset: 3px;
}
.skip-link {
  position: fixed; top: -60px; left: 16px; z-index: 100;
  padding: 10px 14px; border-radius: 9px; background: #fff; color: var(--accent);
  box-shadow: 0 8px 24px #17243a22;
}
.skip-link:focus { top: 12px; }
.sidebar {
  width: 232px;
  background: linear-gradient(165deg, #111f38 0%, #182847 100%);
  padding: 24px 12px;
}
.brand { padding: 2px 10px 32px; font-size: 16px; letter-spacing: -.35px; }
.brand-icon { box-shadow: none; border-radius: 12px; background: #4f6fe3; }
.sidebar-label { margin: 0 14px 9px; color: #9babca; }
.sidebar nav { gap: 3px; }
.sidebar nav button {
  min-height: 44px; padding: 10px 13px; border-radius: 10px;
  font-size: 13px; line-height: 1.2; color: #c3d0e9;
}
.sidebar nav button.active { background: #ffffff19; box-shadow: inset 3px 0 #91acff; }
.sidebar nav button:hover { background: #ffffff15; }
.nav-icon, .menu-icon, .ui-icon, .upload-icon svg {
  display: block; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-icon { width: 20px; height: 20px; flex: 0 0 20px; }
.menu-icon { width: 22px; height: 22px; }
#menu-toggle { width: 42px; height: 42px; padding: 10px; place-items: center; }
.upload-icon svg { width: 29px; height: 29px; }
.sidebar-bottom { color: #c4d4ed; }
.main-wrap { margin-left: 232px; }
.topbar {
  height: 70px; padding: 0 34px; gap: 13px;
  background: #fff; border-bottom-color: var(--line);
}
#breadcrumb { font-size: 13px; color: var(--ink); }
.top-exam-name {
  display: inline-block; max-width: min(42vw, 420px); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: #7a879a; font-size: 12px;
  border-left: 1px solid var(--line); padding-left: 13px;
}
main { max-width: 1300px; padding: 30px 34px 80px; }
.heading { margin-bottom: 20px; }
.heading h1 { font-size: clamp(26px, 2.5vw, 34px); letter-spacing: -.9px; color: var(--ink); }
.heading p, .panel-head p, .step p, .action-panel p { color: var(--muted); font-size: 13px; }
.eyebrow { color: #5972c9; letter-spacing: 1.35px; }
.panel, .step, .action-panel, .metrics article {
  border-color: var(--line); border-radius: 16px;
  box-shadow: 0 5px 25px #243a6108;
}
.panel { padding: 22px; }
.panel-head { align-items: center; flex-wrap: wrap; gap: 10px; }
.panel-head h2 { font-size: 17px; }
.primary, .secondary, .subtle {
  min-height: 42px; padding: 9px 15px; font-size: 13px;
  border-radius: 9px; font-weight: 750;
}
.primary { background: var(--accent); border-color: var(--accent); box-shadow: 0 5px 12px #355bd52b; }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.secondary { border-color: #cad6e8; color: #2f4f9c; }
.subtle.danger { color: #a94851; }
.text-link { font-size: 13px; color: #3154bd; }
.guide {
  border-color: #d7e2f5;
  background: linear-gradient(120deg, #ffffff 43%, #eef3ff 100%);
  padding: 26px 28px;
}
.guide-intro h2 { font-size: 22px; }
.guide-intro p { max-width: 640px; font-size: 14px; }
.guide-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 24px; }
.guide-step {
  justify-content: flex-start; min-height: 49px; padding: 8px 10px;
  border-color: #d9e2f0; color: #4b5b74; font-size: 12px;
}
.guide-step.done { background: #ebf7ef; border-color: #b7dfc5; }
.metrics { gap: 10px; }
.metrics article { min-height: 90px; padding: 15px 17px; }
.metrics span { font-size: 12px; color: #697891; }
.metrics strong { color: var(--ink); }
.exam-row { min-height: 60px; border-color: #edf1f6; }
.exam-row:hover { border-color: #a8bced; background: #f7f9ff; }
.exam-row b { font-size: 13px; }
.exam-row small { font-size: 11px; }
.exam-switch { margin: 0 0 17px; }
.select-exam { font-size: 11px; color: #60718d; letter-spacing: .5px; }
.select-exam select { min-height: 42px; }

/* Roster: direct entry first, import secondary, corrections in the table. */
#students.page.active {
  display: grid; grid-template-columns: minmax(310px, .92fr) minmax(400px, 1.08fr);
  align-items: start; gap: 16px;
}
#students > .heading, #students > .exam-switch { grid-column: 1 / -1; margin-bottom: 0; }
#students > .panel { margin-bottom: 0; min-width: 0; }
#students .inline-entry { margin: 0; padding: 0; border: 0; background: transparent; }
#students .inline-entry > summary { display: none; }
#students .inline-entry p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
#roster-paste { min-height: 172px; font: 14px/1.6 system-ui, sans-serif; }
.inline-entry textarea { border-color: #c7d3e6; }
.inline-actions { justify-content: space-between; flex-wrap: wrap; }
.inline-actions .primary { min-width: 160px; }
.optional-import {
  margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line);
}
.optional-import summary, .key-paste-option summary {
  width: fit-content; color: #3455ad; cursor: pointer; font-size: 13px; font-weight: 750;
}
.optional-import[open] summary, .key-paste-option[open] summary { margin-bottom: 12px; }
.optional-import .import-help { margin: 4px 0 12px; }
.optional-import .dropzone { min-height: 116px; }
.dropzone { border-color: #b6c8e4; background: #f9fbff; }
.dropzone:hover, .dropzone.dragging { border-color: #6483dc; background: #f0f5ff; }
.dropzone b { font-size: 13px; }
.dropzone span { font-size: 12px; }
.dropzone .secondary { margin-top: 3px; }
.summary-line { font-size: 12px; color: #526683; }
#students .table-scroll { max-height: 540px; overflow: auto; }
#students table { min-width: 0; }
#students th:last-child, #students td:last-child { text-align: right; }
.dialog-note { color: var(--muted); margin: 12px 0 4px; }
.dialog-id { color: var(--muted); font-size: 12px; }
#exam-mode-help { margin: -4px 0 4px; color: #5d6f8b; font-size: 12px; }
.exam-dialog { width: min(760px, calc(100vw - 28px)); }
.exam-dialog form { max-height: min(820px, calc(100vh - 32px)); overflow-y: auto; padding: 28px; }
.exam-dialog .dialog-head { align-items: flex-start; }
.exam-dialog .dialog-head h2 { margin: 1px 0 0; font-size: 24px; }
.exam-dialog .dialog-head .eyebrow { margin-bottom: 5px; }
.exam-dialog-intro { margin: 7px 0 20px; color: var(--muted); font-size: 13px; }
.exam-type-picker { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:0; padding:0; border:0; }
.exam-type-picker legend { grid-column:1 / -1; margin-bottom:9px; color:#40526c; font-size:13px; font-weight:800; }
.exam-type-picker button {
  display:grid; grid-template-columns:42px 1fr; align-items:center; gap:11px; min-height:78px;
  padding:12px; border:1px solid #d5deec; border-radius:12px; background:#fff; color:#273b5b; text-align:left;
}
.exam-type-picker button:hover { border-color:#8da5df; background:#f8faff; }
.exam-type-picker button[aria-pressed="true"] { border-color:#4f6fda; background:#eef3ff; box-shadow:0 0 0 2px #4f6fda1c; }
.exam-type-picker button[data-unavailable="true"] { border-style:dashed; color:#78869a; background:#f8fafc; }
.exam-type-picker button > span:last-child { min-width:0; }
.exam-type-picker b, .exam-type-picker small { display:block; }
.exam-type-picker b { font-size:14px; }
.exam-type-picker small { margin-top:3px; color:#6d7d94; font-size:11px; line-height:1.35; }
.exam-type-picker em { margin-left:6px; padding:3px 6px; border-radius:20px; background:#e8edf4; color:#6c7b91; font-size:9px; font-style:normal; text-transform:uppercase; }
.exam-type-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:11px; background:#e8eeff; color:#4162c9; }
.exam-type-icon .ui-icon { width:23px; height:23px; }
.exam-choice-section { margin-top:20px; }
.exam-choice-section h3, .custom-fields h3 { margin:0 0 10px; color:#40526c; font-size:13px; }
.subject-picker { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.subject-picker button { min-height:44px; padding:9px 8px; border:1px solid #d5deec; border-radius:9px; background:#fff; color:#405472; font-size:12px; font-weight:750; }
.subject-picker button:hover { border-color:#8da5df; background:#f8faff; }
.subject-picker button[aria-pressed="true"] { border-color:#4f6fda; background:#eaf0ff; color:#294cae; }
.exam-dialog .custom-fields { margin-top:20px; }
.exam-dialog .custom-fields h3 { grid-column:1 / -1; }
.exam-name-field { margin-top:18px; }
.exam-dialog #exam-mode-help { min-height:36px; margin:14px 0 0; padding:10px 12px; border-radius:9px; background:#f4f7fb; line-height:1.45; }

@media(max-width:620px) {
  .exam-dialog form { padding:21px 18px; }
  .exam-dialog .dialog-head h2 { font-size:20px; }
  .exam-type-picker { grid-template-columns:1fr; }
  .exam-type-picker button { min-height:70px; }
  .subject-picker { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* Key before sheets. Ten answers at a time keep phones usable. */
.upload-grid { gap: 14px; }
.upload-grid .key-panel { grid-column: 1 / -1; }
.key-panel .inline-entry { padding: 0; margin: 0; border: 0; background: transparent; }
.key-panel .inline-entry > summary {
  display: inline-flex; align-items: center; min-height: 36px;
  color: #2c4a99; font-size: 13px;
}
.key-panel .inline-entry > p { color: var(--muted); font-size: 13px; margin: 5px 0 14px; }
.key-group-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.key-group-tabs button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 48px; padding: 8px 13px; border: 1px solid #d7e1ef;
  border-radius: 10px; background: #f8faff; color: #455875; font-weight: 800;
}
.key-group-tabs button small { color: #52647d; font-size: 12px; font-weight: 650; }
.key-group-tabs button[aria-pressed="true"] { border-color: var(--accent); background: #eaf0ff; color: #294aa7; }
.key-group-tabs button.complete small { color: #16835e; }
.key-choice-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 14px 0 12px; }
.key-choice { padding: 8px; border-color: #d9e2ef; border-radius: 10px; }
.key-choice b { font-size: 12px; color: #405472; }
.key-choice button { min-height: 38px; font-size: 13px; }
.key-choice button:hover { border-color: #6f8de4; }
#key-next-group { margin-bottom: 17px; }
.key-paste-option { margin: 0 0 13px; }
.key-paste-option p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
#key-paste { min-height: 68px; }
#key-paste-count { color: #536781 !important; font-size: 13px; font-weight: 750; }
.written-panel { grid-column: 1 / -1; }
.written-panel details > summary { cursor: pointer; font-weight: 800; color: #344a72; min-height: 38px; }
.written-panel details > summary span { font-weight: 500; color: #52647d; }
.written-note, .written-hint { color: var(--muted); font-size: 13px; }
.written-note { margin: 8px 0 16px; padding: 10px 12px; border-radius: 9px; background: #f5f8fd; }
.written-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; }
.written-item { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; min-height: 66px; padding: 10px 12px; border: 1px solid #d9e2ef; border-radius: 10px; background: #fff; text-align: left; color: var(--ink); }
.written-item:hover { border-color: #6f8de4; background: #f8faff; }
.written-item b { font-size: 13px; }
.written-item span:nth-child(2) { grid-column: 1; color: var(--muted); font-size: 11px; }
.written-item span:last-child { grid-column: 2; grid-row: 1 / 3; color: #4468c5; }
#written-dialog { width: min(680px, calc(100vw - 24px)); max-height: min(90vh, 850px); overflow: auto; padding: 24px; border: 1px solid #d9e2ef; border-radius: 17px; box-shadow: 0 24px 70px #17243a4d; color: var(--ink); --keyboard-zindex: 3000; }
#written-dialog::backdrop { background: #1423419c; }
#written-dialog label { display: block; margin: 15px 0 7px; font-size: 13px; font-weight: 750; }
#written-text { width: 100%; min-height: 165px; padding: 12px; border: 1px solid #c7d3e6; border-radius: 9px; resize: vertical; line-height: 1.5; }
#math-editor { display: block; width: 100%; min-height: 52px; padding: 10px; border: 1px solid #c7d3e6; border-radius: 9px; background: white; font-size: 20px; }
#math-keyboard-slot .ML__keyboard.is-visible { position: relative; width: 100%; height: var(--_keyboard-height, 370px); overflow: visible; z-index: 3; }
#math-keyboard-slot .ML__keyboard:not(.is-visible) { height: 0; overflow: hidden; }
.math-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.readiness-strip { padding: 13px 17px; font-size: 13px; }
.readiness-strip b { font-size: 13px; }
.action-panel { flex-wrap: wrap; gap: 8px 16px; padding: 19px 22px; }
.action-panel > div { flex: 1 1 350px; }
.retention-note { flex-basis: 100%; margin: 4px 0 0; color: #52647d; font-size: 12px; line-height: 1.5; }
.undo-action { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 15px; padding: 11px 14px; border: 1px solid #d6c397; background: #fff8e8; border-radius: 9px; color: #5e4b25; font-size: 13px; }
.undo-action[hidden] { display: none; }
.list-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 14px; }
.list-toolbar input { flex: 1 1 240px; min-width: 0; padding: 10px 12px; border: 1px solid #c6d2e4; border-radius: 9px; }
.list-toolbar select { padding: 10px 12px; border: 1px solid #c6d2e4; border-radius: 9px; }
.list-toolbar span { color: #52647d; font-size: 13px; }
.inline-error { display: block; color: #8d1b32; background: #fff1f3; border-left: 3px solid #c23750; padding: 10px 12px; margin: 10px 0; border-radius: 4px; line-height: 1.5; }
.inline-error[hidden] { display: none; }
.scan-manifest { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.scan-manifest > summary { cursor: pointer; color: #344a72; font-weight: 750; }
.scan-list { margin-top: 10px; max-height: 310px; overflow: auto; }
.scan-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.scan-row span { display: grid; gap: 3px; min-width: 0; }
.scan-row .scan-row-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.scan-row .scan-row-actions button { border: 0; background: transparent; cursor: pointer; font: inherit; padding: 4px 0; }
.scan-row small { color: #52647d; }
.result-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.result-summary span { background: #eef3fb; border: 1px solid #d8e2f0; border-radius: 8px; padding: 8px 11px; color: #344a72; font-size: 13px; }
#item-analysis summary { cursor: pointer; font-weight: 800; color: #344a72; min-height: 30px; }
#item-analysis details[open] .table-scroll { margin-top: 14px; }
.job-progress { display: block; width: 100%; height: 10px; accent-color: #3158c2; }
.manual-review { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.choice-review { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.choice-review p { color: #52647d; line-height: 1.5; }
.choice-review-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-review-controls select { min-height: 40px; max-width: 100%; padding: 8px; border: 1px solid #c6d2e4; border-radius: 7px; }
.manual-review p { color: #52647d; line-height: 1.5; }
.manual-previews { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.manual-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.manual-question { border: 1px solid #d8e2f0; border-radius: 9px; padding: 9px; }
.manual-question > b { display: block; margin-bottom: 7px; }
.manual-question > div { display: flex; gap: 5px; }
.manual-question button { flex: 1; min-height: 38px; border: 1px solid #c6d2e4; border-radius: 7px; background: #fff; color: #344a72; }
.manual-question button[aria-pressed="true"] { border-color: #3158c2; background: #e8efff; color: #2146a7; font-weight: 750; }
.auth-footnote { color: #52647d !important; }
@media(max-width:760px) { .manual-grid { grid-template-columns: 1fr; } .result-summary { display: grid; } }
.action-panel .primary { min-width: 190px; }
#mode-warning:not(:empty) {
  display: block; margin: 0 0 14px; padding: 13px 16px;
  border: 1px solid #f0d6a8; border-radius: 10px;
  background: #fff8e9; color: #7a541a !important;
  font-size: 13px; font-weight: 700;
}
#titles .workflow { max-width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#titles .step { padding: 18px; }
.skip-titles { margin: 0 0 16px; }

/* Messages, results and account surfaces. */
#notice { display: none; max-width: min(420px, calc(100vw - 32px)); font-size: 13px; }
#notice.visible { display: flex; align-items: center; gap: 14px; }
#notice button { margin-left: auto; border: 0; background: transparent; font-size: 20px; color: inherit; }
#activity-bar {
  position: fixed; z-index: 29; top: 86px; right: 25px; min-width: 240px;
  padding: 13px 17px 13px 42px; border: 1px solid #bed0f8; border-radius: 10px;
  color: #264791; background: #eef3ff; font-size: 13px; font-weight: 750;
  box-shadow: 0 10px 25px #1420441a;
}
#activity-bar::before {
  content: ''; position: absolute; left: 16px; top: 50%; width: 14px; height: 14px;
  margin-top: -7px; border: 2px solid #b5c6f5; border-top-color: #355bd5;
  border-radius: 50%; animation: ux-spin .8s linear infinite;
}
@keyframes ux-spin { to { transform: rotate(360deg); } }
.result-toolbar input, .result-toolbar select { min-height: 44px; font-size: 13px; }
.result-empty { display: grid; justify-items: start; gap: 10px; padding: 38px; }
.result-empty h2 { font-size: 21px; margin: 0; }
.result-empty p { max-width: 560px; color: var(--muted); margin: 0 0 7px; }
.empty-icon {
  display: grid; place-items: center; width: 46px; height: 46px;
  border-radius: 13px; background: #eaf0ff; color: #4364ce;
}
.empty-icon .ui-icon { width: 23px; height: 23px; }
th { color: #61718a; font-size: 11px; }
td { font-size: 13px; }
.empty { color: #64748b; font-size: 13px; }
.auth-story { background: linear-gradient(145deg, #11233f, #284e91); }
.auth-card h2 { font-size: 27px; }
.auth-form label { font-size: 13px; }
.auth-form input { font-size: 16px; }
.wallet-summary strong { color: #244a9a; }
#settings > .panel { max-width: 760px; }
#settings > .panel > p:first-of-type { margin: 8px 0 22px; color: var(--muted); }
#settings label[for="resource-mode"] { display: block; margin-bottom: 7px; color: #40526c; font-size: 13px; font-weight: 750; }
#resource-mode { display: block; width: min(100%, 380px); min-height: 44px; padding: 8px 12px; border: 1px solid #c7d4e6; border-radius: 9px; background: #fff; color: var(--ink); }
#settings .panel > .muted { max-width: 650px; margin: 22px 0; padding: 14px 16px; border-radius: 9px; background: #f5f8fc; color: #5d6d85 !important; font-size: 12px; }
.camera-scan-button { width: 100%; margin-top: 10px; min-height: 44px; }
.camera-scan-dialog { width: min(760px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); padding: 0; overflow: hidden; background: #091224; color: #fff; }
.camera-scan-dialog::backdrop { background: #020713e8; }
.camera-shell { display: flex; flex-direction: column; max-height: calc(100dvh - 20px); padding: 18px; }
.camera-shell header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.camera-shell header h2 { color: #fff; font-size: 20px; }
.camera-shell .eyebrow { color: #9cb4ff; }
.camera-shell .close { color: #fff; }
.camera-help { margin: 8px 0 14px; color: #bac6da; font-size: 12px; line-height: 1.5; }
.camera-stage { position: relative; flex: 1; min-height: 280px; overflow: hidden; border-radius: 13px; background: #02050b; }
#camera-video { display: block; width: 100%; height: min(56vh, 520px); object-fit: cover; }
.camera-guide { position: absolute; inset: 7% 16%; pointer-events: none; }
.camera-guide i { position: absolute; width: 35px; height: 35px; border-color: #fff; filter: drop-shadow(0 1px 2px #000); }
.camera-guide i:nth-child(1) { top: 0; left: 0; border-top: 4px solid; border-left: 4px solid; }
.camera-guide i:nth-child(2) { top: 0; right: 0; border-top: 4px solid; border-right: 4px solid; }
.camera-guide i:nth-child(3) { bottom: 0; left: 0; border-bottom: 4px solid; border-left: 4px solid; }
.camera-guide i:nth-child(4) { right: 0; bottom: 0; border-right: 4px solid; border-bottom: 4px solid; }
.camera-wait { position: absolute; inset: 0; display: grid; place-items: center; padding: 25px; text-align: center; background: #02050bd9; color: #fff; font-weight: 750; }
.camera-wait[hidden] { display: none; }
.camera-status { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; color: #b9c5d9; font-size: 11px; }
.camera-status b { color: #fff; font-size: 13px; }
.camera-gallery { display: flex; gap: 9px; min-height: 0; overflow-x: auto; padding: 0 0 10px; }
.camera-gallery figure { position: relative; flex: 0 0 76px; margin: 0; border: 1px solid #33435d; border-radius: 8px; overflow: hidden; background: #142039; }
.camera-gallery img { display: block; width: 76px; height: 90px; object-fit: cover; }
.camera-gallery figcaption { display: flex; align-items: center; justify-content: space-between; padding: 5px 6px; color: #dbe5f5; font-size: 9px; }
.camera-gallery button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: #ffdde2; color: #8d2334; }
.camera-shell footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.camera-shell footer button { min-height: 48px; }

@media (max-width: 1100px) {
  #students.page.active { grid-template-columns: 1fr; }
  #titles .workflow { grid-template-columns: 1fr; }
  .key-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .top-exam-name { display: none; }
  .topbar { padding-inline: 24px; }
  .local-badge { display: none; }
  .package-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .dtm-main-names,.dtm-bank-grid { grid-template-columns:1fr; }
  .dtm-generation { align-items:flex-start; flex-direction:column; }
  #grading .action-panel { display: grid; grid-template-columns: minmax(0,1fr); }
  #grading .action-panel > div { flex: none; width: 100%; min-width: 0; }
  .readiness-strip { flex-wrap: wrap; }
  .sidebar { width: min(82vw, 320px); z-index: 20; box-shadow: 12px 0 38px #0a183538; }
  #menu-backdrop { position: fixed; inset: 0 0 0 min(82vw, 320px); z-index: 19; border: 0; background: #0b183899; }
  .menu-open { overflow: hidden; }
  .main-wrap { margin-left: 0; }
  .topbar { height: 62px; padding: 0 17px; }
  .top-exam-name { display: none; }
  main { padding: 22px 16px 75px; }
  .heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .heading h1 { font-size: 27px; }
  .heading .primary { align-self: flex-start; }
  .panel { padding: 17px; }
  .guide { padding: 20px; }
  .guide-intro { gap: 15px; }
  .guide-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .guide-step { min-height: 48px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics article { min-height: 78px; }
  .select-exam, .select-exam select { width: 100%; min-width: 0; }
  .exam-switch { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; align-items: end; }
  .exam-switch .new-exam { white-space: nowrap; }
  #students.page.active { gap: 12px; }
  .key-group-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .key-choice-grid { grid-template-columns: 1fr; }
  .key-choice { display: flex; align-items: center; gap: 12px; }
  .key-choice b { min-width: 59px; margin: 0; }
  .key-choice > div { flex: 1; }
  .key-choice button { min-height: 44px; }
  .written-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #written-dialog { padding: 18px; }
  .upload-grid { grid-template-columns: 1fr; }
  .panel-head [data-replace], .panel-head [data-remove] { min-height: 36px; }
  .action-panel .primary { width: 100%; }
  #notice { top: auto; bottom: 16px; right: 16px; left: 16px; max-width: none; }
  #activity-bar { top: 71px; right: 16px; left: 16px; }
  .result-toolbar input { min-width: 100%; }
  .result-empty { padding: 26px; }
  #students .table-scroll, #results .table-scroll { overflow: visible; max-height: none; }
  #students table, #results > .panel:not(#item-analysis) table { min-width: 0; }
  #students table thead, #results > .panel:not(#item-analysis) table thead { display: none; }
  #students tbody, #results > .panel:not(#item-analysis) tbody { display: grid; gap: 10px; }
  #students tbody tr, #results > .panel:not(#item-analysis) tbody tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px;
    padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff;
  }
  #students tbody td, #results > .panel:not(#item-analysis) tbody td { display: grid; gap: 2px; min-width: 0; padding: 4px; border: 0; text-align: left !important; }
  #students tbody td::before, #results > .panel:not(#item-analysis) tbody td::before { color: #52647d; font-size: 12px; font-weight: 750; text-transform: uppercase; }
  #students tbody td:nth-child(1)::before { content: '№'; }
  #students tbody td:nth-child(2)::before { content: 'O‘quvchi'; }
  #students tbody td:nth-child(3)::before { content: 'ID'; }
  #students tbody td:nth-child(4)::before { content: 'Holat'; }
  #results > .panel:not(#item-analysis) tbody td:nth-child(1)::before { content: 'ID'; }
  #results > .panel:not(#item-analysis) tbody td:nth-child(2)::before { content: 'O‘quvchi'; }
  #results > .panel:not(#item-analysis) tbody td:nth-child(3)::before { content: 'To‘g‘ri'; }
  #results > .panel:not(#item-analysis) tbody td:nth-child(4)::before { content: 'Test T'; }
  #results > .panel:not(#item-analysis) tbody td:nth-child(5)::before { content: 'Baho'; }
  #students tbody td[colspan], #results > .panel:not(#item-analysis) tbody td[colspan] { grid-column: 1 / -1; text-align: center !important; }
  #students tbody td[colspan]::before, #results > .panel:not(#item-analysis) tbody td[colspan]::before { content: none; }
  .auth-card { padding: 26px 22px; }
  .detail-metrics { grid-template-columns: repeat(2, 1fr); }
  .camera-scan-dialog { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
  .camera-shell { height: 100dvh; max-height: none; padding: 14px; }
  .camera-stage { min-height: 240px; }
  #camera-video { height: 100%; min-height: 300px; }
  .camera-guide { inset: 5% 10%; }
  .camera-status { align-items: flex-start; flex-direction: column; gap: 3px; }
  .camera-shell footer { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  .exam-switch { grid-template-columns: 1fr; }
  .exam-switch .new-exam { width: 100%; }
  .guide-step { padding: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
