:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --card: #ffffff;
  --surface: #f8f9fb;
  --text: #1f2430;
  --muted: #5d6679;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --input-bg: #ffffff;
  --accent: #a6343b;
  --accent-dark: #8a2a30;
  --accent-soft: #fbeef0;
  --accent-contrast: #ffffff;
  --good: #15803d;
  --good-bg: #dcfce7;
  --good-border: #86efac;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --bad-border: #fca5a5;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --warn-border: #fcd34d;
  --info: #1e293b;
  --info-bg: #f1f5f9;
  --info-border: #cbd5e1;
  --disabled-bg: #e5e7eb;
  --disabled-text: #4b5563;
  --img-bg: #f0f1f3;
  --focus: #a6343b;
  --topbar: #1e293b;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --radius: 12px;
}

/* Dark theme: same tokens, re-pointed. Components never hard-code colors. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f141d;
    --card: #171d29;
    --surface: #1d2432;
    --text: #e6e8ee;
    --muted: #9aa3b5;
    --border: #2a3242;
    --border-strong: #3a4458;
    --input-bg: #111722;
    --accent: #ef7d86;
    --accent-dark: #f5a3a9;
    --accent-soft: rgba(239, 125, 134, 0.14);
    --accent-contrast: #0b1220;
    --good: #4ade80;
    --good-bg: rgba(34, 197, 94, 0.16);
    --good-border: rgba(74, 222, 128, 0.4);
    --bad: #f87171;
    --bad-bg: rgba(239, 68, 68, 0.16);
    --bad-border: rgba(248, 113, 113, 0.45);
    --warn: #fbbf24;
    --warn-bg: rgba(245, 158, 11, 0.15);
    --warn-border: rgba(251, 191, 36, 0.4);
    --info: #e2e8f0;
    --info-bg: rgba(148, 163, 184, 0.12);
    --info-border: rgba(148, 163, 184, 0.35);
    --disabled-bg: #2a3242;
    --disabled-text: #a3adbf;
    --img-bg: #0f141d;
    --focus: #f5a3a9;
    --topbar: #0b1019;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  z-index: 100;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Public header ---------- */

header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}
header.site .site-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
}

a.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

header.site nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
header.site nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
header.site nav a:hover { color: var(--text); background: var(--surface); }
header.site nav a[aria-current="page"] { color: var(--text); font-weight: 600; background: var(--accent-soft); }
header.site nav a.nav-cta {
  color: var(--accent-contrast);
  background: var(--accent);
  margin-left: 6px;
}
header.site nav a.nav-cta:hover { background: var(--accent-dark); color: var(--accent-contrast); }
header.site nav a.nav-quiet { margin-left: 6px; border: 1px solid var(--border); }

