:root {
  --wine:#183c53;
  --wine-dark:#102b3d;
  --wine-soft:#eaf0f4;
  --accent-line:#aec4d2;
  --ink:#23313c;
  --muted:#606f7c;
  --bg:#f4f6f8;
  --line:#e3e8ec;
  --green:#216149;
  --green-soft:#edf7f1;
  --orange:#835521;
  --orange-soft:#fff5e6;
  --danger:#a23c43;
  --danger-soft:#fcf0f0;
  --gold:#c1a46b;
  --shadow:0 4px 24px #24344706;
  --radius:16px;
  font-family:"Sarabun","Noto Sans Thai","Thonburi","Leelawadee UI",system-ui,sans-serif;
  font-synthesis:none;
  color:var(--ink);
  background:var(--bg);
}

:root[data-theme="wine"] {
  --wine:#772d46;
  --wine-dark:#532238;
  --wine-soft:#f7edf1;
  --accent-line:#d4a9b9;
}

:root[data-theme="forest"] {
  --wine:#205345;
  --wine-dark:#163d33;
  --wine-soft:#eaf3ee;
  --accent-line:#a5c8b7;
}

:root[data-theme="violet"] {
  --wine:#564169;
  --wine-dark:#3e2d50;
  --wine-soft:#f1edf7;
  --accent-line:#c6b6d8;
}

:root[data-theme="slate"] {
  --wine:#374650;
  --wine-dark:#27333c;
  --wine-soft:#edf0f2;
  --accent-line:#b7c4ce;
}

:root[data-theme="copper"] {
  --wine:#79452e;
  --wine-dark:#563121;
  --wine-soft:#f8efe9;
  --accent-line:#d8b8a3;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  font-size:16px;
  line-height:1.65;
}

button,input,select,textarea {
  font:inherit;
}

button,a,input,select {
  touch-action:manipulation;
}

button {
  cursor:pointer;
}

a {
  color:inherit;
  text-decoration:none;
}

