:root {
  color-scheme: light;
  --ink: #1f2a24;
  --muted: #66736c;
  --paper: #ffffff;
  --canvas: #f4f8f2;
  --surface: #fbfdf9;
  --line: #dce7df;
  --green: #1f8f45;
  --green-dark: #106331;
  --green-soft: #eaf7ed;
  --orange: #f4a51c;
  --warm: #fff6df;
  --danger: #b42318;
  --shadow: 0 12px 34px rgba(31, 143, 69, .08);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
body { min-width: 0; min-height: 100vh; margin: 0; overflow-x: hidden; background: var(--canvas); color: var(--ink); font-size: 16px; line-height: 1.45; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 9px 13px; border-radius: 6px; background: var(--ink); color: white; text-decoration: none; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 68px; padding: 0 28px;
  background: var(--paper); border-bottom: 4px solid var(--green);
  box-shadow: 0 4px 18px rgba(31, 143, 69, .08);
}
.topbar > * { min-width: 0; }
.brand { display: inline-flex; align-items: center; min-height: 52px; text-decoration: none; }
.brand-logo { display: block; width: auto; height: 46px; }
.nav { display: flex; gap: 10px; align-items: center; }
.nav form { margin: 0; }
.nav a, .link-button { text-decoration: none; border: 0; background: transparent; color: var(--muted); padding: 9px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.nav a:hover, .link-button:hover { color: var(--ink); background: var(--green-soft); }
.nav a.active { background: var(--green-soft); color: var(--green-dark); font-weight: 800; }
.account-menu { position: relative; flex: 0 0 auto; }
.account-menu > summary { display: grid; gap: 1px; min-width: 145px; padding: 8px 32px 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary::after { content: "⌄"; position: absolute; top: 50%; right: 12px; color: var(--green); font-weight: 900; transform: translateY(-50%); }
.account-menu[open] > summary { border-color: #b7d3c0; background: var(--green-soft); }
.account-name { overflow: hidden; font-size: .84rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.account-role { color: var(--muted); font-size: .7rem; }
.account-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; display: grid; width: 260px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: 0 18px 45px rgba(24, 61, 37, .18); }
.account-panel::before { content: ""; position: absolute; right: 22px; bottom: 100%; border: 7px solid transparent; border-bottom-color: var(--line); }
.account-panel a, .account-panel .link-button { display: flex; align-items: center; width: 100%; min-height: 42px; padding: 9px 11px; border-radius: 6px; text-align: left; text-decoration: none; }
.account-panel a:hover, .account-panel .link-button:hover { background: var(--green-soft); }
.account-panel form { margin: 0; }
.account-identity { display: grid; gap: 2px; margin-bottom: 5px; padding: 8px 11px 12px; border-bottom: 1px solid var(--line); }
.account-identity span { color: var(--muted); font-size: .76rem; }

.page { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 22px 56px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.hero > *, .card-head > * { min-width: 0; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin-top: 0; overflow-wrap: anywhere; }
h1 { margin-bottom: 8px; font-size: 34px; font-weight: 800; line-height: 1.15; }
h2 { font-size: 21px; line-height: 1.25; }
.lede, .muted { color: var(--muted); }
.lede { max-width: 720px; margin: 0; overflow-wrap: anywhere; font-size: 1.05rem; line-height: 1.65; }

.button { display: inline-flex; align-items: center; justify-content: center; max-width: 100%; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 6px; background: var(--green); color: white; font-weight: 750; text-align: center; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--green-dark); }
.button:disabled { opacity: .55; cursor: not-allowed; background: var(--muted); }
.button.secondary { background: white; border-color: var(--line); color: var(--ink); }
.button.danger { background: var(--danger); }
.button.danger:hover { background: #853333; }
.button.small { min-height: 34px; padding: 7px 10px; font-size: .82rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat, .card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.stat { padding: 20px; }
.stat strong { display: block; margin-top: 9px; overflow-wrap: anywhere; font-size: 2rem; letter-spacing: -.04em; }
.stat strong.compact-stat { font-size: 1.2rem; line-height: 1.25; }
.stat span { color: var(--muted); font-size: .88rem; }
.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; }
.dashboard-grid { grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr); align-items: start; }
.card { padding: 24px; margin-bottom: 20px; }
.card-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; }
.card-head h2 { margin: 0; }
.action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.action-card { display: grid; align-content: start; gap: 7px; min-height: 180px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-decoration: none; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.action-card:hover { border-color: #9fc4ad; box-shadow: 0 10px 24px rgba(31, 143, 69, .10); transform: translateY(-2px); }
.action-card.primary-action { border-color: #abd0b5; background: var(--green-soft); }
.action-card strong { color: var(--green-dark); font-size: 1rem; }
.action-card span:not(.action-kicker) { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.action-card b { align-self: end; margin-top: auto; color: var(--green); font-size: .84rem; }
.action-kicker { color: var(--green); font-size: .7rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.quick-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.quick-links a { display: grid; gap: 4px; min-height: 86px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: var(--shadow); text-decoration: none; }
.quick-links a:hover { border-color: #9fc4ad; background: var(--green-soft); }
.quick-links strong { color: var(--green-dark); }
.quick-links span { color: var(--muted); font-size: .82rem; }
.focus-card { position: sticky; top: 92px; }
.focus-card .form-actions { display: grid; }
.focus-card .button { width: 100%; }
.course-workflow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: -6px 0 20px; }
.course-workflow a { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 2px 8px; align-items: center; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: white; text-decoration: none; }
.course-workflow a:hover { border-color: #9fc4ad; background: var(--green-soft); }
.course-workflow a > span { grid-row: 1 / 3; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: white; font-size: .82rem; font-weight: 850; }
.course-workflow strong, .course-workflow small { min-width: 0; overflow-wrap: anywhere; }
.course-workflow strong { color: var(--green-dark); font-size: .82rem; line-height: 1.25; }
.course-workflow small { color: var(--muted); font-size: .7rem; line-height: 1.3; }
.page-tabs { display: flex; gap: 7px; margin: -6px 0 20px; overflow-x: auto; scrollbar-width: thin; }
.page-tabs a { flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--green-dark); font-size: .84rem; font-weight: 750; text-decoration: none; }
.page-tabs a:hover { background: var(--green-soft); }
.compact-course-info .card-head { margin-bottom: 0; }
.inline-details { min-width: 185px; }
.inline-details > summary, .action-menu > summary { display: flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--green-dark); font-size: .8rem; font-weight: 800; cursor: pointer; list-style: none; }
.inline-details > summary::-webkit-details-marker, .action-menu > summary::-webkit-details-marker { display: none; }
.inline-details > summary::after, .action-menu > summary::after { content: "+"; margin-left: 7px; color: var(--green); }
.inline-details[open] > summary::after, .action-menu[open] > summary::after { content: "–"; }
.inline-details[open] > summary { margin-bottom: 9px; background: var(--green-soft); }
.inline-details .action-stack { min-width: 0; }
.action-menu { position: relative; }
.action-menu > summary { min-height: 42px; padding: 10px 16px; color: var(--ink); }
.action-menu > div { position: absolute; top: calc(100% + 7px); right: 0; z-index: 8; display: grid; width: 230px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 14px 34px rgba(24, 61, 37, .16); }
.action-menu a { padding: 10px; border-radius: 6px; font-size: .84rem; font-weight: 700; text-decoration: none; }
.action-menu a:hover { background: var(--green-soft); }
.download-link { display: inline-flex; align-items: center; }
.download-link a { color: var(--green-dark); font-size: .84rem; font-weight: 750; }

.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.table-tools { display: flex; align-items: end; justify-content: flex-end; gap: 10px; margin: -3px 0 14px; }
.table-tools label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.table-tools input[type="search"] { width: min(390px, 100%); min-height: 40px; }
tr[hidden] { display: none !important; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child td { border-bottom: 0; }
.scroll-target { scroll-margin-top: 92px; }
.badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-size: .78rem; font-weight: 800; }
.badge.warm { background: var(--warm); color: #725611; }
.status-detail { margin-top: 6px; color: var(--ink); font-size: .86rem; line-height: 1.4; }
.inline-form { margin: 0; }
.action-stack { display: grid; gap: 7px; min-width: 210px; }
.assignment-control { display: grid; gap: 7px; padding-top: 8px; margin-top: 3px; border-top: 1px solid var(--line); }
.assignment-control select { min-height: 38px; padding: 7px 9px; font-size: .82rem; }
.room-control { display: grid; gap: 6px; min-width: 230px; margin: 0; }
.room-control select { min-height: 38px; padding: 7px 9px; font-size: .8rem; }
.room-control .button { width: 100%; }
.danger-link { width: 100%; padding: 5px 8px; color: var(--danger); font-size: .78rem; text-align: left; }
.action-note { padding: 3px 2px; font-size: .76rem; line-height: 1.35; }
.variant-list { display: grid; gap: 10px; }
.variant { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfb; }
.variant strong { display: block; margin-bottom: 4px; }
.variant small { color: var(--muted); }
.schedule-list { display: grid; gap: 7px; min-width: 220px; }
.schedule-list div { display: grid; gap: 2px; padding: 8px 10px; border-radius: 9px; background: var(--green-soft); }
.schedule-list strong { color: var(--green-dark); font-size: .86rem; }
.schedule-list span { color: var(--muted); font-size: .78rem; }
.session-assignment-list { display: grid; gap: 10px; min-width: 320px; }
.session-assignment-card { display: grid; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfb; }
.session-assignment-card-head { display: grid; gap: 2px; }
.session-assignment-card-head strong { color: var(--green-dark); font-size: .86rem; }
.session-assignment-card-head span { color: var(--muted); font-size: .78rem; }
.session-assignment-state { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.session-assignment-actions { display: grid; gap: 6px; }
.content-range-preview { display: block; padding: 8px 10px; border-radius: 7px; background: var(--green-soft); color: var(--green-dark); font-weight: 750; }
.makeup-needs, .makeup-assignments, .makeup-suggestions, .makeup-suggestion-group { display: grid; gap: 10px; }
.makeup-need-card { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfb; }
.makeup-need-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.makeup-need-head h3 { margin: 0 0 4px; color: var(--green-dark); font-size: 1.05rem; }
.makeup-need-head p { margin: 0 0 4px; }
.makeup-need-head small { display: block; color: var(--muted); }
.makeup-need-head .eyebrow { margin-bottom: 4px; font-size: .68rem; }
.makeup-assignment-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 9px; background: var(--green-soft); }
.makeup-assignment-row > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 8px; align-items: center; min-width: 0; }
.makeup-assignment-row span:not(.badge), .makeup-assignment-row small { grid-column: 2; color: var(--muted); }
.makeup-suggestions { padding-top: 12px; border-top: 1px solid var(--line); }
.makeup-suggestions h4 { margin: 0; }
.makeup-suggestion-group > strong { font-size: .86rem; }
.makeup-candidate { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.makeup-candidate > div { display: grid; gap: 2px; min-width: 0; }
.makeup-candidate span, .makeup-candidate small { color: var(--muted); }
.compact-empty { padding: 14px; text-align: left; }

.form-card { width: min(720px, 100%); }
.form-card.wide-form { width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; min-width: 0; gap: 7px; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 750; font-size: .9rem; }
input, select, textarea { width: 100%; max-width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cbd9d1; border-radius: 6px; background: white; color: var(--ink); }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(244, 165, 28, .32); outline-offset: 2px; border-color: var(--green); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.choice-field { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.choice-field legend { padding: 0 7px; font-weight: 800; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.location-choices { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.choice-box { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfb; cursor: pointer; }
.choice-box:hover { border-color: #a9c7b6; background: var(--green-soft); }
.choice-box input { width: 22px; height: 22px; min-height: 0; flex: 0 0 22px; margin: 0; padding: 0; accent-color: var(--green); cursor: pointer; }
.choice-box span { display: grid; gap: 3px; min-width: 0; line-height: 1.35; }
.choice-box small { color: var(--muted); font-weight: 500; }
.active-choice { margin-top: 2px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-color: #e7c3c3; }
.danger-zone h2, .danger-zone p { margin-bottom: 4px; }
.credential-card { width: min(680px, 100%); }
.credential-row { display: grid; grid-template-columns: 160px 1fr; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.credential-row span { color: var(--muted); font-weight: 750; }
.credential-row code { padding: 12px 14px; border-radius: 9px; background: #f1f5f2; color: var(--ink); font-size: 1.05rem; font-weight: 800; overflow-wrap: anywhere; user-select: all; }
.warm-alert { margin-top: 18px; background: var(--warm); color: #725611; border-color: #efdfb5; }
.upload-form { display: grid; grid-template-columns: 1fr; gap: 12px; }
.upload-form .button { justify-self: start; }
.upload-form input[type="file"] { padding: 7px; }
.upload-form input[type="file"]::file-selector-button { margin-right: 10px; padding: 8px 11px; border: 0; border-radius: 7px; background: var(--green-soft); color: var(--green-dark); font-weight: 750; cursor: pointer; }
.material-upload-box { display: grid; gap: 4px; margin-bottom: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--green-soft); }
.material-upload-box > strong { color: var(--green-dark); }
.material-upload-box > .upload-form { margin-top: 10px; }
.script-note-field { margin-top: 2px; }
.document-note { display: grid; gap: 4px; width: 100%; max-width: 620px; margin-top: 8px; padding: 9px 11px; border-left: 3px solid var(--green); border-radius: 0 8px 8px 0; background: var(--green-soft); font-size: .86rem; line-height: 1.45; }
.document-note strong { color: var(--green-dark); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.document-note span { white-space: pre-wrap; overflow-wrap: anywhere; }
.trash-actions { display: grid; gap: 8px; min-width: 150px; }
.trash-actions form { margin: 0; }
.trash-actions .button { width: 100%; }
.audit-table .status-detail { max-width: 620px; overflow-wrap: anywhere; }
.journal-content { min-width: 180px; white-space: pre-wrap; overflow-wrap: anywhere; }
.grade-roster { display: grid; gap: 10px; }
.grade-person { display: grid; grid-template-columns: minmax(190px, 1fr) 220px minmax(220px, 1.2fr); gap: 14px; align-items: end; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfb; }
.grade-name { display: grid; gap: 5px; align-self: center; min-width: 0; }
.grade-name .muted { font-size: .78rem; line-height: 1.35; }
.grade-person .field span { font-weight: 750; font-size: .82rem; }
.grade-actions { align-items: stretch; }
.attendance-roster-head, .attendance-person { display: grid; grid-template-columns: minmax(160px, 1fr) 64px 64px 104px 104px; gap: 8px; align-items: center; }
.attendance-roster-head { padding: 8px 8px 10px; color: var(--muted); font-size: .76rem; font-weight: 800; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.attendance-roster-head span:not(:first-child) { text-align: center; }
.attendance-person { padding: 11px 8px; border-bottom: 1px solid var(--line); }
.attendance-person:last-child { border-bottom: 0; }
.attendance-name { min-width: 0; }
.attendance-name { display: grid; gap: 3px; }
.attendance-detail { font-size: .74rem; line-height: 1.3; }
.attendance-makeup-badge { justify-self: start; margin-top: 2px; }
.attendance-check { display: grid; place-items: center; min-height: 40px; cursor: pointer; }
.attendance-check input { width: 25px; height: 25px; min-height: 0; margin: 0; padding: 0; border-radius: 4px; accent-color: var(--green); cursor: pointer; }
.mobile-control-label { display: none; }
.attendance-late { display: grid; place-items: center; }
.number-with-unit { display: block; width: 88px; }
.number-with-unit input { width: 100%; min-height: 38px; padding: 6px 8px; border-radius: 6px; text-align: center; }
.attendance-actions { align-items: stretch; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; background: #fdeaea; color: var(--danger); border: 1px solid #f1caca; }
.success { padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; background: var(--green-soft); color: var(--green-dark); border: 1px solid #bfdbc9; }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed #c8d7cf; border-radius: 12px; }
.material-folders { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.material-folder { display: grid; gap: 7px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfb; text-decoration: none; }
.material-folder:hover { border-color: #a9c7b6; background: var(--green-soft); }
.material-folder .badge { justify-self: start; }
.material-folder strong, .material-folder span { overflow-wrap: anywhere; }
.regulation-card p { margin-bottom: 0; line-height: 1.6; }
.participant-courses { display: grid; gap: 12px; }
.participant-course-card { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(240px, .8fr); gap: 16px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfb; }
.participant-course-card > div { display: grid; gap: 4px; min-width: 0; }
.participant-course-card small { color: var(--muted); }
.participant-course-choices { display: grid; gap: 10px; }
.participant-course-choice { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(180px, .45fr); align-items: center; }
.course-choice-copy { display: grid; gap: 3px; min-width: 0; cursor: pointer; }
.course-choice-copy small { color: var(--muted); font-weight: 500; }
.participant-variant-control { display: grid; gap: 5px; min-width: 0; }
.participant-variant-control span { color: var(--muted); font-size: .74rem; font-weight: 800; text-transform: uppercase; }
.participant-variant-control select { min-height: 38px; padding: 7px 9px; }
.participant-variant-form { display: grid; grid-template-columns: minmax(130px, 1fr) auto; gap: 7px; align-items: end; }
.participant-variant-form label { grid-column: 1 / -1; }
.participant-variant-form select { min-height: 38px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.login-card { width: min(420px, 100%); padding: 30px; background: white; border: 1px solid #cfe4d3; border-radius: 8px; box-shadow: 0 22px 60px rgba(16, 99, 49, .14); }
.login-card .brand { justify-content: center; margin-bottom: 30px; }
.login-card .brand-logo { height: 64px; }
.login-card h1 { font-size: 34px; }
.login-card .field { margin-top: 16px; }
.login-card .button { width: 100%; margin-top: 22px; }
.login-hint { margin-top: 18px; padding: 12px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); font-size: .85rem; }
.password-rules { margin: 16px 0 0; padding: 12px 14px; border-left: 3px solid var(--orange); border-radius: 0 6px 6px 0; background: var(--warm); color: #725611; font-size: .88rem; }
.download-frame { display: none; width: 0; height: 0; border: 0; }

.app-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 18px 16px 28px; border-top: 1px solid var(--line); color: var(--muted); }
.app-footer a { color: var(--green); font-weight: 700; text-decoration: none; }
.app-footer a:hover { color: var(--green-dark); text-decoration: underline; }

@media (max-width: 820px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 8px 14px 9px; }
  .brand { justify-content: flex-start; width: auto; }
  .brand-logo { height: 42px; }
  .nav { grid-column: 1 / -1; grid-row: 2; display: flex; width: 100%; gap: 4px; padding-top: 7px; overflow-x: auto; border-top: 1px solid var(--line); scrollbar-width: thin; }
  .account-menu { grid-column: 2; grid-row: 1; }
  .nav form { min-width: 0; }
  .nav a, .link-button { flex: 1 0 auto; display: grid; place-items: center; width: auto; min-height: 38px; padding: 6px 10px; font-size: .78rem; line-height: 1.2; text-align: center; white-space: nowrap; }
  .account-menu > summary { min-width: 125px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .focus-card { position: static; }
  .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-workflow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-actions { width: 100%; justify-content: flex-start; }
  .choice-grid { grid-template-columns: 1fr; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .credential-row { grid-template-columns: 1fr; gap: 7px; }
  .upload-form { grid-template-columns: 1fr; }
  .upload-form .button { width: 100%; }
  .grade-person { grid-template-columns: 1fr; align-items: stretch; }
  .participant-course-card { grid-template-columns: 1fr; align-items: stretch; }
  .participant-course-choice { grid-template-columns: 22px minmax(0, 1fr); align-items: start; }
  .participant-variant-control { grid-column: 2; }
  .attendance-roster-head, .attendance-person { grid-template-columns: minmax(105px, 1fr) 46px 46px 78px 78px; gap: 4px; }
  .attendance-roster-head { padding-inline: 2px; }
  .attendance-roster-head span:first-child { visibility: hidden; }
  .attendance-person { padding: 9px 2px; }
  .attendance-name { font-size: .88rem; }
  .attendance-check input { width: 24px; height: 24px; }
  .number-with-unit { width: 74px; }
  .number-with-unit input { min-height: 34px; padding: 4px 5px; }
}
@media (max-width: 560px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; justify-content: stretch; gap: 8px; padding: 7px 10px 8px; overflow: visible; }
  .brand { justify-content: flex-start; }
  .brand-logo { height: 40px; }
  .nav { grid-column: 1 / -1; display: flex; width: 100%; gap: 4px; min-width: 0; padding-top: 6px; overflow-x: auto; border-top: 1px solid var(--line); }
  .nav form { min-width: 0; }
  .nav a, .link-button { flex: 1 0 auto; display: grid; place-items: center; width: auto; min-height: 38px; padding: 6px 9px; font-size: .76rem; line-height: 1.2; text-align: center; white-space: nowrap; }
  .account-menu > summary { min-width: 0; width: 44px; height: 42px; padding: 0; border-radius: 50%; }
  .account-menu > summary::after { content: "K"; position: static; color: var(--green-dark); font-size: .82rem; transform: none; }
  .account-menu .account-name, .account-menu .account-role { display: none; }
  .account-panel { position: fixed; top: 60px; right: 10px; width: min(290px, calc(100vw - 20px)); }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .page { width: min(100% - 18px, 1180px); padding: 24px 0 48px; }
  .hero { gap: 16px; margin-bottom: 20px; }
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .hero-actions .button, .hero > .button { width: 100%; }
  h1 { font-size: clamp(1.8rem, 10vw, 2.35rem); }
  h2 { font-size: 1.17rem; }
  .lede { font-size: .96rem; line-height: 1.5; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 20px; }
  .stat { padding: 13px; }
  .stat strong { margin-top: 6px; font-size: 1.35rem; line-height: 1.15; }
  .stat strong.compact-stat { font-size: 1rem; }
  .stat span { font-size: .76rem; }
  .card { padding: 16px; margin-bottom: 14px; border-radius: 8px; }
  .action-grid, .quick-links, .course-workflow { grid-template-columns: 1fr; }
  .action-card { min-height: 0; }
  .course-workflow a { padding: 11px; }
  .page-tabs { margin-inline: -9px; padding: 0 9px 4px; }
  .inline-details { width: 100%; min-width: 0; }
  .inline-details > summary { width: 100%; min-height: 42px; }
  .action-menu { width: 100%; }
  .action-menu > summary { width: 100%; }
  .action-menu > div { position: static; width: 100%; margin-top: 6px; box-shadow: none; }
  .card-head { align-items: flex-start; flex-wrap: wrap; gap: 9px; margin-bottom: 14px; }
  .card-head .badge { flex: 0 0 auto; }
  .table-tools { justify-content: stretch; }
  .table-tools input[type="search"] { width: 100%; }
  .form-actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 18px; }
  .form-actions .button { width: 100%; }
  .choice-field { padding: 12px; }
  .choice-box { padding: 10px; }
  .danger-zone .button, .credential-card > .button { width: 100%; }
  .login-page { align-items: start; padding: 12px; }
  .login-card { margin-top: 12px; padding: 24px 20px; border-radius: 8px; }
  .login-card .brand { justify-content: center; margin-bottom: 28px; }
  .login-card .brand-logo { height: 58px; }
  .login-card h1 { font-size: 2rem; }
  .upload-form input[type="file"] { min-width: 0; font-size: .86rem; }
  .material-folders { grid-template-columns: 1fr; }
  .participant-variant-form { grid-template-columns: 1fr; }
  .participant-variant-form label { grid-column: auto; }
  .participant-variant-form .button { width: 100%; }
  .makeup-need-head { flex-direction: column; }
  .makeup-assignment-row, .makeup-candidate { grid-template-columns: 1fr; align-items: stretch; }
  .makeup-assignment-row .danger-link, .makeup-candidate .button { width: 100%; }
  .button.small { min-height: 42px; }
  .action-stack, .schedule-list, .session-assignment-list, .trash-actions, .room-control { width: 100%; min-width: 0; }
  .action-stack .button, .assignment-control .button, .session-assignment-actions .button, .trash-actions .button, .table-wrap td[data-label='Aktion'] > .button { width: 100%; }
  .danger-link { min-height: 40px; text-align: center; }

  .table-wrap { overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tbody { display: grid; gap: 10px; }
  .table-wrap tbody tr:not(.table-empty):not(.documents-empty) { padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfb; }
  .table-wrap td { padding: 6px 0; border: 0; overflow-wrap: anywhere; }
  .table-wrap td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
  .table-wrap .table-empty, .table-wrap .documents-empty { padding: 0; border: 0; background: transparent; }
  .table-wrap .table-empty td, .table-wrap .documents-empty td { padding: 0; }
  .table-wrap .empty { padding: 18px 12px; }
  .table-wrap td[data-label='Aktion'] form { width: 100%; }
  .table-wrap td[data-label='Aktion'] .button { width: 100%; }
  .scroll-target { scroll-margin-top: 138px; }
  .attendance-actions { display: grid; grid-template-columns: 1fr; }
  .attendance-actions .button { width: 100%; }
  .grade-actions { display: grid; grid-template-columns: 1fr; }
  .grade-actions .button { width: 100%; }
}

@media (max-width: 420px) {
  .attendance-roster-head { display: none; }
  .attendance-roster { display: grid; gap: 10px; }
  .attendance-person { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfb; }
  .attendance-person:last-child { border-bottom: 1px solid var(--line); }
  .attendance-name { grid-column: 1 / -1; padding-bottom: 4px; font-size: .94rem; }
  .attendance-check, .attendance-late { align-content: start; gap: 5px; min-width: 0; }
  .mobile-control-label { display: block; color: var(--muted); font-size: .68rem; font-weight: 800; text-align: center; text-transform: uppercase; }
  .number-with-unit { width: 100%; max-width: 88px; }
  .number-with-unit input { min-height: 40px; }
}

@media (max-width: 340px) {
  .stats { grid-template-columns: 1fr; }
}
