/* MATHORA Academy: the one CSS file (PLAN.md 14). Mobile first, light and dark, no external fonts (CSP). */
:root {
  --brand: #1d3a8a; --brand-dark: #12224f; --brand-soft: #e8edfb; --accent: #f2a900;
  --green: #15803d; --red: #b91c1c; --yellow: #a16207; --navy: #12224f;
  --bg: #f2f5fb; --surface: #ffffff; --surface-2: #f7f9fe; --ink: #172033; --muted-ink: #5b667a;
  --line: #dbe2f0; --shadow: 0 1px 2px rgba(18, 34, 79, .06), 0 6px 18px rgba(18, 34, 79, .07);
  --radius: 14px; --radius-sm: 9px; --focus: #3b66f5;
  --ok-bg: #e6f5ec; --warn-bg: #fff4d6; --bad-bg: #fde8e8; --nav-active-bg: #12224f; --nav-active-ink: #fff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #8fa8ff; --brand-dark: #0b1228; --brand-soft: #1d2748; --accent: #f2b73a;
    --green: #4ade80; --red: #f87171; --yellow: #fbbf24; --navy: #0b1228;
    --bg: #0e1424; --surface: #161e33; --surface-2: #1b2540; --ink: #e6ebf7; --muted-ink: #9aa7c2;
    --line: #2a3556; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .35); --focus: #8fa8ff;
    --ok-bg: #12301f; --warn-bg: #3a2e0c; --bad-bg: #3b1616; --nav-active-bg: #8fa8ff; --nav-active-ink: #0e1424;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); line-height: 1.55; font-size: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tamil", "Nirmala UI", "Latha",
    "Tamil Sangam MN", sans-serif;
}
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
h1 { font-size: clamp(1.45rem, 3.5vw, 2rem); line-height: 1.2; margin: 1.2rem 0 .8rem; letter-spacing: -.01em; }
h1::after { content: ""; display: block; width: 3rem; height: 4px; border-radius: 4px; background: var(--accent); margin-top: .45rem; }
h2 { font-size: 1.2rem; margin: 1.4rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: .5rem 0 .9rem; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: .05rem .35rem; border-radius: 6px; font-size: .92em; }
.muted { color: var(--muted-ink); }

