@media(max-width:767px){
 .workspace :is(.dt-layout-table,.grade-table-wrap,.overflow-x-auto):has(table[data-mobile-cards]){overflow:visible;max-height:none;min-width:0;isolation:auto}
 .workspace table[data-mobile-cards]{display:block;width:100%!important;min-width:0!important;max-width:100%;border:0;border-collapse:separate}
 .workspace table[data-mobile-cards] thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .workspace table[data-mobile-cards] tbody{display:grid;gap:16px;width:100%;padding:0 16px 16px;box-sizing:border-box}
 .workspace table[data-mobile-cards] tbody tr{display:flex;flex-direction:column;gap:12px;padding:16px;border:1px solid var(--color-border);border-radius:10px;background:#fff;min-width:0}
 .workspace table[data-mobile-cards] tbody td:nth-child(n){display:grid;grid-template-columns:minmax(90px,.8fr) minmax(0,1.2fr);gap:8px;align-items:start;position:static!important;left:auto!important;right:auto!important;width:auto!important;min-width:0!important;max-width:none!important;white-space:normal!important;background:transparent!important;box-shadow:none!important;border:0;padding:0!important;text-align:left;overflow-wrap:anywhere;font-size:.8125rem;line-height:1.7;order:1}
 .workspace table[data-mobile-cards] tbody td[data-card-label]::before{content:attr(data-card-label);color:var(--color-muted);font-size:.75rem;font-weight:400;line-height:1.7}
 .workspace table[data-mobile-cards] tbody td[data-card-title]{display:block;order:0;font-size:.9375rem;font-weight:600;color:var(--color-ink);border-bottom:1px solid #eeebf3;padding-bottom:12px!important;margin-bottom:2px}
 .workspace table[data-mobile-cards] tbody td[data-card-title]::before{display:none}
 .workspace table[data-mobile-cards] tbody td[data-card-empty]{display:block;text-align:center}
 .workspace table[data-mobile-cards] tbody td[data-card-actions]{display:flex;flex-wrap:wrap;align-items:center;gap:12px;border-top:1px solid var(--color-border);padding-top:12px!important;order:3}
 .workspace table[data-mobile-cards] tbody td[data-card-actions]::before{display:none}
 .workspace table[data-mobile-cards] td :is(input:not([type=hidden]),select,textarea){width:100%!important;min-width:0!important;max-width:100%;box-sizing:border-box}
 .workspace table[data-mobile-cards] td input[type=checkbox]{width:20px!important;height:20px!important;justify-self:start}
 .workspace table[data-mobile-cards] td input[type=hidden]{display:none}
 .workspace table[data-mobile-cards] td .badge{justify-self:start;white-space:normal}
 .workspace table[data-mobile-cards] td .attendance-inline{display:flex;flex-direction:column;gap:16px}
 .workspace table[data-mobile-cards] td form{min-width:0;width:100%}
 .workspace table[data-mobile-cards] td .delete-detail{margin:0}
 .workspace table[data-mobile-cards] td[data-card-actions]>.text-link{min-height:40px;display:inline-flex;align-items:center}
 .workspace .data-grid-scroll:has(table[data-mobile-cards])+.grid-scroll-hint{display:none}
 /* Score cells retain the complete component/question label above the input. */
 .workspace table[data-score-cards] tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
 .workspace table[data-score-cards] tbody td:nth-child(n){display:flex;flex-direction:column;gap:8px}
 .workspace table[data-score-cards] tbody td:nth-child(-n+2){grid-column:1/-1}
 .workspace table[data-score-cards] tbody td:first-child{order:0;font-size:.75rem;color:var(--color-muted)}
 .workspace table[data-score-cards] tbody td[data-card-title]{order:-1;margin-bottom:0}
 .workspace table[data-score-cards] td input{min-height:46px}
 /* Monthly attendance becomes one calendar-style card for each student. */
 .workspace table[data-calendar-cards] tbody tr{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px}
 .workspace table[data-calendar-cards] tbody td:nth-child(n){grid-column:1/-1}
 .workspace table[data-calendar-cards] tbody td[data-card-day]{display:flex;flex-direction:column;align-items:center;gap:4px;grid-column:auto;border:1px solid #ebe6f3;border-radius:6px;padding:6px 2px!important;text-align:center;font-size:.8125rem}
 .workspace table[data-calendar-cards] tbody td[data-card-day]::before{font-size:.625rem;color:var(--color-muted)}
 .student-dialog table[data-mobile-cards] tbody{padding:0 0 16px}
}

/* DataTables adds a footer border to every cell in its last row. In a card
   those cells are stacked, so the footer border must not appear under each item. */
@media(max-width:767px){
 .workspace table:is([data-mobile-cards],[data-export-cards],[data-attendance-grid]){--dt-header_border:0;--dt-body_border:0}
 .workspace div.dt-container.dt-empty-footer table:is([data-mobile-cards],[data-export-cards],[data-attendance-grid])>tbody>tr:last-child>td,
 .workspace table:is([data-mobile-cards],[data-export-cards],[data-attendance-grid])>tbody>tr>td{border-bottom:0!important;box-shadow:none!important}
}

/* Shared mobile type scale; desktop typography remains unchanged. */
@media(max-width:767px){
 :root{--type-title:1.375rem;--type-section:1rem;--type-subheading:.875rem;--type-body:.8125rem;--type-small:.8125rem;--type-caption:.75rem;--type-micro:.6875rem}
 body{font-size:.8125rem;line-height:1.65}
 .app-layout .topbar .school-name{font-size:.9375rem;line-height:1.45;font-weight:600}
 .workspace h2,.workspace .panel-head h2{font-size:1rem;line-height:1.5;font-weight:600}
 .workspace h3{font-size:.875rem;line-height:1.5;font-weight:600}
 .workspace .eyebrow{font-size:.625rem;line-height:1.6;letter-spacing:.07em}
 .workspace :is(p,.hint,.subtext,.empty p){font-size:.8125rem;line-height:1.75}
 .workspace :is(label,legend){font-size:.75rem;line-height:1.6;font-weight:500}
 .workspace :is(.button,.secondary,.text-link,.danger){font-size:.8125rem;line-height:1.5}
 .workspace :is(.badge,.dash-status){font-size:.6875rem;line-height:1.5}
 .workspace :is(.notice,.error){font-size:.8125rem;line-height:1.75}
 .workspace :is(.attendance-heading,.grade-section-title,.uh-heading,.student-form-section>summary){font-size:.875rem;line-height:1.6}
 .workspace :is([data-attendance-status],[data-grade-save-status],[data-uh-save-status],[data-followup-status],[data-journal-status]){font-size:.75rem;line-height:1.7}
 .workspace .dash-welcome h2{font-size:1.375rem;line-height:1.4}
 .workspace .dash-welcome p:not(.eyebrow){font-size:.8125rem;line-height:1.8}
 .workspace .dash-stat>strong{font-size:1.625rem;line-height:1.25}
 .workspace .dash-stat>span,.workspace .dash-stat>p{font-size:.6875rem;line-height:1.7}
 .workspace .dash-task h3,.workspace .dash-module-row h3{font-size:.875rem;line-height:1.5}
 .workspace :is(.dash-task p,.dash-guide p,.dash-module-row p,.dash-today-item span){font-size:.75rem;line-height:1.75}
 .workspace :is(.dash-task-module,.dash-cell-note,.dash-module-progress>div){font-size:.6875rem;line-height:1.65}
 .workspace :is(.dash-today-item strong,.uh-stats strong,.followup-summary strong,.journal-counts strong){font-size:1.5rem;line-height:1.3}
 .workspace :is(.followup-summary span,.journal-counts span){font-size:.75rem;line-height:1.6}
 .workspace div.dt-container{font-size:.75rem}
 .workspace div.dt-container :is(.dt-search label,.dt-length label,.dt-info,.dt-paging .dt-paging-button){font-size:.6875rem;line-height:1.6}
 .workspace table:is([data-mobile-cards],[data-export-cards],[data-attendance-grid]) tbody td:nth-child(n){font-size:.8125rem;line-height:1.65}
 .workspace table:is([data-mobile-cards],[data-export-cards],[data-attendance-grid]) tbody td[data-card-title],.workspace table[data-export-cards] tbody td:nth-child(2),.workspace table[data-attendance-grid] tbody td:nth-child(2){font-size:.875rem;line-height:1.55;font-weight:600}
 .workspace table[data-mobile-cards] tbody td[data-card-label]::before,.workspace table[data-export-cards] tbody td:nth-child(n+3):not(:last-child)::before,.workspace table[data-attendance-grid] tbody td:nth-child(n+3)::before{font-size:.6875rem;line-height:1.6}
 .workspace table[data-export-cards] tbody td:first-child,.workspace table[data-attendance-grid] tbody td:first-child{font-size:.6875rem;line-height:1.6}
 .workspace table[data-calendar-cards] tbody td[data-card-day]{font-size:.75rem;line-height:1.5}
 .workspace table[data-calendar-cards] tbody td[data-card-day]::before{font-size:.625rem}
 .workspace .attendance-reason-summary{font-size:.75rem;line-height:1.7}
 .workspace :is(.attendance-legend,.grid-scroll-hint,.grade-missing,.uh-max,.grade-scope){font-size:.6875rem;line-height:1.7}
 .app-layout .sidebar .brand>span{font-size:.8125rem;line-height:1.5}
 .app-layout .sidebar nav>a,.app-layout .sidebar .nav-group-links>a{font-size:.875rem;line-height:1.5}
 .app-layout .sidebar .nav-group>summary{font-size:.6875rem;line-height:1.6}
 .app-layout .mobile-menu-account strong{font-size:.8125rem}
 .app-layout .mobile-menu-account span{font-size:.6875rem}
 .app-layout .sidebar-period-label{font-size:.625rem}
 .app-layout .sidebar-period-value>strong{font-size:.8125rem}
 .app-layout .sidebar-period-value>span{font-size:.625rem}
 .app-layout .sidebar-logout{font-size:.75rem}
 .student-dialog-head h2{font-size:1.125rem;line-height:1.5}
 .student-detail-grid dt{font-size:.6875rem;line-height:1.6}
 .student-detail-grid dd{font-size:.8125rem;line-height:1.75}
 .swal2-title{font-size:1.125rem;line-height:1.5}
 .swal2-html-container{font-size:.8125rem;line-height:1.75}
 .swal2-styled.swal2-confirm,.swal2-styled.swal2-cancel{font-size:.8125rem}
 .auth-story h1{font-size:1.75rem;line-height:1.35}
 .auth-main .page-title{font-size:1.5rem;line-height:1.4}
 .auth-main :is(label,.hint,.subtext){font-size:.8125rem;line-height:1.75}
 .workspace input:not([type=checkbox]):not([type=hidden]),.workspace select,.workspace textarea,div.dt-container .dt-search input,div.dt-container .dt-length select,.auth-main input,.auth-main select,.swal2-textarea{font-size:1rem;line-height:1.5}
 .footer-school{font-size:.6875rem;line-height:1.6}
 .footer-app{font-size:.625rem;line-height:1.6}
}

/* Compact mobile forms, matching the surrounding card typography. */
@media(max-width:767px){
 .workspace form label,.workspace form legend,.auth-main label{font-size:.75rem;line-height:1.5}
 .workspace input:not([type=checkbox]):not([type=hidden]),.workspace select,.workspace textarea,
 .workspace table td input:not([type=checkbox]):not([type=hidden]),.workspace table td select,.workspace table td textarea,
 .workspace div.dt-container .dt-search input,.workspace div.dt-container .dt-length select,
 .auth-main input,.auth-main select,.swal2-textarea{font-size:.875rem;line-height:1.5;min-height:44px;padding:10px 12px}
 .workspace form.module-filter>label>select{min-height:44px}
 .workspace form :is(.button,.secondary){font-size:.8125rem;line-height:1.5;min-height:44px;padding:10px 14px}
}

/* One card-list treatment for input, recap, administration and document lists. */
@media(max-width:767px){
 .workspace table[data-card-list] tbody{padding:16px;gap:16px;background:#f8f7fc;box-sizing:border-box}
 .workspace table[data-card-list] tbody tr{border:1px solid #d8cdeb;border-left:3px solid var(--color-primary);border-radius:12px;background:#fff;box-shadow:0 2px 8px #29157207;padding:16px;gap:12px;min-width:0}
 .workspace table[data-card-list] tbody tr:focus-within{border-color:#9274c7;box-shadow:0 0 0 2px #e9e0f8}
 .workspace table[data-card-list] tbody td{color:var(--color-ink);font-size:.8125rem;line-height:1.7}
 .workspace table[data-card-list] tbody td[data-card-title],
 .workspace table[data-export-cards] tbody td:nth-child(2),
 .workspace table[data-attendance-grid] tbody td:nth-child(2){background:#f4f0fb!important;color:var(--color-primary);font-size:.9375rem;font-weight:600;line-height:1.55;padding:12px!important;border:0!important;border-radius:7px;margin:0!important;overflow-wrap:anywhere}
 .workspace table[data-card-list] tbody td[data-card-label]::before,
 .workspace table[data-export-cards] tbody td:nth-child(n+3):not(:last-child)::before,
 .workspace table[data-attendance-grid] tbody td:nth-child(n+3)::before{color:#777080;font-size:.6875rem;font-weight:400;line-height:1.7}
 .workspace table[data-mobile-cards]:not([data-score-cards]):not([data-calendar-cards]) tbody td:not([data-card-title]):not([data-card-actions]):not([data-card-empty]){grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:12px}
 .workspace table[data-export-cards] tbody td:nth-child(n+3):not(:last-child){grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);gap:12px}
 .workspace table[data-export-cards] tbody td:first-child{font-size:.6875rem;color:#77648f;font-weight:500}
 .workspace table[data-attendance-grid] tbody td:first-child{margin-top:0;color:#777080;font-size:.6875rem}
 .workspace table[data-card-list] .badge{font-size:.6875rem;line-height:1.5;padding:4px 8px;border-radius:5px;font-weight:500;background:#eee9f9;color:var(--color-primary)}
 .workspace table[data-card-list] [data-card-status=final] .badge,
 .workspace table[data-card-list] [data-card-status=active] .badge{background:#edf7f0;color:#22603e}
 .workspace table[data-card-list] [data-card-status=draft] .badge{background:#fff6e4;color:#80591b}
 .workspace table[data-card-list] [data-card-status=inactive] .badge{background:#f0eef3;color:#766c80}
 .workspace table[data-card-list] tbody td[data-card-actions],
 .workspace table[data-export-cards] tbody td:last-child{border-top:1px solid #ece7f3!important;padding-top:14px!important;margin-top:2px}
 .workspace table[data-card-list] tbody td[data-card-actions]{display:flex;gap:10px;align-items:center}
 .workspace table[data-card-list] [data-card-actions]>.text-link{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:8px 12px;border:1px solid #ded4ee;border-radius:7px;background:#f9f7fd;text-decoration:none;font-size:.75rem}
 .workspace table[data-card-list] tbody tr:has([data-select-participant]:checked){border-color:#a891cd;background:#fff;box-shadow:0 0 0 1px #d9cbee}
 .workspace table[data-card-list] [data-card-empty]{padding:16px 0!important}
 .workspace table[data-calendar-cards] tbody td[data-card-day]{background:#faf8fe!important;border:1px solid #e7dff1;padding:7px 2px!important}
 .workspace table[data-score-cards] tbody td:nth-child(n+3){background:#faf9fc!important;padding:10px!important;border:1px solid #eee9f4;border-radius:7px}
 .workspace table[data-score-cards] tbody td input{background:#fff}
 .student-dialog table[data-card-list] tbody{padding:12px;background:#f8f7fc;border-radius:8px}
}

/* Editable card fields stack their label above the control on mobile. */
@media(max-width:767px){
 .workspace table[data-card-list] tbody td[data-card-label]:has(input:not([type=hidden]),select,textarea),
 .workspace table[data-mobile-cards]:not([data-score-cards]):not([data-calendar-cards]) tbody td[data-card-label]:has(input:not([type=hidden]),select,textarea){display:flex;flex-direction:column;align-items:stretch;gap:8px;grid-template-columns:none}
 .workspace table[data-card-list] tbody td[data-card-label]:has(input:not([type=hidden]),select,textarea)::before{display:block;width:100%;margin:0;font-size:.75rem;line-height:1.5}
 .workspace table[data-card-list] tbody td[data-card-label] :is(input:not([type=checkbox]):not([type=hidden]),select,textarea){display:block;width:100%!important;max-width:100%;min-width:0!important;margin:0;box-sizing:border-box}
 .workspace table[data-card-list] tbody td[data-card-label] input[type=checkbox]{align-self:flex-start}
}