button:disabled {
  cursor:not-allowed;
  opacity:.5;
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible {
  outline:3px solid var(--wine);
  outline-offset:3px;
}

button:focus:not(:focus-visible) {
  outline:none;
}

h1,h2,h3,p {
  margin-top:0;
}

h1,h2,h3 {
  line-height:1.45;
  letter-spacing:-.025em;
}

h1 {
  font-size:29px;
  margin-bottom:8px;
}

h2 {
  font-size:21px;
  margin-bottom:10px;
}

h3 {
  font-size:17px;
  margin-bottom:6px;
}

p {
  margin-bottom:16px;
}

small,.small {
  font-size:13px;
}

strong,b {
  font-weight:650;
}

[hidden] {
  display:none!important;
}

.muted {
  color:var(--muted);
}

.centered {
  text-align:center;
}

.eyebrow {
  display:block;
  font-size:10px;
  letter-spacing:.16em;
  font-weight:700;
  color:var(--wine);
  margin-bottom:10px;
}

.eyebrow.light {
  color:#d5c296;
}

.school-name {
  white-space:nowrap;
  letter-spacing:-.025em;
}

.skip-link {
  position:fixed;
  top:-80px;
  left:16px;
  z-index:100;
  background:white;
  padding:10px;
}

.skip-link:focus {
  top:8px;
}

.button {
  border:1px solid transparent;
  min-height:46px;
  padding:10px 18px;
  border-radius:9px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  font-size:14px;
  font-weight:600;
  transition:background .18s,transform .18s;
}

.button:active {
  transform:translateY(1px);
}

.button.primary {
  background:var(--wine);
  color:white;
}

.button.primary:hover {
  background:var(--wine-dark);
}

.button.secondary {
  background:white;
  border-color:var(--line);
  color:var(--ink);
}

.button.secondary:hover {
  background:var(--wine-soft);
  border-color:var(--accent-line);
}

.button.text {
  background:transparent;
  color:var(--wine);
}

.button.wide {
  width:100%;
}

.link-button {
  background:none;
  border:0;
  color:var(--wine);
  padding:8px 4px;
  font-size:13px;
  min-height:44px;
  text-align:left;
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.icon-button {
  border:1px solid var(--line);
  background:white;
  color:var(--wine);
  height:44px;
  min-width:44px;
  border-radius:10px;
  font-size:23px;
}

.network-banner {
  background:#fff0ca;
  color:#704e0b;
  font-size:14px;
  padding:10px 20px;
  text-align:center;
  position:sticky;
  top:0;
  z-index:60;
}

.spinner {
  display:inline-block;
  width:22px;
  height:22px;
  border:2px solid var(--accent-line);
  border-top-color:var(--wine);
  border-radius:50%;
  animation:spin .75s linear infinite;
}

@keyframes spin {
  to {
    transform:rotate(360deg);
  }

}

.splash {
  position:fixed;
  inset:0;
  background:var(--bg);
  z-index:90;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:12px;
  text-align:center;
  padding:16px;
}

.splash img {
  object-fit:contain;
  border-radius:50%;
}

.splash .school-name {
  font-size:clamp(12px,3.8vw,16px);
}

/* Entry and school identity */
.login-layout {
  min-height:100vh;
  min-height:100svh;
  display:flex;
  flex-direction:column;
  background:#fbfcfd;
}

.login-header {
  padding:22px max(5vw,24px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:white;
  border-bottom:1px solid var(--line);
  gap:20px;
}

.brand-line {
  display:flex;
  gap:13px;
  align-items:center;
}

.brand-line img {
  object-fit:contain;
  flex:none;
  border-radius:50%;
  background:white;
}

.brand-line strong {
  font-size:20px;
  letter-spacing:-.035em;
  color:var(--wine);
}

.brand-line small {
  display:block;
  font-size:9px;
  letter-spacing:.16em;
  font-weight:600;
  color:var(--muted);
  margin-top:1px;
}

.theme-trigger span:first-child {
  font-size:21px;
  line-height:1;
}

.login-body {
  display:grid;
  grid-template-columns:1.05fr 1fr;
  flex:1;
  max-width:1440px;
  width:100%;
  margin:auto;
  padding:32px max(5vw,24px);
  gap:7%;
}

.login-brand {
  background:var(--wine);
  border-radius:24px;
  color:white;
  padding:56px 48px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  position:relative;
  overflow:hidden;
}

.login-brand:after {
  content:'';
  width:370px;
  height:370px;
  border:1px solid #ffffff0c;
  border-radius:50%;
  position:absolute;
  bottom:-250px;
  right:-130px;
  box-shadow:0 0 0 70px #ffffff03,0 0 0 140px #ffffff03;
  pointer-events:none;
}

.login-brand h1 {
  font-size:clamp(28px,3.2vw,48px);
  line-height:1.5;
  letter-spacing:-.045em;
  font-weight:600;
  margin:14px 0 20px;
}

.gold-dot {
  color:var(--gold);
}

.brand-description {
  font-size:16px;
  line-height:1.9;
  color:#e0e8ec;
}

.brand-rule {
  height:2px;
  width:48px;
  background:var(--gold);
  margin:20px 0 26px;
}

.english-name {
  font-size:22px;
  letter-spacing:-.03em;
  line-height:1.45;
  color:#f4f6f8;
  font-weight:350;
}

.english-name strong {
  font-weight:450;
}

.brand-proof {
  display:flex;
  gap:18px;
  margin-top:28px;
  color:var(--gold);
  font-size:11px;
  flex-wrap:wrap;
}

.brand-proof b {
  display:block;
  font-size:12px;
  color:#e0e8ec;
  font-weight:400;
  margin-top:5px;
}

.login-main {
  display:flex;
  justify-content:center;
  align-items:center;
  min-width:0;
  padding:24px 0;
}

.login-card {
  width:100%;
  max-width:380px;
}

.login-card h2 {
  font-size:30px;
  margin-bottom:5px;
}

.login-tabs {
  display:grid;
  grid-template-columns:1fr 1fr;
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:10px;
  padding:4px;
  margin:25px 0 24px;
}

.tab {
  border:0;
  background:transparent;
  color:var(--muted);
  min-height:44px;
  padding:9px 15px;
  border-radius:7px;
  font-size:14px;
}

.tab.active {
  background:white;
  color:var(--wine);
  font-weight:650;
  box-shadow:0 2px 5px #10253509;
}

.login-note {
  display:flex;
  gap:12px;
  align-items:flex-start;
  margin:0 0 26px;
  font-size:13px;
}

.login-note strong {
  font-size:14px;
}

.login-note p {
  margin:4px 0 0;
  color:var(--muted);
}

.note-icon {
  width:30px;
  height:30px;
  border-radius:50%;
  background:var(--wine-soft);
  color:var(--wine);
  display:grid;
  place-items:center;
  flex:none;
}

.google-letter {
  background:white;
  color:#385c87;
  font-size:16px;
  font-weight:800;
  border-radius:50%;
  width:24px;
  height:24px;
  line-height:24px;
}

.login-status {
  color:var(--muted);
  font-size:12px;
  margin:12px 0;
  min-height:18px;
  overflow-wrap:anywhere;
}

.login-divider {
  height:1px;
  background:var(--line);
  margin:22px 0;
}

.demo-note {
  margin:10px 0 0;
  font-size:11px;
}

.login-footer {
  padding:10px max(5vw,24px) 20px;
  display:flex;
  gap:20px;
  align-items:center;
  justify-content:space-between;
  color:var(--muted);
}

.login-footer .school-name {
  font-size:14px;
}

.login-footer .small {
  font-size:10px;
  letter-spacing:.12em;
}

/* Application frame */
.workspace {
  display:flex;
  min-height:100vh;
}

.sidebar {
  width:235px;
  background:white;
  border-right:1px solid var(--line);
  display:flex;
  flex-direction:column;
  position:fixed;
  inset:0 auto 0 0;
  z-index:30;
  overflow:auto;
  padding:27px 18px 16px;
}

.side-brand {
  gap:9px;
  padding:0 0 26px;
}

.side-brand strong {
  font-size:18px;
}

.side-brand small {
  font-size:7px;
  letter-spacing:.14em;
}

.sidebar nav {
  flex:1;
}

.nav-label {
  font-size:10px;
  letter-spacing:.05em;
  color:var(--muted);
  margin:17px 12px 8px;
}

.nav-item {
  display:flex;
  align-items:center;
  gap:11px;
  border:0;
  border-radius:9px;
  min-height:44px;
  padding:10px 12px;
  margin:3px 0;
  background:transparent;
  color:var(--muted);
  font-size:13px;
  position:relative;
}

.nav-item svg {
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.6;
  stroke-linecap:round;
  stroke-linejoin:round;
  flex:none;
}

.nav-item.active {
  color:var(--wine);
  background:var(--wine-soft);
  font-weight:650;
}

.nav-item.active:before {
  content:'';
  position:absolute;
  left:-18px;
  top:12px;
  bottom:12px;
  width:3px;
  border-radius:0 3px 3px 0;
  background:var(--wine);
}

.nav-item:hover {
  background:var(--bg);
}

.nav-item.unavailable {
  color:#707c87;
  font-size:12px;
}

.soon {
  font-size:8px;
  padding:2px 4px;
  border-radius:3px;
  background:var(--bg);
  margin-left:auto;
  white-space:nowrap;
  color:var(--muted);
}

.sidebar-bottom {
  border-top:1px solid var(--line);
  padding:20px 12px 0;
  margin-top:20px;
}

.version-tag {
  font-size:8px;
  letter-spacing:.12em;
  display:block;
  color:var(--muted);
}

.sidebar-bottom .link-button {
  font-size:12px;
}

.main-column {
  margin-left:235px;
  flex:1;
  min-width:0;
}

.topbar {
  min-height:81px;
  padding:16px 32px;
  background:white;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.topbar>.school-name {
  font-size:15px;
  color:#435461;
}

.header-actions {
  display:flex;
  align-items:center;
  gap:12px;
}

.mode-tag {
  font-size:10px;
  white-space:nowrap;
  color:var(--muted);
}

.user-button {
  display:flex;
  align-items:center;
  gap:9px;
  border:0;
  background:white;
  min-height:44px;
  padding:2px 0 2px 10px;
  font-size:13px;
  color:var(--ink);
  border-left:1px solid var(--line);
}

.avatar,.teacher-avatar {
  width:36px;
  height:36px;
  border-radius:50%;
  background:var(--wine-soft);
  color:var(--wine);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:none;
  font-size:16px;
}

.mobile-brand {
  display:none;
}

.demo-banner {
  padding:8px 32px;
  background:#fcf8ef;
  color:#715c37;
  font-size:11px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:center;
  border-bottom:1px solid #eae1cd;
}

.demo-banner .link-button {
  font-size:11px;
  min-height:32px;
  color:#715c37;
  white-space:nowrap;
}

#main {
  padding:30px 32px 12px;
  max-width:1660px;
  margin:0 auto;
  outline:none;
}

.content-footer {
  padding:22px 32px 30px;
  display:flex;
  justify-content:space-between;
  gap:14px;
  font-size:10px;
  color:var(--muted);
}

.mobile-nav {
  display:none;
}

.page-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin-bottom:25px;
}

.breadcrumb {
  font-size:9px;
  letter-spacing:.08em;
  color:var(--muted);
  margin-bottom:9px;
}

.page-heading h1 {
  font-size:26px;
  margin-bottom:6px;
}

.page-heading p {
  font-size:13px;
  color:var(--muted);
  margin:0;
}

.heading-date {
  font-size:12px;
  white-space:nowrap;
  color:var(--muted);
}

.page-heading>.button {
  flex:none;
}

/* Reusable surfaces */
.panel {
  background:white;
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:24px;
  box-shadow:var(--shadow);
  min-width:0;
}

.panel-title {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:19px;
}

.panel-title h2 {
  margin-bottom:0;
}

.panel-title p {
  margin:6px 0 0;
}

.stats {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
  margin-bottom:24px;
}

.stat {
  background:white;
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:20px 22px;
  box-shadow:var(--shadow);
  min-width:0;
}

.stat-top {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:6px;
}

.stat-label {
  font-size:12px;
  color:var(--muted);
}

.stat-icon {
  width:28px;
  height:28px;
  border-radius:8px;
  display:grid;
  place-items:center;
  background:var(--bg);
  color:var(--muted);
}

.stat-icon svg {
  width:16px;
  height:16px;
  stroke:currentColor;
  fill:none;
  stroke-width:1.5;
}

.stat>strong {
  font-size:35px;
  display:block;
  line-height:1.5;
  margin:7px 0 2px;
  letter-spacing:-.04em;
}

.stat>small {
  display:block;
  font-size:10px;
  color:var(--muted);
}

.stat.accent {
  background:var(--wine);
  border-color:var(--wine);
  color:white;
}

.stat.accent .stat-label,.stat.accent small {
  color:#e5eaf0;
}

.stat.accent .stat-icon {
  color:white;
  background:#ffffff19;
}

.stat.alert-stat>strong {
  color:var(--danger);
}

.section-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:26px 0 15px;
}

.section-heading h2 {
  margin:0;
}

.section-heading>span {
  font-size:12px;
  color:var(--muted);
}

.filters {
  display:flex;
  gap:12px;
  align-items:center;
  margin:0 0 20px;
  flex-wrap:wrap;
}

.tabs {
  display:flex;
  gap:3px;
  background:#eaeef2;
  padding:4px;
  border-radius:9px;
}

.search,.select-filter,select {
  border:1px solid var(--line);
  border-radius:9px;
  min-height:44px;
  padding:9px 12px;
  font-size:14px;
  background:white;
  color:var(--ink);
  min-width:0;
}

.search {
  margin-left:auto;
  width:265px;
}

.search::placeholder {
  color:var(--muted);
  font-size:12px;
}

.filters>.muted {
  margin-right:auto;
}

.badge,.count-chip {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  border-radius:6px;
  min-height:25px;
  padding:3px 9px;
  background:var(--orange-soft);
  color:var(--orange);
  white-space:nowrap;
}

.badge.success {
  background:var(--green-soft);
  color:var(--green);
}

.badge.danger {
  background:var(--danger-soft);
  color:var(--danger);
}

.badge.neutral,.count-chip {
  background:var(--bg);
  color:var(--muted);
}

.callout {
  border:1px solid var(--accent-line);
  background:var(--wine-soft);
  padding:18px 20px;
  display:flex;
  align-items:center;
  gap:14px;
  border-radius:12px;
  margin:20px 0;
  font-size:13px;
}

.callout>div {
  flex:1;
}

.callout p {
  margin:4px 0 0;
  color:var(--muted);
  font-size:12px;
}

.callout.warning {
  border-color:#e7d2aa;
  background:var(--orange-soft);
}

.empty {
  text-align:center;
  padding:40px 20px;
  background:white;
  border:1px dashed var(--line);
  border-radius:12px;
  grid-column:1/-1;
}

.empty h3 {
  font-size:18px;
}

.empty p {
  font-size:13px;
  color:var(--muted);
  margin:6px 0 0;
}

.empty-mark {
  display:inline-grid;
  place-items:center;
  background:var(--wine-soft);
  color:var(--wine);
  height:45px;
  width:45px;
  border-radius:50%;
  margin-bottom:12px;
}

.pagination {
  display:flex;
  gap:20px;
  align-items:center;
  justify-content:center;
  font-size:13px;
  margin:24px 0;
}

.records-grid,.jobs-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:18px;
}