/* ---- top bar and menu ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); color: var(--ink);
  border-bottom: 3px solid var(--accent); display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem;
  padding: .5rem 1rem; box-shadow: 0 2px 10px rgba(18, 34, 79, .1);
}
.topbar a { color: var(--ink); text-decoration: none; }
.brand { display: inline-flex; align-items: center; }
/* The logo is dark navy on transparent: a white tile keeps it readable in dark mode too. */
.logo-img { display: block; height: auto; max-width: 100%; }
.brand .logo-img { height: 40px; width: auto; background: #fff; border-radius: 10px; padding: 3px 8px; }
.hero-logo { display: inline-block; background: #fff; border-radius: var(--radius-sm); padding: .7rem 1rem; margin-bottom: 1rem; }
.hero-logo .logo-img { width: min(22rem, 100%); }
.landing-logo { text-align: center; margin: 2rem 0 1rem; }
.landing-logo .logo-img { margin: 0 auto; background: #fff; border-radius: var(--radius-sm); padding: .6rem 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.menu { display: flex; gap: .25rem; overflow-x: auto; align-items: center; flex: 1 1 100%; padding-bottom: .15rem; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a, button.link {
  white-space: nowrap; color: var(--muted-ink); padding: .4rem .8rem; border-radius: 999px; font-size: .93rem; font-weight: 600;
  border: 0; background: none; cursor: pointer; text-decoration: none; line-height: 1.3;
}
.menu a:hover, button.link:hover { background: var(--brand-soft); color: var(--brand); }
.menu a[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 700; }
button.link { margin-left: .4rem; border: 1px solid var(--line); }
form.inline { display: inline; }
@media (min-width: 62rem) { .menu { flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; overflow: visible; } }

/* ---- student pages: 3-line menu button ---- */
.student-page .topbar { flex-wrap: nowrap; justify-content: flex-start; }
.burger { order: -1; } /* the button sits on the left, before the logo */
.burger summary {
  position: relative; z-index: 2; /* stays above the open menu, so it can close it */
  display: flex; align-items: center; justify-content: center; width: 46px; height: 44px; cursor: pointer;
  list-style: none; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.burger summary::-webkit-details-marker { display: none; }
.burger summary:hover, .burger[open] summary { background: var(--brand-soft); }
/* three horizontal lines */
.burger-lines, .burger-lines::before, .burger-lines::after { display: block; width: 22px; height: 3px; border-radius: 3px; background: var(--ink); }
.burger-lines { position: relative; }
.burger-lines::before, .burger-lines::after { content: ""; position: absolute; left: 0; }
.burger-lines::before { top: -7px; }
.burger-lines::after { top: 7px; }
/* The open menu covers the left half of the screen from top to bottom. */
.burger .menu {
  position: fixed; z-index: 1; top: 0; bottom: 0; left: 0; width: 50%; justify-content: flex-start;
  overflow-y: auto; flex-direction: column; flex-wrap: nowrap; align-items: stretch;
  padding: 4.4rem .6rem 1rem; background: var(--surface); border-right: 3px solid var(--accent);
  box-shadow: 4px 0 24px rgba(0, 0, 0, .35);
}
.burger .menu > * { flex-shrink: 0; }
.burger .menu a, .burger button.link { white-space: normal; }
.burger .menu a, .burger button.link { display: block; width: 100%; text-align: left; border-radius: var(--radius-sm); padding: .7rem .9rem; }
.burger button.link { margin: .3rem 0 0; }

/* ---- student pages: a random background picture on every visit ---- */
/* A fixed layer, because background-attachment: fixed does not work on iPhones. */
.student-page::before {
  content: ""; position: fixed; inset: 0; z-index: -1; background: var(--navy) center / cover no-repeat;
  background-image: var(--student-bg);
}
.bg-1  { --student-bg: url("bg/student-01.jpg"); }
.bg-2  { --student-bg: url("bg/student-02.jpg"); }
.bg-3  { --student-bg: url("bg/student-03.jpg"); }
.bg-4  { --student-bg: url("bg/student-04.jpg"); }
.bg-5  { --student-bg: url("bg/student-05.jpg"); }
.bg-6  { --student-bg: url("bg/student-06.jpg"); }
.bg-7  { --student-bg: url("bg/student-07.jpg"); }
.bg-8  { --student-bg: url("bg/student-08.jpg"); }
.bg-9  { --student-bg: url("bg/student-09.jpg"); }
.bg-10 { --student-bg: url("bg/student-10.jpg"); }
/* A see-through panel keeps the text readable on top of the picture. */
.student-page .container {
  width: calc(100% - 1.2rem); margin-top: .8rem; margin-bottom: .8rem; padding-bottom: 1.2rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent); border-radius: var(--radius);
}
.student-page .site-footer { color: #fff; text-shadow: 0 1px 4px #000; }

/* ---- student: dashboard, profile, large QR ---- */
.big-line { font-size: 1.3rem; font-weight: 800; line-height: 1.3; }
.big-line.due { color: var(--red); }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.plain-list li > span { min-width: 0; overflow-wrap: anywhere; }
.profile-photo { display: block; width: 112px; height: 112px; border-radius: 50%; object-fit: cover; background: var(--brand-soft); margin-bottom: .8rem; }
.profile-initials { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; font-weight: 700; color: var(--brand); }
.qr-large { text-align: center; }
.qr-large h1::after { margin-left: auto; margin-right: auto; }
.qr-large .qr-large-image { display: block; width: min(100%, 68vh, 30rem); height: auto; aspect-ratio: 1; margin: .6rem auto 1rem; }

/* ---- class student list ---- */
.list-photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.list-initials { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--brand-soft); color: var(--brand); }

/* ---- student materials: class folders ---- */
a.folder { display: flex; flex-direction: column; gap: .15rem; color: var(--ink); text-decoration: none; border-top: 6px solid var(--accent); }
.cards-grid > a.folder { margin: 0; }
a.folder:hover { border-color: var(--brand); border-top-color: var(--accent); }
.folder-icon { font-size: 2.6rem; line-height: 1.1; }
.folder-name { font-size: 1.2rem; font-weight: 800; overflow-wrap: anywhere; }
.folder-count { margin-top: .5rem; font-weight: 700; color: var(--brand); }
.folder-search { display: flex; flex-wrap: wrap; gap: .6rem; }
.card.folder-search > * { margin: 0; }
.folder-search .input { flex: 1 1 14rem; width: auto; }
.card.material-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin: .6rem 0; scroll-margin-top: 5rem; }
.card.material-row > * { margin: 0; }
.material-icon { font-size: 1.6rem; }
.material-text { display: flex; flex-direction: column; flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.note-open summary { list-style: none; cursor: pointer; }
.note-open summary::-webkit-details-marker { display: none; }
.note-open[open] { flex-basis: 100%; }
.note-body { margin-top: .6rem; padding: .8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* ---- page ---- */
.container { max-width: 68rem; margin: 0 auto; padding: 1rem 1rem 3rem; }
.site-footer { text-align: center; padding: 1.5rem 1rem 2.5rem; color: var(--muted-ink); font-size: .85rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem;
  margin: 1rem 0; box-shadow: var(--shadow);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card h2, .card h3 { margin-top: 0; }
details.card summary { cursor: pointer; font-weight: 600; }

/* ---- messages ---- */
.notice, .warning {
  border-radius: var(--radius-sm); padding: .7rem 1rem; margin: .8rem 0; border: 1px solid transparent; border-left-width: 5px;
}
.notice { background: var(--ok-bg); border-color: var(--green); }
.warning { background: var(--warn-bg); border-color: var(--yellow); }
.error { color: var(--red); font-weight: 600; margin: .3rem 0; }
.offline-bar { background: var(--red); color: #fff; padding: .7rem 1rem; font-weight: 700; border-radius: var(--radius-sm); margin: .8rem 0; }

/* ---- buttons ---- */
.button, .big-button, button.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .6rem 1.2rem;
  border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; text-decoration: none;
  color: #fff; background: linear-gradient(180deg, #2a4ba8, var(--brand-dark)); cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .06s ease, filter .15s ease;
}
.button:hover, .big-button:hover { filter: brightness(1.12); }
.button:active, .big-button:active { transform: translateY(1px); }
.button.danger { background: linear-gradient(180deg, #d13a3a, var(--red)); }
.button[disabled], button[disabled] { opacity: .55; cursor: not-allowed; }
@media (prefers-color-scheme: dark) { .button, .big-button { color: #fff; } }

/* ---- door cards (home, student, staff) ---- */
.doors { display: grid; gap: 1rem; margin: 1.2rem 0; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.doors .big-button {
  flex-direction: column; align-items: flex-start; text-align: left; gap: .25rem; padding: 1.3rem; background: var(--surface);
  color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); font-size: 1.15rem;
  filter: none; position: relative;
}
.doors .big-button:hover { border-color: var(--brand); transform: translateY(-2px); filter: none; }
.doors .big-button small { font-weight: 400; color: var(--muted-ink); font-size: .92rem; }
.door-icon { font-size: 1.9rem; line-height: 1; }
.hero { background: linear-gradient(135deg, var(--brand-dark), #1d3a8a); color: #fff; border-radius: var(--radius); padding: 2rem 1.4rem; margin: 1rem 0; box-shadow: var(--shadow); }
.hero h1 { margin-top: 0; color: #fff; }
.hero h1::after { background: var(--accent); }
.hero p { color: #dbe4ff; max-width: 40rem; margin-bottom: 0; }

/* ---- forms ---- */
.field { margin-bottom: 1rem; }
.card .field { max-width: 36rem; }
.field label, label { font-weight: 600; }
.field label { display: block; margin-bottom: .3rem; }
.input, input[type=text], input[type=date], input[type=time], input[type=month], input[type=password], input[type=email], input[type=number], input[type=file], select, textarea {
  width: 100%; min-height: 44px; padding: .6rem .8rem; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
input[type=file] { padding: .45rem; background: var(--surface-2); }
textarea { min-height: 7rem; resize: vertical; }
.input:hover, input:hover, select:hover, textarea:hover { border-color: #9fb0d6; }
.input:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
.input.invalid { border-color: var(--red); background: var(--bad-bg); }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); vertical-align: -.2rem; margin-right: .3rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .9rem; }
legend { font-weight: 600; padding: 0 .3rem; }
td input[type=text] { min-height: 38px; padding: .35rem .5rem; min-width: 4.2rem; }
td input[type=time] { min-height: 40px; padding: .35rem .5rem; min-width: 8.2rem; }
.code { font-size: 2.4rem; letter-spacing: .4rem; text-align: center; font-weight: 700; }
.thumb { float: right; border-radius: var(--radius-sm); object-fit: cover; margin: 0 0 .5rem .75rem; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; background: var(--surface); display: block; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.card table { border: 0; }
table > tbody, table > thead, table > tfoot { display: table; width: 100%; }
th, td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-ink); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td, tr:hover > td { background: color-mix(in srgb, var(--brand-soft) 55%, transparent); }

/* ---- stat tiles ---- */
.stats { list-style: none; padding: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.stats li { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--brand); padding: 1rem 1.1rem; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.stats li a { text-decoration: none; display: block; }
.stats strong { font-size: 1.5rem; }

/* ---- health ---- */
.health-ok { color: var(--green); font-weight: 600; }
.health-warn { color: var(--yellow); font-weight: 600; }
.health-fail { color: var(--red); font-weight: 700; }
.health-unknown { color: var(--muted-ink); }
.checker-ok { }
.checker-bad { }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea.input { font-family: inherit; }

/* ---- scanner ---- */
.scan-video { width: 100%; max-height: 55vh; background: #000; border-radius: var(--radius); object-fit: cover; }
.result { border-radius: var(--radius); padding: 1.3rem; margin: 1rem 0; color: #fff; text-align: center; box-shadow: var(--shadow); }
.result h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); margin: .4rem 0; }
.result .muted { color: #fff; font-weight: 600; }
.result-ok { background: linear-gradient(180deg, #1c9a4b, #15803d); }
.result-warning { background: linear-gradient(180deg, #c58a0d, #a16207); }
.result-error { background: linear-gradient(180deg, #d63636, #b91c1c); }
.result-photo { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; background: #fff; border: 4px solid rgba(255, 255, 255, .85); }
.result-initials { display: inline-flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 700; color: #12224f; }
.result-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: .9rem; }
.result-actions .button { background: #fff; color: #172033; font-weight: 700; min-width: 8rem; min-height: 52px; font-size: 1.05rem; }
.result-actions .button.paid { background: #d9f2df; color: #0f5b2b; }
.result-actions .button.danger { background: #fbd5d2; color: #8f1a1a; }
.qr { background: #fff; padding: .6rem; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* ---- ID card: 85.6 x 54 mm (PLAN 12). Everything is placed in millimetres. Sizes must not change. ---- */
.card-sheet { display: flex; flex-wrap: wrap; gap: 8mm; }
.id-card {
  position: relative; flex: none; width: 85.6mm; height: 54mm; overflow: hidden; border-radius: 3mm; border: .2mm solid #0a1f4d;
  background: #fff; color: #0a1f4d; line-height: 1.2; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.id-card img, .id-card div { position: absolute; margin: 0; }
.id-card .id-art { left: -.2mm; top: -.2mm; width: 85.6mm; height: 54mm; }
/* front */
.id-card .id-head { left: 10.5mm; top: 2.8mm; width: 47mm; height: auto; }
.id-card .id-tagline { left: 60.5mm; top: 3.6mm; width: 22mm; height: auto; }
.id-card .id-photo-box { left: 5mm; top: 16mm; width: 23mm; height: 25mm; padding: .6mm; border-radius: 2.6mm; background: #f7940a; }
.id-card .id-photo { left: .6mm; top: .6mm; width: 21.8mm; height: 23.8mm; object-fit: cover; border-radius: 2.1mm; border: .6mm solid #fff; background: #cfd9ee; }
.id-card .id-divider { left: 31mm; top: 18mm; width: .35mm; height: 21mm; background: #f7940a; }
.id-card .id-info { left: 33.5mm; top: 17.5mm; width: 40mm; height: 22mm; display: flex; flex-direction: column; justify-content: center; gap: 1.6mm; }
.id-card .id-info div { position: static; }
.id-name { font-size: 4.6mm; font-weight: 800; line-height: 1.12; overflow-wrap: anywhere; max-height: 10.4mm; overflow: hidden; }
.id-name.medium { font-size: 3.7mm; }
.id-name.long { font-size: 2.8mm; }
.id-number { align-self: flex-start; white-space: nowrap; background: #0a1f4d; color: #fff; font-size: 2.65mm; padding: 1.1mm 2.2mm; border-radius: 1.4mm; }
.id-number strong { font-weight: 800; }
.id-class { font-size: 2.5mm; font-weight: 600; line-height: 1.25; max-height: 6.3mm; overflow: hidden; }
/* back: the QR sits on plain white inside the orange frame, with its own quiet margin */
.id-card .id-qr-box { left: 6mm; top: 3.8mm; width: 45mm; height: 45mm; border: .6mm solid #f7940a; border-radius: 3mm; background: #fff; }
.id-card .id-qr { left: .4mm; top: .4mm; width: 43mm; height: 43mm; }
.id-card .id-slogan { left: 52.5mm; top: 10.5mm; width: 31mm; height: auto; }
/* admin print sheet: one student per row, never split across two pages */
.print-list .card-sheet { margin-bottom: 6mm; break-inside: avoid; }

.auth-wrap { max-width: 26rem; margin: 1.5rem auto; }
.auth-wrap .button { width: 100%; }
.auth-layout { display: grid; gap: 1.5rem; align-items: center; margin-top: .5rem; }
.auth-layout .auth-wrap { width: 100%; margin: 0; }
.auth-layout .hero { margin: 0; }
@media (min-width: 52rem) { .auth-layout { grid-template-columns: 1.1fr 1fr; gap: 2.5rem; min-height: 60vh; } }
.auth-wrap h2 { margin-top: .8rem; }
.auth-wide { max-width: 44rem; margin: .5rem auto 1rem; }
.auth-wide .card .field { max-width: none; }

/* segmented tabs: role (student / teacher / staff / admin) and mode (log in / register) */
.tabs { display: flex; gap: .25rem; padding: .25rem; background: var(--brand-soft); border-radius: 999px; margin: 1rem 0 .6rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 1 auto; text-align: center; white-space: nowrap; padding: .5rem 1rem; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--muted-ink); min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(18, 34, 79, .18); }
.mode-tabs { max-width: 22rem; }
.auth-switch { margin-top: .8rem; color: var(--muted-ink); }
.auth-switch a { font-weight: 600; }

/* ---- page building blocks ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; }
.page-head h1 { margin-bottom: .4rem; }
.cards-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr)); align-items: start; margin: 1rem 0; }
.cards-grid > .card { margin: 0; }
.kpis { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); margin: 1rem 0; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.kpi .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-ink); font-weight: 700; }
.kpi .value { font-size: 1.55rem; font-weight: 800; line-height: 1.2; margin: .15rem 0; overflow-wrap: anywhere; }
.kpi .delta { font-size: .85rem; color: var(--muted-ink); }
a.kpi { text-decoration: none; color: var(--ink); display: block; }
a.kpi:hover { border-color: var(--brand); transform: translateY(-1px); }
a.kpi .value { font-size: 1.15rem; font-weight: 600; }
a.kpi .value strong { font-size: 1.6rem; color: var(--brand); }
.kpi.good { border-top-color: var(--green); }
.kpi.bad { border-top-color: var(--red); }
.kpi.bad .value { color: var(--red); }
.kpi.warn { border-top-color: var(--yellow); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 1rem; }
.chips a { padding: .35rem .85rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: .9rem; font-weight: 600; color: var(--ink); }
.chips a:hover { border-color: var(--brand); color: var(--brand); }
.chips a[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.filters { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); align-items: end; }
.filters .field, .card .filters .field { margin: 0; max-width: none; }
.filters .button { width: 100%; }
.badge { display: inline-block; padding: .1rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--muted-ink); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--green); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--yellow); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--red); border-color: transparent; }
.chip-list { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.button.small { min-height: 34px; padding: .3rem .8rem; font-size: .9rem; }
.button.secondary { background: var(--surface); color: var(--brand); border: 1px solid var(--line); box-shadow: none; }
.button.secondary:hover { border-color: var(--brand); filter: none; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form.inline { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.actions form.inline input[type="text"] { width: 15rem; max-width: 100%; }
.confirm { font-size: .85rem; color: var(--muted-ink); font-weight: 500; white-space: nowrap; }
details.card > summary { font-size: 1.1rem; font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; gap: .6rem; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
details.card[open] > summary::before { content: "\2212"; }
details.card[open] > summary { margin-bottom: .8rem; }
.form-grid { display: grid; gap: 0 1.2rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.card .form-grid .field { max-width: none; }
.form-grid .full { grid-column: 1 / -1; }
.item-title { font-weight: 700; }
.small-text { font-size: .88rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .6rem 0 1rem; }
.kv dt { color: var(--muted-ink); font-size: .85rem; font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.qr-card { text-align: center; max-width: 28rem; width: 100%; }
.qr-card .qr { margin: .4rem auto .8rem; display: block; }
.empty { text-align: center; padding: 1.4rem 1rem; color: var(--muted-ink); border: 2px dashed var(--line); border-radius: var(--radius); margin: 1rem 0; }

/* ---- small screens ---- */
@media (max-width: 40rem) {
  .container { padding: .8rem .8rem 3rem; }
  .card { padding: 1rem; border-radius: 12px; }
  .hero { padding: 1.4rem 1rem; }
  th, td { padding: .5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- student animations: only for people who have not asked their device for reduced motion ---- */
@media (prefers-reduced-motion: no-preference) {
  /* "backwards" hides a card while it waits its turn, and leaves nothing behind that would block the card lift */
  @keyframes rise-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
  @keyframes menu-in { from { transform: translateX(-100%); } to { transform: none; } }

  /* 1. gentle entrance, on every student page */
  .student-page .container > :not(.cards-grid) { animation: rise-in .5s ease-out backwards; }

  /* 2. cards one by one (from the 5th card on they arrive together, so nobody waits long) */
  /* cards stacked down the page (timetable, materials) */
  .student-page .container > section.card { animation: rise-in .45s ease-out .1s backwards; }
  .student-page .container > section.card ~ section.card { animation-delay: .2s; }
  .student-page .container > section.card ~ section.card ~ section.card { animation-delay: .3s; }
  .student-page .container > section.card ~ section.card ~ section.card ~ section.card { animation-delay: .4s; }
  .student-page .container > section.card ~ section.card ~ section.card ~ section.card ~ section.card { animation-delay: .5s; }
  /* cards side by side (dashboard, payments, QR codes) */
  .student-page .cards-grid > .card { animation: rise-in .45s ease-out .5s backwards; }
  .student-page .cards-grid > .card:nth-child(1) { animation-delay: .1s; }
  .student-page .cards-grid > .card:nth-child(2) { animation-delay: .2s; }
  .student-page .cards-grid > .card:nth-child(3) { animation-delay: .3s; }
  .student-page .cards-grid > .card:nth-child(4) { animation-delay: .4s; }

  /* 4. the 3-line menu slides in from the left */
  .burger[open] .menu { animation: menu-in .25s ease-out; }

  /* 5. card lift, only where there is a real mouse (forms stay still while you use them) */
  .student-page .container section.card { transition: transform .2s ease, box-shadow .2s ease; }
  @media (hover: hover) {
    .student-page .container section.card:hover { transform: translateY(-5px); box-shadow: 0 12px 26px rgba(18, 34, 79, .22); }
  }
}

/* ---- print: light, no menus ---- */
@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff; color: #000; }
  .topbar, .menu, button, .button, .noprint, .notice, .site-footer { display: none !important; }
  .student-page::before { display: none; }
  .student-page .container { width: auto; margin: 0; background: none; }
  .container { max-width: none; padding: 0; }
  .card { box-shadow: none; border-color: #bbb; }
  h1::after { display: none; }
  .card-sheet { display: flex; flex-wrap: nowrap; gap: 8mm; }
  .id-card { break-inside: avoid; }
}
