/* Berichtsheft Online - handgeschriebenes CSS. Keine Animationen, keine Schatten, keine Web-Fonts. */

:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-alt: #f0f0f3;
  --border: #e3e3e8;
  --text: #16181d;
  --text-muted: #595e69;
  --ink: #16181d;
  --ink-content: #ffffff;
  --primary: #1f4bd8;
  --success: #17795a;
  --success-bg: #e5f3ed;
  --warning: #9a5b06;
  --warning-bg: #fbeed6;
  --danger: #b8322a;
  --danger-bg: #fbe8e6;
  --neutral: #595e69;
  --r-control: 8px;
  --r-panel: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1013;
    --surface: #16171b;
    --surface-alt: #1e2025;
    --border: #2a2c33;
    --text: #ececef;
    --text-muted: #a0a4ae;
    --ink: #ececef;
    --ink-content: #0f1013;
    --primary: #8aa5ff;
    --success: #4fd39a;
    --success-bg: #0f2f24;
    --warning: #f0b25a;
    --warning-bg: #35270d;
    --danger: #f2756a;
    --danger-bg: #381814;
    --neutral: #a0a4ae;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1013;
  --surface: #16171b;
  --surface-alt: #1e2025;
  --border: #2a2c33;
  --text: #ececef;
  --text-muted: #a0a4ae;
  --ink: #ececef;
  --ink-content: #0f1013;
  --primary: #8aa5ff;
  --success: #4fd39a;
  --success-bg: #0f2f24;
  --warning: #f0b25a;
  --warning-bg: #35270d;
  --danger: #f2756a;
  --danger-bg: #381814;
  --neutral: #a0a4ae;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Kopfzeile & Navigation ---------- */

.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.kopf-innen {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.marke { font-weight: 600; color: var(--text); text-decoration: none; flex-shrink: 0; }
.nav-desktop { display: none; flex: 1; align-items: center; gap: 0.25rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-control);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover { background: var(--surface-alt); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--surface-alt); color: var(--text); }

.menue { margin-left: auto; position: relative; }
.menue summary { list-style: none; cursor: pointer; }
.menue summary::-webkit-details-marker { display: none; }
.menue-liste {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: 16rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menue-liste .nav-link { padding: 0.6rem 0.75rem; }
.menue-fuss {
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  padding: 0.25rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
}
.tab {
  flex: 1;
  height: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}
.tab[aria-current="page"] { color: var(--primary); }

@media (min-width: 1024px) {
  .kopf-innen { padding: 0 2.5rem; gap: 2rem; }
  .nav-desktop { display: flex; }
  .menue, .tabs { display: none; }
  .theme-desktop { margin-left: auto; }
}
@media (max-width: 1023.98px) {
  .theme-desktop { display: none; }
}

/* ---------- Seite ---------- */

main { padding: 1.5rem 1rem 7rem; }
main.ohne-nav { padding-bottom: 2rem; }
.seite { max-width: 64rem; margin: 0 auto; }
.seite.schmal { max-width: 42rem; }
@media (min-width: 1024px) {
  main { padding: 2.5rem 2.5rem 3rem; }
}

.titel { margin-bottom: 1.5rem; }
.titel h1 { font-size: 1.5rem; font-weight: 600; line-height: 1.25; }
.titel p { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }

.abschnitt-titel { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.75rem; }
.abschnitt + .abschnitt { margin-top: 2rem; }

/* ---------- Bausteine ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  padding: 1.25rem;
}
@media (min-width: 768px) { .panel { padding: 1.5rem; } }
.panel.flach { padding: 0; overflow: hidden; }
.panel h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.panel .hinweis { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1rem; }
.panel h2.ohne-hinweis { margin-bottom: 1rem; }

.stapel { display: flex; flex-direction: column; gap: 1.5rem; }
.stapel-klein { display: flex; flex-direction: column; gap: 0.5rem; }
.zeile { display: flex; align-items: center; gap: 0.5rem; }
.umbruch { flex-wrap: wrap; }
.zwischen { justify-content: space-between; }
.wachse { flex: 1; min-width: 0; }
.nicht-schrumpfen { flex-shrink: 0; }

.gitter { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (min-width: 1024px) {
  .gitter.zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gitter.drei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .gitter.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.felder-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
@media (min-width: 640px) { .felder-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.muted { color: var(--text-muted); }
.klein { font-size: 0.875rem; }
.winzig { font-size: 0.75rem; }
.fett { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.fehler { color: var(--danger); }
.ok { color: var(--success); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--ink-content); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-alt); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); color: var(--text); }
.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-icon { padding: 0.5rem; min-width: 2.5rem; }
.btn-voll { width: 100%; }
.btn-klein { min-height: 2.25rem; padding: 0.25rem 0.75rem; }
.btn-aufnahme { background: var(--danger); color: #fff; }
svg.icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.btn svg.icon { width: 1rem; height: 1rem; }

/* ---------- Formulare ---------- */

.form-row { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1rem; }
.form-row.kompakt { margin-bottom: 0; }
.form-row > label, .form-row > .label { font-size: 0.875rem; font-weight: 500; }
.form-input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  font-size: 0.875rem;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
textarea.form-input { resize: vertical; }
.form-input.schmal { width: 8rem; }
.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; margin-bottom: 1rem; }
.check input { width: 1rem; height: 1rem; }
.status { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.5rem; min-height: 1.3em; }
.status.fehler { color: var(--danger); }