.record-card,.job-card {
  background:white;
  border:1px solid var(--line);
  border-radius:14px;
  padding:21px;
  min-width:0;
}

.record-card p {
  font-size:13px;
  margin:5px 0;
  color:var(--muted);
  overflow-wrap:anywhere;
}

.record-card h3 {
  margin-top:14px;
}

.job-card {
  padding:0;
}

.job-top {
  display:flex;
  gap:12px;
  padding:20px 20px 0;
  align-items:center;
}

.job-top>div {
  flex:1;
}

.job-top h3 {
  font-size:16px;
  margin:0;
}

.subject-icon {
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  background:var(--wine-soft);
  color:var(--wine);
  border-radius:10px;
  font-size:23px;
  flex:none;
}

.role-label {
  font-size:11px;
  color:var(--muted);
}

.room-line {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin:20px;
  padding:13px 0;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
}

.room-line strong {
  font-size:18px;
}

.room-line span {
  font-size:11px;
  color:var(--muted);
}

.job-meta {
  padding:0 20px 16px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-size:12px;
}

.job-meta>span:first-child {
  color:var(--muted);
}

.job-footer {
  background:#fafbfc;
  border-top:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:12px 18px;
  border-radius:0 0 14px 14px;
}

.job-footer .button {
  font-size:12px;
  padding:8px 12px;
  min-height:44px;
}

.phase-note {
  font-size:10px;
  color:var(--muted);
}

/* Dashboard */
.dashboard-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin:0 0 23px;
}

.exam-selector {
  display:flex;
  align-items:center;
  gap:13px;
  min-width:0;
  font-size:12px;
  color:var(--muted);
}

.exam-selector select {
  font-size:13px;
  min-width:260px;
  max-width:450px;
}

.freshness {
  font-size:10px;
  color:var(--muted);
  white-space:nowrap;
  display:flex;
  align-items:center;
  gap:6px;
}

.freshness i {
  width:5px;
  height:5px;
  border-radius:50%;
  background:var(--green);
}

.dashboard-summary {
  display:grid;
  grid-template-columns:1.5fr 1fr;
  gap:20px;
  margin:0 0 24px;
}

.progress-panel .panel-title {
  margin-bottom:22px;
}

.big-percent {
  font-size:42px;
  letter-spacing:-.05em;
  color:var(--wine);
  line-height:1;
}

.big-percent small {
  font-size:17px;
  margin-left:3px;
}

.panel progress {
  appearance:none;
  display:block;
  width:100%;
  height:7px;
  border:none;
  border-radius:5px;
  background:#edf0f3;
  overflow:hidden;
  accent-color:var(--wine);
}

