:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1d2330; --muted: #5d6677; --line: #dde1e8;
  --accent: #1f4fa3; --accent-text: #ffffff; --ok: #1f7a3d; --warn: #b35c00; --err: #b3261e;
  --chip: #eef1f6;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --card: #1d2129; --text: #e7eaf0; --muted: #9aa3b2; --line: #2e343f;
    --accent: #7aa7ff; --accent-text: #0e1420; --ok: #6fd08f; --warn: #ffb35c; --err: #ff8a80; --chip: #262b35; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { font-weight: 700; font-size: 18px; }
.who { color: var(--muted); font-size: 14px; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 40px auto; }
h1 { font-size: 22px; margin: 0 0 12px; } h2 { font-size: 18px; margin: 0 0 12px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 600; margin-bottom: 6px; }
label { display: block; margin: 8px 0; font-size: 14px; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); font: inherit; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 6px 0 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
button { font: inherit; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 6px; padding: 9px 18px; font-weight: 600; }
.primary:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; }
.small { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 6px; padding: 4px 10px; font-size: 13px; }
.msg { min-height: 1.2em; margin: 8px 0 0; font-size: 14px; }
.msg.error { color: var(--err); } .msg.ok { color: var(--ok); }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.banner { background: var(--chip); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tpl { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; color: var(--text); cursor: pointer; }
.tpl:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tpl strong { display: inline; } .tpl span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.thumb { aspect-ratio: 16 / 9; border-radius: 8px; background: var(--chip); margin-bottom: 10px; display: grid; place-items: center; color: var(--muted); font-size: 12px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.jobs { display: grid; gap: 8px; }
.job { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.job-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.job-title { font-weight: 600; overflow-wrap: anywhere; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--chip); font-size: 12px; }
.chip.done { color: var(--ok); } .chip.error { color: var(--err); } .chip.wait { color: var(--muted); } .chip.review { color: var(--warn); }
.grade { font-size: 20px; font-weight: 700; }
.warn { color: var(--warn); font-size: 13px; margin: 6px 0 0; }
.err { color: var(--err); font-size: 13px; margin: 6px 0 0; }
.meta { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }

/* ---- logo ---- */
.brand { display: flex; align-items: center; gap: 8px; letter-spacing: -.3px; }
.logo { width: 30px; height: 30px; display: block; }

/* ---- form fields with an info symbol ---- */
.field { margin: 10px 0; }
.field-head { display: flex; align-items: center; gap: 6px; }
.field-head label { margin: 0; }
.field > input { margin-top: 4px; }
.info-wrap { position: relative; display: inline-flex; }
.info { width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text);
  font: italic 700 13px/20px Georgia, serif; text-align: center; padding: 0; cursor: help; }
.info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tip { display: none; position: absolute; left: -8px; top: calc(100% + 8px); z-index: 30; width: min(380px, calc(100vw - 48px));
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14); font-size: 13.5px; line-height: 1.45; font-weight: 400; }
.tip::before { content: ""; position: absolute; top: -7px; left: 12px; width: 12px; height: 12px; background: var(--card);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.tip ul { margin: 6px 0 0; padding-left: 18px; } .tip li { margin: 4px 0; }
.tip code { background: var(--chip); border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
.info-wrap:hover .tip, .info:focus + .tip { display: block; }

/* ---- «Eigene Vorlage» card and dialog ---- */
.tpl-new { display: block; width: 100%; text-align: left; font: inherit; background: var(--card); border: 2px dashed var(--line); color: var(--text); }
.tpl-new:hover, .tpl-new:focus-visible { border-color: #5b3fd1; outline: none; box-shadow: 0 0 0 2px rgba(91, 63, 209, .15); }
.tpl-new strong { font-size: 15px; }
.new-thumb { background: linear-gradient(135deg, rgba(47, 107, 255, .10), rgba(91, 63, 209, .14)); }
.new-thumb .plus { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; font-weight: 300; line-height: 1;
  color: #fff; background: linear-gradient(135deg, #2f6bff, #5b3fd1); box-shadow: 0 6px 16px rgba(47, 107, 255, .3); }
.fee { font-size: 16px; margin: 10px 0 4px; }
.fee-points { margin: 4px 0 10px; padding-left: 0; list-style: none; font-size: 14px; }
.fee-points li { position: relative; padding-left: 24px; margin: 5px 0; }
.fee-points li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 17px; height: 17px; border-radius: 50%;
  background: var(--trust-bg); color: var(--trust); font: 700 11px/17px system-ui, sans-serif; text-align: center; }

/* ---- the two file fields ---- */
.files .field { margin: 0; }
.files .field + .field { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.files .field-head label { font-size: 16px; font-weight: 600; color: var(--text); }
.req { margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
input[type=file] { padding: 8px; border: 1px dashed var(--line); border-radius: 10px; background: var(--card); color: var(--muted); font-size: 14px; cursor: pointer; }
input[type=file]::file-selector-button { margin-right: 14px; padding: 9px 18px; border: 0; border-radius: 8px; cursor: pointer;
  font: 600 14px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif; color: #fff;
  background: linear-gradient(135deg, #2f6bff, #5b3fd1); box-shadow: 0 2px 8px rgba(47, 107, 255, .25); transition: filter .15s, box-shadow .15s; }
input[type=file]::file-selector-button:hover { filter: brightness(1.08); box-shadow: 0 4px 12px rgba(47, 107, 255, .35); }
input[type=file]:hover { border-color: #5b3fd1; }
input[type=file]:focus-visible { outline: 2px solid #5b3fd1; outline-offset: 2px; }
/* drag & drop: the whole box takes a dropped PDF */
.dropzone { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 4px; padding: 12px 14px;
  border: 2px dashed var(--line); border-radius: 12px; background: var(--card); transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: #8f7ae6; }
.dropzone input[type=file] { flex: 1 1 260px; width: auto; margin: 0; padding: 0; border: 0; background: transparent; }
.drop-hint { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.drop-hint svg { width: 18px; height: 18px; }
.dropzone.over { border-color: #5b3fd1; border-style: solid; background: linear-gradient(135deg, rgba(47, 107, 255, .07), rgba(91, 63, 209, .10)); }
.dropzone.over .drop-hint { color: #5b3fd1; font-weight: 600; }
.dropzone.filled { border-style: solid; border-color: var(--trust-line); }

/* ---- Punkteverteilung table ---- */
.ps-title { font-size: 14px; color: var(--muted); }
.ps-source { margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.ps-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.ps-row { display: grid; grid-template-columns: 56px 88px 1fr 28px; gap: 6px; align-items: center; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.ps-row input { margin: 0; padding: 5px 7px; }
.ps-key { font-weight: 700; text-align: center; }
.ps-pts-wrap { display: flex; align-items: center; gap: 4px; }
.ps-pts { width: 64px; }
.ps-unit { font-size: 12px; color: var(--muted); }
.ps-pts[readonly] { background: var(--chip); }
.ps-opt { justify-self: start; border: 0; background: none; color: var(--accent); font-size: 12.5px; padding: 4px 2px; }
.ps-del { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--muted); font-size: 16px; line-height: 1; padding: 0; }
.ps-del:hover { color: var(--err); border-color: var(--err); }
.ps-adv { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 6px; }
.ps-adv label { margin: 4px 0; font-size: 13px; }
.ps-adv .ps-split { max-width: 260px; }
.ps-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.ps-total { font-size: 14px; }
.ps-ok { color: var(--ok); font-weight: 600; margin-left: 6px; }
.ps-bad { color: var(--warn); font-weight: 600; margin-left: 6px; }
.ps-adv .check { align-items: flex-start; }

/* ---- footer ---- */
.foot { max-width: 980px; margin: 8px auto 24px; padding: 0 16px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.foot p { margin: 0; border-top: 1px solid var(--line); padding-top: 12px; }

/* ---- school approval: status chip and the downloads ---- */
.school-chip { margin-right: 6px; padding: 3px 10px 3px 22px; border: 1px solid #f0c98a; border-radius: 999px; background: #fff6e6; color: #8a5300;
  font: 600 12.5px/1.4 system-ui, sans-serif; cursor: pointer; position: relative; white-space: nowrap; }
.school-chip::before { content: ""; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #e89a1a; }
.school-chip:hover { border-color: #e89a1a; }
@media (prefers-color-scheme: dark) { .school-chip { background: #3a2a10; border-color: #6b4a14; color: #ffcf85; } }
.school-downloads { display: grid; gap: 8px; margin: 12px 0; }
.school-add { grid-template-columns: 1fr auto; align-items: end; margin-top: 12px; }
.dl { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.dl:hover { border-color: #5b3fd1; box-shadow: 0 0 0 2px rgba(91, 63, 209, .12); }
.dl-icon { flex: none; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; color: #fff; font: 700 12px system-ui, sans-serif;
  background: linear-gradient(135deg, #2f6bff, #5b3fd1); }

/* ---- after sign-up: confirm the e-mail ---- */
.signup-done { text-align: center; padding: 8px 4px 4px; }
.signup-done h2 { font-size: 20px; margin: 10px 0 8px; }
.signup-done p { font-size: 14.5px; }
.done-icon { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 26px system-ui, sans-serif;
  background: linear-gradient(135deg, #2f6bff, #5b3fd1); }

/* ---- sign-up: password rules, consent, captcha ---- */
.pw-rules { list-style: none; margin: 4px 0 12px; padding: 0; font-size: 13px; color: var(--muted); }
.pw-rules li { position: relative; padding-left: 22px; margin: 3px 0; }
.pw-rules li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: "✓"; left: 0; top: 0; width: 16px; height: 16px; background: none; color: var(--ok); font-weight: 700; font-size: 13px; line-height: 18px; text-align: center; }
.consent { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.consent label.check { align-items: flex-start; font-size: 13.5px; }
.consent input[type=checkbox] { margin-top: 3px; }
.captcha { margin: 12px 0; min-height: 65px; }
#authSubmit { width: 100%; margin-top: 6px; }

/* ---- «Datenschutz nach Schweizer Recht» ---- */
.trust { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: 10px;
  background: var(--trust-bg); border: 1px solid var(--trust-line); color: var(--text); }
.trust .trust-icon { width: 34px; height: 34px; flex: none; }
.trust strong { display: block; font-size: 15px; }
.trust p { margin: 4px 0 6px; font-size: 13.5px; }
.trust ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.trust li { margin: 2px 0; }
.trust-icon { color: var(--trust); }
.trust-strip { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; padding: 7px 12px; border-radius: 8px;
  background: var(--trust-bg); border: 1px solid var(--trust-line); font-size: 13px; color: var(--text); }
.trust-strip .trust-icon { width: 20px; height: 20px; flex: none; }
:root { --trust: #1f7a3d; --trust-bg: #eef7f1; --trust-line: #cfe6d7; }
@media (prefers-color-scheme: dark) { :root { --trust: #6fd08f; --trust-bg: #17261d; --trust-line: #2b4535; } }

/* ---- privacy page: the fine print ---- */
.legal { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.legal h1 { font-size: 17px; color: var(--text); }
.legal h2 { font-size: 13px; margin: 16px 0 4px; color: var(--text); }
.legal p, .legal li, .legal td, .legal th { font-size: 12.5px; }
.legal th, .legal td { padding: 4px 6px; }
.legal .trust { margin: 0 0 14px; }
.todo { background: #fff3c4; color: #5a4300; border-radius: 4px; padding: 1px 4px; }
/* printed (the PDF for school managements): readable, black on white */
@page { margin: 12mm 15mm; }
@media print {
  body { background: #fff; }
  .top { border: 0; padding: 0 0 8px; }
  main { max-width: none; padding: 0; }
  .card.legal { border: 0; padding: 0; color: #000; font-size: 10.5pt; }
  .legal h1 { font-size: 16pt; } .legal h2 { font-size: 11pt; margin: 12px 0 4px; }
  .legal p, .legal li { font-size: 10pt; margin-top: 4px; margin-bottom: 4px; }
  .legal > p:last-child:has(a[href="/"]) { display: none; }
  main, .card.legal { margin-bottom: 0; }
}

/* ---- class PDF split ---- */
.split-toggle { margin-top: 8px; }
.split-box { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; }
.split-head { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.split-head label { margin: 0; } .split-head input { width: 140px; }
.split-summary { margin: 8px 0; font-size: 14px; }
.split-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; max-height: 520px; overflow: auto; padding: 2px; }
.split-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.split-card img { width: 100%; display: block; border-bottom: 1px solid var(--line); }
.split-card .cap { padding: 6px 8px; font-size: 12.5px; color: #33405c; }
.split-card.bad { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); }
.noprev { height: 90px; display: grid; place-items: center; color: #8a93a3; font-size: 12px; background: #f4f5f7; border-bottom: 1px solid var(--line); }
.split-ok { margin-top: 10px; }

/* ---- prepaid credit ---- */
.credit-main { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.credit-balance { font-size: 30px; font-weight: 800; line-height: 1.1; margin: 2px 0; }
.credit-balance.low { color: var(--warn); } .credit-balance.empty { color: var(--err); }
.credit-split { display: flex; gap: 24px; }
.credit-num { font-size: 18px; font-weight: 700; }
.credit-log { margin-top: 10px; } .credit-log summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.credit-log table { margin-top: 6px; }
td.plus { color: var(--ok); } td.minus { color: var(--muted); }
.credit-chip { display: inline-block; margin-right: 10px; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--text); font-weight: 600; text-decoration: none; white-space: nowrap; }
.credit-chip:hover { box-shadow: 0 0 0 1px var(--accent); }
.credit-chip.low { color: var(--warn); } .credit-chip.empty { color: var(--err); }
.pending { background: var(--chip); border-left: 4px solid var(--warn); border-radius: 6px; padding: 8px 12px; margin: 12px 0 0; font-size: 14px; }
.packages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.package { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); cursor: pointer; }
.package:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.package input { position: absolute; opacity: 0; pointer-events: none; }
.package strong { font-size: 17px; } .package span { color: var(--muted); font-size: 12.5px; }
.package:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.credit-form { grid-template-columns: 1fr 1.3fr 2fr auto; align-items: end; margin-top: 8px; }
@media (max-width: 760px) { .credit-form { grid-template-columns: 1fr; } }

/* ---- owner reminder (Bedrock before the 5th customer) ---- */
.reminder { margin: 0 0 14px; padding: 12px 16px; border-radius: 10px; border: 1px solid #e3a33a; background: #fff4e0; color: #5a3a00; font-size: 14px; line-height: 1.5; }
.reminder strong { display: block; font-size: 15px; margin-bottom: 2px; }
@media (prefers-color-scheme: dark) { .reminder { background: #3a2a10; border-color: #6b4a14; color: #ffd9a0; } }

/* ---- admin dashboard ---- */
main.wide { max-width: 1240px; }
.badge { font-size: 12px; font-weight: 600; background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; color: var(--muted); font-weight: 600; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 12px; margin-left: 4px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.head-row h2, .head-row h3 { margin: 0; }
.head-row select, .search { width: auto; min-width: 220px; margin: 0; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 10px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 24px; font-weight: 700; margin: 2px 0; }
.stat-sub { color: var(--muted); font-size: 12px; }
.stat.pos .stat-value, td.pos { color: var(--ok); } .stat.neg .stat-value, td.neg { color: var(--err); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.clickable { cursor: pointer; } tr.clickable:hover { background: var(--chip); }
.detail { margin-top: 16px; border-top: 2px solid var(--accent); padding-top: 12px; }
label.check { display: flex; align-items: center; gap: 6px; color: var(--text); }
.warn-inline { color: var(--warn); }
.fixed-row { grid-template-columns: 2fr 1fr auto; align-items: end; }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); max-width: 520px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
