/* Siqma working surfaces. 1440 = 220 rail + 8 inset + 1212 sheet;
   sheet content = 1212 - 2 edge - 48 gutter = 1162. No decorative metrics. */
:root {
  --sidebar-width:220px; --ground:#f3f3f0; --surface:#fff; --raised:#f7f8f5;
  --active:#e9ece6; --ink:#252b27; --muted:#5f675f; --mut:var(--muted);
  --border:#e3e7df; --rule:#edf0ea; --control:#ccd2c8;
  --control-height:38px; --control-radius:7px;
  --ok:#237548; --ok-soft:#edf5ef; --bad:#ad3538; --bad-soft:#fbefed;
  --warn:#805d15; --warn-soft:#faf4e5;
}
html { scroll-padding-top:16px; }
body { font-size:14px; line-height:1.5; }
.topbar { height:48px; padding:0 24px; }
.topbar-date { font-size:12px; }
.workspace-sheet { padding:24px; min-height:calc(100dvh - 56px); }
.sidebar { padding:22px 12px 16px; }
.sidebar > .brand { margin:0 12px 22px; font-size:28px; }
.sidebar nav { gap:4px; }
.sidebar button[data-t] { padding:10px 12px; min-height:40px; font-size:13px; border-radius:7px; }
.sidebar button[data-t][aria-selected=true] { color:var(--ink); background:var(--active); }
.sidebar button[data-t]:hover { background:var(--active); }
.workspace-label { color:var(--muted); font-size:12px; padding-inline:12px; }
.page-heading { margin-bottom:22px; align-items:center; }
.page-heading h1 { font-size:26px; font-weight:600; letter-spacing:-.025em; }
.page-heading p { font-size:13px; line-height:1.55; max-width:65ch; margin-top:6px; }
.page-heading > .primary { font-size:13px; }
.workspace-sheet :is(button,.btn):not(.kq button,.icon-button,.team-person) { min-height:38px; font-size:13px; padding:8px 12px; border-radius:7px; }
.workspace-sheet .text-button { min-height:30px; padding:3px 0; }
.secondary { background:var(--surface); border-color:var(--control); }
.secondary:hover { background:var(--raised); border-color:#aeb8a8; }
.primary { background:var(--accent); border-color:var(--accent); }
.primary:hover { background:var(--accent-hover); border-color:var(--accent-hover); }
.danger { background:var(--surface); color:var(--bad); border-color:#e2b8b8; }
.danger:hover { background:var(--bad-soft); border-color:var(--bad); }
button:disabled { cursor:default; }
.workspace-sheet label { font-size:13px; line-height:1.5; font-weight:500; }
.workspace-sheet :is(input:not([type=checkbox],[type=file]),select,textarea) { min-height:40px; padding:9px 11px; border-radius:7px; border-color:var(--control); font-size:14px; }
.workspace-sheet select { padding-right:30px; }
.workspace-sheet :is(input,select,textarea):focus { border-color:var(--accent); }
.workspace-sheet input[type=checkbox] { accent-color:var(--ink); }
.workspace-sheet .field { margin-bottom:0; }
.field-note,.field-error { font-size:12px; line-height:1.6; }
.field-error:empty { display:none; }
.exam-context { padding:10px 12px; border-radius:9px; margin-bottom:24px; gap:12px; }
.context-field { max-width:540px; }
.context-field label { font-size:12px; color:var(--muted); }
.exam-context select { background-color:var(--surface); }
.status-tag,.team-badge { font-size:12px; font-weight:500; border-radius:5px; padding:3px 8px; line-height:1.4; }
.status-tag.neutral,.team-badge.disabled { background:var(--active); color:#4f594f; }
.status-dot { display:inline-block; width:6px; height:6px; border-radius:50%; flex:none; background:var(--muted); }
.status-dot.success { background:var(--ok); }
.status-dot.warning { background:var(--warn); }
.metric-strip { padding:0 0 22px; margin:0 0 24px; border-bottom:1px solid var(--border); }
.metric { padding-inline:24px; }
.metric:first-child { padding-left:0; }
.metric-value { font-size:30px; font-weight:500; letter-spacing:-.025em; line-height:1.2; margin-top:6px; }
.metric-label { font-size:12px; color:var(--muted); }
.overview-grid { grid-template-columns:minmax(0,1.7fr) minmax(250px,.8fr); gap:20px 32px; }
.overview-focus { background:var(--raised); border:0; border-radius:10px; padding:18px; }
.overview-focus h2 { color:var(--ink); font-size:14px; margin-bottom:12px; }
.next-action h3 { font-size:18px; line-height:1.45; }
.next-action .primary { width:100%; justify-content:space-between; }
.home-workloads { margin-top:24px; }
.home-workloads h3 { font-size:13px; margin-bottom:6px; }
.home-workload { display:flex; width:100%; justify-content:space-between; gap:12px; border:0; border-bottom:1px solid var(--border); border-radius:0; text-align:left; white-space:normal; }
.workspace-sheet .home-workload { padding:10px 0; border-radius:0; }
.home-workload > span { display:flex; align-items:center; gap:8px; font-size:12px; }
.home-workload strong { font-size:14px; font-weight:500; font-variant-numeric:tabular-nums; }
.home-workload:last-child { border-bottom:0; }
#homeReadiness .home-workload { border-radius:0; font-weight:400; padding:10px 0; }
.home-workload:hover { background:var(--active); }
.overview-guide { background:var(--surface); border-radius:9px; border-color:var(--border); }
#t-home .exam-directory-filters { display:none; }
#t-home .exam-row { grid-template-columns:minmax(0,1fr) max-content 50px 30px; }
.exam-directory-count { font-size:12px; margin-block:8px 12px; }
.exam-directory-filters { gap:12px; }
#t-exams .exam-directory-filters { max-width:none; grid-template-columns:minmax(220px,1fr) 190px; }
.exam-search { max-width:none; }
.exam-row { gap:12px; min-height:80px; padding-block:14px; }
.exam-row .exam-name { font-size:14px; font-weight:500; line-height:1.5; }
.exam-row p { font-size:12px; line-height:1.5; margin-top:4px; }
.exam-row-actions { gap:8px; }
.exam-result-count { font-size:18px; font-weight:500; }
.exam-result-count span { font-size:12px; }
.exam-row .status-tag { white-space:normal; max-width:140px; }
.pagination { margin-top:16px; padding-top:12px; font-size:12px; border-top:1px solid var(--rule); }
.empty-state { padding:38px 20px; max-width:none; text-align:center; }
.empty-state h3 { font-size:17px; }
.empty-state p { max-width:50ch; margin:8px auto 18px; line-height:1.65; }
.load-error { border:1px solid #ebcccc; border-radius:9px; background:var(--bad-soft); padding:20px; margin-block:12px; }
.load-error h3 { color:var(--bad); font-size:16px; margin-bottom:7px; }
.load-error p { color:#783538; margin-bottom:14px; font-size:13px; overflow-wrap:anywhere; }
.team-loading { color:var(--muted); padding:22px 0; font-size:13px; }
.team-loading::before { content:''; display:inline-block; width:14px; height:14px; margin-right:9px; border:2px solid var(--control); border-right-color:var(--ink); border-radius:50%; vertical-align:-2px; animation:spin .7s linear infinite; }
.results-toolbar { gap:12px; align-items:end; margin-block:0 18px; }
.result-filters-panel { flex:1; min-width:0; }
.result-filters-panel > summary { display:none; }
.result-filters { gap:10px; }
.result-filter { font-size:12px; }
.resultStatsLabel { font-size:12px; }
.list-meta { margin-block:8px 12px; font-size:12px; }
.list-meta > .inline-actions { margin-left:auto; }
.results-table .student-cell button.text-button { min-height:0; padding:0; line-height:1.5; }
.results-table th { height:40px; font-size:12px; font-weight:400; }
.results-table td { padding-block:13px; font-size:13px; }
.results-table tbody tr:hover { background:var(--raised); }
.results-table tbody tr:focus-within { background:var(--raised); }
.results-table [data-result] { font-size:14px; font-weight:500; text-align:left; }
.student-cell small { font-size:12px; margin-top:3px; color:var(--muted); }
.score-value { font-size:22px; font-weight:500; font-variant-numeric:tabular-nums; }
table[aria-busy=true] { opacity:.45; pointer-events:none; }
.result-detail { margin-top:24px; padding:22px; border-radius:10px; border:1px solid var(--control); background:var(--surface); }
.detail-heading { padding-bottom:16px; margin-bottom:16px; border-bottom:1px solid var(--rule); }
.detail-heading h2 { font-size:20px; line-height:1.4; }
.detail-heading p { font-size:13px; margin-top:5px; }
.detail-actions { gap:8px; }
.detail-subjects { gap:24px; margin-top:24px; }
.detail-subjects h3 { font-size:14px; line-height:1.5; margin-bottom:10px; }
.detail-subjects h3 span { font-size:12px; font-weight:400; }
.chips { gap:6px; }
.chip { font-size:12px; min-height:30px; padding:6px; border-radius:5px; }
.chip.b { background:#e8f0fd; color:#2954a1; }
.result-answer-legend { display:flex; gap:18px; flex-wrap:wrap; margin-top:20px; font-size:12px; }
.result-answer-legend > span { display:flex; gap:6px; align-items:center; color:var(--muted); }
.result-answer-legend > span::before { content:''; width:8px; height:8px; border-radius:50%; background:var(--ok); }
.result-answer-legend > .w::before { background:var(--bad); }
.result-answer-legend > .b::before { background:#2954a1; }
.report-count-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 12px; font-size:13px; }
.report-response-bar { grid-column:1 / -1; display:flex; height:7px; background:var(--active); border-radius:3px; overflow:hidden; }
.report-response-bar i { height:100%; }
.report-response-bar .c { background:var(--ok); }
.report-response-bar .w { background:var(--bad); }
.report-response-bar .b { background:#2954a1; }
.result-tools { margin-top:24px; border-top:1px solid var(--border); padding-top:12px; }
.result-tools > summary { font-size:13px; }
.scan-layout { grid-template-columns:1fr; }
.upload-area { min-height:270px; padding:28px; border-radius:12px; border-color:#b8c2b1; background:var(--raised); }
.upload-icon { margin-bottom:14px; }
.upload-area h2 { font-size:21px; }
.upload-area #scanHint { max-width:60ch; font-size:13px; margin-bottom:20px; }
.upload-actions { flex-wrap:wrap; }
.upload-actions :is(button,.btn) { min-height:40px; }
.upload-caption { margin-top:14px; font-size:12px; }
.scan-result-header { margin-top:0; padding-bottom:14px; }
.scan-result-grid { grid-template-columns:minmax(0,1.05fr) minmax(300px,1fr); gap:28px; }
.score-heading { padding:16px; border:0; background:var(--raised); border-radius:9px; }
.score-heading .score { margin:8px 0; }
.score b { font-size:38px; font-weight:500; }
.score-heading #scanExamName { font-size:12px; margin:10px 0 0; }
.student-section { margin-top:18px; padding-top:16px; }
.scan-identity > summary { font-size:13px; min-height:40px; padding-block:9px; cursor:pointer; }
.scan-save-actions { gap:8px; flex-wrap:wrap; }
.scan-save-actions > * { flex:1 1 auto; }
.scan-save-actions .primary { flex-basis:100%; }
.score-table { margin-top:14px; }
.review-toolbar { border-color:var(--border); padding:10px 12px; }
.canvas-frame { border-color:var(--border); padding:12px; }
.qr-panel { border-color:var(--control); background:var(--raised); }
.qr-panel-heading h3 { font-size:17px; }
.qr-actions { gap:8px; }
.qr-preview { margin-inline:auto; }
.management-panel { padding:18px; border-color:var(--border); border-radius:10px; margin-block:18px; }
.management-panel > h2 { font-size:17px; margin-bottom:14px; }
.manage-row { padding:14px 0; gap:12px; align-items:center; border-bottom:1px solid var(--rule); }
.manage-row:last-child { border-bottom:0; }
.manage-row strong { font-size:14px; font-weight:500; }
.manage-row small { font-size:12px; line-height:1.6; margin-top:3px; color:var(--muted); overflow-wrap:anywhere; }
.manage-fields { gap:14px; }
.manage-fields > .field-error { flex-basis:100%; grid-column:1 / -1; margin-top:6px; }
.scan-identity > .field { margin-top:12px; }
.scan-identity > .student-fields { margin-top:16px; }
#t-scan .score-table { order:0; }
.student-roster-count { font-size:12px; color:var(--muted); margin:18px 0 4px; font-variant-numeric:tabular-nums; }
.student-row { display:grid; grid-template-columns:minmax(180px,1fr) auto max-content; }
.student-row-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.student-row-actions button { font-size:12px; }
#studentsPanel .management-panel { border:0; padding:0; margin:0; }
#studentsPanel .management-panel > h2 { display:none; }
#studentsPanel form[data-form=search] { grid-template-columns:minmax(0,1fr) max-content; max-width:none; }
.student-add,.student-import { padding:2px 0; }
.student-add > summary,.student-import > summary { font-size:13px; font-weight:500; }
.student-add .manage-fields { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin-block:12px; }
.student-import > p { font-size:12px; line-height:1.6; max-width:65ch; }
.section-tabs,.team-nav,.team-tool-nav { display:flex; flex-wrap:nowrap; align-items:center; gap:22px; overflow-x:auto; border-bottom:1px solid var(--border); margin-bottom:24px; padding:0; white-space:nowrap; scrollbar-width:thin; scrollbar-color:var(--control) transparent; }
.workspace-sheet :is(.section-tabs,.team-nav,.team-tool-nav) > button { position:relative; min-height:44px; border:0; border-radius:0; padding:10px 0; font-size:13px; font-weight:400; color:var(--muted); background:transparent; flex:none; }
.workspace-sheet :is(.section-tabs,.team-nav,.team-tool-nav) > button[aria-pressed=true] { color:var(--ink); font-weight:600; background:transparent; }
:is(.section-tabs,.team-nav,.team-tool-nav) > button[aria-pressed=true]::after { content:''; position:absolute; left:0; right:0; bottom:0; height:2px; background:var(--ink); }
.team-nav button.team-nav-button[aria-pressed=true]::after { background:var(--ink); }
.team-heading { margin-bottom:20px; gap:16px; }
.team-heading h2 { font-size:18px; }
.team-heading p { font-size:13px; max-width:65ch; margin-top:5px; }
.team-layout { grid-template-columns:minmax(265px,.8fr) minmax(0,1.5fr); gap:24px; }
.team-roster { border:0; background:var(--raised); padding:16px; border-radius:10px; }
.team-detail { border-color:var(--border); border-radius:10px; padding:20px; }
.team-person { padding:10px 8px; border-radius:7px; gap:10px; }
.team-person[aria-pressed=true] { background:var(--active); border-color:transparent; }
.team-specific-note { border:0; background:var(--raised); padding:10px 12px; border-radius:7px; font-size:13px; }
.team-scope { color:var(--muted); }
.team-save { padding-top:16px; margin-top:16px; }
.team-role-grid { gap:12px; }
.team-role-grid article { border:0; border-radius:9px; padding:16px; background:var(--raised); }
.team-role-grid h3 { font-size:15px; }
.team-role-grid p { font-size:13px; line-height:1.6; }
.team-role-grid strong { color:var(--ink); font-size:12px; font-weight:500; }
.team-permissions { border-color:var(--border); border-radius:9px; }
.team-matrix th,.team-matrix td { font-size:13px; padding:11px 12px; }
.manage-dialog { max-width:min(640px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); border-color:var(--border); border-radius:12px; box-shadow:0 18px 60px #15201826; }
.manage-dialog header { padding:18px 20px; align-items:flex-start; }
.manage-dialog header h2,.manage-dialog header h3 { font-size:18px; line-height:1.4; }
.manage-dialog header p { font-size:12px; line-height:1.6; }
.manage-dialog footer { padding:14px 20px; position:sticky; bottom:0; background:var(--surface); z-index:1; }
.student-dialog-body,.team-dialog-body,.action-dialog-body { padding:18px 20px; }
.manage-dialog :is(input:not([type=checkbox],[type=file]),select,textarea) { min-height:40px; font-size:14px; }
.manage-dialog textarea { width:100%; resize:vertical; }
.action-dialog { max-width:min(480px,calc(100vw - 32px)); }
.action-dialog [hidden] { display:none; }
.action-dialog-body p { font-size:14px; line-height:1.65; overflow-wrap:anywhere; }
.action-dialog-body p:empty { display:none; }
.action-dialog .field { margin-top:16px; }
.student-history li { padding-block:13px; }
.student-history span { font-size:13px; }
.settings-row { grid-template-columns:minmax(180px,.65fr) minmax(0,1.5fr); gap:32px; padding:24px 0; }
.settings-row:first-child { padding-top:0; }
.settings-row h2 { font-size:16px; margin-bottom:7px; }
.settings-row p { font-size:13px; line-height:1.65; }
.settings-content { border:0; background:var(--raised); border-radius:9px; padding:18px; }
#accountPanel .management-panel { margin:0 0 20px; }
#settingsData .settings-row { margin:0; }
.whatsapp-state { display:flex; align-items:center; gap:8px; font-weight:500; font-size:15px; }
.whatsapp-state::before { content:''; width:7px; height:7px; flex:none; border-radius:50%; background:var(--muted); }
.whatsapp-state[data-state=connected]::before { background:var(--ok); }
.whatsapp-state[data-state=error]::before { background:var(--bad); }
.whatsapp-note { font-size:13px; line-height:1.6; }
.whatsapp-qr { background:var(--raised); border-radius:9px; padding:18px; max-width:420px; margin-block:16px; }
.whatsapp-qr img { display:block; max-width:100%; height:auto; margin:0 auto 12px; }
.whatsapp-qr p { font-size:13px; line-height:1.6; }
.whatsapp-job { align-items:flex-start; }
#waJobFilter { max-width:280px; }
.card-library { gap:28px 20px; }
.library-preview { background:var(--raised); border-color:var(--border); border-radius:10px; padding:24px; }
.library-card h2 { font-size:15px; line-height:1.5; margin-top:14px; }
.library-card p { font-size:12px; line-height:1.65; }
.library-actions { gap:8px; }
.print-note { background:var(--raised); border-radius:9px; padding:16px; font-size:13px; }
.workspace-footer { padding-top:16px; margin-top:28px; font-size:12px; }
.operation-notice { position:relative; padding:12px 14px; gap:12px; font-size:13px; }
.toast { border:1px solid var(--border); font-size:13px; max-width:calc(100vw - 28px); line-height:1.5; }
.auth-form-wrap h1 { font-size:30px; line-height:1.3; }
.auth-form-wrap input { min-height:46px; }
.auth-main { padding:48px; }
.auth-help { line-height:1.65; font-size:13px; }
.qr-public-result { border:1px solid var(--border); border-radius:14px; padding:32px; max-width:490px; }
.qr-public-brand { display:flex; align-items:center; gap:9px; font-size:21px; margin-bottom:30px; }
.qr-public-brand .brand-mark { width:20px; height:24px; }
.qr-public-result h1 { font-size:25px; line-height:1.3; }
.qr-public-result #qrPublicExam { font-size:14px; line-height:1.6; margin-block:10px 20px; }
.qr-public-score { font-size:36px; line-height:1.3; letter-spacing:-.025em; font-variant-numeric:tabular-nums; margin:20px 0 10px; }
.qr-public-result #qrPublicNote { font-size:13px; line-height:1.65; }
.qr-public-result #qrPublicRefresh { margin-top:16px; }
@media(max-width:1100px) {
  .overview-grid { grid-template-columns:minmax(0,1.5fr) minmax(230px,1fr); gap:20px; }
  .team-layout { grid-template-columns:1fr; }
  .team-people { max-height:260px; }
  .scan-result-grid { grid-template-columns:1fr; }
  .result-summary { grid-template-columns:1fr 1fr; }
  .student-row { grid-template-columns:minmax(0,1fr) auto; }
  .student-row-actions { grid-column:1 / -1; justify-content:flex-start; }
}
@media(max-width:850px) {
  :root { --sidebar-width:196px; }
  .sidebar button[data-t] { font-size:12px; padding-inline:9px; }
  .workspace-sheet { padding:20px; }
  .overview-grid { grid-template-columns:1fr; grid-template-areas:"focus" "exams" "guide"; gap:22px; }
  .overview-focus { display:grid; grid-template-columns:1fr 1fr; gap:0 22px; }
  .overview-focus > h2 { grid-column:1; }
  .home-workloads { grid-column:2; grid-row:1 / 3; margin:0; }
  .results-toolbar { display:grid; grid-template-columns:1fr; }
  .results-toolbar .search-field { max-width:none; }
  .student-add .manage-fields { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:760px) {
  :root { --mobile-gutter:14px; --dock-height:56px; }
  body { font-size:13px; }
  .topbar { height:48px; padding:0 14px; }
  .workspace-sheet { padding:18px 14px 22px; min-height:calc(100dvh - 48px); }
  .page-heading { margin-bottom:18px; flex-wrap:nowrap; align-items:flex-start; }
  .page-heading > div { flex-basis:auto; }
  .page-heading h1 { font-size:22px; line-height:1.3; }
  .page-heading p { font-size:12px; line-height:1.5; max-width:40ch; }
  .workspace-sheet h2 { font-size:16px; line-height:1.4; }
  .workspace-sheet h3 { font-size:14px; line-height:1.45; }
  .workspace-sheet :is(button,.btn):not(.kq button,.team-person) { min-height:40px; font-size:12px; padding:8px 10px; }
  .workspace-sheet .icon-button { min-width:40px; width:40px; padding:9px; }
  .workspace-sheet .text-button { padding:4px 0; min-height:32px; }
  .workspace-sheet :is(input:not([type=checkbox],[type=file]),select,textarea),.manage-dialog :is(input:not([type=checkbox],[type=file]),select,textarea) { min-height:40px; font-size:16px; padding:8px 10px; }
  .workspace-sheet select,.manage-dialog select { padding-right:28px; }
  .workspace-sheet label { font-size:12px; line-height:1.5; }
  .workspace-sheet .field { margin-bottom:0; }
  .workspace-sheet .field label { margin-bottom:5px; }
  .workspace-sheet .mut,.workspace-sheet .field-note { font-size:12px; line-height:1.6; }
  .sidebar { width:270px; padding:22px 14px; }
  .sidebar button[data-t] { min-height:42px; padding-inline:12px; font-size:13px; }
  .exam-context { grid-template-columns:minmax(0,1fr) auto; gap:6px 10px; padding:10px; margin-bottom:18px; }
  .context-field { max-width:none; }
  .exam-context select { min-height:38px; }
  .exam-context .context-field select { font-size:16px; min-height:40px; }
  .exam-context > .icon-button { width:40px; height:40px; min-height:40px; }
  .status-tag,.team-badge { font-size:12px; line-height:1.4; padding:3px 7px; }
  .metric-strip { margin-bottom:20px; padding-bottom:18px; }
  .metric { padding-inline:14px; }
  .metric-label { font-size:12px; line-height:1.4; }
  .metric-value { font-size:26px; }
  .overview-focus { padding:16px; display:block; }
  .home-workloads { margin-top:22px; }
  #homeReadiness { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 12px; }
  #homeReadiness .home-workload { min-height:48px; padding-block:8px; }
  .home-workload > span { line-height:1.5; }
  .workspace-sheet .home-workload { padding:10px 0; }
  .overview-focus h2 { font-size:13px; }
  .next-action h3 { font-size:17px; }
  #t-home .exam-row { grid-template-columns:minmax(0,1fr) max-content 28px; gap:8px; }
  #t-home .exam-result-count { display:none; }
  .exam-row { min-height:82px; padding-block:12px; gap:8px; }
  .exam-row .exam-name { font-size:13px; }
  .exam-row .status-tag { max-width:112px; }
  #t-exams .exam-row { grid-template-columns:minmax(0,1fr) max-content; }
  #t-exams .exam-row > div:first-child { grid-column:1; grid-row:1; }
  #t-exams .exam-row > .status-tag { grid-column:2; grid-row:1; justify-self:end; }
  #t-exams .exam-row-actions { grid-column:1 / -1; grid-row:2; justify-content:flex-start; }
  #t-exams .exam-row-actions .icon-button { margin-left:auto; }
  #t-exams .exam-result-count { display:none; }
  #t-exams .exam-directory-filters { grid-template-columns:minmax(0,1fr) 120px; gap:8px; }
  .results-toolbar { margin-bottom:14px; }
  .result-filters-panel { width:100%; border-block:1px solid var(--border); }
  .result-filters-panel > summary { display:list-item; cursor:pointer; min-height:40px; padding:9px 0; font-size:12px; font-weight:500; }
  .result-filters-panel[open] .result-filters { padding-bottom:14px; }
  .list-meta { flex-wrap:wrap; gap:8px; }
  .result-filters { width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .result-filter:last-child { grid-column:1 / -1; }
  .result-filters select { max-width:none; }
  .results-table td { padding-block:12px; }
  .results-table .student-cell button { font-size:13px; }
  .results-table .score-value { font-size:21px; }
  .result-detail { padding:16px 12px; margin-top:18px; }
  .detail-heading { flex-wrap:wrap; gap:10px; }
  .detail-heading h2 { font-size:18px; }
  .detail-heading .detail-actions { margin-left:auto; }
  .detail-subjects { gap:22px; }
  .chips { grid-template-columns:repeat(5,minmax(0,1fr)); }
  .management-panel { padding:16px; margin-block:16px; }
  .management-panel > h2 { font-size:16px; }
  .upload-area { min-height:260px; padding:26px 16px; }
  .upload-area h2 { font-size:19px; }
  .upload-area #scanHint { font-size:13px; margin-bottom:18px; }
  .upload-actions { width:100%; max-width:340px; display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .upload-actions #qrOpen { grid-column:1 / -1; }
  .upload-actions .btn { width:auto; }
  .upload-caption { font-size:12px; margin-top:14px; }
  .scan-result-grid { gap:22px; grid-template-columns:1fr; }
  .result-summary { display:block; }
  .score-heading .score b { font-size:34px; }
  .score-table { border-top:0; margin-top:14px; }
  .student-fields { gap:12px; }
  .scan-save-actions .primary { flex-basis:100%; }
  .scan-save-actions :is(button,.btn) { min-height:40px; }
  .review-toolbar { padding:9px 10px; font-size:12px; }
  .review-toolbar > span { max-width:75%; }
  .qr-panel-heading h3 { font-size:16px; }
  .qr-actions > .btn,.qr-actions > button { flex:1 1 auto; white-space:normal; }
  .section-tabs,.team-nav,.team-tool-nav { gap:20px; margin-bottom:20px; }
  .workspace-sheet :is(.section-tabs,.team-nav,.team-tool-nav) > button { min-height:44px; padding:10px 0; font-size:12px; }
  .team-heading { flex-wrap:wrap; gap:12px; }
  .team-heading h2 { font-size:17px; }
  .team-heading p { max-width:55ch; font-size:12px; }
  .team-roster,.team-detail { padding:14px; }
  .team-layout { gap:18px; }
  .team-person { padding:10px 6px; }
  .team-person-name strong { font-size:13px; }
  .team-people { max-height:230px; }
  .team-profile-fields { gap:14px; }
  .team-role-grid { grid-template-columns:1fr 1fr; gap:10px; }
  .team-role-grid article { padding:13px; }
  .team-role-grid h3 { font-size:14px; }
  .team-role-grid p { font-size:12px; }
  .team-matrix th,.team-matrix td { font-size:12px; padding:10px; }
  .manage-row { padding-block:13px; }
  .manage-row strong { font-size:13px; }
  .manage-row small { font-size:12px; }
  .student-row { grid-template-columns:minmax(0,1fr) auto; }
  .student-row-actions { gap:7px; grid-column:1 / -1; }
  .workspace-sheet .student-row-actions button { min-height:38px; font-size:12px; padding:7px 9px; }
  .student-add .manage-fields { grid-template-columns:1fr; gap:14px; }
  .student-active { font-size:12px; line-height:1.6; }
  .manage-dialog { max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); border-radius:11px; }
  .manage-dialog header { padding:16px; }
  .manage-dialog header h2,.manage-dialog header h3 { font-size:17px; }
  .manage-dialog footer { padding:12px 16px max(12px,env(safe-area-inset-bottom)); }
  .student-dialog-body,.team-dialog-body,.action-dialog-body { padding:16px; }
  .manage-dialog :is(button,.btn) { min-height:40px; font-size:13px; }
  .settings-row { grid-template-columns:1fr; gap:14px; padding:20px 0; }
  .settings-row h2 { font-size:16px; }
  .settings-content { padding:16px; }
  #accountPanel .manage-fields { display:grid; grid-template-columns:1fr; gap:14px; }
  .card-library { gap:26px 16px; }
  .library-preview { padding:16px; }
  .library-card h2 { font-size:14px; }
  .library-actions { flex-wrap:wrap; gap:8px; }
  .whatsapp-job { flex-wrap:wrap; }
  .whatsapp-job > div { flex-basis:100%; }
  .whatsapp-qr { padding:14px; }
  .operation-notice { flex-wrap:wrap; padding-right:44px; gap:8px; }
  .operation-notice .icon-button { position:absolute; right:4px; top:6px; }
  .operation-notice > span { flex-basis:100%; }
  .workspace-footer { font-size:12px; gap:10px; margin-top:24px; }
  .mobile-nav button { font-size:11px; min-height:54px; }
  .auth-main { padding:32px 22px 24px; }
  .auth-form-wrap h1 { font-size:26px; }
  .auth-mini-brand { margin-bottom:36px; }
  .qr-result-page { padding:32px 14px; }
  .qr-public-result { padding:24px 20px; }
  .qr-public-result h1 { font-size:23px; }
  .qr-public-score { font-size:32px; }
}
@media(max-width:359px) {
  .page-heading { flex-wrap:wrap; }
  .metric { padding-inline:10px; }
  .metric-value { font-size:24px; }
  .team-role-grid { grid-template-columns:1fr; }
  .chips { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .library-preview { padding:12px; }
}
@media(prefers-reduced-motion:reduce) {
  .team-loading::before { animation:none; }
  html { scroll-behavior:auto; }
}

/* Phone usability pass: visible viewport, safe-area and component density. */
@media(max-width:760px) {
  html { scroll-padding-top:calc(60px + env(safe-area-inset-top)); scroll-padding-bottom:calc(var(--dock-height) + env(safe-area-inset-bottom) + 12px); }
  .topbar { height:calc(48px + env(safe-area-inset-top)); min-height:calc(48px + env(safe-area-inset-top)); padding:env(safe-area-inset-top) max(14px,env(safe-area-inset-right)) 0 max(14px,env(safe-area-inset-left)); }
  .workspace-sheet { padding-inline:max(14px,env(safe-area-inset-left)) max(14px,env(safe-area-inset-right)); }
  .mobile-nav { height:calc(56px + env(safe-area-inset-bottom)); min-height:calc(56px + env(safe-area-inset-bottom)); padding:3px max(8px,env(safe-area-inset-right)) calc(3px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); }
  .mobile-nav button { min-height:48px; padding:4px 2px; line-height:1.2; }
  .mobile-nav .icon { width:18px; height:18px; }
  #logout { width:40px; height:40px; min-width:40px; min-height:40px; }
  .sidebar { overflow-y:auto; overscroll-behavior:contain; }
  .sidebar > nav,.sidebar-bottom { flex-shrink:0; }
  .workspace-sheet :is(input:not([type=checkbox],[type=file]),select),.manage-dialog :is(input:not([type=checkbox],[type=file]),select) { height:40px; line-height:1.375; }
  #lTab .student-cell button { font-size:13px; min-height:24px; padding:0; line-height:1.5; white-space:normal; overflow-wrap:anywhere; }
  #lTab td { padding-block:10px; }
  #t-key .kq { scroll-margin-top:calc(150px + env(safe-area-inset-top)); }
  .manage-dialog { max-height:calc(var(--visible-viewport-height,100dvh) - 24px); }
  .manage-dialog header { position:sticky; top:0; z-index:2; background:var(--surface); padding:14px 16px; }
  .manage-dialog footer { z-index:2; }
  .manage-dialog .field label { font-size:12px; }
  .keyboard-open .mobile-nav { display:none; }
  .keyboard-open .app-shell { padding-bottom:12px; }
  .keyboard-open .manage-dialog { max-height:calc(var(--visible-viewport-height,100dvh) - 16px); }
  #newBox .types { gap:10px; margin-block:16px; }
  #newBox .types button { min-height:64px; padding:10px 12px; gap:5px; font-size:13px; line-height:1.5; }
  #newBox .types button small { font-size:12px; line-height:1.5; }
  .student-dialog .manage-fields { gap:12px; }
  .team-dialog-body { padding-block:14px; }
  .team-dialog-body > label { margin-top:12px; }
  .team-heading > button { margin-left:auto; }
}
@media(max-width:600px) {
  .workspace-sheet:has(#t-cards:not(.hide)) .page-heading p { display:none; }
  .card-library { grid-template-columns:1fr; gap:0; }
  .library-card { display:grid; grid-template-columns:88px minmax(0,1fr); gap:5px 16px; padding:18px 0; border-bottom:1px solid var(--border); align-items:start; }
  .library-card:first-child { padding-top:0; }
  .library-card:last-child { border-bottom:0; }
  .library-card .library-preview { grid-column:1; grid-row:1 / 5; padding:9px; margin:0; border-radius:7px; }
  .library-card .library-preview img { width:100%; height:auto; }
  .library-card h2 { grid-column:2; margin:0; font-size:14px; line-height:1.45; }
  .library-card p { grid-column:2; margin:0; font-size:12px; line-height:1.5; }
  .library-card .card-subjects { min-height:0; margin:0; }
  .library-card .library-actions { grid-column:2; margin-top:7px; gap:8px; }
  #cardLibrary .library-actions > :is(a,button) { min-height:38px; padding:7px 10px; font-size:12px; }
}
@media(max-width:359px) {
  .library-card { grid-template-columns:72px minmax(0,1fr); gap:5px 12px; }
}
@media(max-width:760px) and (max-height:500px) {
  :root { --dock-height:44px; }
  .mobile-nav { height:calc(44px + env(safe-area-inset-bottom)); min-height:calc(44px + env(safe-area-inset-bottom)); }
  .mobile-nav button { flex-direction:row; min-height:36px; padding:4px 2px; gap:6px; }
  .mobile-nav .icon { width:16px; height:16px; }
  .manage-dialog { max-height:calc(var(--visible-viewport-height,100dvh) - 16px); }
}
@media(min-width:761px) and (max-width:1000px) and (max-height:500px) and (pointer:coarse) {
  :root { --dock-height:44px; }
  html { scroll-padding-top:60px; scroll-padding-bottom:56px; }
  .app-shell { display:block; padding-bottom:calc(44px + env(safe-area-inset-bottom)); }
  .app-column { padding:0; }
  .sidebar { position:fixed; top:0; left:0; bottom:0; width:270px; height:100dvh; z-index:60; padding:18px 14px; overflow-y:auto; transform:translateX(-100%); transition:transform .2s ease-out; background:var(--surface); border-right:1px solid var(--border); }
  .sidebar.open { transform:translateX(0); }
  .sidebar button[data-t] { min-height:40px; font-size:13px; }
  #logout { width:40px; height:40px; min-width:40px; min-height:40px; }
  .drawer-close { display:inline-flex; position:absolute; top:12px; right:12px; width:40px; height:40px; }
  .nav-backdrop { position:fixed; inset:0; z-index:50; background:#1c251d55; }
  .topbar { height:48px; padding:0 max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left)); }
  .topbar .mobile-brand { display:inline-flex; font-size:22px; }
  .topbar .mobile-brand .brand-mark { width:20px; height:23px; }
  .topbar .breadcrumb,.topbar-date { display:none; }
  .workspace-sheet { padding:16px max(16px,env(safe-area-inset-right)) 20px max(16px,env(safe-area-inset-left)); border:0; border-radius:0; min-height:calc(100dvh - 92px); }
  .page-heading h1 { font-size:22px; }
  .mobile-nav { display:grid; position:fixed; inset:auto 0 0; z-index:40; grid-auto-flow:column; grid-auto-columns:1fr; gap:3px; height:calc(44px + env(safe-area-inset-bottom)); padding:3px max(10px,env(safe-area-inset-right)) calc(3px + env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left)); border-top:1px solid var(--border); background:var(--surface); }
  .mobile-nav button { display:flex; flex-direction:row; justify-content:center; gap:6px; min-height:36px; padding:4px 2px; border:0; font-size:12px; color:var(--muted); }
  .mobile-nav .icon { width:16px; height:16px; }
  .mobile-nav button[aria-current=page] { color:var(--accent); background:var(--accent-soft); }
  .result-filters-panel > summary { display:list-item; min-height:40px; padding:9px 0; font-size:13px; cursor:pointer; }
  .result-filters-panel[open] .result-filters { padding-block:8px; }
  .manage-dialog { max-height:calc(var(--visible-viewport-height,100dvh) - 16px); }
  .manage-dialog header { position:sticky; top:0; z-index:2; background:var(--surface); }
  .keyboard-open .mobile-nav { display:none; }
  .keyboard-open .app-shell { padding-bottom:12px; }
  #t-key { --key-bubble:38px; --key-row:44px; }
}
@media(max-width:760px), (max-width:1000px) and (max-height:500px) and (pointer:coarse) {
  .manage-dialog { --dialog-space:24px; max-height:calc(var(--visible-viewport-height,100dvh) - var(--dialog-space)); overflow:hidden; }
  .keyboard-open .manage-dialog { --dialog-space:16px; max-height:calc(var(--visible-viewport-height,100dvh) - var(--dialog-space)); }
  .manage-dialog[open] { display:flex; flex-direction:column; position:fixed; top:calc(var(--visible-viewport-top,0px) + var(--visible-viewport-height,100dvh) / 2); bottom:auto; margin:0 auto; transform:translateY(-50%); }
  .manage-dialog > form { display:flex; flex-direction:column; min-height:0; max-height:calc(var(--visible-viewport-height,100dvh) - var(--dialog-space) - 2px); margin:0; }
  .manage-dialog header,.manage-dialog footer { position:static; flex-shrink:0; }
  .manage-dialog :is(.student-dialog-body,.team-dialog-body,.action-dialog-body) { overflow-y:auto; overscroll-behavior:contain; min-height:0; flex:1 1 auto; }
}