progress::-webkit-progress-bar {
  background:#edf0f3;
  border-radius:5px;
}

progress::-webkit-progress-value {
  background:var(--wine);
  border-radius:5px;
}

progress::-moz-progress-bar {
  background:var(--wine);
  border-radius:5px;
}

.progress-legend {
  display:flex;
  gap:20px;
  margin:18px 0 10px;
  flex-wrap:wrap;
  font-size:11px;
  color:var(--muted);
}

.progress-legend span {
  display:flex;
  gap:7px;
  align-items:center;
}

.progress-legend b {
  font-weight:600;
  color:var(--ink);
}

.dot {
  width:6px;
  height:6px;
  border-radius:50%;
  display:inline-block;
}

.primary-dot {
  background:var(--wine);
}

.waiting-dot {
  background:var(--gold);
}

.empty-dot {
  background:#c4cdd4;
}

.progress-panel>p {
  font-size:10px;
  margin:8px 0 0;
}

.attention-panel h2 {
  margin-bottom:14px;
}

.quality-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:7px 0;
  font-size:12px;
  color:var(--muted);
}

.quality-row strong {
  font-size:16px;
  color:var(--ink);
}

.quality-row+.quality-row {
  border-top:1px solid #f1f3f5;
}

.teacher-panel {
  padding-bottom:8px;
}

.dashboard-filters {
  padding:0 0 15px;
  margin:0;
  border-bottom:1px solid var(--line);
}

.dashboard-filters .search {
  margin:0;
  width:300px;
  background:#fafbfc;
}

.dashboard-filters .select-filter {
  margin-left:auto;
  font-size:12px;
}

.teacher-table-head,.teacher-row {
  display:grid;
  grid-template-columns:minmax(180px,2fr) minmax(70px,.8fr) minmax(70px,.8fr) minmax(95px,1fr) minmax(100px,1.1fr);
  gap:14px;
  align-items:center;
}

.teacher-table-head {
  font-size:10px;
  color:var(--muted);
  padding:15px 0;
  background:#fff;
}

.teacher-row {
  padding:17px 0;
  border-top:1px solid #edf0f3;
}

.teacher-identity {
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.teacher-identity strong {
  display:block;
  font-size:13px;
  overflow-wrap:anywhere;
}

.teacher-identity small {
  font-size:10px;
  color:var(--muted);
  display:block;
}

.teacher-avatar {
  border-radius:11px;
  width:34px;
  height:34px;
  font-size:13px;
}

.teacher-count {
  font-size:13px;
}

.teacher-count>span:not(.mobile-label) {
  color:var(--muted);
  font-size:11px;
}

.teacher-progress {
  display:flex;
  align-items:center;
  gap:9px;
}

.teacher-progress small {
  font-size:10px;
  color:var(--muted);
  min-width:28px;
}

.teacher-progress progress {
  height:5px;
}

.teacher-status {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
}

.teacher-status>small {
  font-size:9px;
  color:var(--danger);
}

.mobile-label {
  display:none;
}

.subject-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
}

.subject-summary {
  padding:20px;
}

.subject-code {
  font-size:9px;
  letter-spacing:.16em;
  color:var(--wine);
  font-weight:700;
}

.subject-summary h3 {
  font-size:15px;
  margin:6px 0 14px;
}

.subject-numbers {
  display:flex;
  align-items:baseline;
  gap:8px;
  margin-bottom:10px;
}

.subject-numbers strong {
  font-size:26px;
  line-height:1;
}

.subject-numbers span {
  font-size:11px;
  color:var(--muted);
}

.subject-summary>small {
  font-size:10px;
  display:block;
  margin-top:12px;
}

.room-panel {
  margin-top:25px;
}

.room-filters {
  display:flex;
  gap:8px;
  min-width:0;
}

.room-filters select {
  font-size:12px;
  max-width:170px;
}

.room-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.room-card {
  border:1px solid var(--line);
  border-radius:11px;
  padding:17px;
  min-width:0;
}

.room-title {
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding-bottom:12px;
  border-bottom:1px solid var(--line);
}

.room-title strong {
  font-size:14px;
}

.room-title>span {
  font-size:11px;
  color:var(--muted);
}

.room-person {
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  margin-top:12px;
  font-size:12px;
}

.room-person small {
  display:block;
  color:var(--muted);
  font-size:9px;
}

.status-dot {
  display:inline-flex;
  gap:5px;
  align-items:center;
  font-size:10px;
  color:var(--muted);
  white-space:nowrap;
}

.status-dot:before {
  content:'';
  width:5px;
  height:5px;
  border-radius:50%;
  background:currentColor;
  flex:none;
}

.status-dot.success {
  color:var(--green);
}

.status-dot.danger {
  color:var(--danger);
}

.status-dot.waiting {
  color:var(--orange);
}

.room-warning {
  font-size:10px;
  color:var(--danger);
  background:var(--danger-soft);
  border-radius:6px;
  padding:7px 10px;
  margin:12px 0 0;
}

.dashboard-footnote {
  font-size:10px;
  color:var(--muted);
  line-height:1.8;
  margin:20px 2px 6px;
}

.integrity-panel {
  margin-top:24px;
}

.integrity-panel ul {
  padding-left:20px;
  font-size:12px;
}

.integrity-panel li {
  padding:7px 0;
}

.integrity-panel small {
  color:var(--muted);
  overflow-wrap:anywhere;
}

/* Forms, settings and dialogs */
.settings-layout {
  display:grid;
  grid-template-columns:1.6fr 1fr;
  gap:24px;
  align-items:start;
}

.database-panel p {
  font-size:13px;
}

.connection-state {
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--bg);
  padding:16px;
  margin:22px 0;
}

.connection-state .status-dot {
  font-size:12px;
}

.database-id {
  overflow-wrap:anywhere;
  font-size:12px;
  color:var(--muted);
  margin:7px 0 0;
}

.settings-aside {
  display:grid;
  gap:20px;
}

.settings-aside p {
  font-size:13px;
}

.database-title {
  margin-top:18px;
}

.field {
  display:flex;
  flex-direction:column;
  gap:7px;
  min-width:0;
  margin-bottom:16px;
  font-size:13px;
}

.field>span {
  font-size:13px;
  font-weight:550;
}

.field input,.field select {
  width:100%;
  min-height:48px;
  border:1px solid #d7dfe5;
  border-radius:9px;
  padding:10px 12px;
  background:white;
  font-size:16px;
  color:var(--ink);
}

.field input[readonly],.field select:disabled {
  background:var(--bg);
  color:var(--muted);
}

.field small {
  font-size:11px;
  color:var(--muted);
}

.form-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:0 18px;
}

