/* Structure and touch sizing only. Colours, materials, icons and logos come from the existing theme. */
body.site-touch-layout{--site-dock-height:94px;padding-bottom:0;scroll-padding-bottom:calc(var(--site-dock-height) + 20px)}
body.site-touch-layout .desktop-side-nav{display:none!important}
body.site-touch-layout main.app-shell{width:100%!important;max-width:none!important;margin:0!important;padding:20px clamp(16px,3vw,64px) calc(var(--site-dock-height) + 24px)!important;min-height:100dvh;box-sizing:border-box}
body.site-touch-layout .topbar{min-height:0!important;padding:16px 22px!important;align-items:center;gap:20px;position:static;display:flex;justify-content:space-between}
body.site-touch-layout .topbar>div:first-child{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:24px;align-items:center}
body.site-touch-layout .topbar-brand-line{grid-row:1/3;margin:0}
body.site-touch-layout .topbar h1{margin:0;line-height:1.2}
body.site-touch-layout .topbar .teacher-meta{margin:6px 0 0}
body.site-touch-layout .topbar-action-links{display:none!important}
body.site-touch-layout .topbar-actions{min-width:0;flex:0 0 auto}
body.site-touch-layout .site-dock :is(a,button){display:flex;align-items:center;justify-content:center;min-height:64px!important;min-width:0;padding:12px 16px!important;font-size:20px!important;line-height:1.2;white-space:nowrap;text-decoration:none;touch-action:manipulation}
body.site-touch-layout :is(.primary-btn,.secondary-btn,.mini-btn,.icon-link){min-height:56px;padding:12px 18px;font-size:18px;display:inline-flex;align-items:center;justify-content:center;touch-action:manipulation}
body.site-touch-layout :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]),select){min-height:56px;font-size:18px}
body.site-touch-layout textarea{font-size:18px;min-height:96px}
body.site-touch-layout :is(input,select,textarea,button,a){scroll-margin-block:24px calc(var(--site-dock-height) + 24px)}
.site-layout-message{position:fixed;z-index:150;bottom:calc(var(--site-dock-height) + 12px);left:10%;right:10%}
.site-layout-message[hidden]{display:none}
@media(min-width:1500px){body.site-touch-layout{--site-dock-height:108px}body.site-touch-layout .site-dock :is(a,button){min-height:76px!important;font-size:24px!important}}
@media print{body.site-touch-layout :is(.site-dock,.site-menu,.site-layout-message){display:none!important}body.site-touch-layout main.app-shell{padding:0!important;margin:0!important;min-height:0!important}}