@media (max-width: 600px) {
  .site-inner { padding: 0 16px; }
  header.site .site-inner { min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  /* One scrollable row instead of wrapping onto several lines. */
  header.site nav { width: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  header.site nav::-webkit-scrollbar { display: none; }
  header.site nav a { padding: 7px 10px; font-size: 0.9rem; }
  header.site nav a.nav-cta { margin-left: auto; }
}

/* ---------- Staff top bar ---------- */
/* A visibly different "mode" from the public site, with an account
   indicator and real tab navigation instead of plain text links. */

.staff-topbar { background: var(--topbar); position: sticky; top: 0; z-index: 20; }
.staff-topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 24px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.staff-topbar .brand { color: #fff; }
.staff-tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.staff-tabs a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
}
.staff-tabs a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.staff-tabs a[aria-current="page"] { background: rgba(255, 255, 255, 0.16); color: #fff; font-weight: 600; }
.staff-topbar :focus-visible { outline-color: #f5a3a9; }

.staff-account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: #cbd5e1;
  white-space: nowrap;
}
.staff-role-badge {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.staff-account-link { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.staff-account-link:hover .staff-name, .staff-account-link[aria-current="page"] .staff-name { color: #fff; text-decoration: underline; }
.staff-account-link:hover .staff-role-badge { background: rgba(255, 255, 255, 0.24); }
.staff-logout {
  color: #cbd5e1;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  font-size: 0.82rem;
}
.staff-logout:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

@media (max-width: 760px) {
  .staff-topbar { position: static; }
  .staff-topbar-inner { flex-direction: column; align-items: flex-start; padding: 12px 16px; }
  .staff-tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .staff-tabs a { white-space: nowrap; }
  .staff-account { width: 100%; justify-content: space-between; }
}

/* ---------- Layout ---------- */

main {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 24px 72px;
  flex: 1;
}
main.wide { max-width: 1200px; }
main.home { max-width: 1100px; }
.narrow { max-width: 640px; margin: 0 auto; }

footer.site-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  font-size: 0.88rem;
  color: var(--muted);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-top: 22px;
  padding-bottom: 22px;
}
.footer-brand { display: inline-flex; align-items: center; gap: 10px; }
.footer-brand strong { color: var(--text); }
footer.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
footer.site-footer a { color: var(--muted); text-decoration: none; }
footer.site-footer a:hover { color: var(--text); text-decoration: underline; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px 32px;
  margin-bottom: 20px;
}
@media (max-width: 520px) {
  main { padding: 24px 12px 56px; }
  .card { padding: 20px 18px; }
}

h1, h2, h3 { color: var(--text); letter-spacing: -0.02em; }
h1 { font-size: 1.85rem; font-weight: 750; margin-top: 0; line-height: 1.2; }
h2 { font-size: 1.22rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.02rem; font-weight: 650; }
@media (max-width: 520px) { h1 { font-size: 1.55rem; } }

.lead { color: var(--muted); font-size: 1.04rem; line-height: 1.6; }
.muted { color: var(--muted); font-size: 0.9rem; }
.small-text { font-size: 0.8rem; }

/* Page title + intro above the cards (student pages). */
.page-head { margin: 0 0 22px; }
.page-head h1 { margin-bottom: 6px; }
.page-head .lead { margin: 0; }

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.card-header h1 { margin-bottom: 4px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-contrast);
  text-decoration: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); border-color: transparent; box-shadow: none; font-weight: 500; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.large { padding: 12px 22px; font-size: 1rem; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; font-weight: 500; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.outline-danger { background: var(--card); color: var(--bad); border-color: var(--bad-border); box-shadow: none; }
.btn.outline-danger:hover { background: var(--bad-bg); }
.btn:disabled,
.btn[aria-disabled="true"] {
  background: var(--disabled-bg);
  color: var(--disabled-text);
  border-color: transparent;
  cursor: not-allowed;
}

.hint { display: block; font-size: 0.76rem; color: var(--muted); margin-top: 4px; }

/* ---------- Forms ---------- */

label { display: block; margin: 16px 0 6px; font-weight: 600; font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font: inherit;
  font-size: 1rem;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, input[type=number]:focus,
input[type=date]:focus, input[type=search]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }

.error { color: var(--bad); margin-top: 12px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  font-weight: 400;
}
.checkbox-row input[type=checkbox] { width: auto; }
.checkbox-row input[type=radio] { width: auto; }
textarea { resize: vertical; min-height: 4.5em; }
.area-choice .checkbox-row { margin: 8px 0; }

form.inline { display: inline; }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.inline-form .field { display: flex; flex-direction: column; gap: 4px; }
.inline-form .field label { margin: 0; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.inline-form .field input, .inline-form .field select, .inline-form .field textarea {
  padding: 8px 10px;
  font-size: 0.92rem;
  width: auto;
}
@media (max-width: 640px) {
  .inline-form .field { width: 100% !important; flex: 1 1 100% !important; }
  .inline-form .field input, .inline-form .field select, .inline-form .field textarea { width: 100%; }
}

/* Collapsible "add" panels on staff pages */
details.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 16px 0 20px;
  background: var(--surface);
}
details.panel > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "+ "; }
details.panel[open] > summary::before { content: "− "; }
details.panel > .panel-body { padding: 0 16px 16px; }
details.panel > .panel-body > p:first-child { margin-top: 0; }

/* ---------- Notices, flash toasts ---------- */

.notice {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--info);
  margin: 18px 0;
}
.notice a { color: inherit; font-weight: 600; }
.notice.warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px));
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left-width: 5px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.93rem;
  animation: toast-in 0.2s ease;
}
.toast.success { border-left-color: var(--good); }
.toast.error { border-left-color: var(--bad); }
.toast.warning { border-left-color: var(--warn); }
.toast.info { border-left-color: var(--accent); }
.toast-text { flex: 1; }
.toast form { margin: 0; }
.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.toast-close:hover { background: var(--surface); color: var(--text); }
.toast.hiding { opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.footnote {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.ok { background: var(--good-bg); color: var(--good); }
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.no { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

/* ---------- Student: stepper, next step, door code ---------- */

.stepper {
  list-style: none;
  padding: 0;
  margin: 24px 0 8px;
  display: grid;
  grid-template-columns: repeat(var(--steps, 4), 1fr);
  counter-reset: step;
}
.stepper li {
  position: relative;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding-top: 42px;
}
.stepper li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--card);
  border: 2px solid var(--border-strong);
  color: var(--muted);
  z-index: 1;
}
.stepper li::after {
  content: "";
  position: absolute;
  top: 15px;
  left: calc(-50% + 16px);
  width: calc(100% - 32px);
  height: 2px;
  background: var(--border-strong);
}
.stepper li:first-child::after { display: none; }
.stepper li.done::before { content: "✓"; background: var(--good); border-color: var(--good); color: var(--card); }
.stepper li.done::after, .stepper li.current::after { background: var(--good); }
.stepper li.current::before { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper li.current { color: var(--text); font-weight: 600; }
.stepper li.failed::before { content: "!"; border-color: var(--bad); color: var(--bad); }
.stepper .step-sub { display: block; font-weight: 400; font-size: 0.75rem; color: var(--muted); }
@media (max-width: 520px) {
  .stepper { grid-template-columns: 1fr; gap: 14px; }
  .stepper li { text-align: left; padding: 4px 0 0 44px; min-height: 32px; }
  .stepper li::before { left: 0; transform: none; }
  .stepper li::after { display: none; }
}

.next-step {
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  border-radius: 10px;
  padding: 20px 22px;
  margin: 20px 0;
}
.next-step h2 { margin: 0 0 6px; font-size: 1.1rem; }
.next-step p { margin: 0; }
.next-step .actions { margin-top: 16px; }
.next-step.failed { background: var(--bad-bg); border-color: var(--bad-border); }
.next-step.waiting { background: var(--surface); border-color: var(--border); }

.door-code {
  text-align: center;
  background: var(--good-bg);
  border: 1px solid var(--good-border);
  border-radius: 12px;
  padding: 26px 20px;
  margin: 20px 0;
}
.door-code .label { display: block; font-weight: 600; color: var(--good); margin-bottom: 6px; }
.door-code .code {
  display: block;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(2.8rem, 12vw, 4rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  padding-left: 0.3em; /* balances letter-spacing so the digits stay centered */
  color: var(--text);
  line-height: 1.1;
}
.door-code .actions { justify-content: center; margin-top: 14px; }

/* License serial (SolidWorks): same look as the door code, but serial numbers
   are long, so smaller and allowed to wrap. */
.license-box {
  text-align: center;
  background: var(--good-bg);
  border: 1px solid var(--good-border);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0 12px;
}
.license-box .label { display: block; font-weight: 600; color: var(--good); margin-bottom: 6px; }
.license-box .license-serial {
  display: block;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  overflow-wrap: anywhere;
  color: var(--text);
}
.license-box .actions { justify-content: center; margin-top: 12px; }

.details-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
  font-size: 0.92rem;
}
.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Quiz ---------- */

.quiz-question { margin-bottom: 18px; }
.quiz-question fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
.quiz-question legend.q-text { font-weight: 600; margin-bottom: 10px; padding: 0; }
.quiz-question label.option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  margin: 6px 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.97rem;
}
.quiz-question label.option:hover { border-color: var(--accent); }
.quiz-question label.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.quiz-question input[type=radio] { width: auto; margin: 0; accent-color: var(--accent); }
.quiz-question.unanswered { border-color: var(--bad-border); }

.quiz-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-top: 8px;
}
.quiz-bar .progress-wrap { flex: 1; }
.quiz-bar .progress-label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 4px; }

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.2s ease;
}