.form-grid>.full {
  grid-column:1/-1;
}

.form-actions {
  display:flex;
  justify-content:flex-end;
  gap:12px;
  margin-top:22px;
  padding-top:18px;
  border-top:1px solid var(--line);
}

.form-error {
  font-size:13px;
  color:var(--danger);
  background:var(--danger-soft);
  padding:12px;
  border-radius:8px;
  overflow-wrap:anywhere;
}

.detail-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  margin:22px 0;
}

.detail-grid>div {
  min-width:0;
}

.detail-grid dt {
  font-size:12px;
  color:var(--muted);
}

.detail-grid dd {
  margin:5px 0 0;
  font-size:14px;
  overflow-wrap:anywhere;
}

dialog {
  border:1px solid var(--line);
  border-radius:20px;
  width:calc(100% - 32px);
  max-width:640px;
  max-height:calc(100dvh - 40px);
  padding:0;
  color:var(--ink);
  box-shadow:0 28px 100px #0e26353a;
  overscroll-behavior:contain;
}

dialog::backdrop {
  background:#0d243d77;
  backdrop-filter:blur(4px);
}

.dialog-head {
  position:sticky;
  top:0;
  background:white;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:20px 24px;
  border-bottom:1px solid var(--line);
  z-index:1;
}

.dialog-head h2 {
  font-size:20px;
  margin:0;
}

#dialog-body {
  padding:24px;
}

.dialog-copy {
  font-size:14px;
  color:var(--muted);
  line-height:1.8;
}

.dialog-copy strong {
  color:var(--ink);
}

.profile-info {
  display:flex;
  gap:14px;
  align-items:center;
  margin-bottom:20px;
  min-width:0;
}

.profile-info>div {
  min-width:0;
}

.profile-info p {
  font-size:13px;
  color:var(--muted);
  margin:3px 0 0;
  overflow-wrap:anywhere;
}

.theme-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}

.theme-option {
  display:flex;
  flex-direction:column;
  align-items:center;
  border:1px solid var(--line);
  background:white;
  border-radius:12px;
  padding:18px 10px;
  gap:5px;
  color:var(--ink);
  min-width:0;
}

.theme-option.selected {
  border:2px solid var(--wine);
  padding:17px 9px;
  background:var(--wine-soft);
}

.theme-option strong {
  font-size:13px;
}

.theme-option small {
  font-size:9px;
  color:var(--muted);
}

.theme-swatch {
  width:36px;
  height:36px;
  border-radius:50%;
  display:grid;
  place-items:center;
  margin-bottom:5px;
  color:white;
}

.theme-swatch span {
  visibility:hidden;
}

.theme-option.selected .theme-swatch span {
  visibility:visible;
}

.swatch-navy {
  background:#183c53;
}

.swatch-wine {
  background:#772d46;
}

.swatch-forest {
  background:#205345;
}

.swatch-violet {
  background:#564169;
}

.swatch-slate {
  background:#374650;
}

.swatch-copper {
  background:#79452e;
}

.toast {
  position:fixed;
  bottom:30px;
  left:50%;
  transform:translateX(-50%);
  max-width:calc(100% - 32px);
  width:max-content;
  padding:14px 20px;
  color:white;
  background:var(--wine-dark);
  border-radius:12px;
  box-shadow:0 7px 32px #17253530;
  z-index:110;
  font-size:13px;
}

.toast.error {
  background:#8a333c;
}

.menu-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.menu-grid .nav-label {
  grid-column:1/-1;
}

.menu-grid .nav-item {
  background:white;
  border:1px solid var(--line);
  padding:16px;
  font-size:14px;
}

.menu-grid .nav-item.active:before {
  display:none;
}

.checklist {
  background:white;
  border:1px solid var(--line);
  border-radius:14px;
}

.checklist-item {
  display:flex;
  gap:15px;
  align-items:center;
  padding:20px;
}

.checklist-item+.checklist-item {
  border-top:1px solid var(--line);
}

.checklist-item>div {
  flex:1;
}

.checklist-item p {
  font-size:13px;
  color:var(--muted);
  margin:4px 0 0;
}

.check-number {
  height:35px;
  width:35px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:var(--wine-soft);
  color:var(--wine);
}

/* Tablet, phones and safe areas */
@media(min-width:1600px) {
  #main {
    padding-left:45px;
    padding-right:45px;
  }

  .sidebar {
    width:250px;
  }

  .main-column {
    margin-left:250px;
  }

}

@media(max-width:1200px) {
  .sidebar {
    width:210px;
    padding-left:14px;
    padding-right:14px;
  }

  .side-brand strong {
    font-size:16px;
  }

  .side-brand small {
    font-size:6px;
  }

  .side-brand img {
    width:37px;
    height:37px;
  }

  .main-column {
    margin-left:210px;
  }

  .topbar {
    padding:15px 24px;
  }

  .topbar>.school-name {
    font-size:13px;
  }

  .header-actions {
    gap:8px;
  }

  .mode-tag {
    display:none;
  }

  #main {
    padding:25px 24px 12px;
  }

  .demo-banner {
    padding:7px 24px;
  }

  .stat {
    padding:18px 16px;
  }

  .stat-label {
    font-size:11px;
  }

  .stats {
    gap:12px;
  }

  .teacher-table-head,.teacher-row {
    grid-template-columns:minmax(145px,1.7fr) 65px 65px minmax(85px,1fr) minmax(90px,1fr);
    gap:10px;
  }

  .teacher-identity {
    gap:8px;
  }

  .teacher-avatar {
    width:30px;
    height:30px;
  }

  .jobs-grid,.records-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .subject-grid {
    gap:12px;
  }

  .subject-summary {
    padding:16px;
  }

  .dashboard-summary {
    gap:16px;
  }

  .panel {
    padding:20px;
  }

  .teacher-panel {
    padding-bottom:8px;
  }

  .nav-item {
    font-size:12px;
  }

  .nav-item.unavailable {
    font-size:11px;
  }

  .login-brand {
    padding:40px 32px;
  }

  .login-body {
    gap:6%;
  }

}

