/* =====================================================================
   Correction Devoirs — design system
   Tokens → base → shell → components → status indicators → A4 page → print
   ===================================================================== */

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-024F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 400; font-display: swap; src: url("../fonts/noto-sans-arabic-arabic-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 500; font-display: swap; src: url("../fonts/noto-sans-arabic-arabic-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 600; font-display: swap; src: url("../fonts/noto-sans-arabic-arabic-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Noto Sans Arabic"; font-weight: 700; font-display: swap; src: url("../fonts/noto-sans-arabic-arabic-700-normal.woff2") format("woff2"); }

:root {
  --font: "Inter", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f6;
  --border: #e3e6ee;
  --border-strong: #cfd4e0;
  --text: #1b1f2a;
  --text-muted: #646b7d;
  --text-subtle: #8a91a3;
  --primary: #2f55d4;
  --primary-hover: #2546b8;
  --primary-soft: #eaf0ff;
  --primary-text: #2346bd;
  --success: #12805c;
  --success-soft: #e6f6ef;
  --danger: #c92a2a;
  --danger-soft: #fdecec;
  --warning: #b45309;
  --warning-soft: #fff4e0;
  --info: #0e7490;
  --info-soft: #e5f6fa;
  --absent: #5b6274;
  --absent-soft: #eceef3;
  --pen: #e03131;           /* annotations to reproduce with the red pen */
  --correct: #16a34a;
  --incorrect: #dc2626;
  --sidebar-bg: #121826;
  --sidebar-text: #c9cfdc;
  --sidebar-muted: #7d8699;
  --sidebar-active: #1f2a40;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .08);
  --sidebar-w: 252px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-bs-theme="dark"] {
  --bg: #0f131c;
  --surface: #161b26;
  --surface-2: #1b2130;
  --surface-3: #232a3b;
  --border: #2a3245;
  --border-strong: #38425a;
  --text: #e7eaf2;
  --text-muted: #a1a9bb;
  --text-subtle: #7d8699;
  --primary: #6b8cff;
  --primary-hover: #8aa3ff;
  --primary-soft: #1d2747;
  --primary-text: #a9bcff;
  --success: #3ccf91;
  --success-soft: #11291f;
  --danger: #ff6b6b;
  --danger-soft: #331718;
  --warning: #f5b84a;
  --warning-soft: #33260f;
  --info: #4fc3dc;
  --info-soft: #0f2a31;
  --absent: #a1a9bb;
  --absent-soft: #232a3b;
  --sidebar-bg: #0b0f17;
  --sidebar-active: #18223a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
}

/* ------------------------------------------------------------ base */
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
.text-muted, .muted { color: var(--text-muted) !important; }
.text-subtle { color: var(--text-subtle); }
.small, small { font-size: .85rem; }
.xsmall { font-size: .76rem; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9em; }
.ar { font-family: "Noto Sans Arabic", var(--font); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; vertical-align: -2px; }
.icon-lg { width: 22px; height: 22px; }
.visually-hidden-focusable:not(:focus) { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 1030;
  width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; transition: width .2s var(--ease), transform .2s var(--ease);
}
.sidebar-brand { display: flex; align-items: center; gap: .65rem; height: var(--topbar-h); padding: 0 1.1rem; color: #fff; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #3f6bff, #2241b8); color: #fff; flex-shrink: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .6rem 1rem; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 1rem .7rem .35rem; white-space: nowrap; }
.nav-link-app {
  display: flex; align-items: center; gap: .75rem; padding: .52rem .7rem; border-radius: 8px;
  color: var(--sidebar-text); font-size: .9rem; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.nav-link-app:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav-link-app.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 #5b7cff; }
[dir="rtl"] .nav-link-app.active { box-shadow: inset -3px 0 0 #5b7cff; }
.nav-link-app .icon { width: 19px; height: 19px; opacity: .9; }
.sidebar-footer { padding: .75rem; border-top: 1px solid rgba(255, 255, 255, .06); font-size: .78rem; color: var(--sidebar-muted); white-space: nowrap; overflow: hidden; }
.app-main { flex: 1; margin-inline-start: var(--sidebar-w); min-width: 0; transition: margin .2s var(--ease); }
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-main { margin-inline-start: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .label, body.sidebar-collapsed .nav-section, body.sidebar-collapsed .sidebar-footer .label { display: none; }
body.sidebar-collapsed .nav-link-app { justify-content: center; padding: .6rem; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }

.topbar {
  position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title .crumb { font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .page { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-search { position: relative; flex: 0 1 320px; margin-inline-start: auto; }
.topbar-search input { padding-inline-start: 2.1rem; background: var(--surface-2); border-color: var(--border); height: 36px; }
.topbar-search .icon { position: absolute; inset-inline-start: .65rem; top: 9px; color: var(--text-subtle); }
.search-results { position: absolute; top: 42px; inset-inline: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 360px; overflow: auto; display: none; z-index: 30; }
.search-results.show { display: block; }
.search-results a { display: block; padding: .5rem .8rem; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:hover, .search-results a.active { background: var(--surface-2); }
.topbar-actions { display: flex; align-items: center; gap: .35rem; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--text-muted); position: relative; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; inset-inline-end: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: inline-grid; place-items: center; font-weight: 600; font-size: .8rem; }
.content { padding: 1.5rem; max-width: 1480px; }
.content-wide { max-width: none; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h1 { margin: 0; }
.page-header .subtitle { color: var(--text-muted); margin: .25rem 0 0; font-size: .92rem; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1025; }
  .app-main, body.sidebar-collapsed .app-main { margin-inline-start: 0; }
  .topbar { padding: 0 .9rem; }
  .topbar-search { display: none; }
  .content { padding: 1rem; }
  body.sidebar-collapsed .sidebar .label, body.sidebar-collapsed .nav-section { display: initial; }
}

/* ------------------------------------------------------------ components */
.card-app { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-app > .card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.card-app > .card-head h2, .card-app > .card-head h3 { font-size: .98rem; margin: 0; }
.card-app > .card-body-app { padding: 1.1rem; }
.card-app > .card-foot { padding: .75rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.stat-card { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .25rem; height: 100%; }
.stat-card .stat-label { font-size: .8rem; color: var(--text-muted); display: flex; align-items: center; gap: .4rem; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.stat-card .stat-hint { font-size: .78rem; color: var(--text-subtle); }
.stat-icon { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--primary-soft); color: var(--primary); }

.btn { font-weight: 500; border-radius: 8px; display: inline-flex; align-items: center; gap: .45rem; justify-content: center; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-active-bg: var(--primary-hover); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); }
.btn-soft { background: var(--primary-soft); color: var(--primary-text); border: 1px solid transparent; }
.btn-soft:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%); color: var(--primary-text); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border: 1px solid transparent; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-xs { padding: .15rem .45rem; font-size: .78rem; border-radius: 6px; }
.form-control, .form-select { border-color: var(--border-strong); border-radius: 8px; background-color: var(--surface); color: var(--text); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.form-label { font-weight: 500; font-size: .86rem; margin-bottom: .3rem; }
.form-text { color: var(--text-subtle); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; inset-inline-start: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-subtle); }
.input-icon .form-control { padding-inline-start: 2.2rem; }

.table-app { width: 100%; margin: 0; font-size: .9rem; border-collapse: separate; border-spacing: 0; }
.table-app th { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--surface-2); padding: .6rem .8rem; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table-app td { padding: .6rem .8rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-app tbody tr:hover td { background: var(--surface-2); }
.table-app tbody tr:last-child td { border-bottom: 0; }
.table-app .num { text-align: end; font-variant-numeric: tabular-nums; }
.table-scroll { overflow: auto; max-height: calc(100vh - 260px); }
.row-actions { display: flex; gap: .25rem; justify-content: flex-end; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .icon { width: 40px; height: 40px; color: var(--text-subtle); margin-bottom: .75rem; }
.empty-state h3 { font-size: 1rem; color: var(--text); }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar .form-control, .toolbar .form-select { width: auto; min-width: 160px; height: 36px; padding-top: .3rem; padding-bottom: .3rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 550; background: var(--surface-3); color: var(--text-muted); white-space: nowrap; line-height: 1.5; }
.kbd, kbd { font-family: var(--font); font-size: .72rem; font-weight: 600; padding: .1rem .38rem; border-radius: 5px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); border-bottom-width: 2px; }

.alert { border-radius: var(--radius); border: 1px solid transparent; font-size: .92rem; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }

.toast-stack { position: fixed; bottom: 1.25rem; inset-inline-end: 1.25rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; max-width: 380px; }
.toast-app { background: var(--text); color: var(--surface); padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow-md); font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; animation: toast-in .2s var(--ease); }
.toast-app.success { background: #0f5132; color: #fff; }
.toast-app.error { background: #842029; color: #fff; }
.toast-app.warning { background: #7a4b05; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.progress-thin { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-thin > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s var(--ease); }
.progress-thin.success > span { background: var(--success); }

.steps { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.step { display: flex; align-items: center; gap: .5rem; padding: .4rem .8rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: .85rem; font-weight: 500; }
.step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: .75rem; font-weight: 600; }
.step.active { border-color: var(--primary); color: var(--primary-text); background: var(--primary-soft); }
.step.active .n { background: var(--primary); color: #fff; }
.step.done { color: var(--success); }
.step.done .n { background: var(--success); color: #fff; }

.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 2.2rem 1rem; text-align: center; background: var(--surface-2); transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .icon { width: 34px; height: 34px; color: var(--primary); }

.modal-content { border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.modal-header, .modal-footer { border-color: var(--border); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .9rem; margin: 0; }
.dl-grid dt { color: var(--text-muted); font-weight: 500; }
.dl-grid dd { margin: 0; }

/* ------------------------------------------------------------ status indicators (consistent everywhere) */
.st { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.st .icon { width: 13px; height: 13px; }
.st-correct, .st-valid { background: var(--success-soft); color: var(--success); }
.st-incorrect, .st-invalid { background: var(--danger-soft); color: var(--danger); }
.st-absent { background: var(--absent-soft); color: var(--absent); letter-spacing: .03em; }
.st-review, .st-lowconf { background: var(--warning-soft); color: var(--warning); }
.st-pending { background: var(--surface-3); color: var(--text-muted); }
.st-progress { background: var(--info-soft); color: var(--info); }
.st-complete { background: var(--success-soft); color: var(--success); }
.st-unsaved { background: var(--warning-soft); color: var(--warning); }
.st-draft { background: var(--surface-3); color: var(--text-muted); }
.st-ready { background: var(--primary-soft); color: var(--primary-text); }
.st-default { background: var(--warning-soft); color: var(--warning); }
.st-pathway-valid { background: var(--success); color: #fff; }
.st-pathway-invalid { background: var(--danger); color: #fff; }
.vn { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; font-weight: 700; font-size: .85rem; }
.vn-v { background: var(--success-soft); color: var(--success); }
.vn-n { background: var(--danger-soft); color: var(--danger); }
.vn-p { background: var(--surface-3); color: var(--text-subtle); }
.dot-st { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--success); } .dot-ko { background: var(--danger); } .dot-warn { background: var(--warning); } .dot-off { background: var(--border-strong); }
.domain-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: 6px; font-size: .78rem; font-weight: 650; color: #fff; }
.cell-result { display: inline-flex; align-items: center; gap: .35rem; }
.cell-result .score { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ------------------------------------------------------------ A4 exam page (preview, editor, workspace) */
.a4-wrap { display: flex; justify-content: center; padding: 1rem; background: var(--surface-3); border-radius: var(--radius-lg); }
.a4 {
  --a4w: 794px; width: var(--a4w); min-height: calc(var(--a4w) * 1.4142); background: #fff; color: #111; position: relative;
  flex-shrink: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); padding: 46px 42px 40px; font-family: "Calibri", "Inter", "Noto Sans Arabic", sans-serif; font-size: 13px;
}
.a4 .a4-code { position: absolute; top: 18px; inset-inline-start: 120px; font-size: 10px; font-weight: 700; color: #333; }
.a4 .a4-pageno { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: 11px; color: #555; }
.a4-section { margin: 14px 0 6px; display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.a4-section .sec-domain, .a4-section .sec-path { border: 1px solid #555; background: #e7e7e7; text-align: center; font-weight: 700; padding: 3px 0; font-size: 13px; }
.a4-section .sec-path.p2 { background: #8c8c8c; color: #111; }
.a4-item { display: grid; grid-template-columns: 54px 54px 1fr; gap: 8px; margin: 18px 0 8px; position: relative; }
.a4-item.zones-right { grid-template-columns: 1fr 54px 54px; }
.a4-item.zones-right .z-vn { order: 3; }
.a4-item.zones-right .z-note { order: 2; }
.a4-item.zones-right .item-frame { order: 1; }
.a4-item .zone { border: 1.5px solid #333; min-height: 70px; display: flex; flex-direction: column; justify-content: space-around; align-items: center; font-weight: 800; color: var(--pen); font-size: 22px; font-family: "Comic Sans MS", "Segoe Print", cursive; }
.a4-item .zone .zone-head { position: absolute; top: -22px; font-size: 11px; font-weight: 700; color: #222; font-family: "Calibri", "Inter", sans-serif; border: 1px solid #555; padding: 1px 8px; background: #f2f2f2; }
.a4-item .item-frame { border: 1.5px solid #333; padding: 8px 12px 10px; position: relative; min-height: 70px; }
.a4-item .item-tag { position: absolute; top: -21px; inset-inline-end: 0; border: 1px solid #333; border-bottom: 0; border-radius: 4px 4px 0 0; background: #e4e4e4; font-weight: 700; font-size: 11.5px; padding: 1px 12px; }
.a4-item.zones-right .item-tag { inset-inline-end: auto; inset-inline-start: 0; }
.a4-q { margin: 2px 0 6px; }
.a4-q .q-text { font-size: 13px; margin-bottom: 3px; }
.a4-q .q-text b { margin-inline-end: 4px; }
.a4-q .q-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }
.a4-q .q-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12.5px; }
.cb { width: 17px; height: 17px; border: 1.6px solid #222; background: #fff; display: inline-block; position: relative; cursor: default; border-radius: 1px; }
.cb.marked::before, .cb.marked::after { content: ""; position: absolute; left: 50%; top: 50%; width: 140%; height: 1.6px; background: #1d3a8a; }
.cb.marked::before { transform: translate(-50%, -50%) rotate(45deg); }
.cb.marked::after { transform: translate(-50%, -50%) rotate(-45deg); }
.cb.ok { box-shadow: 0 0 0 2.5px var(--correct); }
.cb.ko { box-shadow: 0 0 0 2.5px var(--incorrect); }
.cb.expected { box-shadow: 0 0 0 2.5px var(--correct); outline: 2px dashed var(--correct); outline-offset: 2px; }
.cb.key { background: color-mix(in srgb, var(--correct) 25%, #fff); }
.cb.clickable { cursor: pointer; }
.cb.clickable:hover { background: #eef3ff; }
.a4-footer-note { margin-top: 18px; font-style: italic; font-size: 12px; color: #444; }
.a4-cover { text-align: center; padding-top: 60px; color: #333; }
.a4-cover .cover-title { display: inline-block; background: #6b6b6b; color: #fff; padding: 18px 46px; border-radius: 18px; font-size: 26px; font-weight: 700; }
.a4-cover table { margin: 34px auto 0; border-collapse: collapse; width: 82%; font-size: 14px; }
.a4-cover th, .a4-cover td { border: 1px solid #fff; padding: 7px 12px; background: #e4e4e4; text-align: start; }
.a4-cover tr.p-row td { background: #6b6b6b; color: #fff; font-weight: 600; }
.a4-scaler { transform-origin: top center; }

/* ------------------------------------------------------------ page editor */
.editor-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.editor-pages { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.page-thumb { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); margin-bottom: .45rem; cursor: pointer; font-size: .88rem; }
.page-thumb.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.page-thumb .pn { width: 28px; height: 36px; border: 1px solid var(--border-strong); border-radius: 3px; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: #fff; color: #333; }
.editor-inspector { position: sticky; top: calc(var(--topbar-h) + 1rem); max-height: calc(100vh - var(--topbar-h) - 2rem); overflow: auto; }
.a4 .selectable { cursor: pointer; transition: box-shadow .12s; }
.a4 .selectable:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }
.a4 .selected { box-shadow: 0 0 0 3px var(--primary) !important; }
.answer-toggle { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 650; cursor: pointer; color: var(--text-muted); transition: all .12s; }
.answer-toggle:hover { border-color: var(--primary); color: var(--primary); }
.answer-toggle.on { background: var(--success); border-color: var(--success); color: #fff; }
.answer-toggle.detected { box-shadow: 0 0 0 2px var(--info); }
@media (max-width: 1199.98px) { .editor-grid { grid-template-columns: 1fr; } .editor-pages, .editor-inspector { position: static; max-height: none; } }

/* ------------------------------------------------------------ correction workspace */
.ws { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1rem; align-items: start; }
.ws-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; padding: .8rem 1rem; }
.ws-student { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.ws-student .num-badge { min-width: 42px; height: 42px; border-radius: 11px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; }
.ws-student .name { font-size: 1.15rem; font-weight: 650; line-height: 1.2; }
.ws-stage { position: relative; background: #2a2f3a; border-radius: var(--radius-lg); overflow: hidden; min-height: 70vh; display: flex; align-items: center; justify-content: center; touch-action: none; }
.ws-stage .stage-inner { position: relative; transform-origin: 0 0; }
.ws-stage img, .ws-stage video { display: block; max-width: none; user-select: none; -webkit-user-drag: none; }
.ws-stage .stage-msg { color: #cfd5e2; text-align: center; padding: 2rem; max-width: 460px; }
.ws-stage .stage-msg .icon { width: 42px; height: 42px; opacity: .7; margin-bottom: .6rem; }
.ws-stage .stage-tools { position: absolute; top: .7rem; inset-inline-end: .7rem; display: flex; gap: .35rem; z-index: 5; }
.ws-stage .stage-tools .icon-btn { background: rgba(15, 18, 25, .7); color: #e8ecf5; border-color: rgba(255, 255, 255, .1); }
.ws-stage .stage-tools .icon-btn:hover { background: rgba(15, 18, 25, .9); }
.ws-stage .stage-badge { position: absolute; top: .7rem; inset-inline-start: .7rem; z-index: 5; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay .ov-box { position: absolute; border: 2.5px solid transparent; border-radius: 2px; pointer-events: auto; cursor: pointer; }
.overlay .ov-box.sel-ok { border-color: var(--correct); background: rgba(22, 163, 74, .12); }
.overlay .ov-box.sel-ko { border-color: var(--incorrect); background: rgba(220, 38, 38, .12); }
.overlay .ov-box.missed { border: 2.5px dashed var(--correct); }
.overlay .ov-box.lowconf { outline: 2px solid #f59f00; outline-offset: 3px; }
.overlay .ov-box.neutral { border-color: rgba(120, 140, 170, .55); }
.overlay .ov-frame { position: absolute; border: 2px solid rgba(250, 204, 21, .85); border-radius: 3px; }
.overlay .ov-frame.estimated { border-style: dashed; }
.overlay .ov-tag { position: absolute; transform: translateY(-100%); background: #facc15; color: #111; font-weight: 700; font-size: 11px; padding: 0 6px; border-radius: 4px 4px 0 0; white-space: nowrap; }
.overlay .ov-zone { position: absolute; display: flex; flex-direction: column; justify-content: space-around; align-items: center; color: var(--pen); font-weight: 800; font-family: "Comic Sans MS", "Segoe Print", cursive; text-shadow: 0 0 3px #fff, 0 0 6px #fff; }
body.hide-overlay .overlay { display: none; }
.ws-panel { position: sticky; top: calc(var(--topbar-h) + 1rem); max-height: calc(100vh - var(--topbar-h) - 2rem); display: flex; flex-direction: column; }
.ws-panel .panel-scroll { overflow: auto; flex: 1; }
.q-card { border: 1px solid var(--border); border-radius: 10px; padding: .45rem .6rem; margin-bottom: .4rem; background: var(--surface); }
.q-card.needs-review { border-color: color-mix(in srgb, var(--warning) 55%, transparent); background: color-mix(in srgb, var(--warning-soft) 60%, var(--surface)); }
.q-card.active { box-shadow: 0 0 0 2px var(--primary); }
.q-row { display: flex; align-items: center; gap: .5rem; }
.q-row .q-label { font-weight: 650; min-width: 64px; }
.q-boxes { display: flex; gap: .35rem; }
.q-boxes .answer-toggle { width: 34px; height: 34px; font-size: .85rem; }
.answer-toggle.sel-ok { background: var(--success); border-color: var(--success); color: #fff; }
.answer-toggle.sel-ko { background: var(--danger); border-color: var(--danger); color: #fff; }
.answer-toggle.missed { border-style: dashed; border-color: var(--success); color: var(--success); }
.q-meta { display: flex; flex-wrap: wrap; gap: .2rem .6rem; font-size: .74rem; color: var(--text-muted); margin-top: .25rem; }
.item-head { display: flex; align-items: center; justify-content: space-between; margin: .6rem 0 .3rem; }
.item-head .code { font-weight: 700; }
.pen-annot { color: var(--pen); font-weight: 800; font-family: "Comic Sans MS", "Segoe Print", cursive; font-size: 1.1rem; }
.ws-actions { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.ws-actions .btn { flex: 1; }
.conn { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 550; }
.conn .dot-st { width: 9px; height: 9px; }
.page-dots { display: flex; gap: .3rem; align-items: center; }
.page-dots button { min-width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.page-dots button.saved { background: var(--success-soft); color: var(--success); border-color: transparent; }
.page-dots button.current { border-color: var(--primary); color: var(--primary-text); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.page-dots button.cover { opacity: .5; }
.page-dots button.ps-auto { background: var(--info-soft); color: var(--info); border-color: transparent; }
.page-dots button.ps-review, .page-dots button.ps-manual { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.page-dots button.ps-err { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.page-dots button.ps-proc { background: var(--info-soft); color: var(--info); border-style: dashed; border-color: var(--info); animation: pulse-soft 1.2s ease-in-out infinite; }
.page-dots button.current { border-color: var(--primary); border-style: solid; }
/* mode switch + « copie complète » bar */
.mode-switch { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 2px; gap: 2px; }
.mode-switch button { border: 0; background: transparent; border-radius: 7px; padding: .3rem .6rem; font-size: .78rem; font-weight: 600; color: var(--text-muted); display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.mode-switch button.active { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08)); }
.mode-switch button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.batch-bar { display: flex; align-items: center; gap: .75rem 1rem; padding: .6rem .9rem; flex-wrap: wrap; }
.bb-target { display: flex; align-items: center; gap: .45rem; flex: 0 1 auto; max-width: 420px; font-size: .88rem; flex-wrap: wrap; }
.bb-big { font-size: 1.05rem; color: var(--primary-text); }
.bb-pages { display: flex; gap: .4rem; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.bb-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 92px; padding: .3rem .55rem; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); text-align: start; line-height: 1.15; }
.bb-chip .bb-no { font-weight: 700; font-size: .8rem; }
.bb-chip .bb-st { font-size: .7rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: .2rem; white-space: nowrap; }
.bb-chip .icon { width: 12px; height: 12px; }
.bb-chip.current { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent); }
.bb-chip.target { border-style: dashed; border-color: var(--primary); }
.bb-chip.ps-done { background: var(--success-soft); } .bb-chip.ps-done .bb-st { color: var(--success); }
.bb-chip.ps-auto { background: var(--info-soft); } .bb-chip.ps-auto .bb-st { color: var(--info); }
.bb-chip.ps-proc .bb-st { color: var(--info); }
.bb-chip.ps-review, .bb-chip.ps-manual { background: var(--warning-soft); } .bb-chip.ps-review .bb-st, .bb-chip.ps-manual .bb-st { color: var(--warning); }
.bb-chip.ps-err { background: var(--danger-soft); } .bb-chip.ps-err .bb-st { color: var(--danger); }
.bb-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-inline-start: auto; }
.st-auto { background: var(--info-soft); color: var(--info); }
.batch-only { display: none; }
body.mode-batch .batch-only { display: inline; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-soft { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .spin, .page-dots button.ps-proc { animation: none; } }
.shortcuts { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .76rem; color: var(--text-muted); }
.student-list { max-height: 50vh; overflow: auto; }
.student-list a { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border-radius: 7px; color: var(--text); font-size: .86rem; }
.student-list a:hover { background: var(--surface-3); }
.student-list a.current { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
@media (max-width: 1199.98px) { .ws { grid-template-columns: 1fr; } .ws-panel { position: static; max-height: none; } }

/* ------------------------------------------------------------ phone scanner */
.scanner-body { background: #0b0d12; color: #e8ecf5; min-height: 100vh; margin: 0; overflow: hidden; }
.scanner { position: fixed; inset: 0; display: flex; flex-direction: column; }
.scanner-top { padding: .6rem .8rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: rgba(0, 0, 0, .55); position: relative; z-index: 3; font-size: .85rem; }
.scanner-view { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #000; }
.scanner-view video, .scanner-view img.frozen { max-width: 100%; max-height: 100%; object-fit: contain; }
.scanner-view canvas.guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scanner-bottom { padding: .8rem 1rem calc(1rem + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-around; background: rgba(0, 0, 0, .65); position: relative; z-index: 3; }
.shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: rgba(255, 255, 255, .15); display: grid; place-items: center; }
.shutter:active { transform: scale(.95); }
.shutter span { width: 54px; height: 54px; border-radius: 50%; background: #fff; display: block; }
.scan-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; }
.scan-btn.on { background: #facc15; color: #111; }
.scan-status { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .75); padding: .45rem .9rem; border-radius: 14px; font-size: .85rem; z-index: 4; max-width: 92%; text-align: center; }

/* ------------------------------------------------------------ auth pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: radial-gradient(1200px 600px at -10% -10%, #3557d6 0%, #1a2a6c 45%, #101727 100%); color: #e7ecff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { color: #fff; font-size: 2rem; line-height: 1.2; max-width: 460px; }
.auth-side .feat { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: 1rem; color: #c8d3ff; max-width: 440px; }
.auth-side .feat .icon { color: #9fb4ff; margin-top: 2px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ------------------------------------------------------------ print */
@page { size: A4 portrait; margin: 12mm; }
@media print {
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .toast-stack, .page-header .btn, .stage-tools { display: none !important; }
  .app-main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .card-app { border: 0; box-shadow: none; }
  .a4-wrap { padding: 0; background: #fff; display: block; }
  .a4 { box-shadow: none; width: auto; min-height: 0; padding: 0; page-break-after: always; break-after: page; }
  .a4:last-child { page-break-after: auto; }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; break-inside: avoid; }
  .table-scroll { max-height: none; overflow: visible; }
  .print-break { page-break-before: always; }
}

/* ------------------------------------------------------------ phone scanner — « copie complète » */
.batch-label { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4; text-align: center; background: rgba(10, 12, 18, .78); border-radius: 14px; padding: .35rem 1.1rem .45rem; pointer-events: none; min-width: 150px; }
.batch-label .bl-mode { font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: #8fd3e3; font-weight: 700; }
.batch-label .bl-page { font-size: 2.1rem; font-weight: 800; line-height: 1.05; color: #fff; }
.batch-label .bl-sub { font-size: .75rem; color: #c9d1e2; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 5; }
.batch-flash.on { animation: shot .35s ease-out; }
@keyframes shot { 0% { opacity: .85; } 100% { opacity: 0; } }
.bl-thumb { position: absolute; left: 10px; bottom: 10px; z-index: 5; width: 74px; border-radius: 8px; overflow: hidden; border: 2px solid #22c55e; background: #000; transition: opacity .4s; }
.bl-thumb img { width: 100%; display: block; }
.bl-thumb span { position: absolute; inset: auto 0 0 0; background: rgba(34, 197, 94, .9); color: #04210f; font-size: .7rem; font-weight: 800; text-align: center; }
.batch-done { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: rgba(8, 10, 15, .86); padding: 1.5rem; }
.batch-done .bd-icon .icon { width: 56px; height: 56px; color: #22c55e; }
.batch-chips { display: flex; gap: .4rem; overflow-x: auto; padding: .45rem .7rem; background: rgba(0, 0, 0, .7); position: relative; z-index: 6; }
.batch-chips button { flex: 0 0 auto; border: 1px solid #3a4256; background: #161a24; color: #c9d1e2; border-radius: 9px; padding: .35rem .7rem; font-size: .8rem; font-weight: 700; }
.batch-chips button.captured { border-color: #1f8a4c; background: #0f2a1a; color: #7ee2a8; }
.batch-chips button.current { border-color: #fff; color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.sc-modes { display: flex; background: #161a24; border-radius: 9px; padding: 2px; }
.sc-modes button { flex: 1; border: 0; background: transparent; color: #aab3c5; border-radius: 7px; padding: .4rem; font-size: .8rem; font-weight: 600; }
.sc-modes button.active { background: #fff; color: #111; }

/* ------------------------------------------------------------ mandatory check of uncertain answers */
.q-card.needs-review { border: 1.5px solid var(--warning); border-inline-start-width: 5px; background: color-mix(in srgb, var(--warning-soft) 75%, var(--surface)); }
.q-card.reviewed { border-inline-start: 4px solid var(--success); }
.must-check { display: flex; align-items: center; gap: .4rem; font-size: .74rem; color: var(--warning); margin: -.05rem 0 .25rem; min-width: 0; }
.must-check .icon { flex: none; }
.must-check strong { text-transform: uppercase; letter-spacing: .03em; font-size: .72rem; flex: none; }
.must-check .why { color: var(--text-muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.must-check .btn { flex: none; }
.must-check .btn { font-weight: 700; }
.st-must { background: var(--warning); color: #fff; font-weight: 700; }
[data-bs-theme="dark"] .st-must { color: #1b1204; }
.q-card.flash { animation: must-flash 1s ease-out 2; }
@keyframes must-flash { 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 55%, transparent); } }
#btnSave.btn-warning { color: #fff; }
[data-bs-theme="dark"] #btnSave.btn-warning { color: #1b1204; }
.live-media { max-height: 72vh; max-width: 100%; }

/* ------------------------------------------------------------ full-screen correction (F) */
.ws-rail { display: none; }
body.ws-full .sidebar, body.ws-full .topbar, body.ws-full .sidebar-backdrop, body.ws-full .batch-bar, body.ws-full .shortcuts { display: none !important; }
body.ws-full .app-main { margin-inline-start: 0; }
body.ws-full .content { padding: .5rem .6rem; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
body.ws-full .ws-head { flex: none; padding: .35rem .7rem; margin-bottom: .5rem !important; gap: .4rem .9rem; }
body.ws-full .ws-student .num-badge { min-width: 34px; height: 34px; font-size: .95rem; }
body.ws-full .ws-student .name { font-size: 1rem; }
body.ws-full #saveError { flex: none; }
body.ws-full .ws-head [title="Progression de la classe"] { width: 110px !important; }
body.ws-full .ws-head [title="Progression de la classe"] .xsmall span:first-child { display: none; }
body.ws-full #btnPair > span { display: none; }
body.ws-full .ws { flex: 1; min-height: 0; grid-template-columns: 136px minmax(0, 1fr) minmax(380px, 30vw); gap: .5rem; align-items: stretch; }
body.ws-full .ws-main { display: flex; flex-direction: column; min-height: 0; }
body.ws-full .ws-main > .d-flex { margin-top: .25rem !important; flex: none; }
body.ws-full .ws-stage { flex: 1; min-height: 0; border-radius: 10px; }
body.ws-full .live-media { max-height: calc(100vh - 110px); }
body.ws-full .ws-panel { position: static; max-height: none; min-height: 0; height: 100%; }
body.ws-full .ws-panel .card-head { padding: .45rem .75rem; }
body.ws-full .ws-panel .card-head h2 { font-size: .95rem; }
body.ws-full .ws-actions { padding: .45rem .6rem; }
body.ws-full .q-card { padding: .3rem .5rem; margin-bottom: .28rem; }
body.ws-full .q-meta { margin-top: .12rem; font-size: .7rem; }
body.ws-full .item-head { margin: .4rem 0 .18rem; }
body.ws-full .q-boxes .answer-toggle { width: 30px; height: 30px; }
body.ws-full .q-row .q-label { min-width: 52px; }
body.ws-full .panel-scroll > .d-flex.mt-3 { margin-top: .5rem !important; }
body.ws-full .ws-rail { display: flex; flex-direction: column; gap: .4rem; overflow-y: auto; min-height: 0; padding: .1rem .15rem .4rem; }
.rail-head { font-size: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .45rem; line-height: 1.25; }
.rail-head .icon { width: 13px; height: 13px; }
.rail-page { display: flex; flex-direction: column; align-items: stretch; gap: .2rem; padding: .3rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); text-align: start; }
.rail-page:hover { border-color: var(--primary); }
.rail-page.current { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.rail-page.target { border-style: dashed; border-color: var(--primary); }
.rail-thumb { position: relative; display: block; aspect-ratio: 1 / 1.414; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.rail-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rail-ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; color: var(--text-subtle); }
.rail-count { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--warning); color: #fff; font-size: .75rem; font-weight: 800; display: grid; place-items: center; }
.rail-label { display: flex; flex-direction: column; font-size: .78rem; line-height: 1.15; }
.rail-label small { font-size: .68rem; color: var(--text-muted); }
.rail-page.ps-done .rail-label small { color: var(--success); }
.rail-page.ps-auto .rail-label small, .rail-page.ps-proc .rail-label small { color: var(--info); }
.rail-page.ps-review, .rail-page.ps-manual { border-color: color-mix(in srgb, var(--warning) 60%, transparent); }
.rail-page.ps-review .rail-label small, .rail-page.ps-manual .rail-label small { color: var(--warning); font-weight: 600; }
.rail-page.ps-err .rail-label small { color: var(--danger); }
@media (max-width: 1100px) { body.ws-full .ws { grid-template-columns: 96px minmax(0, 1fr) 340px; } }
@media (prefers-reduced-motion: reduce) { .q-card.flash { animation: none; } }
.ws-stage .stage-tools .icon-btn.active { background: #facc15; color: #111; border-color: #facc15; }