.aktionsleiste {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
@media (max-width: 1023.98px) {
  .aktionsleiste.klebrig {
    position: sticky;
    bottom: calc(3.5rem + env(safe-area-inset-bottom));
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding: 1rem 1.25rem 0.75rem;
    background: var(--surface);
  }
  .aktionsleiste.klebrig .btn-primary { flex: 1; }
}

/* ---------- Badges & Typ-Farben ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-betrieb { background: var(--success-bg); color: var(--success); }
.badge-berufsschule { background: var(--warning-bg); color: var(--warning); }
.badge-frei { background: var(--surface-alt); color: var(--neutral); }
.typ-betrieb { color: var(--success); }
.typ-berufsschule { color: var(--warning); }
.typ-frei { color: var(--neutral); }
.punkt { display: inline-block; width: 0.625rem; height: 0.625rem; border-radius: 50%; flex-shrink: 0; }
.bg-betrieb { background: var(--success); }
.bg-berufsschule { background: var(--warning); }
.bg-frei { background: var(--neutral); }
.bg-rand { background: var(--border); }
.bg-fehlt { background: var(--danger); }

/* ---------- Listen ---------- */

.liste { border: 1px solid var(--border); border-radius: var(--r-control); overflow: hidden; }
.liste > * + * { border-top: 1px solid var(--border); }
.liste-zeile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.875rem;
  background: var(--surface);
  font-size: 0.875rem;
  color: inherit;
  text-decoration: none;
}
a.liste-zeile:hover { background: var(--surface-alt); }

.kw-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.kw-gruppe + .kw-gruppe { margin-top: 1.5rem; }
.eintrag { display: flex; gap: 0.75rem; padding: 0.75rem 0; }
.eintrag + .eintrag { border-top: 1px solid var(--border); }
.eintrag-datum { width: 3.5rem; flex-shrink: 0; line-height: 1.25; }
.eintrag-datum .tag { font-size: 0.75rem; color: var(--text-muted); }
.eintrag-datum .kurz { font-size: 0.875rem; font-weight: 500; }
.eintrag-text { font-size: 0.875rem; }
.eintrag-text li + li { margin-top: 2px; }
.eintrag-meta { margin-top: 0.25rem; font-size: 0.75rem; color: var(--text-muted); }
.eintrag-aktionen { display: flex; flex-shrink: 0; align-items: flex-start; margin-right: -0.5rem; }
.leer { text-align: center; padding: 2.5rem 0; color: var(--text-muted); font-size: 0.875rem; }

.banner {
  background: var(--ink);
  color: var(--ink-content);
  border-radius: var(--r-control);
  padding: 0.625rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.banner button { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  padding: 0.25rem 0.375rem 0.25rem 0.75rem;
  font-size: 0.875rem;
}
.chip button { background: none; border: 0; padding: 2px; cursor: pointer; color: var(--text-muted); display: inline-flex; }
.chip button:hover { color: var(--danger); }
.chip .text { cursor: pointer; }

/* ---------- Fortschritt, Statistik ---------- */

.balken { height: 0.5rem; border-radius: 999px; background: var(--surface-alt); overflow: hidden; display: flex; }
.balken > span { display: block; height: 100%; }
.balken .fuell { background: var(--primary); }
.kacheln { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.kachel { background: var(--surface-alt); border-radius: var(--r-control); padding: 1rem; }
.kachel .label { font-size: 0.875rem; color: var(--text-muted); }
.kachel .wert { font-size: 1.5rem; font-weight: 600; }
.diagramm { display: flex; align-items: flex-end; gap: 0.75rem; height: 10rem; }
.diagramm-spalte { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.diagramm-balken { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 8rem; width: 100%; }
.diagramm-balken > span { width: 0.75rem; border-radius: 4px 4px 0 0; min-height: 1px; }
.legende { display: flex; flex-wrap: wrap; gap: 0.375rem 1rem; font-size: 0.875rem; color: var(--text-muted); }
.legende span { display: flex; align-items: center; gap: 0.375rem; }
.trenner { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

/* ---------- Kalender ---------- */

.kal-gitter { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.kal-kopf { text-align: center; font-size: 0.75rem; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.kal-tag {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: inherit;
  text-decoration: none;
  font-size: 0.875rem;
}
.kal-tag:hover { background: var(--surface-alt); }
.kal-tag.erledigt { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.kal-tag.fehlt { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.kal-tag.frei { background: var(--surface-alt); border-color: transparent; color: var(--text-muted); }
.kal-tag.heute { outline: 2px solid var(--ink); outline-offset: 2px; }
.kal-fuss { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; }
.kal-typ { display: none; font-size: 11px; line-height: 1; }
@media (min-width: 640px) {
  .kal-tag { aspect-ratio: 5 / 4; padding: 8px; }
  .kal-typ { display: block; }
  .kal-fuss .punkt { display: none; }
}
.kal-fuss svg.icon { width: 1rem; height: 1rem; margin-left: auto; }

/* ---------- Woche ---------- */

.woche-kopf { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border-bottom: 1px solid var(--border); }
.tag-karte { padding: 1rem; }
.tag-karte + .tag-karte { border-top: 1px solid var(--border); }
.tag-karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; font-weight: 500; }
.plan-gitter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
@media (min-width: 640px) { .plan-gitter { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.stunden-block { padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.stunden-block:last-of-type { border-bottom: 0; margin-bottom: 0.5rem; padding-bottom: 0; }

/* ---------- Anmeldung ---------- */

.login { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login > div { width: 100%; max-width: 24rem; }

/* ---------- Kleinteile ---------- */
.mb-3 { margin-bottom: 0.75rem; }
.voll { grid-column: 1 / -1; }
.felder-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 0.75rem; }