body.site-touch-layout .sticky-action{position:relative!important}
/* Authentication pages retain their own layout and logo, with larger direct controls. */
body.login-page :is(.primary-btn,.secondary-btn,.icon-link){min-height:56px;font-size:18px;padding:12px 18px}
body.login-page :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]),select){min-height:56px;font-size:18px}
/* The same menu geometry as the whiteboard; each theme retains its colours. */
body.site-touch-layout .site-dock{position:fixed!important;inset:auto auto max(8px,env(safe-area-inset-bottom)) 50%!important;transform:translateX(-50%);z-index:110;display:flex!important;align-items:center;gap:12px;width:max-content!important;max-width:calc(100% - 24px)!important;min-height:var(--site-dock-height);margin:0!important;padding:12px!important;border:1px solid var(--line);border-radius:18px;box-shadow:0 8px 28px #0004;box-sizing:border-box}
.site-page-actions{flex:0 1 auto;min-width:0;display:flex;justify-content:center;gap:12px}
.site-page-actions:empty{display:none}
.site-page-actions>button{min-width:160px;max-width:420px;flex:1}
body.site-touch-layout .console-menu{bottom:calc(var(--site-dock-height) + max(8px,env(safe-area-inset-bottom)) + 12px)}
body.site-touch-layout .console-key{gap:12px;min-height:72px;clip-path:polygon(9px 0,calc(100% - 9px) 0,100% 9px,100% calc(100% - 9px),calc(100% - 9px) 100%,9px 100%,0 calc(100% - 9px),0 9px);border-radius:0;white-space:nowrap}
.console-key img{width:27px;height:27px;flex-shrink:0}
body.site-touch-layout .console-key img{filter:brightness(0) invert(.85)}
body.site-touch-layout .console-menu-key{background:var(--text);color:var(--bg);font-weight:700}
body.site-touch-layout .console-menu-key img{filter:brightness(0) invert(.85)}
body.site-touch-layout .site-dock>.console-key{min-width:120px}
body.site-touch-layout .site-menu{color:var(--text);background:var(--panel);border:1px solid var(--line)}
body .console-menu{position:fixed;inset:auto 3.5vw calc(var(--site-dock-height,var(--wb-dock)) + 12px);margin:0;width:auto;max-width:none;max-height:48dvh;padding:20px;border-radius:18px;overflow:hidden;box-sizing:border-box}
body .console-menu[open]{display:flex;flex-direction:column}
.console-menu::backdrop{background:#1118;backdrop-filter:blur(5px)}
.console-menu-scroll{overflow:auto;min-height:0;padding:4px 4px 12px;overscroll-behavior:contain}
.console-menu-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
body .console-menu-grid :is(.console-key,.wb-key){min-height:94px!important;font-size:20px}
.console-menu-footer{flex-shrink:0;padding:14px 4px 0;border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:16px;font-size:22px}
.console-menu-footer button{min-width:150px}
body .site-redundant-entry{display:none!important}
@media(max-width:1400px){body .console-menu-grid :is(.console-key,.wb-key){min-height:76px!important}}
@media(max-width:1100px){.console-menu-grid{grid-template-columns:repeat(3,minmax(0,1fr))}body.site-touch-layout .site-dock>.console-key{min-width:80px}body.site-touch-layout .site-dock img{display:none}}
@media(max-width:760px){body.site-touch-layout{--site-dock-height:82px}body.site-touch-layout main.app-shell{padding:12px 12px calc(var(--site-dock-height) + 20px)!important}body.site-touch-layout .site-dock{gap:6px;padding:8px!important}body.site-touch-layout .site-dock>.console-key{min-width:60px}body.site-touch-layout .site-dock :is(a,button){min-height:60px!important;font-size:16px!important;padding:8px!important}.site-page-actions>button{min-width:0}body.site-touch-layout .topbar>div:first-child{grid-template-columns:1fr;gap:8px}body.site-touch-layout .topbar-brand-line{grid-row:auto}body.site-touch-layout .topbar-date{display:none}.console-menu-grid{grid-template-columns:repeat(2,minmax(0,1fr))}body .console-menu{max-height:60dvh;padding:12px}.console-menu-grid .console-key{white-space:normal;font-size:17px!important}}

body.site-touch-layout .home-secondary-entry-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
body.site-touch-layout .tools-tier-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:760px){body.site-touch-layout :is(.home-secondary-entry-grid,.tools-tier-grid){grid-template-columns:1fr}}

/* 2026-10 workspace candidate. Management and classroom surfaces use different
   densities. Existing themes, content, form actions and whiteboard stay intact. */
body.site-touch-layout {
    --site-dock-height: 76px;
    --workspace-accent: #3c7ee8;
    --workspace-focus: #78afff;
    --workspace-sidebar: 226px;
    font-size: 16px;
    line-height: 1.6;
}
body.site-touch-layout main.app-shell {
    max-width: 1480px !important;
    margin-inline: auto !important;
    padding: 28px clamp(20px, 3.2vw, 52px) 112px !important;
}
body.site-touch-layout .topbar {
    margin-bottom: 28px;
    padding: 0 0 22px !important;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
body.site-touch-layout .topbar h1 { font-size: clamp(24px, 2.4vw, 32px); letter-spacing: -.025em; font-weight: 750; }
body.site-touch-layout .topbar .teacher-meta { font-size: 14px; color: var(--muted); }
body.site-touch-layout .topbar-date { font-size: 14px; font-variant-numeric: tabular-nums; }
body.site-touch-layout .topbar-action-links { display: flex !important; gap: 8px; }
body.site-touch-layout :is(.primary-btn,.secondary-btn,.mini-btn,.icon-link) {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 15px;
    line-height: 1.35;
    border-radius: 9px;
    clip-path: none;
}
body.site-touch-layout :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=file]),select) {
    min-height: 46px;
    font-size: 16px;
    border-radius: 9px;
}
body.site-touch-layout textarea { font-size: 16px; line-height: 1.7; border-radius: 9px; }
body.site-touch-layout :is(a,button,input,select,textarea):focus-visible {
    outline: 3px solid var(--workspace-focus);
    outline-offset: 3px;
}
body.site-touch-layout :is(.panel,.class-command-deck,.tools-command-deck) { border-radius: 14px; }
body.site-touch-layout .panel { padding: clamp(20px, 2.1vw, 30px); margin-bottom: 24px; }
body.site-touch-layout .section-head { gap: 16px; align-items: center; }
body.site-touch-layout .section-head h2 { font-size: 20px; line-height: 1.4; }
body.site-touch-layout .today-head { margin-bottom: 24px; gap: 16px; }
body.site-touch-layout .today-head h2 { font-size: 25px; line-height: 1.4; }
body.site-touch-layout .today-head-class-form { margin-left: auto; }
body.site-touch-layout .home-context-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; margin: 0 0 28px; }
body.site-touch-layout .home-context-card { min-height: 116px; border-radius: 12px; padding: 18px 20px; }
body.site-touch-layout .home-context-card strong { font-size: 20px; line-height: 1.4; }
body.site-touch-layout .home-context-card > span { font-size: 14px; }
body.site-touch-layout .home-whiteboard-entry { background: #2d66bf; color: #fff; border-color: #2d66bf; box-shadow: none; }
body.site-touch-layout .home-whiteboard-entry strong { color: #fff; }
body.site-touch-layout .home-whiteboard-entry .titanium-icon { width: 44px; height: 44px; }
body.site-touch-layout .today-record-head { margin-bottom: 12px; }
body.site-touch-layout .today-record-head h3 { font-size: 16px; }
body.site-touch-layout .today-card-grid.today-record-strip { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
body.site-touch-layout .today-card { padding: 18px; min-height: 124px; border-radius: 12px; }
body.site-touch-layout .today-card > span { font-size: 14px; }
body.site-touch-layout .today-card > strong { font-size: 25px; line-height: 1.45; font-variant-numeric: tabular-nums; }
body.site-touch-layout .today-card > small { font-size: 13px; line-height: 1.5; }
body.site-touch-layout .today-attention-card { padding: 16px 18px; border-radius: 10px; }
body.site-touch-layout .home-secondary-entry-grid { gap: 18px; }
body.site-touch-layout .home-secondary-entry-grid .quick-card { min-height: 116px; padding: 22px; border-radius: 12px; }
body.site-touch-layout .home-secondary-entry-grid .quick-card > span { font-size: 18px; }
body.site-touch-layout .home-secondary-entry-grid .quick-card > small { font-size: 14px; margin-top: 7px; }
body.site-touch-layout .site-dock {
    gap: 0;
    min-height: 0;
    padding: 8px !important;
    border-radius: 14px;
    box-shadow: 0 6px 24px #0002;
}
body.site-touch-layout .site-dock :is(a,button) { min-height: 46px !important; padding: 10px 14px !important; font-size: 15px !important; border-radius: 8px; }
body.site-touch-layout .site-dock .console-key { min-width: 0; gap: 8px; clip-path: none; }
.site-primary-links { display: none; }
.site-context-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.site-page-actions { gap: 8px; }
.site-page-actions > button { min-width: 120px; max-width: 320px; overflow-wrap: anywhere; }
body.site-touch-layout .site-dock img { display: block; width: 20px; height: 20px; }
body.site-touch-layout .site-menu { inset-inline: auto 24px; width: min(680px,calc(100% - 48px)); border-radius: 16px; }
body.site-touch-layout .console-menu-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
body.site-touch-layout .console-menu-grid .console-key { min-height: 72px !important; font-size: 16px !important; border-radius: 10px; padding: 14px; white-space: normal; }
body.site-touch-layout .console-menu-footer { font-size: 16px; }
body.site-touch-layout .console-menu-footer button { min-width: 110px; }
@media (min-width: 1180px) {
    body.site-touch-layout .desktop-side-nav {
        display: flex !important; flex-direction: column; position: fixed; inset: 0 auto 0 0;
        width: var(--workspace-sidebar); height: 100dvh; margin: 0; padding: 32px 18px;
        border: 0; border-right: 1px solid var(--line); border-radius: 0;
        background: var(--panel); box-shadow: none; z-index: 105;
    }
    body.site-touch-layout .desktop-side-brand { min-height: 52px; padding: 0 12px; margin: 0 0 34px; gap: 12px; font-size: 21px; }
    body.site-touch-layout .desktop-side-brand img { width: 34px; height: 34px; border-radius: 9px; }
    body.site-touch-layout .desktop-side-links { display: grid; gap: 8px; }
    body.site-touch-layout .desktop-side-links a { grid-template-columns: 22px minmax(0,1fr); gap: 12px; min-height: 50px; padding: 12px 14px; font-size: 15px; border-radius: 9px; }
    body.site-touch-layout .desktop-side-links a.active { background: color-mix(in srgb,var(--workspace-accent) 15%,transparent); color: var(--text); border-left: 3px solid var(--workspace-accent); }
    body.site-touch-layout main.app-shell { width: calc(100% - var(--workspace-sidebar)) !important; margin-left: var(--workspace-sidebar) !important; }
    body.site-touch-layout .topbar-brand-line { display: none; }
    body.site-touch-layout .topbar > div:first-child { display: block; }
    body.site-touch-layout .site-dock { inset: auto 28px 20px auto !important; transform: none; }
}
@media (max-width: 1179px) {
    body.site-touch-layout .desktop-side-nav { display: none !important; }
    body.site-touch-layout .site-dock { width: min(660px,calc(100% - 24px)) !important; display: flex !important; flex-direction: column; }
    .site-primary-links { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); width: 100%; gap: 4px; }
    body.site-touch-layout .site-dock .site-primary-link { display: flex; flex-direction: column; gap: 4px; min-height: 56px !important; padding: 6px !important; font-size: 13px !important; color: var(--muted); }
    body.site-touch-layout .site-primary-link.is-active { color: var(--text); background: color-mix(in srgb,var(--workspace-accent) 15%,transparent); font-weight: 700; }
    .site-context-controls { width: 100%; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
    body.site-touch-layout .site-dock .site-fullscreen { display: none; }
    body.site-touch-layout { --site-dock-height: 132px; }
    body.site-touch-layout main.app-shell { padding-bottom: 172px !important; }
    .site-page-actions { flex: 1; }
    .site-page-actions > button { min-width: 0; max-width: none; }
}
@media (max-width: 760px) {
    body.site-touch-layout main.app-shell { padding: 20px 16px 176px !important; }
    body.site-touch-layout .topbar { margin-bottom: 22px; padding-bottom: 18px !important; gap: 12px; }
    body.site-touch-layout .topbar-brand-line { display: none; }
    body.site-touch-layout .topbar > div:first-child { display: block; }
    body.site-touch-layout .topbar-action-links { display: none !important; }
    body.site-touch-layout .topbar-actions { display: none; }
    body.site-touch-layout .panel { padding: 20px 16px; margin-bottom: 18px; }
    body.site-touch-layout .today-head { flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
    body.site-touch-layout .today-head h2 { font-size: 22px; }
    body.site-touch-layout .home-context-row { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
    body.site-touch-layout .home-whiteboard-entry { grid-column: 1/-1; min-height: 84px; }
    body.site-touch-layout .home-context-card { padding: 14px; min-height: 102px; }
    body.site-touch-layout .home-context-card strong { font-size: 17px; }
    body.site-touch-layout .today-card-grid.today-record-strip { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    body.site-touch-layout .today-card { min-height: 118px; padding: 14px; }
    body.site-touch-layout .home-secondary-entry-grid { grid-template-columns: 1fr; gap: 12px; }
    body.site-touch-layout .home-secondary-entry-grid .quick-card { min-height: 94px; }
    body.site-touch-layout .site-menu { inset-inline: 12px; width: auto; max-height: 60dvh; }
    body.site-touch-layout .console-menu-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    body.site-touch-layout .site-dock :is(a,button) { font-size: 14px !important; padding: 8px 10px !important; }
}
@media (pointer: coarse) {
    body.site-touch-layout :is(.primary-btn,.secondary-btn,.mini-btn,.icon-link) { min-height: 48px; }
    body.site-touch-layout :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]),select) { min-height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
    body.site-touch-layout *, body.site-touch-layout *::before, body.site-touch-layout *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    body.site-touch-layout .desktop-side-nav { display: none !important; }
    body.site-touch-layout main.app-shell { width: 100% !important; margin: 0 !important; padding: 0 !important; }
}
body.site-touch-layout .console-menu-key { background: var(--panel); color: var(--text); font-weight: 600; }
body.site-touch-layout .site-primary-link img,
body.site-touch-layout .console-key img { filter: brightness(0) invert(.24); }
body.site-touch-layout[data-theme="opal_obsidian"] .site-primary-link img,
body.site-touch-layout[data-theme="opal_obsidian"] .console-key img { filter: brightness(0) invert(.88); }

/* 2026-10 visual review: a compact home workspace, with both existing themes.
   Keep classroom forms/whiteboard layouts separate from management navigation. */
body.site-touch-layout .desktop-side-links img { width: 21px; height: 21px; opacity: .76; }
body.site-touch-layout[data-theme="opal_obsidian"] .desktop-side-links img { filter: brightness(0) invert(.88); }
body.site-touch-layout .desktop-side-links a.active img { opacity: 1; }
body.site-touch-layout[data-theme]:not(.mode-whiteboard) .topbar {
    background: transparent; box-shadow: none; margin-bottom: 22px;
}
body.site-touch-layout.page-home[data-theme] .topbar h1 { font-weight: 720; }
body.site-touch-layout.page-home[data-theme] .today-hero {
    background: var(--panel); box-shadow: none; padding: 24px; gap: 0;
}
body.site-touch-layout.page-home[data-theme] .today-head {
    display: grid; grid-template-columns: minmax(0,1fr) minmax(180px,240px) auto;
    align-items: center; gap: 12px; margin-bottom: 22px;
}
body.site-touch-layout.page-home[data-theme] .today-head h2 { font-size: 22px; line-height: 1.35; margin: 0; }
body.site-touch-layout.page-home[data-theme] .today-head-class-form { min-width: 0; margin: 0; }
body.site-touch-layout.page-home[data-theme] .today-head-class-form select { width: 100%; min-width: 0; }
body.site-touch-layout.page-home[data-theme] .home-context-row {
    grid-template-columns: 1.3fr 1fr 1fr; gap: 12px; margin-bottom: 24px;
}
body.site-touch-layout.page-home[data-theme] .home-context-card {
    min-height: 108px; padding: 18px; border-radius: 12px; box-shadow: none;
}
body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry {
    gap: 16px; border-color: #3568c4; background: #3568c4; color: #fff;
    box-shadow: none; text-decoration: none;
}
body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry::before,
body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry::after { display: none; }
body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry strong { color: #fff; font-size: 20px; }
body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry .titanium-icon { width: 40px; height: 40px; }
body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry:hover { background: #2b5bb2; border-color: #2b5bb2; }
body.site-touch-layout.page-home[data-theme] .home-context-card:not(.home-whiteboard-entry) {
    background: transparent; border-color: var(--line); align-content: center; gap: 5px;
}
body.site-touch-layout.page-home[data-theme] .home-context-card:not(.home-whiteboard-entry) > span { color: var(--muted); font-size: 13px; }
body.site-touch-layout.page-home[data-theme] .home-context-card:not(.home-whiteboard-entry) strong {
    font-size: 26px; line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums;
}
body.site-touch-layout.page-home[data-theme] .retention-day-dots { gap: 5px; margin-top: 3px; }
body.site-touch-layout.page-home[data-theme] .retention-day-dots i { width: 7px; height: 7px; }
body.site-touch-layout.page-home[data-theme] .today-record-head {
    margin: 0 0 12px; padding: 0; border: 0; align-items: center;
}
body.site-touch-layout.page-home[data-theme] .today-record-head h3 { font-size: 15px; font-weight: 600; }
body.site-touch-layout.page-home[data-theme] .today-record-head > span { color: var(--muted); font-size: 13px; }
body.site-touch-layout.page-home[data-theme] .today-card-grid.today-record-strip {
    border: 0; background: transparent; border-radius: 0; overflow: visible; gap: 12px;
}
body.site-touch-layout.page-home[data-theme] .today-card {
    min-height: 112px; padding: 15px 16px; border: 1px solid var(--line);
    border-radius: 11px; background: transparent; box-shadow: none;
}
body.site-touch-layout.page-home[data-theme] .today-card > span { font-size: 13px; color: var(--muted); }
body.site-touch-layout.page-home[data-theme] .today-card strong { font-size: 26px; line-height: 1.35; font-weight: 700; }
body.site-touch-layout.page-home[data-theme] .today-card small { color: var(--muted); font-size: 12px; }
body.site-touch-layout.page-home[data-theme] .today-card.done { border-top: 3px solid var(--success); }
body.site-touch-layout.page-home[data-theme] .today-card.todo { border-top: 3px solid #d19a45; }
body.site-touch-layout.page-home[data-theme] .today-card:hover { background: color-mix(in srgb,var(--workspace-accent) 8%,var(--panel)); }
body.site-touch-layout.page-home[data-theme] .today-attention-panel {
    color: var(--text); border: 1px solid var(--line); background: var(--panel); box-shadow: none;
}
body.site-touch-layout.page-home[data-theme] .today-attention-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 28px; }
body.site-touch-layout.page-home[data-theme] .today-attention-card {
    display: grid; grid-template-columns: 72px minmax(0,1fr); align-items: center; gap: 12px;
    min-height: 68px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line);
    border-radius: 0; background: transparent; box-shadow: none; color: var(--text);
}
body.site-touch-layout.page-home[data-theme] .today-attention-card strong { font-size: 15px; color: var(--text); }
body.site-touch-layout.page-home[data-theme] .today-attention-card small { font-size: 13px; color: var(--muted); }
body.site-touch-layout.page-home[data-theme] .home-secondary-entry-grid .quick-card {
    min-height: 104px; padding: 18px 20px; box-shadow: none;
}
body.site-touch-layout.page-home[data-theme] .home-secondary-entry-grid .quick-card > span { font-size: 17px; }
@media (max-width: 1179px) {
    body.site-touch-layout.page-home { --site-dock-height: 80px; }
    body.site-touch-layout.page-home main.app-shell { padding-bottom: 112px !important; }
    body.site-touch-layout.page-home .site-dock { flex-direction: row; align-items: stretch; }
    body.site-touch-layout.page-home .site-primary-links { flex: 1; }
    body.site-touch-layout.page-home .site-context-controls {
        width: auto; flex: 0 0 62px; justify-content: center; border: 0; margin: 0; padding: 0;
    }
    body.site-touch-layout.page-home .site-context-controls .console-menu-key {
        flex-direction: column; gap: 4px; width: 100%; min-height: 56px !important;
        padding: 6px !important; font-size: 13px !important; border: 0; background: transparent; box-shadow: none;
    }
}
@media (max-width: 760px) {
    body.site-touch-layout.page-home[data-theme] main.app-shell { padding: 16px 14px 112px !important; }
    body.site-touch-layout.page-home[data-theme] .topbar { margin-bottom: 18px; padding-bottom: 14px !important; }
    body.site-touch-layout.page-home[data-theme] .topbar h1 { font-size: 24px; }
    body.site-touch-layout.page-home[data-theme] .topbar .teacher-meta { margin-top: 4px; font-size: 13px; }
    body.site-touch-layout.page-home[data-theme] .today-hero { padding: 18px 16px; }
    body.site-touch-layout.page-home[data-theme] .today-head {
        grid-template-columns: minmax(0,1fr) auto; gap: 10px; margin-bottom: 18px;
    }
    body.site-touch-layout.page-home[data-theme] .today-head > div { grid-column: 1/-1; }
    body.site-touch-layout.page-home[data-theme] .today-head h2 { font-size: 20px; }
    body.site-touch-layout.page-home[data-theme] .today-head .mini-btn { justify-self: stretch; }
    body.site-touch-layout.page-home[data-theme] .home-context-row {
        grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 20px;
    }
    body.site-touch-layout.page-home[data-theme] .home-context-card { min-height: 88px; padding: 13px; }
    body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry { grid-column: 1/-1; min-height: 72px; gap: 12px; }
    body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry strong { font-size: 18px; }
    body.site-touch-layout.page-home[data-theme] .home-whiteboard-entry .titanium-icon { width: 32px; height: 32px; }
    body.site-touch-layout.page-home[data-theme] .home-context-card:not(.home-whiteboard-entry) strong { font-size: 24px; }
    body.site-touch-layout.page-home[data-theme] .today-card-grid.today-record-strip { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    body.site-touch-layout.page-home[data-theme] .today-card { min-height: 104px; padding: 12px 13px; }
    body.site-touch-layout.page-home[data-theme] .today-card strong { font-size: 24px; }
    body.site-touch-layout.page-home[data-theme] .today-attention-panel { padding: 18px 16px; }
    body.site-touch-layout.page-home[data-theme] .today-attention-grid { grid-template-columns: minmax(0,1fr); }
    body.site-touch-layout.page-home[data-theme] .today-attention-panel .section-head { flex-wrap: wrap; }
}

/* Roster actions remain native disclosures and retain server-controlled open
   states after validation errors. Compact closed tools to expose the list. */
body.site-touch-layout[data-theme] .readonly-notice {
    border: 1px solid var(--line); border-left: 3px solid var(--workspace-accent);
    background: var(--panel); color: var(--text); box-shadow: none; padding: 12px 16px;
    font-size: 14px; line-height: 1.65;
}
body.site-touch-layout.page-class[data-theme] .class-page-selector-panel { padding: 16px 18px; }
body.site-touch-layout.page-class[data-theme] .class-page-selector-panel .inline-form { margin: 0; width: 100%; }
body.site-touch-layout.page-class[data-theme] .class-page-selector-panel label {
    display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center;
    gap: 14px; width: 100%; font-size: 14px;
}
body.site-touch-layout.page-class[data-theme] .class-page-selector-panel select { min-width: 0; width: 100%; }
body.site-touch-layout.page-class[data-theme] .class-student-entry-row { gap: 12px; margin-bottom: 12px; }
body.site-touch-layout.page-class[data-theme] details.tool-collapse {
    padding: 0; margin-bottom: 12px; border-radius: 12px; box-shadow: none;
}
body.site-touch-layout.page-class[data-theme] .class-student-entry-row details.tool-collapse { margin-bottom: 0; }
body.site-touch-layout.page-class[data-theme] details.tool-collapse > summary {
    min-height: 56px; padding: 12px 16px; margin: 0; box-sizing: border-box;
    font-size: 15px; font-weight: 600; color: var(--text);
}
body.site-touch-layout.page-class[data-theme] details.tool-collapse > summary::after { font-size: 12px; padding: 4px 8px; }
body.site-touch-layout.page-class[data-theme] details.tool-collapse[open] > summary { border-bottom: 1px solid var(--line); }
body.site-touch-layout.page-class[data-theme] details.tool-collapse > .stack-form,
body.site-touch-layout.page-class[data-theme] details.tool-collapse > .student-management-grid { padding: 16px; }
body.site-touch-layout.page-class[data-theme] details.tool-collapse > p { margin: 14px 16px; }
body.site-touch-layout.page-class[data-theme] #student-list .section-head { margin-bottom: 14px; }
body.site-touch-layout.page-class[data-theme] #student-list .section-head p { margin: 4px 0 0; }
body.site-touch-layout.page-class[data-theme] .student-search-field { margin: 10px 0 14px; }
body.site-touch-layout.page-class[data-theme] .student-card span { min-width: 0; overflow-wrap: anywhere; }
body.site-touch-layout.page-class[data-theme] .student-card[hidden],
body.site-touch-layout.page-class[data-theme] .student-search-status[hidden] { display: none !important; }
body.site-touch-layout.page-class[data-theme] .student-search-status { margin: 0 0 12px; }
@media (max-width: 760px) {
    body.site-touch-layout.page-class[data-theme] .class-page-selector-panel { padding: 14px 16px; }
    body.site-touch-layout.page-class[data-theme] .class-page-selector-panel label { grid-template-columns: 64px minmax(0,1fr); gap: 10px; }
    body.site-touch-layout.page-class[data-theme] details.tool-collapse > summary { min-height: 54px; padding: 10px 14px; }
}

/* Mobile navigation keeps Back beside the page title. A second dock row is
   reserved for pages with an actual visible save shortcut. */
.topbar-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
body.site-touch-layout .site-header-back { display: none; }
@media (max-width: 1179px) {
    body.site-touch-layout .site-header-back {
        display: inline-flex; flex: 0 0 44px; width: 44px; height: 44px;
        min-height: 44px; padding: 10px; border-radius: 10px;
    }
    body.site-touch-layout .site-header-back img { width: 22px; height: 22px; }
    body.site-touch-layout[data-theme="opal_obsidian"] .site-header-back img { filter: brightness(0) invert(.88); }
    body.site-touch-layout .site-dock .site-back { display: none; }
    body.site-touch-layout .site-dock:not(.has-context-action) { flex-direction: row; align-items: stretch; }
    body.site-touch-layout .site-dock:not(.has-context-action) .site-primary-links { flex: 1; }
    body.site-touch-layout .site-dock:not(.has-context-action) .site-context-controls {
        width: auto; flex: 0 0 62px; justify-content: center; border: 0; margin: 0; padding: 0;
    }
    body.site-touch-layout .site-dock:not(.has-context-action) .console-menu-key {
        flex-direction: column; gap: 4px; width: 100%; min-height: 56px !important;
        padding: 6px !important; font-size: 13px !important; border: 0; background: transparent; box-shadow: none;
    }
    body.site-touch-layout:has(.site-dock:not(.has-context-action)) { --site-dock-height: 80px; }
    body.site-touch-layout:has(.site-dock:not(.has-context-action)) main.app-shell { padding-bottom: 112px !important; }
}

body.site-touch-layout.page-home[data-theme] .home-whiteboard-arrow { color: #fff; opacity: .9; }

/* Keep ordinary homework entry readable and operable at narrow widths. These
   rules target editable cards; historical read-only status grids stay intact. */
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) .homework-status-student-grid:has(.homework-status-student-card) {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 10px;
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) .homework-status-student-card {
    grid-template-columns: minmax(0, 56px) minmax(0, 1fr);
    align-items: center; gap: 10px; padding: 10px;
    background: var(--panel); border-color: var(--line);
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) .homework-status-student-card > strong {
    color: var(--text); white-space: normal; overflow-wrap: anywhere;
    line-height: 1.45; font-size: 13px;
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) :is(.homework-status-choice, .homework-status-subject-row) label {
    position: relative;
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) :is(.homework-status-choice, .homework-status-subject-row) input {
    width: 1px; height: 1px; min-width: 0; min-height: 0;
    padding: 0; margin: 0; border: 0; left: 50%; top: 50%;
    overflow: hidden; clip-path: inset(50%);
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) :is(.homework-status-choice, .homework-status-subject-row) span {
    min-height: 44px; padding: 6px 4px; color: var(--text);
    background: var(--panel); border: 1px solid var(--line);
    box-shadow: none; white-space: nowrap;
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) :is(.homework-status-choice, .homework-status-subject-row) input:checked + span {
    color: var(--text); border-color: var(--workspace-accent);
    background: color-mix(in srgb, var(--workspace-accent) 18%, var(--panel));
    box-shadow: inset 0 0 0 1px var(--workspace-accent);
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) .homework-status-choice input[value="excellent"]:checked + span {
    border-color: var(--success); background: color-mix(in srgb, var(--success) 18%, var(--panel));
    box-shadow: inset 0 0 0 1px var(--success);
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) .homework-status-choice input[value="incomplete"]:checked + span {
    border-color: var(--danger); background: color-mix(in srgb, var(--danger) 18%, var(--panel));
    box-shadow: inset 0 0 0 1px var(--danger);
}
body.site-touch-layout.page-homework_statuses[data-theme]:not(.mode-whiteboard) :is(.homework-status-choice, .homework-status-subject-row) input:focus-visible + span,
body.site-touch-layout[data-theme] .file-upload-field:has(.file-upload-input:focus-visible) .file-upload-btn {
    outline: 3px solid var(--workspace-accent); outline-offset: 3px;
}

/* Reach-first candidate: fix observed content clipping without changing data. */
body.site-touch-layout[data-theme]:is(.page-homework_statuses,.page-lesson_evaluations) .classroom-context-row {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}
body.site-touch-layout[data-theme] .homework-status-context-row .classroom-choice-fieldset {
    grid-column: 1 / -1;
}
body.site-touch-layout[data-theme] .homework-subject-controls {
    grid-template-columns: minmax(0, 2fr) minmax(170px, 1fr);
}
body.site-touch-layout[data-theme] .classroom-context-row :is(input, select) { min-width: 0; max-width: 100%; width: 100%; }
body.site-touch-layout[data-theme] .score-options label { position: relative; min-width: 0; }
body.site-touch-layout[data-theme] .score-options input {
    width: 1px; height: 1px; min-width: 0; min-height: 0; padding: 0; margin: 0;
    left: 50%; top: 50%; clip-path: inset(50%);
}
body.site-touch-layout[data-theme] .score-options span {
    color: var(--text); background: var(--panel); border: 1px solid var(--line); min-height: 52px;
}
body.site-touch-layout[data-theme] .score-options input:checked + span {
    background: color-mix(in srgb, var(--workspace-accent) 20%, var(--panel));
    border-color: var(--workspace-accent); box-shadow: inset 0 0 0 1px var(--workspace-accent);
}
body.site-touch-layout[data-theme] .score-options input:focus-visible + span {
    outline: 3px solid var(--workspace-focus); outline-offset: 3px;
}
body.site-touch-layout.page-seat_planner .seat-planner-layout {
    grid-template-columns: minmax(210px, .65fr) minmax(0, 2fr);
}
body.site-touch-layout.page-seat_planner .seat-planner-layout > :last-child { grid-column: 1 / -1; }
body.site-touch-layout.page-seat_planner .seat-board-panel { min-width: 0; }
@media (max-width: 1350px) {
    body.site-touch-layout.page-seat_planner .seat-planner-layout { grid-template-columns: minmax(0, 1fr); }
    body.site-touch-layout.page-seat_planner .seat-board-panel { grid-row: 1; }
}
@media (max-width: 600px) {
    body.site-touch-layout[data-theme] .homework-subject-controls { grid-template-columns: minmax(0, 1fr); }
}

/* Shared homework paint interaction: one status tool, names only. */
.homework-paint-ready .homework-status-student-card > :not(.homework-name-key) { display: none !important; }
.homework-paint-ready .homework-status-student-grid { grid-template-columns: repeat(auto-fill,minmax(100px,1fr)) !important; gap: 10px !important; }
.homework-paint-ready .homework-status-student-card { display: block !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
.homework-paint-toolbar { display: flex; gap: 12px; align-items: center; }
.homework-paint-tool, .homework-name-key { font: 600 18px/1.25 system-ui,sans-serif; min-height: 52px; border-radius: 9px; border: 2px solid var(--line); cursor: pointer; touch-action: manipulation; }
.homework-paint-tool { min-width: 128px; padding: 10px 22px; color: #fff; }
.homework-paint-tool[data-status=excellent] { background: #7138a8; border-color: #7138a8; }
.homework-paint-tool[data-status=completed] { background: #185db0; border-color: #185db0; }
.homework-paint-tool[data-status=incomplete] { background: #b62736; border-color: #b62736; }
.homework-paint-tool[aria-pressed=true] { outline: 3px solid var(--text); outline-offset: 3px; box-shadow: inset 0 0 0 2px #fff; }
.homework-name-key { width: 100%; padding: 8px; color: var(--text); background: var(--panel); overflow-wrap: anywhere; }
.homework-status-student-card[data-status=excellent] .homework-name-key { background: #7138a8; border-color: #7138a8; color: #fff; }
.homework-status-student-card[data-status=completed] .homework-name-key { background: #185db0; border-color: #185db0; color: #fff; }
.homework-status-student-card[data-status=incomplete] .homework-name-key { background: #b62736; border-color: #b62736; color: #fff; }
.homework-paint-ready :is(.homework-name-key,.homework-paint-tool):focus-visible { outline: 4px solid var(--text); outline-offset: 3px; }
.homework-paint-feedback { padding: 10px; border: 1px solid var(--line); }
@media(max-width:600px) { .homework-paint-toolbar { gap: 10px; } .homework-paint-tool { flex: 1; min-width: 0; padding: 10px 8px; } }
@media(forced-colors:active) { .homework-paint-tool[aria-pressed=true] { outline: 4px solid Highlight; } .homework-name-key { forced-color-adjust: none; } }
.homework-name-key { transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease; }
.homework-name-key.is-painted { animation: homework-paint-confirm 180ms cubic-bezier(.2,.8,.2,1); }
.homework-paint-tool { transition: box-shadow 120ms ease, outline-color 120ms ease; }
@keyframes homework-paint-confirm { 0% { transform: scale(.96); } 65% { transform: scale(1.018); } 100% { transform: scale(1); } }
@media(prefers-reduced-motion:reduce) { .homework-name-key,.homework-paint-tool { animation: none !important; transition: none !important; } }
.discipline-paint-ready .discipline-mode-fieldset, .discipline-paint-ready > label { display: none; }
.discipline-paint-ready .discipline-setup-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.discipline-paint-ready .discipline-student-grid { grid-template-columns: repeat(auto-fill,minmax(100px,1fr)); gap: 10px; }
.discipline-paint-ready .discipline-student-btn.excellent { background: #7138a8; border-color: #7138a8; color: #fff; }
.discipline-paint-ready .discipline-student-btn.normal { background: #185db0; border-color: #185db0; color: #fff; }
.discipline-paint-ready .discipline-student-btn.violation { background: #b62736; border-color: #b62736; color: #fff; }
.discipline-paint-ready .homework-name-key:focus-visible { outline: 4px solid var(--text); outline-offset: 3px; }
/* Numeric entry stays numeric; tighten cards without hiding keep/absent/clear. */
body.site-touch-layout.page-scores .score-form { gap: 12px; }
body.site-touch-layout.page-scores .score-card { padding: 14px; gap: 10px; min-width: 0; }
body.site-touch-layout.page-scores .score-card h3 { margin: 0 0 8px; font-size: 17px; }
body.site-touch-layout.page-scores .score-card :is(input,select) { min-width: 0; width: 100%; min-height: 44px; }
body.site-touch-layout.page-exams .exam-class-selector-panel { padding-block: 16px; }
body.site-touch-layout.page-exams .exam-management-grid { grid-template-columns: minmax(240px,.8fr) minmax(0,1.5fr); }
@media(max-width:1000px) { body.site-touch-layout.page-exams .exam-management-grid { grid-template-columns: minmax(0,1fr); } }
/* Border patterns reinforce the same status tools without repeating text. */
.homework-status-student-card[data-status=excellent] .homework-name-key,
.discipline-paint-ready .discipline-student-btn.excellent { border-style: double; border-width: 4px; border-color: #dfc2ff; }
.homework-status-student-card[data-status=incomplete] .homework-name-key,
.discipline-paint-ready .discipline-student-btn.violation { border-style: dashed; border-color: #ffd0d5; }
/* Historical records keep their read-only text and unknown state; only confirmed
   statuses share the live-entry palette. */
body.page-homework_status .homework-status-student-grid.readonly > .excellent,
body.page-discipline_status .discipline-student-grid.readonly > .excellent { background: #7138a8; border-color: #7138a8; color: #fff !important; }
body.page-homework_status .homework-status-student-grid.readonly > .completed,
body.page-discipline_status .discipline-student-grid.readonly > .normal { background: #185db0; border-color: #185db0; color: #fff !important; }
body.page-homework_status .homework-status-student-grid.readonly > .incomplete,
body.page-discipline_status .discipline-student-grid.readonly > .violation { background: #b62736; border-color: #b62736; color: #fff !important; }

/* Post-freeze mobile fix: the paint tools follow long name lists; low actions
   stay in one compact row. Desktop paint placement is unchanged. */
@media (max-width: 760px) {
    body.site-touch-layout:has(.homework-paint-ready,.discipline-paint-ready) { --site-dock-height: 80px; overflow: visible; }
    body.site-touch-layout:has(.homework-paint-ready,.discipline-paint-ready) main.app-shell { overflow: visible !important; padding-bottom: 108px !important; }
    body.site-touch-layout .panel:has(> .homework-paint-ready,> .discipline-paint-ready) { overflow: visible; }
    body.site-touch-layout :is(.homework-paint-ready,.discipline-paint-ready) .homework-paint-toolbar {
        position: sticky; top: var(--record-paint-sticky-top, env(safe-area-inset-top, 0px)); z-index: 90;
        align-self: start; padding: 10px 4px; margin-inline: -4px;
        background: var(--panel); border-bottom: 1px solid var(--line);
        box-shadow: 0 4px 8px #0002;
    }
    body.site-touch-layout :is(.homework-paint-ready,.discipline-paint-ready) .homework-name-key { scroll-margin-top: 86px; scroll-margin-bottom: 100px; }
    body.site-touch-layout .homework-paint-ready > label,
    body.site-touch-layout .homework-paint-ready > p.muted { display: none; }
    body.site-touch-layout:has(.homework-paint-ready,.discipline-paint-ready) .site-dock { flex-direction: row; }
    body.site-touch-layout:has(.homework-paint-ready,.discipline-paint-ready) .site-primary-links { display: none; }
    body.site-touch-layout:has(.homework-paint-ready,.discipline-paint-ready) .site-context-controls { margin: 0; padding: 0; border: 0; width: 100%; }
    body.site-touch-layout:has(.homework-paint-ready,.discipline-paint-ready) .site-page-actions { flex: 1; }
    body.site-touch-layout:has(.homework-paint-ready,.discipline-paint-ready) .site-page-actions > button { min-width: max-content; }
}
@media(min-width:1180px) {
    body.site-touch-layout .site-page-actions { flex: 0 0 auto; }
    body.site-touch-layout .site-page-actions > button { flex: 0 0 auto; min-width: max-content !important; max-width: none; }
}

/* Optional grade tools remain intact, behind native disclosures. */
body.site-touch-layout.page-scores .score-entry-tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
body.site-touch-layout.page-scores details.score-entry-tool { padding: 0; margin: 0; overflow: visible; }
body.site-touch-layout.page-scores details.score-entry-tool > summary { padding: 14px 18px; min-height: 52px; cursor: pointer; font-size: 17px; font-weight: 650; }
body.site-touch-layout.page-scores details.score-entry-tool[open] { grid-column: 1 / -1; }
body.site-touch-layout.page-scores .score-entry-tool-content { padding: 4px 18px 18px; }
body.site-touch-layout.page-scores #manual-score-entry { scroll-margin-top: 16px; }
@media(max-width:600px) { body.site-touch-layout.page-scores .score-entry-tools { grid-template-columns: minmax(0,1fr); gap: 10px; } }
/* Preserve the native submitter as the dock's target, but show only one save. */
body.site-touch-layout:has(.homework-paint-ready,.discipline-paint-ready) main .site-save-source { display: none !important; }

/* Roster title and search share one row; wrapping preserves readable touch targets. */
body.site-touch-layout.page-class[data-theme] #student-list .student-list-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;}
body.site-touch-layout.page-class[data-theme] #student-list .student-list-head>div{flex:0 0 auto;max-width:100%;}
body.site-touch-layout.page-class[data-theme] #student-list .student-list-head .student-search-field{display:block;flex:0 1 240px;width:240px;max-width:100%;min-width:180px;margin:0 0 0 auto;}
body.site-touch-layout.page-class[data-theme] #student-list .student-list-head input[type=search]{width:100%;min-height:48px;box-sizing:border-box;}
@media(max-width:600px){body.site-touch-layout.page-class[data-theme] #student-list .student-list-head .student-search-field{flex:0 1 240px;min-width:0;}}

/* Five primary destinations keep the original font and touch dimensions. */
@media(max-width:1179px){
 body.site-touch-layout .site-primary-links{min-width:0;}
 body.site-touch-layout .site-dock .site-primary-link{min-width:44px;}
}
@media(max-width:420px){
 body.site-touch-layout .site-dock:not(.has-context-action){flex-direction:column!important;}
 body.site-touch-layout .site-dock:not(.has-context-action) .site-primary-links{width:100%;flex:none;}
 body.site-touch-layout .site-dock:not(.has-context-action) .site-context-controls{width:100%;flex:auto;justify-content:flex-end;}
 body.site-touch-layout .site-dock:not(.has-context-action) .console-menu-key{width:auto;min-width:62px;flex-direction:row;min-height:44px!important;}
 body.site-touch-layout:has(.site-dock:not(.has-context-action)){--site-dock-height:136px;}
 body.site-touch-layout:has(.site-dock:not(.has-context-action)) main.app-shell{padding-bottom:168px!important;}
}
