/* Nexus 1.4: shared working surfaces, loaded after each device shell.
   Layout-specific densities are variables rather than another patch per release. */
:root{--control-size:34px;--space-1:4px;--space-2:8px;--space-3:12px;--text-main:14px;--text-meta:11px;--panel-radius:6px}
body[data-layout="mobile"]{--control-size:38px;--text-main:14px;--text-meta:11px}
button,.button{font-size:var(--text-main);line-height:1.2;min-height:var(--control-size)}
button.primary,.button.primary{color:var(--white);background:var(--accent);border-color:var(--accent)}
html[data-theme="dark"] button.primary,html[data-theme="dark"] .button.primary{color:#122419}
button[aria-busy="true"]{cursor:progress;opacity:.7}
button:focus-visible,a:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.toolbar{gap:8px;margin-bottom:10px;min-width:0}
.toolbar-left,.toolbar-right{gap:6px;min-width:0;align-items:center}
.toolbar button,.toolbar .button,.toolbar select{min-height:var(--control-size);font-size:12px;padding:5px 9px;max-width:100%}
.toolbar select{min-width:0}
.view-heading{margin-bottom:12px;min-height:0;gap:12px}
.view-heading h1{font-size:25px;line-height:1.2}
.heading-actions{gap:6px}
.tabs{gap:18px;margin-bottom:12px;scrollbar-width:thin}
.tabs>a,.tabs>button{font-size:13px;line-height:1.2;padding-top:10px;padding-bottom:10px}
.course-tabs a.active{font-weight:700}
.table-wrap th,.table-wrap td{font-size:13px;padding-top:9px;padding-bottom:9px}
.table-wrap th{font-size:11px;line-height:1.25}
.table-wrap .student-name{font-size:14px}
.student-name{gap:4px;min-width:0}
.student-id{font-size:10px;white-space:nowrap;color:var(--muted)}
.student-label{overflow-wrap:anywhere}
.badge{font-size:11px;line-height:1.2;padding:3px 6px}
.empty-state{padding:24px 12px;min-height:0}
.empty-state p{font-size:14px;margin-bottom:10px}
/* Dialog content remains scrollable, but its title and commit controls stay reachable. */
dialog{padding:0;border-radius:10px;max-height:calc(100dvh - 24px);overscroll-behavior:contain}
#dialog-content{padding:0 16px 14px}
#dialog .dialog-heading{position:sticky;top:0;z-index:4;background:var(--paper);margin:0 -16px 12px;padding:10px 12px 8px 16px;border-bottom:1px solid var(--line);gap:10px}
#dialog .dialog-heading h2{font-size:18px;line-height:1.2;overflow-wrap:anywhere}
#dialog .dialog-heading .icon-button{width:34px;height:34px;min-height:34px;flex-shrink:0}
#dialog .dialog-form footer{position:sticky;bottom:-14px;z-index:3;background:var(--paper);margin:12px -16px -14px;padding:10px 16px;border-top:1px solid var(--line);gap:8px}
#dialog .form-grid{gap:10px 12px}
#dialog .field{margin-bottom:10px}
#dialog .field>span:first-child{font-size:12px;margin-bottom:4px}
#dialog .form-error:empty{display:none}
#dialog input:not([type=checkbox]):not([type=radio]),#dialog select{min-height:var(--control-size);padding:7px 9px}
#dialog .table-wrap{margin-left:0;margin-right:0}
.grade-group-main span,.grade-group-main small{font-size:12px;white-space:normal;overflow-wrap:anywhere}
.grade-group-main b{font-size:14px}
.grade-group-actions button{font-size:12px;min-height:36px}
.quick-grade-progress{margin-bottom:10px;font-size:12px}
.quick-grade-student{min-height:64px;padding:10px}
.quick-grade-student .student-id{font-size:12px}
.quick-grade-pad button{min-height:46px;font-size:21px}
.quick-grade-nav span{font-size:12px;white-space:normal;text-overflow:clip}
.quick-grade-nav button{min-height:38px;font-size:13px}
.quick-grade-done{padding:20px 8px}
.category-tree-list .category-row input,.category-tree-list .category-row select{font-size:12px}
.grade-group-note b,.grade-group-note span,.grade-group-readonly small{font-size:12px}
/* One compact row instead of repeating the plan title, room badge and edit mode. */
.seating-toolbar{display:flex;flex-wrap:nowrap;gap:6px;margin-bottom:8px}
.seating-toolbar>.toolbar-left{flex:1;min-width:0;flex-wrap:nowrap}
.seating-toolbar>.toolbar-left select{max-width:100%;width:auto;min-width:0}
.seating-toolbar>.toolbar-right{flex-shrink:0;flex-wrap:nowrap;gap:4px}
.seating-toolbar>.toolbar-right button{padding:5px 7px}
.seating-toolbar .icon-button{width:32px;min-width:32px;height:34px;min-height:34px}
.seating-toolbar .badge{display:none}
/* Existing workflows need state, not instructions. */
.lesson-entry-block{margin-bottom:0}
.lesson-entry-block>label,.homework-entry-heading>label{font-size:12px;font-weight:650;margin-bottom:5px}
.journal-input-wrap textarea{box-sizing:border-box;min-height:46px;max-height:220px;padding:10px 48px 10px 10px;font-size:15px;line-height:1.35;resize:vertical}
.journal-input-wrap .journal-ok{width:32px;height:32px;min-height:32px;right:6px;bottom:6px;box-shadow:none;border-radius:7px;font-size:11px;padding:0}
.save-state{font-size:11px;line-height:1.3;min-height:0}
.save-state:empty{display:none}
.homework-entry-heading{gap:8px;align-items:baseline}
.homework-entry-controls{margin-top:6px;gap:8px}
.homework-entry-controls label{gap:5px}
.homework-entry-controls select,.homework-entry-controls input{min-height:32px;padding:4px 7px;font-size:12px}
.due-homework-item{padding:8px;gap:8px}
.due-homework-copy p,.assigned-homework-item p{font-size:14px;line-height:1.35;overflow-wrap:anywhere}
.due-homework-actions{gap:6px}
.due-homework-actions button{font-size:12px;min-height:34px;padding:5px 8px}
.homework-review-toolbar{margin-bottom:8px}
.homework-review-copy{margin-bottom:8px}
.homework-review-copy p{font-size:14px;line-height:1.35}
.homework-review-actions{position:sticky;bottom:-14px;z-index:3;background:var(--paper);padding:10px 0 6px;border-top:1px solid var(--line);margin-top:10px}
.lesson-extra>summary{min-height:34px;padding-top:8px;padding-bottom:8px;font-size:13px}
.attachment-row{min-height:42px}
.attachment-row>a span{font-size:13px}
.attachment-row>a small{font-size:11px}
.lesson-attendance-launch{min-height:44px;padding:8px 10px}
.lesson-attendance-launch b,.lesson-attendance-launch strong{font-size:14px}
.lesson-attendance-launch svg{width:18px;height:18px}
dialog.attendance-popup{max-height:calc(100dvh - 16px)}
.attendance-popup .attendance-popup-content{padding:10px;min-height:0}
.attendance-popup .attendance-popup-head{margin-bottom:6px;gap:8px}
.attendance-popup-head span{font-size:12px}
.attendance-popup .attendance-all-there{min-height:34px;padding:6px 10px;font-size:14px;margin:0 0 5px}
.attendance-popup .attendance-popup-tools{margin:0 0 6px}
.attendance-popup .attendance-popup-tools .subtabs button{font-size:12px;min-height:32px}
.attendance-popup .attendance-sort-label select{min-height:32px;font-size:12px}
.attendance-popup .attendance-quick{font-size:14px;min-height:40px}
.attendance-popup .attendance-quick-status{font-size:12px}
.attendance-code-actions .attendance-code-choice small{font-size:12px}
.global-live-countdown{max-width:calc(100vw - 24px)}
.global-live-countdown strong{font-size:12px}
.global-live-countdown [data-live-timer]{font-size:14px;line-height:1.3}
.timer-popover-title b{font-size:15px}
.timer-setting>span:first-child{font-size:12px}
.timer-quick-grid button{font-size:13px;min-height:38px}
.timer-setting-row button{font-size:13px}
body[data-layout="desktop"] .topbar{height:46px;min-height:46px}
body[data-layout="desktop"] .desktop-lesson-head{padding-top:0;min-height:0;margin-bottom:12px}
body[data-layout="desktop"] .desktop-lesson-title strong{font-size:23px}
body[data-layout="desktop"] .desktop-lesson-title>span{font-size:12px}
body[data-layout="desktop"] .desktop-lesson-actions button{font-size:13px;min-height:34px}
body[data-layout="desktop"] .desktop-lesson-workflow{gap:12px}
body[data-layout="desktop"] .desktop-global-live-countdown{max-width:calc(100vw - 230px)}
body[data-layout="desktop"] #view{padding-bottom:90px}
body[data-layout="desktop"] dialog.wide{width:min(1100px,calc(100vw - 40px))}
body[data-layout="mobile"] .mobile-topbar{height:calc(46px + env(safe-area-inset-top));padding-left:10px;padding-right:10px}
body[data-layout="mobile"] .mobile-topbar .wordmark{font-size:27px}
body[data-layout="mobile"] .mobile-topbar .global-actions{gap:0}
body[data-layout="mobile"] .mobile-topbar .icon-button{width:34px;height:36px;min-height:36px;padding:6px}
body[data-layout="mobile"] #view{padding:10px 10px 64px}
body[data-layout="mobile"] .mobile-context{padding:0;min-height:0}
body[data-layout="mobile"] .mobile-course-head{margin:0 0 6px;min-height:36px;padding:0 0 6px}
body[data-layout="mobile"] .mobile-course-head strong{font-size:19px}
body[data-layout="mobile"] .course-tabs,body[data-layout="mobile"] .calendar-tabs{margin:0 -10px 10px;padding:0 10px;gap:16px}
body[data-layout="mobile"] .tabs>a,body[data-layout="mobile"] .tabs>button{font-size:13px;min-height:36px}
body[data-layout="mobile"] .mobile-lesson-head{display:flex;flex-wrap:wrap;gap:6px;padding:0 0 8px;margin-bottom:8px;min-height:0}
body[data-layout="mobile"] .mobile-lesson-title{flex:1 1 100%;min-width:0}
body[data-layout="mobile"] .mobile-lesson-title strong{font-size:20px}
body[data-layout="mobile"] .mobile-lesson-title>span{font-size:12px}
body[data-layout="mobile"] .mobile-lesson-actions{display:flex;flex-direction:row;flex:1;justify-content:flex-end;gap:5px}
body[data-layout="mobile"] .mobile-lesson-actions button,body[data-layout="mobile"] .mobile-lesson-actions .lesson-return{min-height:32px;height:32px;font-size:12px;padding:4px 8px}
body[data-layout="mobile"] .mobile-lesson-actions .lesson-return{margin-right:auto}
body[data-layout="mobile"] .lesson-entry-block{padding:8px}
body[data-layout="mobile"] .journal-input-wrap textarea{font-size:16px}
body[data-layout="mobile"] .lesson-workflow{gap:8px}
body[data-layout="mobile"] .homework-entry-controls select,body[data-layout="mobile"] .homework-entry-controls input{font-size:13px;min-height:34px}
body[data-layout="mobile"] .seating-toolbar select{font-size:12px;max-width:100%;padding:4px}
body[data-layout="mobile"] .seating-toolbar button{font-size:12px;min-height:34px;padding:4px 6px;gap:3px}
body[data-layout="mobile"] .seating-toolbar button svg{width:15px;height:15px}
body[data-layout="mobile"] .bottom-nav{padding:4px 4px calc(4px + env(safe-area-inset-bottom))}
body[data-layout="mobile"] .bottom-nav a{min-height:43px;gap:2px;font-size:11px}
body[data-layout="mobile"] .bottom-nav a>span:first-child{padding:2px 12px}
body[data-layout="mobile"] .bottom-nav svg{width:22px;height:22px}
body[data-layout="mobile"] .mobile-global-live-countdown{bottom:calc(61px + env(safe-area-inset-bottom));right:8px;max-width:calc(100vw - 16px);gap:5px;padding:5px 8px;flex-wrap:wrap}
body[data-layout="mobile"] .mobile-global-live-countdown strong{font-size:11px;max-width:120px}
body[data-layout="mobile"] .mobile-global-live-countdown [data-live-timer]{font-size:13px;white-space:normal}
body[data-layout="mobile"] .table-wrap{margin:0;max-width:100%}
body[data-layout="mobile"] .table-wrap td,body[data-layout="mobile"] .table-wrap th{padding:8px;font-size:13px}
body[data-layout="mobile"] .table-wrap table{min-width:460px}
body[data-layout="mobile"] .student-overview-card{padding:9px}
body[data-layout="mobile"] .mobile-grade-card{padding:10px 0}
body[data-layout="mobile"] .mobile-grade-card .grade-history{margin:7px 0}
body[data-layout="mobile"] .mobile-grade-card .student-name{font-size:15px}
body[data-layout="mobile"] .mobile-grade-card footer>button{font-size:12px;min-height:34px}
body[data-layout="mobile"] .member-choice{font-size:14px;min-height:38px;padding:7px 5px}
body[data-layout="mobile"] .members-grid{max-height:55dvh}
body[data-layout="mobile"] dialog{width:calc(100vw - 12px);max-height:calc(100dvh - 12px)}
body[data-layout="mobile"] #dialog-content{padding:0 12px 12px}
body[data-layout="mobile"] #dialog .dialog-heading{margin:0 -12px 10px;padding:8px 10px 6px 12px}
body[data-layout="mobile"] #dialog .dialog-form footer{margin:10px -12px -12px;bottom:-12px;padding:8px 12px}
body[data-layout="mobile"] #dialog input:not([type=checkbox]):not([type=radio]),body[data-layout="mobile"] #dialog select{font-size:16px;min-height:38px;max-width:100%;min-width:0}
body[data-layout="mobile"] #dialog .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
body[data-layout="mobile"] #dialog .form-grid .span-2{grid-column:1/-1}body[data-layout="mobile"] #dialog .dialog-form footer.dialog-footer-split{flex-direction:column;align-items:stretch}body[data-layout="mobile"] #dialog .dialog-form footer.dialog-footer-split .dialog-footer-extra,body[data-layout="mobile"] #dialog .dialog-form footer.dialog-footer-split .dialog-footer-actions{width:100%}body[data-layout="mobile"] #dialog .dialog-form footer.dialog-footer-split .dialog-footer-actions{justify-content:flex-end}
body[data-layout="mobile"] #dialog .field{min-width:0;margin-bottom:6px}
body[data-layout="mobile"] #dialog .field textarea{min-width:0;max-width:100%}
body[data-layout="mobile"] #dialog .grade-pad{grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
body[data-layout="mobile"] #dialog .grade-pad button{min-height:43px;padding:5px;font-size:20px}
body[data-layout="mobile"] #dialog .quick-grade-student{min-height:58px}
body[data-layout="mobile"] #dialog .quick-grade-student strong{font-size:23px}
body[data-layout="mobile"] #dialog .quick-grade-nav button{font-size:12px;padding:5px 7px}
body[data-layout="mobile"] .mobile-calendar-toolbar{margin-bottom:8px;min-height:36px}
body[data-layout="mobile"] .mobile-calendar-title b{font-size:17px}
body[data-layout="mobile"] .mobile-calendar-summary{margin:0 0 6px;font-size:12px}
body[data-layout="mobile"] .mobile-month-day{min-height:45px}
body[data-layout="mobile"] .settings-accordion>summary{padding:10px 8px}
body[data-layout="mobile"] .settings-accordion-body{padding:10px 8px}
body[data-layout="mobile"] .settings-quick-actions{gap:5px}
@media(max-width:359px){body[data-layout="mobile"] .mobile-topbar .icon-button{width:30px}body[data-layout="mobile"] #dialog .form-grid{grid-template-columns:1fr}}
/* Field labels are readable without reserving a separate instruction row. */
.journal-field>label,.homework-entry-heading>label{font-size:12px;line-height:1.2}
.desktop-coursebook-editor,.mobile-coursebook-editor{gap:8px}
.homework-entry-controls>label{display:flex;align-items:center;gap:6px}
.homework-entry-controls>label>span{font-size:12px;line-height:1.2;margin:0}
.mobile-coursebook-editor .lesson-block-heading b{font-size:12px}
.mobile-coursebook-editor .due-homework-copy p{font-size:14px}
.mobile-coursebook-editor .due-homework-copy small{font-size:11px}
.mobile-coursebook-editor .due-homework-actions button{font-size:12px}
body[data-layout="mobile"] .mobile-lesson-actions .lesson-grade-button span{display:inline}
body[data-layout="mobile"] .mobile-lesson-actions .lesson-grade-button{width:auto}
body[data-layout="desktop"][data-tab="seating"] #view{padding-bottom:45px}
body[data-layout="mobile"] .mobile-lesson-actions .lesson-grade-button svg{width:15px}
body[data-layout="mobile"] .homework-entry-controls>label{display:flex;flex-direction:row;align-items:center;gap:6px}

body[data-layout="mobile"] .homework-entry-heading>label{font-size:12px;line-height:1.2}
body[data-layout="mobile"] .assigned-homework-item p{font-size:13px;line-height:1.3}
body[data-layout="mobile"] .assigned-homework-item small{font-size:11px}
body[data-layout="mobile"] .homework-entry-controls>label>span{font-size:12px}
/* Replace old light-only text colours in secondary navigation and form labels. */
.field>span:first-child{color:var(--muted)}
.desktop-shell .tabs>a,.desktop-shell .tabs>button{color:var(--muted)}
.desktop-shell .tabs .active{color:var(--accent)}
.page-context,.page-context a,.sidebar-status{color:var(--muted)}
html[data-theme="dark"] button.primary:hover,html[data-theme="dark"] .button.primary:hover,
html[data-theme="dark"] .desktop-shell .toolbar button.primary:hover,
html[data-theme="dark"] .desktop-shell .heading-actions button.primary:hover,
html[data-theme="dark"] .desktop-shell .setting-actions button.primary:hover{background:color-mix(in srgb,var(--accent) 84%,white);border-color:var(--accent);color:#101510}
/* Size the attendance window to its content, not to unused screen height. */
body[data-layout="mobile"] dialog.attendance-popup,body[data-layout="desktop"] dialog.attendance-popup{height:auto;min-height:0}

/* Unified grading workspace */
.grading-setup .grading-start{width:100%;margin-top:12px}
.grading-session-head{display:grid;grid-template-columns:auto minmax(0,1fr);gap:12px;align-items:center;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid var(--line)}
.grading-mode-tabs{margin:0;flex-shrink:0}
.grading-mode-tabs button{min-width:76px}
.grading-group-summary{min-width:0;display:flex;flex-direction:column;align-items:flex-end;gap:2px;text-align:right}
.grading-group-summary strong{max-width:100%;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.grading-group-summary span{font-size:11px;color:var(--muted);white-space:normal}
.grading-mode-body{min-width:0}
.grading-selected-student{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:42px;padding:7px 9px;border:1px solid var(--line);border-radius:5px;background:var(--soft)}
.grading-selected-student strong{min-width:0;font-size:17px;font-weight:600}
.grading-selected-student .student-name{display:inline-flex;align-items:baseline;gap:5px}
.grading-selected-student span:last-child{flex-shrink:0;font-size:11px;color:var(--muted)}
.grading-grade-pad{margin:8px 0 11px}
.grading-no-selection,.grading-no-plan{padding:13px;border:1px dashed var(--line);border-radius:5px;color:var(--muted);text-align:center;font-size:12px}
.grading-plan-select{display:flex;justify-content:flex-end;margin:7px 0}.grading-plan-select select{width:auto;min-width:180px}
.grading-seat-stage{margin-top:6px}
.grading-seat.has-grade{background:var(--accent-soft);border-color:#aebfaa}
.grading-seat.grade-unavailable{opacity:.32}
.grading-student-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;margin-top:8px;max-height:42dvh;overflow:auto;border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:4px 0}
.grading-student-list>button{min-width:0;display:flex;justify-content:space-between;text-align:left;white-space:normal;padding:7px 9px;border-color:transparent;background:transparent}
.grading-student-list>button:hover{background:var(--soft)}
.grading-student-list>button.selected{background:var(--accent-soft);border-color:#b9c9b5}
.grading-student-list .student-name{min-width:0;font-size:13px}
.grading-student-list>button>b{min-width:30px;text-align:right;font-size:13px;color:var(--accent)}
.grading-unplaced{display:flex;flex-wrap:wrap;gap:4px;margin-top:7px;padding-top:7px;border-top:1px solid var(--line)}
.grading-unplaced>button{min-height:30px;padding:4px 7px;font-size:11px;white-space:normal}
.grading-unplaced>button.selected{background:var(--accent-soft);border-color:#b9c9b5}
.grading-unplaced>button>b{margin-left:5px;color:var(--accent)}

body[data-layout="mobile"] #dialog .grading-session-head{grid-template-columns:1fr;gap:7px;margin-bottom:8px;padding-bottom:8px}
body[data-layout="mobile"] #dialog .grading-mode-tabs{display:grid;grid-template-columns:repeat(3,1fr);width:100%}
body[data-layout="mobile"] #dialog .grading-mode-tabs button{min-width:0;min-height:34px;padding:4px 5px}
body[data-layout="mobile"] #dialog .grading-group-summary{align-items:flex-start;text-align:left}
body[data-layout="mobile"] #dialog .grading-group-summary strong{font-size:12px}
body[data-layout="mobile"] #dialog .grading-group-summary span{font-size:10px}
body[data-layout="mobile"] #dialog .grading-selected-student{min-height:38px;padding:5px 7px}
body[data-layout="mobile"] #dialog .grading-selected-student strong{font-size:16px}
body[data-layout="mobile"] #dialog .grading-selected-student span:last-child{font-size:10px}
body[data-layout="mobile"] #dialog .grading-grade-pad{margin:6px 0 8px}
body[data-layout="mobile"] #dialog .grading-student-list{grid-template-columns:1fr;max-height:36dvh;margin-top:6px}
body[data-layout="mobile"] #dialog .grading-student-list>button{min-height:37px;padding:5px 7px}
body[data-layout="mobile"] #dialog .grading-seat-stage{margin-top:4px}
body[data-layout="mobile"] #dialog .grading-plan-select{margin:4px 0}
body[data-layout="mobile"] #dialog .grading-plan-select select{width:100%;min-width:0}
body[data-layout="mobile"] #dialog .grading-unplaced{margin-top:4px;padding-top:4px}
@media(min-width:700px){.grading-grade-pad{grid-template-columns:repeat(8,minmax(0,1fr));gap:6px}.grading-grade-pad button{min-height:42px}}

/* Nexus 1.4.4 compact in-lesson navigation and stable attendance seating */
.lesson-neighbor-nav{display:inline-flex;align-items:center;gap:2px}
.lesson-nav-arrow,.attendance-nav-arrow{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}
.lesson-nav-arrow.disabled,.attendance-nav-arrow.disabled{opacity:.28;pointer-events:none}
.lesson-neighbor-nav .lesson-nav-arrow{width:32px;height:32px;min-height:32px;padding:6px;border:1px solid var(--line);border-radius:4px;background:var(--white)}
.lesson-neighbor-nav .lesson-nav-arrow svg{width:14px;height:14px}
.attendance-lesson-nav{display:grid;grid-template-columns:30px minmax(0,1fr) 30px;align-items:center;gap:4px;margin:0 0 5px}
.attendance-lesson-nav select{min-width:0;width:100%;min-height:30px;height:30px;padding:2px 7px;font-size:11px}
.attendance-lesson-nav .attendance-nav-arrow{width:30px;height:30px;min-height:30px;padding:5px;border:1px solid var(--line);border-radius:4px;background:var(--white)}
.attendance-lesson-nav .attendance-nav-arrow svg{width:14px;height:14px}
.attendance-popup .seat{position:relative}
.attendance-popup .seat .seat-status{position:absolute!important;right:4px;top:3px;z-index:3;display:block!important;margin:0!important;min-width:10px;font-size:9px!important;line-height:1!important;text-align:right;white-space:nowrap;pointer-events:none}
.attendance-popup .seat.is-absent .seat-student-name{color:#975a45}
.attendance-popup .seat.is-processed .seat-student-name{color:#80681f}
html[data-theme="dark"] .lesson-neighbor-nav .lesson-nav-arrow,html[data-theme="dark"] .attendance-lesson-nav .attendance-nav-arrow{background:#202620;border-color:#465146}
html[data-theme="dark"] .attendance-popup .seat.is-absent .seat-student-name{color:#e4ad98}
html[data-theme="dark"] .attendance-popup .seat.is-processed .seat-student-name{color:#dfc973}
body[data-layout="mobile"] .lesson-neighbor-nav{gap:1px}
body[data-layout="mobile"] .lesson-neighbor-nav .lesson-nav-arrow{width:30px;height:32px;min-height:32px;padding:6px}
body[data-layout="mobile"] .attendance-lesson-nav{grid-template-columns:28px minmax(0,1fr) 28px;gap:3px;margin-bottom:3px}
body[data-layout="mobile"] .attendance-lesson-nav select{height:28px;min-height:28px;padding:1px 5px;font-size:9px}
body[data-layout="mobile"] .attendance-lesson-nav .attendance-nav-arrow{width:28px;height:28px;min-height:28px;padding:5px}
body[data-layout="mobile"] .attendance-popup .seat .seat-status{right:2px;top:2px;font-size:7px!important}
@media(max-width:390px){
 body[data-layout="mobile"] .mobile-lesson-actions .lesson-grade-button{width:32px;padding:5px}
 body[data-layout="mobile"] .mobile-lesson-actions .lesson-grade-button span{display:none}
 body[data-layout="mobile"] .mobile-lesson-actions .lesson-grade-button svg{width:15px;height:15px}
}

/* Lesson context: recent course entries stay visible beside the editor on desktop and below it on mobile. */
.desktop-lesson-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,300px);gap:18px;align-items:start}
.desktop-lesson-layout .desktop-coursebook-editor{min-width:0;max-width:none}
.lesson-recent{min-width:0;border-left:1px solid var(--line);padding-left:14px}
body[data-layout="desktop"] .lesson-recent{position:sticky;top:58px}
.lesson-recent-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:7px}
.lesson-recent-heading b{font-size:12px}
.lesson-recent-group{margin-top:10px}
.lesson-recent-group:first-of-type{margin-top:0}
.lesson-recent-label{margin:0 4px 4px;font-size:9px;font-weight:750;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.lesson-recent-list{display:flex;flex-direction:column}
.lesson-recent-list a{display:flex;flex-direction:column;gap:2px;padding:8px 4px;border-bottom:1px solid var(--line);white-space:normal}
.lesson-recent-list a:first-child{border-top:1px solid var(--line)}
.lesson-recent-list a:hover{background:var(--soft);color:inherit}
.lesson-recent-list a.is-open{background:var(--accent-soft);color:inherit}
.lesson-recent-list a.is-next:not(.is-open){border-left:2px solid var(--accent);padding-left:7px}
.lesson-recent-list span{font-size:10px;color:var(--muted);font-variant-numeric:tabular-nums}
.lesson-recent-list strong{font-size:12px;font-weight:550;line-height:1.3;overflow-wrap:anywhere}
.attendance-popup .attendance-seat-edit{min-height:32px;padding:4px 8px;font-size:12px}
.attendance-popup .attendance-seat-edit svg{width:15px;height:15px}
body[data-layout="mobile"] .lesson-recent{border-left:0;border-top:1px solid var(--line);padding:10px 0 0;margin-top:4px}
body[data-layout="mobile"] .lesson-recent-list a{padding:9px 2px}
body[data-layout="mobile"] .lesson-recent-list strong{font-size:13px}
body[data-layout="mobile"] .lesson-recent-list span{font-size:10px}
@media(max-width:920px){body[data-layout="desktop"] .desktop-lesson-layout{grid-template-columns:minmax(0,1fr) 220px;gap:12px}}

/* Seating and list grading open the grade choices as a local popup instead of moving the user to a remote control row. */
.grading-picker-overlay{position:fixed;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;padding:24px;background:#1d241e55}
.grading-picker-card{width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 40px);overflow:auto;background:var(--paper);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow);padding:14px}
.grading-picker-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}
.grading-picker-head>div{min-width:0;display:flex;flex-direction:column;gap:2px}
.grading-picker-head strong{font-size:17px;font-weight:600;min-width:0}
.grading-picker-head .student-name{display:inline-flex;align-items:baseline;gap:5px}
.grading-picker-head span:last-child{font-size:11px;color:var(--muted)}
.grading-picker-card .grading-grade-pad{margin:8px 0 0}
body[data-layout="mobile"] .grading-picker-overlay{padding:10px}
body[data-layout="mobile"] .grading-picker-card{width:min(460px,calc(100vw - 20px));padding:10px}
body[data-layout="mobile"] .grading-picker-head strong{font-size:16px}
body[data-layout="mobile"] .grading-picker-card .grading-grade-pad{grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}

/* Nexus 1.4.12 optional note per student grade. */
.grading-note-field{display:flex;flex-direction:column;gap:5px;margin-top:8px}
.grading-note-field>span{font-size:11px;color:var(--muted)}
.grading-note-field>span small{font-size:10px}
.grading-note-field textarea{min-height:58px;max-height:140px;resize:vertical}
.grade-note-field textarea{min-height:72px}
.grade-note-cell{max-width:280px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--muted);font-size:12px}
body[data-layout="mobile"] .grading-note-field{margin-top:6px}
body[data-layout="mobile"] .grading-note-field textarea{min-height:54px}

/* Nexus 1.4.14 cancellation context, open excuses and optional U grading. */
.lesson-open-excuses{margin-top:8px;padding:9px 10px;border:1px solid var(--line);border-radius:8px;background:var(--soft)}
.lesson-open-excuses.inside-attendance{margin:8px 0 4px}
.lesson-open-excuses-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
.lesson-open-excuses-head b{font-size:12px;font-weight:650}.lesson-open-excuses-head span{font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums}
.lesson-open-excuses-list{display:flex;gap:6px;flex-wrap:wrap}.lesson-open-excuses-list button{min-height:34px;padding:5px 8px;display:flex;align-items:center;gap:7px;background:var(--paper)}
.lesson-open-excuses-list button span{font-size:12px;font-weight:600}.lesson-open-excuses-list button small{font-size:10px;color:var(--muted)}
.lesson-attendance-card.cancelled .lesson-attendance-main>div{display:flex;flex-direction:column;gap:2px}.lesson-attendance-card.cancelled .lesson-attendance-main small{color:var(--muted);font-size:11px}
.u-grade-config{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:8px 10px;margin:0 0 10px;border:1px solid var(--line);border-radius:8px;background:var(--soft)}
.u-grade-config>label:not(.checkbox-line){display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}.u-grade-config input[type=number]{width:82px;min-height:34px}
.u-grade-config>small{flex-basis:100%;font-size:10px;color:var(--muted)}
.grade-u-penalty{display:inline-flex;align-items:center;justify-content:center;min-height:26px;padding:2px 7px;border:1px solid var(--line);border-radius:999px;background:var(--soft);font-size:11px;font-weight:650;color:var(--muted)}
.grade-u-row{background:var(--soft)}
body[data-layout="mobile"] .lesson-open-excuses-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}body[data-layout="mobile"] .lesson-open-excuses-list button{justify-content:space-between;min-width:0}
body[data-layout="mobile"] .u-grade-config{align-items:stretch}body[data-layout="mobile"] .u-grade-config>label:not(.checkbox-line){justify-content:space-between;flex:1 1 130px}

/* View-local random draw for course student list and ordinary seating. */
.random-picker-controls{display:flex;align-items:center;gap:9px;min-width:0;margin:2px 0 12px}
.random-picker-draw{display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:0 0 auto;white-space:nowrap;font-weight:650;background:var(--accent-soft);color:var(--ink);border:1px solid var(--accent)}
.random-picker-draw svg{width:17px;height:17px;flex-shrink:0}
.random-picker-draw:disabled{cursor:default;opacity:.55}
.random-picker-status{display:flex;align-items:baseline;gap:7px;flex-wrap:wrap;min-width:0;flex:1;padding:4px 0;line-height:1.3}
.random-picker-status strong{min-width:0;overflow-wrap:anywhere;font-size:14px;font-weight:700}
.random-picker-status [data-random-count]{font-size:11px;color:var(--muted);white-space:nowrap}
.random-picker-announcement{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.course-student-card.is-random-picked:not(.is-random-final){opacity:.45;filter:grayscale(1)}
.course-student-table tr.is-random-picked:not(.is-random-final){opacity:.45;filter:grayscale(1)}
.seat.is-random-picked:not(.is-random-final){opacity:.38;filter:grayscale(1)}
.course-student-card.is-random-cycling,.course-student-card.is-random-final{position:relative;z-index:1;outline:3px solid var(--accent);outline-offset:1px;background:var(--accent-soft);opacity:1;filter:none;box-shadow:0 0 18px rgba(79,156,105,.35)}
.course-student-table tr.is-random-cycling,.course-student-table tr.is-random-final{position:relative;z-index:1;outline:3px solid var(--accent);outline-offset:-2px;opacity:1;filter:none;box-shadow:0 0 17px rgba(79,156,105,.28)}
.course-student-table tr.is-random-cycling>td,.course-student-table tr.is-random-final>td{background:var(--accent-soft)}
.seat.is-random-cycling,.seat.is-random-final{position:relative;z-index:2;outline:3px solid var(--accent);outline-offset:1px;background:var(--accent-soft)!important;color:var(--ink)!important;border-color:var(--accent)!important;opacity:1!important;filter:none!important;box-shadow:0 0 19px rgba(79,156,105,.5)}
.is-random-final.is-random-blinking{animation:nexus-random-blink .17s ease-in-out 3}
@keyframes nexus-random-blink{0%,100%{opacity:1}45%{opacity:.24;filter:brightness(1.35)}}
@media(max-width:480px){.random-picker-controls{gap:8px}.random-picker-draw{min-height:38px;padding:7px 10px;font-size:12px}.random-picker-status strong{font-size:12px}.random-picker-status [data-random-count]{font-size:10px}}
@media(prefers-reduced-motion:reduce){.is-random-final.is-random-blinking{animation:none}}
