/* Teacher roll workspace; all positioning comes from confirmed source coordinates. */
@page roll-seats { size:A4 portrait; margin:10mm; }
@media print {
  #print-area .blank-seat-page { page:roll-seats; color:#17263c; }
  #print-area .blank-print-header { display:flex; align-items:center; gap:3mm; padding-bottom:3mm; border-bottom:1.5px solid #304361; }
  #print-area .blank-print-header img { width:10mm; height:10mm; object-fit:contain; }
  #print-area .blank-print-header strong { font-size:9pt; }
  #print-area .blank-print-header h1 { margin:1mm 0 0; font-size:15pt; line-height:1.35; text-align:left; }
  #print-area .blank-print-header>span { margin-left:auto; font-size:9pt; }
  #print-area .blank-print-meta { display:flex; flex-wrap:wrap; justify-content:space-between; gap:1mm 4mm; margin-top:3mm; font-size:9pt; line-height:1.5; }
  #print-area .blank-print-scope { margin:1mm 0 2mm; font-size:9pt; line-height:1.5; }
  #print-area .blank-print-podium { padding:1mm; margin:1mm 0; text-align:center; border:1px solid #778399; background:#eef1f5; font-size:9pt; font-weight:700; }
  #print-area .blank-print-columns { display:grid; grid-template-columns:repeat(var(--print-columns),minmax(0,1fr)); gap:.6mm; font-size:8pt; text-align:center; margin:1mm 0; }
  #print-area .blank-print-grid { display:grid; grid-template-columns:repeat(var(--print-columns),minmax(0,1fr)); gap:.6mm; }
  #print-area .blank-print-seat { min-width:0; min-height:23mm; border:1px solid #768397; border-radius:1mm; padding:1.4mm 1mm; break-inside:avoid; overflow-wrap:anywhere; }
  #print-area .blank-seat-top { display:flex; flex-direction:column; align-items:center; gap:1mm; font-size:8pt; line-height:1.2; }
  #print-area .blank-seat-top strong { font-size:10pt; }
  #print-area .blank-seat-person { display:flex; flex-direction:column; align-items:center; gap:1.4mm; margin-top:1.6mm; line-height:1.2; }
  #print-area .blank-seat-person b { font-size:10pt; }
  #print-area .blank-seat-checks { white-space:nowrap; font-size:6.5pt; color:#111; }
  #print-area .blank-seat-exception { font-size:8pt; font-weight:650; text-align:center; line-height:1.3; }
  #print-area .blank-seat-empty { font-size:8pt; color:#697585; }
  #print-area .blank-print-seat.excused { border:1.3px solid #597593; background:#f0f5fa; }
  #print-area .blank-print-seat.off { background:#e2e4e8; border-color:#424b59; }
  #print-area .blank-print-seat.empty { border:1px dashed #b8bfc9; }
  #print-area .blank-print-grid.is-hall .blank-print-seat { min-height:9mm; padding:.5mm 1.4mm; }
  #print-area .is-hall .blank-seat-top { flex-direction:row; justify-content:space-between; gap:1mm; font-size:8pt; line-height:1.1; }
  #print-area .is-hall .blank-seat-top strong { font-size:9pt; }
  #print-area .is-hall .blank-seat-person { flex-direction:row; justify-content:space-between; gap:1mm; margin-top:.4mm; line-height:1.1; }
  #print-area .is-hall .blank-seat-person b { font-size:9pt; flex-shrink:0; }
  #print-area .is-hall .blank-seat-exception { font-size:7.5pt; }
  #print-area .blank-print-key { margin:2mm 0 0; font-size:8pt; line-height:1.4; }
  #print-area .blank-seat-page .print-sign { margin-top:3mm; font-size:9pt; }
}
.roll-query-compact { display:none; padding:14px 20px; align-items:center; justify-content:space-between; gap:12px; font-weight:650; }
.roll-query-card.is-loaded .roll-query-compact { display:flex; }
.roll-query-card.is-loaded #room-query { display:none; }
#main:has(.roll-workspace) > .page-head { margin-bottom:14px; }
#main:has(.roll-workspace) > .page-head .page-description,
#main:has(.roll-workspace) > .page-head .page-eyebrow { display:none; }
.roll-workspace { scroll-margin-top:20px; overflow:hidden; }
.roll-workspace [hidden],.roll-group [hidden],.roll-query-card [hidden] { display:none !important; }
.roll-workspace-head { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:22px 24px 16px; }
.roll-workspace-head h2 { margin:4px 0 0; font-size:28px; line-height:1.15; letter-spacing:.02em; }
.roll-scope-line { display:flex; flex-wrap:wrap; gap:3px 9px; font-size:12px; color:#586978; letter-spacing:normal; line-height:1.45; }
.roll-scope-line span { white-space:nowrap; }
.roll-view-controls { display:flex; gap:5px; padding:4px; border:1px solid #dce5ea; border-radius:12px; background:#f4f7f9; }
.roll-view-controls .btn { border:0; min-height:40px; padding:8px 14px; font-size:13px; border-radius:9px; box-shadow:none; }
.roll-view-controls .btn:not(.primary) { background:transparent; }
.roll-metrics { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; padding:0 24px; }
.roll-metric { display:grid; grid-template-columns:28px 1fr; align-items:center; gap:3px 8px; min-height:84px; padding:11px 12px; border:1px solid #dce5ea; border-radius:12px; background:#fff; color:#334a5d; }
.roll-metric-symbol { display:grid; place-items:center; width:26px; height:26px; border-radius:50%; border:1px solid currentColor; font-weight:800; grid-row:1/3; }
.roll-metric > span:not(.roll-metric-symbol) { font-size:11px; line-height:1.4; font-weight:650; }
.roll-metric > strong { font-size:26px; line-height:1.1; font-variant-numeric:tabular-nums; }
.roll-metric.metric-present { background:#eaf6ee; border-color:#bbdec7; color:#14683d; }
.roll-metric.metric-face_only { background:#edf4ff; border-color:#c8dcf5; color:#245d97; }
.roll-metric.metric-manual_not_entered { background:#fff0f0; border-color:#edc3c8; color:#a2283c; }
.roll-metric.metric-leave { background:#eef0f3; color:#596472; }
.roll-metric.metric-grade_off { background:#303944; border-color:#303944; color:#fff; }
.roll-stat-note { padding:9px 24px 14px; font-size:11px; color:#657486; }
.roll-map-tools { display:flex; align-items:end; justify-content:space-between; gap:12px; padding:0 24px 12px; }
.roll-map-tools .field { max-width:220px; min-width:165px; margin:0; }
.roll-map-tools .field > span { font-size:11px; }
.roll-map-tools select { min-height:36px; padding:6px 10px; font-size:12px; }
.roll-map-tools .btn { font-size:12px; min-height:36px; padding:6px 11px; }
.roll-map-guide { padding:10px 24px; border-top:1px solid #e6ecef; display:flex; align-items:center; justify-content:space-between; gap:10px; color:#687986; font-size:11px; }
.roll-map-guide > span:first-child { display:flex; align-items:center; gap:6px; }
.roll-map-guide svg { width:15px; height:15px; flex:none; }
.roll-seat-viewport { max-height:min(70svh,730px); padding:16px 20px 10px; background:#f4f7f9; border-block:1px solid #e1e9ee; }
.roll-seat-canvas { align-items:center; gap:12px; }
.roll-seat-grid { display:grid; gap:3px; align-self:center; padding:2px; }
.roll-seat-position { min-width:0; min-height:0; }
button.roll-seat { width:100%; height:100%; padding:3px; position:relative; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; border:1px solid #bac8d2; border-radius:5px; background:#fff; color:#263f52; box-shadow:0 1px 2px #29425410; cursor:pointer; line-height:1.12; font-family:inherit; touch-action:inherit; overflow:hidden; }
button.roll-seat:hover:not(:disabled) { box-shadow:0 0 0 2px #486f86; z-index:2; }
button.roll-seat:focus-visible { outline:3px solid #b87110; outline-offset:2px; z-index:3; }
.roll-seat .roll-seat-number { font-size:10px; font-weight:600; letter-spacing:-.025em; }
.roll-seat > strong { font-size:11px; font-weight:750; white-space:nowrap; }
.roll-seat .roll-seat-name { font-size:11px; font-weight:500; white-space:nowrap; max-width:100%; overflow:hidden; text-overflow:ellipsis; }
.roll-seat .roll-seat-symbol { font-weight:800; position:absolute; top:2px; right:3px; font-size:10px; }
button.roll-seat-present { background:#d8f2e0; color:#185c35; border-color:#7bbf93; }
button.roll-seat-face_only { background:#ddeaff; color:#174d88; border-color:#97bcea; }
button.roll-seat-leave { background:#dfe4e9; color:#596474; border-color:#bdc7cf; }
button.roll-seat-grade_off { background:#343d49; border-color:#252e39; color:#fff; }
button.roll-seat-marked { background:#fbe0e3; border:2px solid #be364e; color:#9a1f34; }
button.roll-seat-empty,button.roll-seat-disabled { background:#eaf0f3; border-style:dashed; color:#98a5af; box-shadow:none; cursor:default; }
button.roll-seat-disabled { background:repeating-linear-gradient(135deg,#e2e7eb 0,#e2e7eb 4px,#eff2f5 4px,#eff2f5 8px); }
.roll-seat-readonly:not(.roll-seat-empty):not(.roll-seat-disabled) { cursor:help; }
.roll-seat-grid.compact button.roll-seat { padding:0; border-radius:2px; }
.roll-seat-grid.compact .roll-seat-number { font-size:clamp(6px,calc(var(--roll-seat-size)*.38),10px); }
.roll-seat-grid.compact .roll-seat-name,.roll-seat-grid.compact strong,.roll-seat-grid.compact .roll-seat-symbol,.roll-seat-grid.compact .roll-seat-many { display:none; }
.roll-seat-grid.compact .roll-seat-marked .roll-seat-number::before { content:"!"; font-weight:900; margin-right:1px; }
.roll-seat-many { font-size:9px; }
.roll-unmapped { padding:15px 24px; }
.roll-unmapped > summary { font-size:13px; font-weight:650; }
.roll-unmapped-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(70px,1fr)); gap:6px; padding-top:10px; }
.roll-unmapped-grid .roll-seat { height:76px; }
.roll-person-choices { display:grid; gap:9px; margin-block:14px; }
.roll-list-filters { padding:16px 24px; border-top:1px solid #e5ecef; }
.roll-group-map .roll-header { padding-block:15px; }
.roll-group .roll-reference { font-size:11px; line-height:1.6; color:#657486; margin-top:8px; }
.roll-group .roll-reference summary { cursor:pointer; }
.roll-group .roll-header h2 { display:flex; gap:7px; flex-wrap:wrap; align-items:center; font-size:18px; }
.roll-group .roll-toolbar { flex-direction:column; align-items:stretch; gap:14px; }
.roll-bulk-actions { display:flex; align-items:center; flex-wrap:wrap; gap:9px; }
.roll-bulk-actions .btn { min-height:43px; padding:10px 16px; font-size:14px; border-width:1px; font-weight:700; }
.roll-confirm-present { background:#187449 !important; color:#fff !important; border-color:#187449 !important; }
.roll-confirm-absent { background:#ac3048 !important; color:#fff !important; border-color:#ac3048 !important; }
.roll-select-all { background:#fff !important; border-color:#899cab !important; }
.roll-selected-count { font-size:12px; color:#637587; margin-left:4px; }
#roll-selection-tools { padding:0 24px 14px; }
.roll-selection-heading { display:flex; align-items:center; flex-wrap:wrap; gap:10px 16px; }
.roll-selection-count { font-size:15px; color:#52677a; }
.roll-selection-count strong { font-size:20px; color:#223b59; font-variant-numeric:tabular-nums; }
.roll-selection-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.roll-workspace :is(.roll-selection-heading,.roll-selection-actions) .btn { min-height:44px; font-size:16px; font-weight:700; padding:8px 14px; }
.roll-workspace .roll-selection-actions .btn:disabled { opacity:.42; cursor:not-allowed; }
body #app .roll-seat.roll-seat-selected { outline:3px solid #c77d0b; outline-offset:-3px; box-shadow:inset 0 0 0 5px #fff; z-index:1; }
.roll-seat-selection-mark { position:absolute; top:2px; left:2px; display:grid; place-items:center; width:16px; height:16px; border-radius:4px; background:#8c5200; color:#fff; font-size:12px; font-weight:900; line-height:1; }
.roll-seat-grid.compact .roll-seat-selection-mark { top:1px; left:1px; width:8px; height:8px; font-size:7px; border-radius:1px; }
@media(max-width:620px) {
  #roll-selection-tools { padding:0 12px 12px; }
  .roll-selection-heading { gap:8px 12px; }
  .roll-selection-count { font-size:13px; }
  .roll-selection-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .roll-workspace .roll-selection-actions .btn { padding:8px 5px; font-size:14px; }
}
@media print { #roll-selection-tools { display:none; } }
.roll-list-table input[type="checkbox"] { width:19px; height:19px; accent-color:#197349; }
.roll-group .roll-footer { border-top:1px solid #e1e8ed; }
.roll-group .roll-footer .actions { flex-wrap:wrap; }
.roll-group .row-status-manual-not-entered { background:#fff1f2; }
@media(max-width:1050px) {
  .roll-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .roll-metric { min-height:64px; }
  .roll-metric > strong { font-size:24px; }
}
@media(max-width:620px) {
  #main:has(.roll-workspace) > .page-head { display:block; margin-bottom:12px; padding:0; border:0; }
  #main:has(.roll-workspace) > .page-head::after { display:none; }
  #main:has(.roll-workspace) > .page-head>div:first-child { display:none; }
  #main:has(.roll-workspace) > .page-head>.actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  #main:has(.roll-workspace) > .page-head .btn { min-height:44px; margin:0; font-size:14px; padding:10px 8px; }
  .roll-query-compact { padding:10px 12px; font-size:12px; }
  .roll-workspace { scroll-margin-top:8px; }
  .roll-workspace-head { padding:14px 12px 12px; gap:8px; }
  .roll-workspace-head h2 { font-size:23px; }
  .roll-scope-line { font-size:10px; gap:2px 6px; }
  .roll-view-controls { gap:2px; padding:3px; }
  .roll-view-controls .btn { min-height:35px; padding:6px 8px; font-size:11px; gap:4px; }
  .roll-view-controls svg { width:13px; height:13px; }
  .roll-metrics { padding:0 12px; gap:5px; }
  .roll-metric { padding:7px; min-height:57px; gap:2px 6px; grid-template-columns:21px 1fr; border-radius:8px; }
  .roll-metric-symbol { width:20px; height:20px; font-size:11px; }
  .roll-metric > span:not(.roll-metric-symbol) { font-size:9px; }
  .roll-metric > strong { font-size:21px; }
  .roll-stat-note { padding:7px 12px; font-size:10px; }
  .roll-map-tools { padding:2px 12px 9px; align-items:center; }
  .roll-map-tools .field { min-width:122px; max-width:155px; }
  .roll-map-tools .field > span { display:none; }
  .roll-map-tools .btn { max-width:165px; font-size:10px; white-space:normal; line-height:1.4; }
  .roll-map-guide { padding:7px 12px; font-size:9px; align-items:center; gap:6px; }
  .roll-seat-viewport { padding:9px 12px 8px; max-height:68svh; }
  .roll-seat-canvas { gap:8px; }
  .roll-seat .roll-seat-name { font-size:9px; }
  .roll-seat > strong { font-size:9px; }
  .roll-seat .roll-seat-number { font-size:8px; }
  .roll-seat-grid.compact .roll-seat-number { font-size:clamp(6px,calc(var(--roll-seat-size)*.38),9px); }
  .roll-unmapped { padding:12px; }
  .roll-list-filters { padding:12px; gap:8px; }
  .roll-bulk-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; }
  .roll-bulk-actions .btn { min-height:45px; padding:7px 4px; font-size:11px; gap:2px; white-space:normal; line-height:1.3; }
  .roll-bulk-actions .btn svg { display:none; }
  .roll-selected-count { grid-column:1/-1; }
  .roll-group .roll-header h2 { font-size:16px; }
}
@media(prefers-reduced-motion:reduce) { .roll-workspace * { scroll-behavior:auto !important; } }

/* The complete plan belongs to the page; only enlarged plans have an inner pan area. */
.roll-seat-viewport[data-roll-zoom="fit"] {
  max-height:none; height:auto; overflow:visible; cursor:auto;
  touch-action:pan-y; overscroll-behavior:auto; scrollbar-gutter:auto;
}
.roll-seat-viewport[data-roll-zoom="fit"] .roll-seat-canvas {
  width:100%; min-width:0; padding:0;
}

.roll-group .roll-header { flex-direction:column; align-items:stretch; gap:10px; padding:20px 24px 0; }
.roll-exam-title { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.roll-group .roll-exam-title h2 { margin:0; font-size:20px; min-width:0; max-width:100%; }
.roll-group .roll-exam-title h2 .muted { min-width:0; max-width:100%; overflow-wrap:anywhere; line-height:1.6; }
.roll-start-time { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; font-size:14px; color:var(--role-ink,#28385f); font-weight:650; }
.roll-start-time svg { width:16px; height:16px; }
.roll-exam-scope { font-size:13px; color:var(--role-muted,#627399); }
.roll-group .roll-reference { margin:0; font-size:12px; }
.roll-group .roll-reference summary { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; line-height:1.6; padding-block:3px; list-style:none; }
.roll-group .roll-reference summary::-webkit-details-marker { display:none; }
.roll-group .roll-reference summary::before { content:"›"; font-size:17px; font-weight:700; }
.roll-group .roll-reference[open] summary::before { transform:rotate(90deg); }
.roll-group .roll-reference summary>span:first-of-type { font-weight:650; }
.roll-save-strip { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:13px 0; border-top:1px solid var(--role-line,#d9def0); }
.roll-save-status { display:grid; gap:5px; }
.roll-save-label { font-size:11px; color:var(--role-muted,#627399); }
.roll-save-state { display:inline-flex; align-items:center; gap:6px; font-size:14px; font-weight:650; color:#365445; white-space:nowrap; }
.roll-save-state svg { width:16px; height:16px; flex:none; }
.roll-save-state.save-unsaved { color:#975314; background:#fff0d9; border:1px solid #efd4ad; border-radius:6px; padding:5px 8px; }
.roll-save-state.save-new { color:#697586; }
.roll-save-state.save-archived { color:#5b6575; }
.roll-group .roll-history-link { display:flex; align-items:center; gap:9px; min-height:44px; border:0; box-shadow:none; background:transparent; padding:5px 8px; font-size:13px; text-align:left; color:var(--role-ink,#28385f); }
.roll-history-link>svg { width:18px; height:18px; }
.roll-history-link small { display:block; font-size:11px; color:var(--role-muted,#627399); margin-top:3px; font-weight:500; }
.roll-history-link>span:last-child { font-size:22px; }
.roll-no-history { font-size:12px; color:#7b8795; }
@media(max-width:620px) {
  .roll-group .roll-header { padding:16px 15px 0; gap:8px; }
  .roll-group .roll-exam-title h2 { font-size:17px; }
  .roll-start-time { font-size:12px; gap:4px; }
  .roll-exam-scope { font-size:12px; }
  .roll-group .roll-reference { font-size:11px; }
  .roll-group .roll-reference summary { gap:5px; }
  .roll-save-state { font-size:13px; }
  .roll-save-strip { display:grid; grid-template-columns:minmax(0,1fr); gap:7px; }
  .roll-group .roll-history-link { padding-inline:4px; gap:6px; font-size:12px; min-width:0; white-space:normal; }
  .roll-history-link small { overflow-wrap:anywhere; }
}

/* Read-only dates explain the action before the teacher taps a seat. */
.roll-readonly-notice { display:flex; align-items:flex-start; gap:8px; margin:0 24px 16px; padding:10px 12px; border:1px solid #e7ce84; border-radius:8px; background:#fff6d8; color:#684b08; font-size:14px; font-weight:650; line-height:1.6; }
.roll-readonly-notice svg { width:19px; height:19px; flex:none; margin-top:2px; }
.roll-readonly-notice span { min-width:0; overflow-wrap:anywhere; }
.roll-readonly-details { display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px 18px; margin:20px 0 0; line-height:1.6; }
.roll-readonly-details dt { font-weight:700; }
.roll-readonly-details dd { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; }
@media(max-width:620px) { .roll-readonly-notice { margin:0 12px 12px; font-size:14px; } }

/* Keep a finger hold for student details without blocking ordinary page swipes. */
button.roll-seat { -webkit-touch-callout:none; -webkit-user-select:none; user-select:none; }
.roll-map-guide > span:first-child { flex-wrap:wrap; }

/* Exact source seating retains the printed stage and row direction. */
.source-podium { margin-top: 0; margin-bottom: 8px; }
.source-rear-label { text-align: center; margin-top: 8px; color: var(--muted); font-size: .8rem; }
.room-diagram.source-top { display: flex; flex-direction: column; }
.room-diagram.source-top .source-podium { order: -1; }
.room-diagram.source-top .source-rear-label { order: 2; }
.source-podium { position:relative; }
.source-entry { position:absolute; left:8px; font-size:.75em; letter-spacing:0; }
.room-diagram.mini .source-entry { display:none; }
body :is(#app,#modal) .hall-readable:is([data-roll-zoom=fit],[data-seat-zoom=fit]) .seat-podium.source-podium { position:relative; }