.missed-list { padding-left: 0; list-style: none; margin: 12px 0 0; }
.missed-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.missed-list li:last-child { border-bottom: none; }
.missed-list .q { font-weight: 600; display: block; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.92rem; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td .by { display: block; color: var(--muted); font-size: 0.76rem; margin-top: 2px; }
/* Action buttons wrap within their cell instead of being cut off. */
td.row-actions { text-align: right; }
td.row-actions > * { margin: 2px 0 2px 4px; }
td.primary { min-width: 170px; }
td.primary .by { overflow-wrap: anywhere; }
tfoot td { font-weight: 600; border-bottom: none; }

th .sort-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
th .sort-btn::after { content: "↕"; opacity: 0.35; font-size: 0.9em; }
th[aria-sort="ascending"] .sort-btn::after { content: "↑"; opacity: 1; }
th[aria-sort="descending"] .sort-btn::after { content: "↓"; opacity: 1; }
th .sort-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Under ~720px, table rows become stacked cards with the column name as a
   label on each value (cells carry data-label). */
@media (max-width: 720px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 10px;
    background: var(--card);
  }
  table.responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    text-align: right;
  }
  table.responsive td:last-child { border-bottom: none; }
  table.responsive td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    text-align: left;
    flex-shrink: 0;
  }
  table.responsive td[data-label=""]::before { display: none; }
  table.responsive td.row-actions { justify-content: flex-end; }
  table.responsive td.primary { font-weight: 600; font-size: 1rem; }
  table.responsive tfoot tr { border: none; background: none; }
}