@media(max-width:1000px) {
  .sidebar {
    display:none;
  }

  .main-column {
    margin-left:0;
    padding-bottom:85px;
  }

  .mobile-nav {
    display:flex;
    position:fixed;
    bottom:0;
    left:0;
    right:0;
    background:#fffffffa;
    border-top:1px solid var(--line);
    padding:6px max(12px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
    z-index:40;
    justify-content:space-around;
    backdrop-filter:blur(15px);
  }

  .mobile-nav .nav-item {
    flex:1;
    flex-direction:column;
    gap:3px;
    font-size:10px;
    margin:0;
    padding:7px 8px;
    min-height:52px;
    max-width:140px;
  }

  .mobile-nav .nav-item.active:before {
    display:none;
  }

  .mobile-nav .nav-item svg {
    width:20px;
    height:20px;
  }

  .topbar {
    min-height:75px;
  }

  .topbar>.school-name {
    font-size:16px;
  }

  .content-footer {
    padding-left:24px;
    padding-right:24px;
  }

  .toast {
    bottom:calc(86px + env(safe-area-inset-bottom));
  }

  .login-body {
    padding:24px;
    gap:30px;
  }

  .login-header {
    padding:20px 24px;
  }

  .login-brand {
    padding:35px 28px;
  }

  .brand-proof {
    gap:12px;
  }

  .brand-proof b {
    font-size:11px;
  }

  .login-footer {
    padding-left:24px;
    padding-right:24px;
  }

  .login-footer .school-name {
    font-size:13px;
  }

}

@media(max-width:760px) {
  h1 {
    font-size:25px;
  }

  .login-body {
    display:block;
    max-width:520px;
    padding:24px;
  }

  .login-brand {
    display:none;
  }

  .login-main {
    padding:8px 0 18px;
  }

  .login-card {
    max-width:400px;
  }

  .login-card h2 {
    font-size:28px;
  }

  .login-header {
    padding:18px 22px;
  }

  .login-footer {
    flex-wrap:wrap;
    justify-content:center;
    gap:5px 20px;
    margin-top:auto;
    padding:14px 16px max(18px,env(safe-area-inset-bottom));
    border-top:1px solid var(--line);
  }

  .login-footer .school-name {
    width:100%;
    text-align:center;
    font-size:clamp(12px,3.7vw,15px);
  }

  .login-footer .small {
    font-size:9px;
  }

  .brand-line strong {
    font-size:18px;
  }

  .brand-line small {
    font-size:8px;
  }

  .brand-line img {
    width:42px;
    height:42px;
  }

  .login-header .button {
    padding:8px 12px;
    font-size:12px;
  }

  .topbar {
    padding:13px 20px 12px;
    display:grid;
    grid-template-columns:1fr auto;
    gap:10px 12px;
  }

  .mobile-brand {
    display:flex;
    align-items:center;
    gap:9px;
    font-size:16px;
    color:var(--wine);
  }

  .mobile-brand img {
    border-radius:50%;
    object-fit:contain;
  }

  .topbar>.school-name {
    grid-row:2;
    grid-column:1/-1;
    font-size:clamp(12px,3.5vw,15px);
    text-align:left;
    padding-top:2px;
  }

  .header-actions {
    grid-row:1;
    grid-column:2;
    gap:6px;
  }

  .user-button {
    padding-left:7px;
    gap:5px;
  }

  .user-button>span:not(.avatar) {
    display:none;
  }

  .avatar {
    width:32px;
    height:32px;
  }

  .topbar .icon-button {
    border-color:transparent;
    font-size:24px;
  }

  .demo-banner {
    padding:8px 20px;
    font-size:10px;
    gap:8px;
  }

  .demo-banner .link-button {
    font-size:10px;
  }

  .page-heading {
    align-items:flex-start;
    gap:12px;
    margin-bottom:20px;
  }

  .page-heading h1 {
    font-size:23px;
  }

  .page-heading p {
    font-size:12px;
  }

  .breadcrumb {
    font-size:8px;
  }

  .page-heading>.button {
    font-size:11px;
    padding:9px 10px;
    min-height:44px;
  }

  .heading-date {
    display:none;
  }

  .stats {
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
  }

  .stat {
    padding:17px;
  }

  .stat-label {
    font-size:12px;
  }

  .stat>strong {
    font-size:32px;
    margin-top:3px;
  }

  .stat>small {
    font-size:10px;
  }

  .dashboard-toolbar {
    align-items:flex-end;
    gap:12px;
  }

  .exam-selector {
    flex:1;
    flex-direction:column;
    align-items:stretch;
    gap:5px;
    font-size:10px;
  }

  .exam-selector select {
    min-width:0;
    max-width:100%;
    font-size:12px;
  }

  .freshness {
    font-size:9px;
    padding-bottom:12px;
  }

  .dashboard-summary {
    grid-template-columns:1fr;
  }

  .progress-panel .panel-title {
    margin-bottom:19px;
  }

  .big-percent {
    font-size:37px;
  }

  .panel {
    padding:21px;
  }

  .panel-title {
    margin-bottom:18px;
  }

  .panel h2,.section-heading h2 {
    font-size:19px;
  }

  .attention-panel {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:0 18px;
  }

  .attention-panel>.eyebrow,.attention-panel>h2 {
    grid-column:1/-1;
  }

  .attention-panel .quality-row {
    display:block;
    border:0;
    background:var(--bg);
    padding:10px 12px;
    border-radius:8px;
    margin-top:7px;
    font-size:10px;
  }

  .attention-panel .quality-row strong {
    display:block;
    font-size:22px;
    margin-top:1px;
  }

  .attention-panel .quality-row:last-child {
    grid-column:1/-1;
    display:flex;
    align-items:center;
  }

  .teacher-table-head {
    display:none;
  }

  .teacher-row {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:13px 20px;
    padding:20px 0;
  }

  .teacher-identity {
    grid-row:1;
    grid-column:1/-1;
    padding-right:110px;
    min-height:40px;
    gap:10px;
  }

  .teacher-identity strong {
    font-size:14px;
  }

  .teacher-identity small {
    font-size:11px;
  }

  .teacher-avatar {
    width:35px;
    height:35px;
  }

  .teacher-status {
    grid-row:1;
    grid-column:2;
    justify-self:end;
    align-self:start;
    align-items:flex-end;
  }

  .teacher-status .badge {
    font-size:10px;
  }

  .teacher-count {
    background:#f7f9fa;
    padding:8px 11px;
    border-radius:7px;
    display:flex;
    gap:4px;
    align-items:center;
  }

  .teacher-count>span.mobile-label {
    display:inline;
    font-size:11px;
    color:var(--muted);
    margin-right:auto;
  }

  .teacher-progress {
    grid-column:1/-1;
  }

  .teacher-progress small {
    font-size:10px;
  }

  .teacher-panel {
    padding-bottom:0;
  }

  .dashboard-filters {
    gap:10px;
    padding-bottom:17px;
  }

  .dashboard-filters .search {
    flex:1;
    min-width:140px;
    width:auto;
  }

  .dashboard-filters .select-filter {
    min-width:100px;
    max-width:140px;
    font-size:11px;
  }

  .subject-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px;
  }

  .subject-summary {
    padding:18px;
  }

  .room-panel .panel-title {
    display:block;
  }

  .room-filters {
    margin-top:17px;
  }

  .room-filters select {
    flex:1;
    max-width:none;
    font-size:12px;
  }

  .room-grid {
    grid-template-columns:1fr;
  }

  .room-card {
    padding:17px;
  }

  .room-title strong {
    font-size:15px;
  }

  .room-person {
    font-size:13px;
  }

  .room-person small {
    font-size:10px;
  }

  .status-dot {
    font-size:11px;
  }

  .settings-layout {
    grid-template-columns:1fr;
  }

  .settings-aside {
    grid-template-columns:1fr 1fr;
    gap:16px;
  }

  .settings-aside>p {
    grid-column:1/-1;
  }

  .settings-aside .panel {
    padding:18px;
  }

  .settings-aside h2 {
    font-size:17px;
  }

  .settings-aside p {
    font-size:12px;
  }

  .settings-aside .button {
    font-size:12px;
    padding:9px;
  }

  .records-grid,.jobs-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .job-top {
    flex-wrap:wrap;
  }

  .job-top .badge {
    margin-left:54px;
    margin-top:-5px;
  }

  .job-top h3 {
    font-size:15px;
  }

  .room-line {
    flex-direction:column;
    align-items:flex-start;
    gap:3px;
  }

  .job-footer {
    flex-direction:column;
  }

  .job-footer .button {
    width:100%;
  }

  .filters .search {
    flex:1;
    min-width:160px;
  }

  .filters .tabs {
    flex:none;
  }

  .filters .select-filter {
    flex:1;
  }

  .callout {
    align-items:flex-start;
    flex-wrap:wrap;
  }

  .callout>.button {
    font-size:12px;
  }

  .form-grid {
    grid-template-columns:1fr;
  }

  .content-footer {
    font-size:9px;
    flex-wrap:wrap;
  }

  .menu-grid {
    gap:8px;
  }

  .menu-grid .nav-item {
    font-size:12px;
    padding:13px;
    gap:9px;
  }

  .theme-grid {
    gap:10px;
  }

  .theme-option {
    padding:16px 7px;
  }

  .theme-option.selected {
    padding:15px 6px;
  }

}

