/*
 * Grundstil der Plattform. Keine externen Schriften: Es werden ausschließlich
 * die auf dem Gerät installierten Systemschriften verwendet.
 * Die Markenfarbe kommt aus /brand.css (--brand, --brand-ink).
 */
:root {
  --brand: #115e59;
  --brand-ink: #ffffff;
  --bg: #f4f4f0;
  --surface: #ffffff;
  --border: #e3e3dd;
  --border-strong: #b9bab4;
  --text: #1c2524;
  --muted: #5b6462;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, white);
  --warn-bg: #fdf3e8;
  --warn-border: #f0d4b3;
  --warn-text: #8a4b0f;
  --danger: #b42318;
  --ok-bg: #e3f1ed;
  --ok-text: #1d5c4f;
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
code, kbd, .mono { font-family: var(--mono); }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; }
.skip-link:focus { left: 1rem; z-index: 10; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .875rem clamp(1rem, 3vw, 3rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.125rem; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm);
  background: var(--brand); color: var(--brand-ink); font-weight: 700;
}
.brand-logo { height: 2.25rem; width: auto; }

.page { padding: clamp(1rem, 4vw, 3rem) clamp(1rem, 3vw, 3rem); max-width: 80rem; margin: 0 auto; }
.footer { text-align: center; padding: 0 1rem 2rem; color: var(--muted); font-size: .9375rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2.5rem);
}
.card-narrow { max-width: 34rem; margin: 0 auto; }
.muted { color: var(--muted); }
.prose { max-width: 70ch; }
.error-detail { white-space: pre-wrap; font-size: .8125rem; overflow-x: auto; }