/* ---------- Toolbar, stat tiles ---------- */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0 8px;
}
.toolbar input[type=search] { flex: 1 1 260px; width: auto; padding: 9px 12px; font-size: 0.95rem; }
.toolbar select { width: auto; padding: 9px 12px; font-size: 0.95rem; }
.toolbar .spacer { flex: 1; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
  margin: 18px 0 8px;
}
.tile {
  all: unset;
  box-sizing: border-box;
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
button.tile:hover { border-color: var(--accent); }
.tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.tile .tile-value { display: block; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -0.02em; }
.tile .tile-label { display: block; font-size: 0.8rem; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.tile.attention .tile-value { color: var(--accent); }
div.tile { cursor: default; }

/* ---------- Section blocks (settings, staff) ---------- */

.section { margin-bottom: 26px; }
.section + .section { border-top: 1px solid var(--border); padding-top: 22px; }
.section h2 { border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: 2px; margin-top: 0; }

/* ---------- Dialogs (confirm, image lightbox) ---------- */

dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: min(440px, calc(100vw - 24px));
}
dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
dialog .actions { justify-content: flex-end; }
dialog p { margin-top: 0; }

dialog.lightbox {
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  padding: 12px;
}
dialog.lightbox img {
  display: block;
  max-width: calc(100vw - 60px);
  max-height: calc(100vh - 110px);
  margin: 0 auto;
  object-fit: contain;
}
dialog.lightbox .lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
dialog.lightbox .lightbox-caption { font-size: 0.85rem; color: var(--muted); }

/* ---------- Multi-page info viewer ---------- */

.info-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.info-progress label { margin: 0; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.info-progress select { flex: 1 1 240px; width: auto; font-size: 0.95rem; padding: 8px 10px; }
.info-progress .progress { flex: 1 1 100%; }

.info-page { display: none; }
.info-page.active { display: block; animation: info-fade 0.2s ease; }
@keyframes info-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.info-page h2 { margin-top: 0; }

.info-images {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 12px;
  margin: 16px 0;
}
.info-images-2, .info-images-4 { grid-template-columns: 1fr 1fr; }
.zoomable {
  all: unset;
  position: relative;
  display: block;
  cursor: zoom-in;
  border-radius: 8px;
}
.zoomable:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.zoomable::after {
  content: "⤢";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 0.95rem;
  opacity: 0.8;
}
.info-images img {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  background: var(--img-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.info-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .info-images-2, .info-images-4 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Caretaker: door code + approve, side by side */
.code-form { display: inline-flex; gap: 8px; align-items: center; }
.code-form input[type=text] {
  width: 8.5em;
  padding: 6px 10px;
  font-size: 0.95rem;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.08em;
}
@media (max-width: 720px) {
  .code-form { display: flex; width: 100%; }
  .code-form input[type=text] { flex: 1; width: auto; }
}
.area-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 18px 0 0; border-bottom: 1px solid var(--border); }
.area-tabs a {
  padding: 8px 14px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.area-tabs a:hover { color: var(--text); }
.area-tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.access-help { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; font-size: 0.9rem; }
.access-help p { margin: 6px 0 0; }
td.primary .by { font-weight: 400; overflow-wrap: anywhere; }
@media (max-width: 720px) {
  table.responsive td.primary { flex-wrap: wrap; }
  table.responsive td.primary .by { flex-basis: 100%; text-align: right; }
}

/* Areas (rooms): apply checkboxes, info chooser, per-area headers */
fieldset.area-choice { border: 1px solid var(--border); border-radius: 8px; margin: 18px 0 0; padding: 6px 16px 12px; }
fieldset.area-choice legend { font-weight: 600; font-size: 0.9rem; padding: 0 6px; }
fieldset.area-choice .checkbox-row { margin: 8px 0; }
.area-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.area-link {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); text-decoration: none;
}
.area-link:hover { border-color: var(--accent); }
.area-link .area-name { font-weight: 700; font-size: 1.1rem; color: var(--accent); }
.area-tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.track-card h2 { margin: 0; }
.track-card .card-header { align-items: center; }

/* Info pages: pictogram row and bullet lists */
.info-icons { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 12px 0 18px; }
.info-icons img { width: 120px; height: 120px; }
@media (max-width: 520px) { .info-icons img { width: 90px; height: 90px; } }
.info-bullets { padding-left: 1.3em; margin: 8px 0 14px; }
.info-bullets li { margin: 8px 0; }

/* Agreement pages */
.agreement h2 { font-size: 1.05rem; margin: 20px 0 4px; }
.agreement h2 + p { margin-top: 0; }
@media print {
  header, footer, .toast-region, .no-print, .skip-link, p > a[href] { display: none !important; }
  body { background: #fff; }
  .card { border: none; padding: 0; }
}

/* Landing page: one "how it works" list per room */
.how-it-works { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 28px; }
.how-it-works h3 { margin: 8px 0 4px; color: var(--accent); }
.how-it-works ol { margin: 0; padding-left: 1.3em; }
.how-it-works li { margin: 4px 0; }
.how-it-works-box { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 12px 16px; margin: 18px 0 0; }
.how-it-works-box h2 { font-size: 1rem; margin: 0 0 4px; }
.how-it-works section[hidden] { display: none; }

/* Fault reports */
.report-list { display: grid; gap: 12px; margin-top: 12px; }
.report { border: 1px solid var(--border); border-left: 5px solid var(--bad); border-radius: 8px; padding: 12px 16px; background: var(--card); }
.report.in_progress { border-left-color: var(--warn); }
.report.resolved { border-left-color: var(--good); opacity: 0.85; }
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.report-head strong { margin: 0 6px; }
.report-text { white-space: pre-line; margin: 0 0 10px; }
.report-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.report-form .field { display: flex; flex-direction: column; gap: 4px; }
.report-form .field.grow { flex: 1 1 260px; }
.report-form label { margin: 0; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.report-form select, .report-form input { width: auto; padding: 7px 10px; font-size: 0.92rem; }
.report-form .field.grow input { width: 100%; }
.report-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.tab-count { display: inline-block; min-width: 1.5em; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 0.72rem; font-weight: 700; text-align: center; line-height: 1.5; }
.my-reports { list-style: none; padding: 0; margin: 8px 0 0; }
.my-reports li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.my-reports li:last-child { border-bottom: none; }

/* ---------- Landing page ---------- */

.hero { padding: 24px 0 36px; max-width: 680px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 { font-size: clamp(1.9rem, 4.2vw, 2.6rem); line-height: 1.12; letter-spacing: -0.03em; margin-bottom: 14px; }
.hero-lead { font-size: 1.12rem; line-height: 1.6; color: var(--muted); margin: 0; }
.hero .actions { margin-top: 26px; }

.section-title { font-size: 1.05rem; margin: 8px 0 14px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.area-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.area-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 22px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.area-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07); }
.area-card h3 { margin: 14px 0 4px; font-size: 1.15rem; }
.area-card > .muted { margin: 0 0 12px; }
.area-card-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.area-icon { width: 24px; height: 24px; }
.area-needs { list-style: none; padding: 0; margin: 0 0 16px; font-size: 0.88rem; }
.area-needs li { position: relative; padding: 3px 0 3px 22px; }
.area-needs li::before {
  content: "";
  position: absolute; left: 3px; top: 0.62em;
  width: 9px; height: 5px;
  border-left: 2px solid var(--good); border-bottom: 2px solid var(--good);
  transform: rotate(-45deg);
}
.area-card-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* Two fields side by side (e.g. name + class), stacked on phones. */
.form-row { display: grid; grid-template-columns: 1fr 180px; gap: 0 16px; }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }
.track-title { display: flex; align-items: center; gap: 12px; }
.area-card-icon.small { width: 36px; height: 36px; border-radius: 9px; }
.area-card-icon.small .area-icon { width: 20px; height: 20px; }

/* Staff bar: keep tabs and account on one row on laptop widths. */
@media (max-width: 1080px) and (min-width: 761px) {
  .staff-name { display: none; }
  .staff-tabs a { padding: 8px 10px; }
  .staff-topbar-inner { gap: 10px 14px; }
}

/* Sign-in pages: a narrow, centred card with a full-width button. */
.auth-card { max-width: 440px; margin: 16px auto 20px; }
.auth-card h1 { font-size: 1.6rem; }
.auth-card .actions .btn:first-child { width: 100%; }

/* ED logo in the header and footer (views/partials/ed-logo.ejs). */
.ed-logo { height: 28px; width: auto; display: block; flex-shrink: 0; color: var(--text); }
.staff-topbar .ed-logo { color: #fff; }
.brand-divider { width: 1px; height: 22px; background: var(--border-strong); }
.staff-topbar .brand-divider { background: rgba(255, 255, 255, 0.3); }
.footer-brand .ed-logo { height: 20px; }

/* ---------- Printers (admin, live status from the Bambu cloud) ---------- */

:root {
  --printing: #2563c9;
  --plate: #e6e9ee;
}
@media (prefers-color-scheme: dark) {
  :root {
    --printing: #5b93f0;
    --plate: #222a39;
  }
}

.printers-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 18px;
}
.printers-head h1 { margin-bottom: 4px; }
.printers-head .lead { margin: 0; }
.printers-head .lead b { color: var(--bad); }
.printer-account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--muted); font-size: 0.85rem; }
.printer-signin { margin-top: 8px; }
.printer-signin h2 { margin-top: 0; }

.printer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.printer-grid[hidden] { display: none; }
.printer-history[hidden] { display: none; }
.printer-grid .empty-state { grid-column: 1 / -1; text-align: center; padding: 40px 20px; }

.printer-tile {
  --c: var(--muted);
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  padding: 16px 16px 16px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  min-height: 196px;
}
.printer-tile.k-printing { --c: var(--printing); }
.printer-tile.k-done { --c: var(--good); }
.printer-tile.k-attention { --c: var(--bad); border: 2px solid var(--bad); padding: 15px 15px 15px 13px; }
.printer-tile.k-offline { --c: var(--border-strong); }
.printer-tile.k-offline .body { opacity: 0.6; }

/* The part growing on the build plate */
.printer-tile .stack {
  position: relative;
  background: var(--plate);
  border-radius: 4px 4px 0 0;
  border-bottom: 5px solid var(--muted);
  overflow: hidden;
}
.printer-tile .fill {
  position: absolute;
  left: 5px; right: 5px; bottom: 0;
  height: calc(var(--p, 0) * 100%);
  background: repeating-linear-gradient(to top, var(--c) 0 3px, color-mix(in srgb, var(--c) 62%, var(--card)) 3px 4px);
  transition: height 0.9s ease-out;
}
.printer-tile.k-printing .fill::before {
  content: "";
  position: absolute;
  left: -5px; right: -5px; top: -3px;
  height: 3px;
  background: var(--text);
  animation: printer-pass 2.4s ease-in-out infinite;
}
@keyframes printer-pass { 50% { opacity: 0.25; } }
.printer-tile.k-offline .stack { background: repeating-linear-gradient(135deg, var(--plate) 0 6px, transparent 6px 12px); }

.printer-tile .body { min-width: 0; display: flex; flex-direction: column; }
.printer-tile .name { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.printer-tile h2 { margin: 0; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.printer-tile .model { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.printer-tile .state { margin: 10px 0 0; color: var(--c); font-weight: 600; font-size: 0.92rem; }
.printer-tile .big { margin: 2px 0 0; font-weight: 750; font-size: 2rem; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.printer-tile .big.label { color: var(--c); margin-top: 12px; }
.printer-tile .eta { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.printer-tile .stage { margin: 2px 0 0; font-size: 0.9rem; font-weight: 600; }
.printer-tile .job { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font-size: 0.9rem; min-width: 0; }
.printer-tile .job span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.printer-tile .job img { flex: none; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--plate); }
.printer-tile .errors { margin: 8px 0 0; padding: 0; list-style: none; color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.printer-tile .errors li + li { margin-top: 6px; }
.printer-tile .errors .code { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.printer-tile .errors a { color: inherit; }

.printer-history { margin-top: 20px; }
.printer-history h2 { margin-top: 0; }
.printer-history .history-cover { width: 56px; }
.printer-history .history-cover img { display: block; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--plate); }

.printer-tile .foot { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.printer-tile .meta { display: flex; gap: 16px; margin: 0; font-size: 0.85rem; }
.printer-tile .meta div { display: flex; flex-direction: column; }
.printer-tile .meta dt { color: var(--muted); font-size: 0.74rem; }
.printer-tile .meta dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; }
.printer-tile .slots { display: flex; gap: 5px; margin: 0; padding: 0; list-style: none; }
.printer-tile .slots li { width: 14px; height: 14px; border-radius: 50%; background: var(--sw, transparent); border: 1px solid color-mix(in srgb, var(--text) 25%, transparent); }
.printer-tile .slots li.empty { background: repeating-linear-gradient(135deg, var(--border) 0 2px, transparent 2px 4px); }
.printer-tile .slots li.active { outline: 2px solid var(--text); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .printer-tile .fill { transition: none; }
  .printer-tile.k-printing .fill::before { animation: none; }
}

/* Printer cards link to the printer's own page: the name's link covers the card. */
.printer-tile { position: relative; transition: border-color 0.15s, box-shadow 0.15s; }
.printer-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.printer-tile a.tile-link { color: inherit; text-decoration: none; }
.printer-tile a.tile-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.printer-tile a.tile-link:focus-visible { outline: none; }
.printer-tile:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.printer-tile .errors a { position: relative; z-index: 1; }

/* A printer's own page */
.printer-back { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.printer-back:hover { color: var(--accent); }
.printer-hero { display: grid; grid-template-columns: 56px 1fr auto; gap: 20px; align-items: stretch; }
.printer-hero .stack { min-height: 150px; }
.printer-hero .hero-cover { width: 150px; height: 150px; border-radius: 10px; object-fit: cover; background: var(--plate); }
.printer-hero h1 { margin: 0 0 2px; }
.printer-hero .model { color: var(--muted); margin: 0; }
.printer-hero .stage { margin: 4px 0 0; font-weight: 600; }
.printer-hero .errors { margin-top: 10px; }
@media (max-width: 640px) {
  .printer-hero { grid-template-columns: 40px 1fr; }
  .printer-hero .hero-cover { grid-column: 1 / -1; width: 140px; height: 140px; }
}
.printer-hero.printer-tile { min-height: 0; }
.printer-hero.printer-tile:hover { border-color: var(--border); box-shadow: var(--shadow-sm); }
.printer-hero.printer-tile.k-attention:hover { border-color: var(--bad); }

.printer-progress { height: 8px; border-radius: 4px; background: var(--plate); overflow: hidden; margin: 10px 0 4px; }
.printer-progress span { display: block; height: 100%; background: var(--c); width: calc(var(--p, 0) * 100%); transition: width 0.9s ease-out; }

.printer-details { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.printer-details .card { margin: 0; padding: 20px 22px; }
.printer-details h2 { margin: 0 0 12px; font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 0.92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 500; overflow-wrap: anywhere; }

.ams-unit + .ams-unit { margin-top: 16px; }
.ams-unit h3 { margin: 0 0 8px; font-size: 0.92rem; display: flex; justify-content: space-between; gap: 12px; }
.ams-unit h3 .muted { font-weight: 400; }
.tray-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tray-list li { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; font-size: 0.9rem; }
.tray-list .sw { width: 18px; height: 18px; border-radius: 50%; background: var(--sw, transparent); border: 1px solid color-mix(in srgb, var(--text) 25%, transparent); }
.tray-list .sw.empty { background: repeating-linear-gradient(135deg, var(--border) 0 2px, transparent 2px 4px); }
.tray-list li.active .sw { outline: 2px solid var(--text); outline-offset: 2px; }
.tray-list .remain { width: 70px; height: 6px; border-radius: 3px; background: var(--plate); overflow: hidden; }
.tray-list .remain span { display: block; height: 100%; background: var(--muted); }
.tray-list .right { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

/* Drawings of the printer models */
.printer-tile .model { display: inline-flex; align-items: center; gap: 6px; }
.printer-tile .model-img { width: 26px; height: 26px; }
.printer-hero .hero-title { display: flex; align-items: center; gap: 14px; }
.printer-hero .hero-model { width: 64px; height: 64px; flex: none; }
.printer-tile .model-img, .printer-hero .hero-model { object-fit: cover; border-radius: 6px; }
.printer-hero .hero-model { width: 72px; height: 72px; }

#modellbilder { margin-top: 20px; }
.model-photos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.model-photos li { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start; padding: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.model-photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.model-photo-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.model-photo-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.model-photo-form input[type=file] { flex: 1 1 160px; padding: 6px 8px; font-size: 0.85rem; }
@media (max-width: 520px) { .model-photos { grid-template-columns: 1fr; } }

/* The staff page: wider than .narrow, the table has five columns. */
.staff-page { max-width: 1040px; margin: 0 auto; }
@media (min-width: 761px) {
  .staff-page td[data-label="E-post"] { overflow-wrap: normal; word-break: normal; }
}

/* "Nytt lösenord" on the staff page: a button that opens a small form in the row. */
details.row-details { display: inline-block; vertical-align: top; text-align: left; }
details.row-details > summary { list-style: none; }
details.row-details > summary::-webkit-details-marker { display: none; }