@media(max-width:450px) {
  #main {
    padding:24px 16px 10px;
  }

  .topbar {
    padding:12px 16px 10px;
  }

  .demo-banner {
    padding:6px 16px;
    font-size:9px;
  }

  .demo-banner .link-button {
    min-height:36px;
    font-size:9px;
  }

  .demo-banner>span {
    max-width:230px;
  }

  .page-heading h1 {
    font-size:21px;
  }

  .page-heading p {
    font-size:11px;
  }

  .page-heading .button {
    font-size:10px;
    padding:8px;
  }

  .page-heading {
    gap:10px;
  }

  .dashboard-toolbar {
    gap:9px;
  }

  .freshness {
    font-size:8px;
  }

  .stats {
    gap:10px;
  }

  .stat {
    padding:15px 13px;
  }

  .stat-label {
    font-size:11px;
  }

  .stat-icon {
    width:24px;
    height:24px;
  }

  .stat>small {
    font-size:9px;
  }

  .stat>strong {
    font-size:31px;
  }

  .panel {
    padding:18px;
  }

  .teacher-panel {
    padding-bottom:0;
  }

  .progress-legend {
    gap:12px;
    font-size:10px;
  }

  .progress-panel>p {
    font-size:9px;
  }

  .panel h2,.section-heading h2 {
    font-size:18px;
  }

  .teacher-identity {
    padding-right:97px;
  }

  .teacher-identity strong {
    font-size:13px;
  }

  .teacher-identity small {
    font-size:10px;
  }

  .teacher-avatar {
    width:30px;
    height:30px;
    font-size:12px;
  }

  .teacher-row {
    gap:11px 12px;
  }

  .dashboard-filters .search {
    min-width:100%;
    font-size:16px;
  }

  .dashboard-filters .select-filter {
    margin:0;
    max-width:none;
    font-size:13px;
  }

  .subject-summary {
    padding:16px;
  }

  .subject-summary h3 {
    font-size:14px;
  }

  .room-card {
    padding:14px;
  }

  .room-title>span {
    font-size:10px;
  }

  .room-person {
    font-size:12px;
  }

  .dashboard-footnote {
    font-size:9px;
  }

  .jobs-grid,.records-grid {
    grid-template-columns:1fr;
  }

  .job-top {
    flex-wrap:nowrap;
  }

  .job-top .badge {
    margin:0;
  }

  .room-line {
    flex-direction:row;
    align-items:center;
  }

  .job-footer {
    flex-direction:row;
  }

  .job-footer .button {
    width:auto;
  }

  .settings-aside {
    grid-template-columns:1fr;
  }

  .settings-aside>p {
    grid-column:auto;
  }

  .login-header {
    padding:16px;
  }

  .login-body {
    padding:22px;
  }

  .login-header .theme-trigger {
    width:44px;
    padding:0;
  }

  .login-header .theme-trigger span:last-child {
    display:none;
  }

  .login-card h2 {
    font-size:27px;
  }

  .login-tabs {
    margin:23px 0;
  }

  .login-note {
    margin-bottom:20px;
  }

  dialog {
    width:calc(100% - 20px);
    max-height:calc(100dvh - 24px);
    border-radius:15px;
  }

  .dialog-head {
    padding:15px 17px;
  }

  .dialog-head h2 {
    font-size:17px;
  }

  #dialog-body {
    padding:18px;
  }

  .form-actions {
    gap:8px;
  }

  .form-actions .button {
    padding:10px 12px;
    font-size:13px;
  }

  .detail-grid {
    gap:14px;
  }

  .theme-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .theme-option strong {
    font-size:13px;
  }

  .theme-option small {
    font-size:10px;
  }

  .theme-option {
    padding:14px 10px;
  }

  .theme-option.selected {
    padding:13px 9px;
  }

  .content-footer {
    padding:20px 16px;
  }

  .field input,.field select,.search,.select-filter {
    font-size:16px;
  }

}

@media(max-width:350px) {
  .page-heading {
    flex-wrap:wrap;
  }

  .page-heading>.button {
    font-size:12px;
  }

  .stats {
    gap:8px;
  }

  .stat {
    padding:13px 11px;
  }

  .stat-label {
    font-size:10px;
  }

  .stat-icon {
    display:none;
  }

  .stat>small {
    font-size:9px;
  }

  .topbar>.school-name {
    font-size:11.5px;
  }

  .mobile-brand {
    font-size:15px;
  }

  .teacher-avatar {
    display:none;
  }

  .teacher-identity {
    padding-right:97px;
  }

  .panel {
    padding:15px;
  }

  .teacher-panel {
    padding-bottom:0;
  }

  .progress-legend {
    gap:9px;
  }

  .freshness {
    display:none;
  }

  .login-body {
    padding:20px;
  }

  .room-person {
    gap:7px;
  }

  .room-title strong {
    font-size:14px;
  }

}