/* Formulare */
.field { display: grid; gap: .375rem; margin-bottom: 1.125rem; align-content: start; }
.field label { font-weight: 600; font-size: .9375rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.hint { color: var(--muted); font-size: .875rem; }
.error-text { color: var(--danger); font-size: .875rem; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: inherit;
  padding: .75rem .875rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
}
input[aria-invalid=true] { border-color: var(--danger); }

/* Schaltflächen */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 600; line-height: 1.2;
  padding: .75rem 1.25rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-block { width: 100%; }

/* Hinweise */
.alert { border-radius: var(--radius-sm); padding: .875rem 1rem; margin: 0 auto 1rem; max-width: 80rem; border: 1px solid var(--border); background: var(--surface); }
.alert-success { background: var(--ok-bg); border-color: transparent; color: var(--ok-text); }
.alert-warning { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.alert-error { border-color: var(--danger); color: var(--danger); }

/* Status-Pillen */
.pill { display: inline-block; padding: .25rem .75rem; border-radius: 999px; font-size: .875rem; font-weight: 500; background: #ececea; }
.pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }

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

/* ---- Phase 2: Anmeldung, Kurs, Test ---- */
.mono { font-family: var(--mono); }
.divider { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.form-footer { margin: 1.25rem 0 0; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; margin: 0; }
.topbar-user { font-size: .9375rem; }
@media (max-width: 560px) { .topbar-user { display: none; } }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.stack > * + * { margin-top: 1.25rem; }
.narrow-page { max-width: 48rem; margin: 0 auto; }
.course-card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.course-card-head h2 { margin: 0; font-size: 1.25rem; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: 0; }
.inline-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.result-box { margin-top: 1.25rem; }

.course-layout { display: grid; grid-template-columns: minmax(15rem, 22rem) 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .course-layout { grid-template-columns: 1fr; } }
.course-nav { padding: 1.5rem; }
.course-nav-title { font-weight: 600; margin: 0 0 .75rem; }
.progress { height: .5rem; border-radius: 999px; background: #e6e6e1; overflow: hidden; margin-bottom: 1rem; }
.progress-bar { display: block; height: 100%; background: var(--brand); width: 0; }
.progress-0 { width: 0%; } .progress-5 { width: 5%; } .progress-10 { width: 10%; } .progress-15 { width: 15%; } .progress-20 { width: 20%; } .progress-25 { width: 25%; } .progress-30 { width: 30%; } .progress-35 { width: 35%; } .progress-40 { width: 40%; } .progress-45 { width: 45%; } .progress-50 { width: 50%; } .progress-55 { width: 55%; } .progress-60 { width: 60%; } .progress-65 { width: 65%; } .progress-70 { width: 70%; } .progress-75 { width: 75%; } .progress-80 { width: 80%; } .progress-85 { width: 85%; } .progress-90 { width: 90%; } .progress-95 { width: 95%; } .progress-100 { width: 100%; }
.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-list li > a, .lesson-list li > span, .lesson-list-test > a, .lesson-list-test > span {
  display: block; padding: .625rem .75rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
}
.lesson-list li > a:hover, .lesson-list-test > a:hover { background: var(--bg); }
.lesson-list [aria-disabled=true], .lesson-list-test [aria-disabled=true] { color: var(--muted); }
.lesson-list .is-current > span, .lesson-list-test.is-current > span { background: var(--brand-soft); font-weight: 600; }
.lesson-list-test { border-top: 1px solid var(--border); margin-top: .5rem; padding-top: .5rem; }
.check { color: var(--brand); margin-right: .25rem; }
.lesson .block { margin: 1.5rem 0; }
.lesson img, .video { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.video { width: 100%; background: #1f2928; aspect-ratio: 16 / 9; }
.notice { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: 1rem 1.25rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.notice > :first-child { margin-top: 0; } .notice > :last-child { margin-bottom: 0; }
figcaption { font-size: .875rem; margin-top: .5rem; }
.lesson-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.lesson-actions form { margin: 0; }

.question { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.25rem; margin: 0 0 1.25rem; min-width: 0; }
.question legend { float: left; width: 100%; display: grid; gap: .25rem; padding: 0; margin-bottom: .5rem; }
.question legend + * { clear: both; }
.question-prompt { font-weight: 600; font-size: 1.0625rem; }
.option { display: flex; gap: .75rem; align-items: flex-start; padding: .625rem .5rem; border-radius: var(--radius-sm); cursor: pointer; }
.option:hover { background: var(--bg); }
.option input { margin-top: .25rem; width: 1.125rem; height: 1.125rem; accent-color: var(--brand); flex: none; }

/* ---- Phase 3: Verwaltung ---- */
.admin-shell { display: grid; grid-template-columns: 16rem 1fr; min-height: 100vh; }
.admin-side { min-width: 0; background: var(--surface); border-right: 1px solid var(--border); padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 2rem; }
.admin-side .brand { padding: 0 .5rem; }
.admin-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.admin-nav a { display: block; padding: .75rem 1rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.admin-nav a:hover { background: var(--bg); }
.admin-nav a[aria-current=page] { background: var(--brand-soft); font-weight: 600; }
.admin-logout { margin-top: auto; display: grid; gap: .25rem; padding: 0 .5rem; font-size: .9375rem; }
.admin-logout .link-button { justify-self: start; }
.admin-main { padding: clamp(1rem, 3vw, 2.5rem); min-width: 0; }
.admin-main > * + * { margin-top: 1.5rem; }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.admin-head h1 { margin: 0; }
.admin-head p { margin: .5rem 0 0; max-width: 60ch; }
.admin-eyebrow { margin: 0 0 .25rem !important; }
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .admin-side { min-width: 0; border-right: 0; border-bottom: 1px solid var(--border); gap: 1rem; padding: 1rem; }
  .admin-nav { grid-auto-flow: column; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; padding: .5rem .75rem; }
  .admin-logout { margin-top: 0; grid-auto-flow: column; justify-content: start; gap: 1rem; }
}
.card-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.25rem 1.5rem; }
.code-box { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.code-value { font-size: 1.25rem; letter-spacing: .02em; }
.seats { font-size: .875rem; }
.card-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.card-warn h2 { font-size: 1.25rem; }
.pending-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-color: var(--warn-border) !important; }
.warn-text { color: var(--warn-text); margin: .25rem 0 0; font-size: .9375rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }
.card h2 { font-size: 1.25rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; color: var(--muted); padding: .75rem .75rem .75rem 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .875rem .75rem .875rem 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.cell-sub { display: block; font-size: .8125rem; }
.cell-actions { white-space: nowrap; }
.cell-actions form { display: inline; margin-right: 1rem; }
.pill-soon { background: #fdf6dc; color: #6b5300; }
.tabs { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.tabs a { padding: .375rem .75rem; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.tabs a[aria-current=page] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1.5rem; }
.grid-2 > .card { margin: 0; }
.card-narrow-left { max-width: 40rem; }
.big-code { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); font-weight: 700; letter-spacing: .06em; padding: 1rem 1.25rem; background: var(--bg); border-radius: var(--radius-sm); display: inline-block; margin: .5rem 0 1rem; }
.code-input { font-size: 1.5rem; letter-spacing: .3em; text-align: center; }
.checkbox-field label { display: flex; gap: .625rem; align-items: flex-start; font-weight: 500; }
.checkbox-field input { margin-top: .3rem; width: 1.125rem; height: 1.125rem; accent-color: var(--brand); flex: none; }

/* Aushang */
.poster { background: var(--bg); }
.poster-actions { max-width: 210mm; margin: 1rem auto; display: flex; gap: .75rem; padding: 0 1rem; }
.poster-page { background: #fff; max-width: 210mm; min-height: 270mm; margin: 0 auto 2rem; padding: 18mm; box-sizing: border-box; }
.poster-page h1 { font-size: 2rem; margin: 2.5rem 0 1rem; }
.poster-lead { font-size: 1.25rem; }
.poster-code { margin: 2.5rem 0; padding: 1.5rem 2rem; border: 3px solid var(--brand); border-radius: var(--radius); display: grid; gap: .5rem; }
.poster-code strong { font-size: 3rem; letter-spacing: .04em; }
.poster-steps { font-size: 1.125rem; display: grid; gap: .75rem; padding-left: 1.5rem; }
.poster-url { overflow-wrap: anywhere; }
@media print {
  .no-print { display: none !important; }
  .poster, body { background: #fff; }
  .poster-page { margin: 0; padding: 0; min-height: 0; max-width: none; }
  .brand-mark, .poster-code { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Phase 4: Betreiberbereich ---- */
body.operator { --brand: #1f2928; --brand-ink: #ffffff; --brand-soft: #e6ebea; }
.operator-side { background: #1f2928; color: #f2f4f3; border-right: 0; }
.operator-side .operator-title { color: #fff; font-weight: 700; font-size: 1.125rem; text-decoration: none; padding: 0 .5rem; }
.operator-side .admin-nav a { color: #e3e8e6; }
.operator-side .admin-nav a:hover { background: #2c3836; }
.operator-side .admin-nav a[aria-current=page] { background: #3a4846; color: #fff; }
.operator-side .admin-logout { color: #c9d1cf; }
.operator-side .link-button { color: #fff; }
.operator-side :focus-visible { outline-color: #fff; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fdf0ee; }
.pill-muted { background: #ececea; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fieldset-plain { border: 0; padding: 0; margin: 0 0 1.125rem; }
.fieldset-plain legend { font-weight: 600; font-size: .9375rem; margin-bottom: .5rem; padding: 0; }
.check-inline { display: flex; gap: .5rem; align-items: center; margin: .25rem 0; font-weight: 400; }
.check-inline input { width: 1.125rem; height: 1.125rem; accent-color: var(--brand); }
.label-inline { display: inline-flex; gap: .5rem; align-items: center; }
.label-inline input { width: auto; padding: .375rem .5rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.upload-row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: .75rem 0; }
.upload-row input[type=text] { flex: 1 1 14rem; width: auto; }
.stack-sm > * + * { margin-top: .5rem; }
.small { font-size: .8125rem; }
.nowrap { white-space: nowrap; }
.table-compact td, .table-compact th { padding-top: .5rem; padding-bottom: .5rem; font-size: .9375rem; }
.table-compact td.small { max-width: 24rem; overflow-wrap: anywhere; }
.filter-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-row .field { margin: 0; min-width: 14rem; }
.pager { display: flex; gap: 1.5rem; justify-content: center; margin-top: 1rem; }
.icon-button { background: none; border: 1px solid var(--border); border-radius: 6px; width: 2rem; height: 2rem; cursor: pointer; font: inherit; color: var(--text); }
.icon-button:hover { background: var(--bg); }

.save-options { margin: .75rem 0 1rem; padding: .5rem .75rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: .9375rem; }
.save-options summary { cursor: pointer; color: var(--muted); }
.save-options[open] summary { margin-bottom: .5rem; }
.save-options .hint { margin: .5rem 0 0; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; width: 18rem; display: grid; gap: .75rem; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
@media (max-width: 560px) { .dropdown-panel { position: static; width: auto; margin-top: .5rem; } }

.editor-list { padding-left: 1.5rem; margin: 0 0 1rem; }
.editor-list li { padding: .5rem 0; border-bottom: 1px solid var(--border); display: list-item; }
.editor-list li > .muted { margin-left: .5rem; font-size: .875rem; }
.editor-list li > .inline-actions { float: right; gap: .25rem; }
.editor-list li > .inline-actions form { margin: 0; }
.block-card .block-type { font-size: .875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.editor-media { display: block; max-width: 100%; max-height: 22rem; border-radius: var(--radius-sm); background: #1f2928; }
.segmented { display: flex; flex-wrap: wrap; gap: .5rem; }
.segmented label { display: inline-flex; gap: .375rem; align-items: center; padding: .5rem .875rem; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; }
.segmented input { accent-color: var(--brand); }
.option-row { display: flex; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.option-row input[type=text] { flex: 1; }
textarea { width: 100%; font: inherit; color: inherit; padding: .75rem .875rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); resize: vertical; }

.rte { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); }
.rte:focus-within { outline: 3px solid var(--brand); outline-offset: 1px; }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .375rem; border-bottom: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.rte-btn { min-width: 2.25rem; height: 2.25rem; padding: 0 .5rem; border: 1px solid transparent; border-radius: 6px; background: none; font: inherit; color: var(--text); cursor: pointer; }
.rte-btn:hover { background: var(--surface); border-color: var(--border); }
.tool-bold { font-weight: 700; } .tool-italic { font-style: italic; }
.rte-area { min-height: 9rem; padding: .75rem 1rem; outline: none; }
.rte-area > :first-child { margin-top: 0; }

.swatches { display: flex; gap: .625rem; align-items: center; flex-wrap: wrap; }
.swatch { width: 2.75rem; height: 2.75rem; border-radius: var(--radius-sm); border: 2px solid transparent; cursor: pointer; }
.swatch[aria-pressed=true] { border-color: var(--text); box-shadow: inset 0 0 0 2px #fff; }
.swatch-115e59 { background: #115e59; } .swatch-1e4f91 { background: #1e4f91; } .swatch-6b2a5e { background: #6b2a5e; }
.swatch-9a3412 { background: #9a3412; } .swatch-1c2524 { background: #1c2524; }
.color-input input { width: 2.75rem; height: 2.75rem; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: none; cursor: pointer; }
.brand-preview { background: #f7f7f5; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.5rem; display: grid; gap: .75rem; }
.brand-preview .brand-mark { background: var(--brand); color: var(--brand-ink); }
.brand-preview .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.preview-title { font-size: 1.5rem; font-weight: 700; margin: .5rem 0 0; }
.preview-input { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .75rem .875rem; background: #fff; color: var(--muted); }
.logo-preview { max-height: 4rem; max-width: 100%; }

/* ---- Installer ---- */
.install { max-width: 44rem; margin: 0 auto; }
.install > * + *, .install form > * + * { margin-top: 1.5rem; }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.check-list li { display: flex; gap: .75rem; align-items: flex-start; }
.check-icon { font-weight: 700; width: 1.25rem; flex: none; }
.is-ok .check-icon { color: var(--ok-text); }
.is-fail .check-icon, .is-fail { color: var(--danger); }
.check-hint { display: block; }
.install-steps { display: grid; gap: .75rem; padding-left: 1.25rem; }
.color-field { width: 4rem; height: 2.75rem; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.install-submit { font-size: 1.0625rem; padding: 1rem; }
