/* Spind – calm, readable, no external fonts or assets (N-03, privacy). */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #17202c;
  --muted: #5a6575;
  --border: #dde2e9;
  --border-strong: #c3cbd6;
  --primary: #1f56c2;
  --primary-hover: #17459f;
  --primary-soft: #e9effb;
  --ok: #17703f;
  --ok-soft: #e4f4ea;
  --ok-line: #9fd3b4;
  --warn: #8a5300;
  --warn-soft: #fff4d9;
  --warn-line: #ecc77a;
  --err: #b42318;
  --err-soft: #fdecea;
  --err-line: #f1aaa3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --focus: 0 0 0 3px #8db3f5;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 1rem; letter-spacing: -.01em; }
.page-head h1 { margin-bottom: .3rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: .05em .35em; }

.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--surface); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; }

.hint, .muted { color: var(--muted); }
.hint { font-size: .9rem; }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
label .hint { font-weight: 400; }

/* ---------------------------------------------------------------- layout */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.brand .icon { color: var(--primary); width: 1.4em; height: 1.4em; }
.usernav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .92rem; }
.usernav form { margin: 0; }
.who { color: var(--text); font-weight: 600; }

.container { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.container.narrow { max-width: 440px; padding-top: 3rem; }

.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.page-head { margin-bottom: 1.25rem; }
.page-head .sub { color: var(--muted); margin: 0; }

/* ---------------------------------------------------------------- alerts */

.alert {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .8rem 1rem; margin: 0 0 1.25rem;
  border: 1px solid; border-radius: var(--radius);
}
.alert > .icon { margin-top: .15rem; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert-ok { background: var(--ok-soft); border-color: var(--ok-line); color: #0f4d2b; }
.alert-err { background: var(--err-soft); border-color: var(--err-line); color: #7a1a12; }
.tip {
  display: flex; gap: .7rem; align-items: flex-start;
  margin: 1.5rem 0; padding: .9rem 1rem;
  background: var(--primary-soft); border-radius: var(--radius);
  color: #1c3a72; font-size: .92rem;
}
.tip .icon { margin-top: .15rem; }
.tip p { margin: 0; }

/* --------------------------------------------------------------- buttons */

.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  padding: .6rem 1.05rem; min-height: 2.6rem;
  border: 1px solid var(--primary); border-radius: var(--radius-sm);
  background: var(--primary); color: #fff;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover, button:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--primary); border-color: transparent; }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary-hover); border-color: transparent; }
.btn-danger { background: var(--err); border-color: var(--err); }
.btn-danger:hover { background: #8f1c13; border-color: #8f1c13; }
.btn-danger-quiet { background: var(--surface); color: var(--err); border-color: var(--err-line); }
.btn-danger-quiet:hover { background: var(--err-soft); color: #8f1c13; border-color: var(--err); }
.btn-sm { padding: .35rem .7rem; min-height: 2.1rem; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.btn-link:hover { background: none; color: var(--primary-hover); }
.icon-btn { background: none; border: 0; color: var(--muted); padding: .2rem; min-height: 0; border-radius: 6px; }
.icon-btn:hover { background: var(--err-soft); color: var(--err); }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* ----------------------------------------------------------------- forms */

label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .95rem; }
input, select { font: inherit; font-weight: 400; }
input:not([type=checkbox]):not([type=radio]), select {
  padding: .55rem .7rem; min-height: 2.6rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input[type=file] { padding: .45rem .5rem; }
input:focus, select:focus { border-color: var(--primary); }
.narrow-input { width: 6rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack > * { margin: 0; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem; margin-top: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: .95rem; padding: 0; margin-bottom: .5rem; }
fieldset.checks { display: flex; gap: .4rem 1.2rem; flex-wrap: wrap; align-content: flex-start; }
fieldset.checks legend { width: 100%; }
label.check { flex-direction: row; align-items: center; font-weight: 400; gap: .4rem; }
input[type=checkbox], input[type=radio] { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); margin: 0; }

/* Radio cards: pick how material is handed out. */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; }
.choices legend { grid-column: 1 / -1; }
.choice {
  flex-direction: row; align-items: flex-start; gap: .7rem;
  padding: .9rem 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; font-weight: 400;
}
.choice input { margin-top: .25rem; flex: none; }
.choice strong { display: flex; align-items: center; gap: .4rem; }
.choice small { display: block; color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice:has(input:focus-visible) { box-shadow: var(--focus); }
/* Worksheet options only matter for worksheets; without :has() they stay visible. */
@supports selector(:has(*)) {
  .material-form .worksheet-only { display: none; }
  .material-form:has(input[value=worksheet]:checked) .worksheet-only { display: grid; }
  .material-form:has(input[value=worksheet]:checked) .copy-only { display: none; }
  .custom-only, .recipients .checks.some-only { display: none; }
  form:has(input[name=access][value=custom]:checked) .custom-only { display: flex; }
  .recipients:has(input[value=some]:checked) .checks.some-only { display: flex; }
}
.recipients .checks { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.recipients .some-only { margin-top: .6rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.access-choices .choice { padding: .7rem .9rem; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.card > h2:first-child, .card-head h2 { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.danger-card { border-color: var(--err-line); }
.danger-card ul { margin: 0; padding-left: 1.2rem; }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem;
  padding: 2.5rem 1rem; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
}
.empty .icon { width: 2.2rem; height: 2.2rem; stroke-width: 1.5; color: var(--border-strong); }
.empty p { margin: 0; }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.badge-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge-ok { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.badge .icon { width: 1em; height: 1em; vertical-align: -.15em; }
/* The subject next to a class name: "7a Deutsch". */
.subject-tag { display: inline-block; font-size: .6em; font-weight: 600; vertical-align: .25em; padding: .1em .55em; border-radius: 999px; background: var(--primary-soft); color: var(--primary); letter-spacing: 0; }

/* -------------------------------------------- live status (teacher view) */

.live {
  border: 1px solid; border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.5rem;
  background: var(--surface); box-shadow: var(--shadow);
}
.live.is-open { border-color: var(--ok-line); background: linear-gradient(var(--ok-soft), var(--surface) 70%); }
.live.is-closed { border-color: var(--border); }
.live.is-blocked { border-color: var(--err-line); background: linear-gradient(var(--err-soft), var(--surface) 70%); }
.live-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; }
.live-state { display: flex; align-items: center; gap: .9rem; }
.live-state h2 { margin: 0; font-size: 1.15rem; }
.live-state p { margin: 0; color: var(--muted); }
.live-icon {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; flex: none;
  background: var(--surface-2); color: var(--muted);
}
.live-icon .icon { width: 1.4rem; height: 1.4rem; }
.is-open .live-icon { background: var(--ok); color: #fff; }
.is-blocked .live-icon { background: var(--err); color: #fff; }
.live-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.live-actions form { margin: 0; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.quick-label { font-weight: 600; font-size: .9rem; color: var(--muted); margin-right: .2rem; }
.live-extra { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.live-extra h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.live-extra ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.live-extra li { display: flex; align-items: center; gap: .7rem; padding: .35rem .5rem .35rem .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: .9rem; }
.live-extra form { margin: 0; }
.live-extra .btn-link { font-size: .85rem; }
.live-more { margin-top: .9rem; }
.live-more summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .92rem; width: fit-content; }
.live-more .form-row { margin-top: .75rem; }
.live-more .hint { margin: .5rem 0 0; }
.live.compact { padding: .9rem 1.1rem; }

/* ------------------------------------------------------------------ tabs */

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border-strong); margin: 0 0 1.5rem; overflow-x: auto; }
.tabs a {
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
  padding: .7rem 1rem; margin-bottom: -1px;
  color: var(--muted); font-weight: 600; text-decoration: none;
  border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current=page] { color: var(--primary); border-bottom-color: var(--primary); }
.count { font-size: .78rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.tabs a[aria-current=page] .count { background: var(--primary-soft); border-color: transparent; color: var(--primary); }

/* --------------------------------------------------------- student table */

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
th { white-space: nowrap; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 600; }
td.go { text-align: right; vertical-align: middle; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .6rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: .88rem; text-decoration: none; color: var(--text);
}
.chip .icon { color: var(--primary); width: 1em; height: 1em; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-live { background: var(--ok-soft); border-color: var(--ok-line); }
.chip.is-live small { color: var(--muted); font-size: .8rem; }
.live-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--ok); flex: none; animation: live-pulse 2s ease-in-out infinite; }
.live-badge { display: inline-flex; align-items: center; gap: .35rem; width: fit-content; margin: .15rem 0; }
@keyframes live-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

.adder { margin-top: 1.25rem; }
.adder > summary { list-style: none; width: fit-content; }
.adder > summary::-webkit-details-marker { display: none; }
.adder[open] > summary { margin-bottom: 1rem; }
.adder-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.adder-body .card { margin: 0; }
.adder-body h3 { margin: 0; }

.danger-zone { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.danger-zone summary { cursor: pointer; color: var(--muted); font-size: .92rem; width: fit-content; }
.danger-zone[open] summary { margin-bottom: .75rem; }

/* ----------------------------------------------------------- list rows */

.rows { list-style: none; margin: 0 0 1rem; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.pager { display: flex; align-items: center; gap: .15rem; }
.pager-pos { font-size: .85rem; color: var(--muted); white-space: nowrap; padding: 0 .25rem; }
.pager .is-disabled { opacity: .35; pointer-events: none; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin: 2rem 0 .75rem; }
.section-head h2 { margin: 0; }
.assignment { border-bottom: 1px solid var(--border); }
.assignment:last-child { border-bottom: 0; }
.assignment > .row { border-bottom: 0; }
.manage { padding: 0 1rem .85rem 4.2rem; }
.manage summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .92rem; width: fit-content; }
.manage-body { display: flex; flex-direction: column; gap: 1.25rem; margin-top: .9rem; }
.manage-body h3 { margin: 0; font-size: 1rem; }
.periods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.periods li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; }
.periods form { margin: 0; }
.row-icon { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; border-radius: 10px; background: var(--primary-soft); color: var(--primary); flex: none; }
.row-icon.is-sheet { background: var(--warn-soft); color: var(--warn); }
.row-icon.is-danger { background: var(--err-soft); color: var(--err); }
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-main a.strong { text-decoration: none; }
td[data-label=Name] a { white-space: nowrap; }
.row-main a.strong:hover { text-decoration: underline; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; }
.row-actions form { margin: 0; }
.timeline .is-current { background: var(--surface-2); }

/* --------------------------------------------------------------- week */

.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin-top: 1rem; }
.day { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem; min-height: 5rem; }
.day h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 .5rem; }
.slot {
  display: flex; align-items: center; justify-content: space-between; gap: .3rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: 6px; padding: .3rem .3rem .3rem .55rem; margin-bottom: .35rem;
  font-variant-numeric: tabular-nums; font-size: .92rem; font-weight: 600;
}
.slot form { margin: 0; display: flex; }
/* Another subject's lesson: the time is taken. */
.slot.is-taken { flex-direction: column; align-items: flex-start; gap: 0; border-left-color: var(--border-strong); background: var(--surface-2); color: var(--muted); font-weight: 500; padding-right: .55rem; }
.slot.is-taken small { font-size: .78rem; font-weight: 400; }
.day-empty { color: var(--border-strong); font-size: .88rem; margin: 0; }

/* ------------------------------------------------------- credentials */

.credentials { border-color: var(--warn-line); background: var(--warn-soft); }
.creds { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 0 0 .75rem; }
.creds dt { font-size: .85rem; color: var(--muted); }
.creds dd { margin: 0; }

/* Second factor (account page, login): QR codes stay large enough to scan
   from an iPad screen. */
[hidden] { display: none !important; }
.qr-row { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; margin-bottom: .75rem; }
.qr-box { flex: 0 0 auto; width: 13rem; max-width: 100%; }
.qr { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.steps { flex: 1 1 16rem; margin: 0; padding-left: 1.2rem; }
.steps li { margin-bottom: .5rem; }
.break { word-break: break-all; }
.passkey-box { margin-top: 1rem; }
.creds code { font-size: 1.35rem; background: var(--surface); padding: .1rem .5rem; }

/* ------------------------------------------------------- student home */

.hero {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.1rem 1.25rem; border-radius: var(--radius); border: 1px solid; margin-bottom: 1.5rem;
}
.hero > div { display: flex; flex-direction: column; }
.hero strong { font-size: 1.15rem; }
.hero-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; flex: none; }
.hero-icon .icon { width: 1.5rem; height: 1.5rem; }
.hero.is-open { background: var(--ok-soft); border-color: var(--ok-line); }
.hero.is-open .hero-icon { background: var(--ok); color: #fff; }
.hero.is-closed { background: var(--surface); border-color: var(--border); }
.hero.is-closed .hero-icon { background: var(--surface-2); color: var(--muted); }
.hero.is-blocked { background: var(--err-soft); border-color: var(--err-line); }
.hero.is-blocked .hero-icon { background: var(--err); color: #fff; }

.subject + .subject { margin-top: 1.75rem; }
.subject-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .75rem; margin: 1.5rem 0 .75rem; }
.subject-head h2 { margin: 0; }
.subject-teacher { color: var(--muted); }

.doc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: .75rem; }
.doc-card {
  display: flex; align-items: center; gap: .9rem; height: 100%;
  padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.doc-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(31, 86, 194, .12); color: var(--text); }
.doc-icon { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 10px; background: var(--primary-soft); color: var(--primary); flex: none; }
.doc-icon .icon { width: 1.4rem; height: 1.4rem; }
.doc-icon.is-sheet { background: var(--warn-soft); color: var(--warn); }
.doc-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc-title { font-weight: 600; font-size: 1.05rem; overflow-wrap: break-word; }
.doc-meta { color: var(--muted); font-size: .85rem; }

/* ------------------------------------------------------- teacher home */

.class-grid { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.class-card {
  display: flex; flex-direction: column; gap: .2rem; height: 100%;
  padding: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; color: var(--text);
}
.class-card:hover { border-color: var(--primary); color: var(--text); }
.class-name { font-size: 1.5rem; font-weight: 700; }
.class-meta { color: var(--muted); font-size: .9rem; }
.state { display: inline-flex; align-items: center; gap: .4rem; margin-top: .8rem; padding: .3rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 600; width: fit-content; }
.state.is-open { background: var(--ok-soft); color: var(--ok); }
.state.is-closed { background: var(--surface-2); color: var(--muted); }
.state.is-blocked { background: var(--err-soft); color: var(--err); }

/* --------------------------------------------------------------- login */

.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-logo { display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 14px; background: var(--primary); color: #fff; margin-bottom: .75rem; }
.login-logo .icon { width: 2rem; height: 2rem; }
.login-brand p { color: var(--muted); }

/* -------------------------------------------------------------- editor */

.editor-main { display: flex; flex-direction: column; height: calc(100vh - 3.3rem); }
/* The editor fills the rest of the screen whatever the top bar's height;
   dvh follows Safari's toolbars on the iPad. */
body:has(.editor-main) { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
body:has(.editor-main) .editor-main { flex: 1; height: auto; min-height: 0; }
/* Every pixel counts for the editor on an iPad in landscape: the editor bar
   has the way back, so the app's top bar is left out. */
body:has(.editor-main) .topbar { display: none; }
.editor-bar {
  display: flex; align-items: center; gap: .75rem 1.25rem; flex-wrap: wrap;
  padding: .45rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.back { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; text-decoration: none; font-size: .92rem; }
.editor-title { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.editor-title .muted { font-size: .9rem; }
.editor-tools { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .75rem; border-radius: 999px; font-size: .88rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.pill-info { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.pill[hidden] { display: none; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented a { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; font-size: .88rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.segmented a + a { border-left: 1px solid var(--border-strong); }
.segmented a[aria-current=page] { background: var(--primary); color: #fff; }
.warning { display: flex; align-items: center; gap: .5rem; padding: .55rem 1rem; background: var(--warn-soft); color: #5c3700; border-bottom: 1px solid var(--warn-line); font-weight: 600; }
.warning[hidden] { display: none; }
.editor-frame { flex: 1; min-height: 0; }
.editor-frame > * { width: 100%; height: 100%; }

/* ------------------------------------------- printable credential slips */

.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; margin-top: 1rem; }
.slip { border: 1px dashed var(--muted); border-radius: var(--radius-sm); padding: .8rem; background: var(--surface); display: flex; flex-direction: column; gap: .2rem; }
.slip code { font-size: 1.1rem; }

/* ------------------------------------------------------- smartphone lock */

.phone-lock { margin-top: 2rem; gap: .9rem; padding: 2.5rem 1.5rem; }
.phone-lock .icon { color: var(--primary); }
.phone-lock h1 { color: var(--text); margin: 0; font-size: 1.4rem; }
.phone-lock form { margin: 0; }

@media (max-width: 999px) {
  .wide-only { display: none; }
}

/* ------------------------------------------- touch (school iPads first) */

@media (pointer: coarse) {
  .btn-sm { min-height: 44px; padding: .45rem .85rem; }
  .chip { padding: .5rem .85rem; }
  .icon-btn { padding: .6rem; }
  .btn-link { padding: .55rem .3rem; }
  .live-more summary, .danger-zone summary { padding: .55rem 0; }
  .segmented a { padding: .6rem .95rem; }
  .crumbs a { padding: .4rem 0; }
  tbody tr:hover, .doc-card:hover { box-shadow: var(--shadow); }
}

/* -------------------------------------------------------------- mobile */

@media (max-width: 700px) {
  html { font-size: 16px; }
  .container { padding: 1rem 1rem 3rem; }
  .topbar { padding: .5rem 1rem; }
  .usernav a { display: none; }
  .live-actions, .quick { width: 100%; }
  table.students thead { display: none; }
  table.students, table.students tbody, table.students tr, table.students td { display: block; }
  table.students tr { border-bottom: 1px solid var(--border); padding: .4rem 0; }
  table.students td { border: 0; padding: .3rem 1rem; }
  table.students td[data-label="Gerade offen"]::before, table.students td[data-label="Zuletzt geändert"]::before {
    content: attr(data-label); display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  }
  td.go { text-align: left; }
  .tabs a { flex: 1; justify-content: center; padding: .65rem .3rem; font-size: .92rem; }
  .tabs a .icon { display: none; }
  .quick-label { width: 100%; }
  .quick .btn { flex: 1; }
  .doc-card { flex-wrap: wrap; }
  .doc-body { flex-basis: calc(100% - 3.7rem); }
  .doc-card > .btn { margin-left: 3.7rem; }
  .row { flex-wrap: wrap; }
  .row-actions { width: 100%; justify-content: flex-start; padding-left: 3.2rem; }
  .manage { padding-left: 1rem; }
  .editor-title .muted { display: none; }
  .pager-pos { display: none; }
}

@media print {
  .topbar, .no-print, .skip { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .container { max-width: none; padding: 0; }
  .slips { grid-template-columns: 1fr 1fr; }
  .slip { break-inside: avoid; }
}