@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after {
    animation-duration:.01ms!important;
    transition:none!important;
    scroll-behavior:auto!important;
  }

}

@media print {
  .sidebar,.topbar,.mobile-nav,.demo-banner,.content-footer,.button,.filters,.room-filters {
    display:none!important;
  }

  .main-column {
    margin:0;
    padding:0;
  }

  #main {
    padding:0;
  }

  .panel,.stat,.teacher-row,.room-card {
    break-inside:avoid;
    box-shadow:none;
  }

  body {
    font-size:12px;
    background:white;
  }

  .stats {
    grid-template-columns:repeat(4,1fr);
  }

  .teacher-table-head,.teacher-row {
    display:grid;
    grid-template-columns:2fr 1fr 1fr 1fr 1fr;
  }

  .teacher-identity,.teacher-status,.teacher-progress {
    grid-row:auto;
    grid-column:auto;
    padding:0;
  }

  .mobile-label {
    display:none;
  }

}

/* Keep iOS form controls at 16px to avoid focus zoom, including tablet layouts. */
@media(max-width:1000px) {
  #main input,#main select,#modal input,#modal select {
    font-size:16px;
  }

  .mobile-nav {
    background:#fff;
    backdrop-filter:none;
  }

  .demo-banner .link-button {
    min-height:44px;
  }

  #main {
    padding-left:max(16px,env(safe-area-inset-left));
    padding-right:max(16px,env(safe-area-inset-right));
  }

  .topbar {
    padding-top:calc(12px + env(safe-area-inset-top));
    padding-left:max(16px,env(safe-area-inset-left));
    padding-right:max(16px,env(safe-area-inset-right));
  }

  .login-header {
    padding-top:calc(16px + env(safe-area-inset-top));
    padding-left:max(16px,env(safe-area-inset-left));
    padding-right:max(16px,env(safe-area-inset-right));
  }

}

/* The same focus-safe size applies to iPad landscape and larger touch screens. */
#main input, #main select, #modal input, #modal select {
  font-size:16px;
}

/* Three credit rows; long lines wrap naturally on small phones. */
.developer-credit { display: grid; gap: .2rem; text-align: center; font-size: .75rem; line-height: 1.7; color: var(--muted); width: 100%; }
.developer-credit span { display: block; }
.login-footer { flex-wrap: wrap; justify-content: center; padding-block: 1.2rem; }
.login-footer .developer-credit { flex-basis: 100%; }
.content-footer { display: block; padding: 1.2rem 1rem; }
.freshness { flex-wrap: wrap; }
.freshness.stale { color: #9b4b12; }
.freshness.stale i { background: #b56a22; }
@media (max-width: 600px) { .developer-credit { font-size: .68rem; } .login-footer { position: static; } }
.score-trio { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:18px 0; }
.score-trio dt { color:var(--muted); font-size:12px; }
.score-trio dd { font-size:22px; font-weight:700; margin:4px 0; }
.export-panel { padding:clamp(20px,3vw,32px); margin:22px 0; background:var(--surface,#fff); border:1px solid var(--border,#e2e5e8); border-radius:20px; }
.export-panel p { line-height:1.8; }
.export-panel .form-actions { flex-wrap:wrap; justify-content:flex-start; }
.upload-rows { max-height:320px; overflow:auto; border:1px solid var(--border,#ddd); border-radius:12px; margin:16px 0; }
.upload-rows > div { display:flex; justify-content:space-between; gap:16px; padding:10px 14px; border-bottom:1px solid var(--border,#ddd); }
.check-label { display:flex; align-items:flex-start; gap:10px; margin:18px 0; line-height:1.7; }
.check-label input { flex:0 0 20px; width:20px; height:20px; margin-top:4px; }
.field textarea { min-height:100px; padding:12px; font:inherit; font-size:16px; border:1px solid var(--border,#ddd); border-radius:10px; resize:vertical; }
.file-hash { overflow-wrap:anywhere; font-size:12px; }

/* Guided setup and recovery messages */
.setup-panel { margin-bottom: 28px; border-top: 3px solid var(--wine); }
.setup-heading, .setup-footer { display:flex; align-items:center; justify-content:space-between; gap:18px; flex-wrap:wrap; }
.setup-heading h2 { margin:6px 0; font-size:clamp(20px,2.2vw,26px); }
.setup-heading p { margin:0; color:var(--muted); }
.setup-steps { list-style:none; padding:0; margin:24px 0; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.setup-steps li { border:1px solid var(--line); border-radius:12px; background:#fff; }
.setup-steps li.current { border-color:var(--wine); background:var(--wine-soft); }
.setup-steps a { display:flex; align-items:center; gap:12px; padding:16px; text-decoration:none; color:inherit; min-height:94px; }
.setup-steps a > span:nth-child(2) { flex:1; min-width:0; }
.setup-steps strong, .setup-steps small { display:block; }
.setup-steps small { color:var(--muted); font-size:13px; line-height:1.6; margin-top:4px; }
.step-number { flex:0 0 30px; height:30px; border-radius:50%; background:var(--wine-soft); color:var(--wine); display:grid; place-items:center; font-weight:700; }
.complete .step-number { background:#e7f4ed; color:#276445; }
.setup-complete { margin-bottom:24px; }
summary { cursor:pointer; min-height:44px; padding:10px 0; font-weight:600; }
.help-layout { display:grid; grid-template-columns:1.2fr 1fr; gap:24px; align-items:start; }
.help-layout h2 { margin-top:0; }
.help-layout p { line-height:1.8; color:var(--muted); }
.help-layout details + details { border-top:1px solid var(--line); }
.help-steps { padding-left:24px; }
.help-steps li { padding-left:8px; margin-bottom:24px; }
.help-steps h3 { margin-bottom:6px; font-size:17px; }
.help-steps p { margin-top:0; }
.workspace-notice { margin:16px 32px 0; border:1px solid #dfc68e; background:#fff8e9; color:#674a18; border-radius:12px; padding:16px 20px; display:flex; gap:16px; align-items:center; justify-content:space-between; line-height:1.7; }
.workspace-notice .button { flex-shrink:0; }
.mode-tag.stale { background:#fff1d5; color:#78520c; }
@media(max-width:760px) { .setup-steps, .help-layout { grid-template-columns:1fr; } .setup-steps a { min-height:80px; padding:14px; } .setup-footer { align-items:stretch; } .setup-footer .button { width:100%; justify-content:center; } .workspace-notice { margin:12px 16px 0; align-items:stretch; flex-direction:column; } }
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { animation-duration:.01ms !important; transition-duration:.01ms !important; scroll-behavior:auto !important; } }
