/* =========================================================================================
   FCH Inside – Design-System
   Aufbau: 1. Schriften  2. Grundwerte  3. Grundlagen  4. Bausteine  5. Schmale Bildschirme
   Regeln: docs/design.md. Alle Bausteine in allen Zuständen: /intern/muster (nach Anmeldung).
   Seiten benutzen nur diese Bausteine und Grundwerte, keine eigenen Farben oder Abstände.
   ========================================================================================= */

/* 1. Schriften: Barlow (SIL Open Font License, siehe /schriften/OFL.txt), selbst ausgeliefert */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/schriften/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("/schriften/barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/schriften/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("/schriften/barlow-700.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("/schriften/barlow-condensed-600.woff2") format("woff2"); }

/* 2. Grundwerte ------------------------------------------------------------------------- */
:root {
  /* Farben mit Bedeutung (docs/design.md, Abschnitt 5) */
  --navy: #0e1b33;          /* Navigation, Karte "Als Nächstes" */
  --navy-2: #16274a;        /* aktiver Menüpunkt, Hover in der Navigation */
  --navy-text: #c9d1e0;     /* Schrift auf Navy */
  --navy-leise: #9aa6bd;
  --blau: #0b4fb3;          /* anklickbar; eigene Slots */
  --blau-dunkel: #083d8c;
  --blau-flaeche: #e8eef9;
  --rot: #c8102e;           /* nur Konflikt, Fehler, Gefahr; kleiner Markierungsstrich */
  --rot-flaeche: #fbeaec;
  --frei: #2f7d4f;          /* frei */
  --tinte: #14171c;         /* Schrift */
  --grau: #5b6270;          /* Nebenschrift */
  --linie: #e3e6eb;
  --flaeche: #eef0f3;       /* belegt von anderen */
  --papier: #f6f5f2;        /* Seitengrund */
  --weiss: #ffffff;

  /* Abstände: nur diese */
  --a-1: 4px; --a-2: 8px; --a-3: 12px; --a-4: 16px; --a-5: 24px; --a-6: 32px; --a-7: 48px;

  /* Schrift */
  --schrift: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --schrift-zahl: "Barlow Condensed", var(--schrift);
  --s-klein: 14px; --s-text: 16px; --s-titel: 19px; --s-seite: 30px; --s-zeit: 44px;

  --r: 6px; --r-karte: 10px;
  --tippflaeche: 44px;
  --nav-breite: 232px;
}

/* 3. Grundlagen ------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0; background: var(--papier); color: var(--tinte);
  font: 400 var(--s-text)/1.5 var(--schrift);
  font-variant-numeric: tabular-nums lining-nums;
}
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--blau); font-weight: 600; }
:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; }
.leise { color: var(--grau); }
.klein { font-size: var(--s-klein); }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 4. Bausteine -------------------------------------------------------------------------- */

/* Rahmen: Navigation links, Inhalt rechts */
.app { display: grid; grid-template-columns: var(--nav-breite) minmax(0, 1fr); min-height: 100vh; }

/* Navigation */
.nav { background: var(--navy); color: var(--weiss); display: flex; flex-direction: column; padding: var(--a-5) var(--a-4); position: sticky; top: 0; height: 100vh; }
.nav__marke { display: flex; align-items: center; gap: var(--a-3); padding: 0 var(--a-2) var(--a-6); color: var(--weiss); text-decoration: none; }
.nav__marke img { width: 40px; height: 40px; }
.nav__marke b { display: block; font-weight: 700; font-size: 17px; line-height: 1.1; }
.nav__marke > span > span { display: block; font-size: 12px; color: var(--navy-leise); font-weight: 400; }
.nav__punkt {
  display: flex; align-items: center; gap: var(--a-3); position: relative;
  color: var(--navy-text); text-decoration: none; font-weight: 500;
  padding: 10px var(--a-3); border-radius: var(--r);
}
.nav__punkt svg { width: 18px; height: 18px; flex: none; }
.nav__punkt:hover { background: var(--navy-2); color: var(--weiss); }
.nav__punkt[aria-current="page"] { background: var(--navy-2); color: var(--weiss); font-weight: 600; }
.nav__punkt[aria-current="page"]::before { content: ""; position: absolute; left: calc(-1 * var(--a-4)); top: 8px; bottom: 8px; width: 3px; background: var(--rot); border-radius: 0 2px 2px 0; }
.nav__zahl { margin-left: auto; background: var(--rot); color: var(--weiss); font-size: 11px; font-weight: 700; border-radius: 9px; padding: 0 6px; line-height: 18px; }
.nav__person { margin-top: auto; border-top: 1px solid #24365c; padding: var(--a-4) var(--a-2) 0; display: grid; grid-template-columns: auto 1fr; gap: var(--a-1) var(--a-3); align-items: center; font-size: var(--s-klein); color: var(--navy-text); }
.nav__person small { display: block; color: var(--navy-leise); }
.nav__abmelden { grid-column: 1 / -1; justify-self: start; margin-top: var(--a-2); background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--navy-text); cursor: pointer; text-decoration: underline; }
.nav__abmelden:hover { color: var(--weiss); }
.symbol { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kreis { width: 32px; height: 32px; border-radius: 50%; background: #2a3d66; color: var(--weiss); display: grid; place-items: center; font-weight: 600; font-size: var(--s-klein); }

/* Kopf und Leiste nur auf dem Handy */
.mobilkopf, .mobilnav { display: none; }

/* Inhalt */
.inhalt { padding: var(--a-6) 40px var(--a-7); max-width: 1240px; }
.seitenkopf { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--a-4) var(--a-5); padding-bottom: 20px; border-bottom: 1px solid var(--linie); margin-bottom: 28px; }
.seitenkopf__ueber { font-size: var(--s-klein); color: var(--grau); font-weight: 500; }
.seitenkopf h1 { margin-top: 2px; font-size: var(--s-seite); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.seitenkopf__rechts { margin-left: auto; display: flex; gap: var(--a-1); }

.zweispaltig { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.abschnitt + .abschnitt, .inhalt > .abschnitt, .inhalt > .zweispaltig { margin-top: 28px; }
.inhalt > .seitenkopf + * { margin-top: 0; }
.abschnitt__titel { font-size: var(--s-klein); font-weight: 600; color: var(--grau); text-transform: uppercase; letter-spacing: .08em; margin-bottom: var(--a-3); }

/* Karte */
.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--r-karte); padding: 18px 20px; }
.karte--ohne-rand { padding: 0; }

/* Als Nächstes */
.naechstes { background: var(--navy); color: var(--weiss); border-radius: var(--r-karte); padding: 22px var(--a-5); display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; position: relative; overflow: hidden; }
.naechstes::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(var(--blau) 50%, var(--rot) 50%); }
.naechstes__wann { font-size: var(--s-klein); color: var(--navy-leise); font-weight: 500; margin-bottom: 6px; }
.naechstes__zeit { font: 600 var(--s-zeit)/1 var(--schrift-zahl); letter-spacing: .01em; }
.naechstes__was { font-size: var(--s-titel); font-weight: 600; }
.naechstes__wo { color: var(--navy-text); }

/* Agenda: Tage mit Einträgen */
.agenda { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--r-karte); }
.agenda__tag { display: grid; grid-template-columns: 120px minmax(0, 1fr); border-top: 1px solid var(--linie); }
.agenda__tag:first-child { border-top: 0; }
.agenda__datum { padding: var(--a-3) 0 var(--a-3) 20px; white-space: nowrap; color: var(--grau); }
.agenda__datum b { color: var(--tinte); font-weight: 600; margin-right: 6px; }
.agenda__tag--heute .agenda__datum b { color: var(--blau); }
.agenda__eintraege { padding: var(--a-2) 20px var(--a-2) 0; }
.eintrag { display: grid; grid-template-columns: 108px minmax(0, 1fr) auto; gap: var(--a-4); align-items: baseline; padding: 6px 0; }
.eintrag__zeit { font-weight: 500; }
.eintrag__was b { font-weight: 600; }
.eintrag__was span { color: var(--grau); }
.eintrag__hinweis { grid-column: 2 / -1; font-size: 14px; color: var(--rot); }
.eintrag__hinweis a { color: var(--rot); }
.eintrag--konflikt .eintrag__zeit, .eintrag--konflikt .eintrag__was b { text-decoration: line-through; text-decoration-color: var(--rot); text-decoration-thickness: 1.5px; }
.agenda__leer { color: var(--grau); padding: 6px 0; }

/* Etikett: ein Wort statt Symbol */
.etikett { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px var(--a-2); border-radius: 4px; white-space: nowrap; background: var(--flaeche); color: var(--grau); }
.etikett--konflikt { background: var(--rot-flaeche); color: var(--rot); }
.etikett--blau { background: var(--blau-flaeche); color: var(--blau); }
.etikett--frei { background: #e6f2ea; color: var(--frei); }

/* Aufgaben ("Zu erledigen") */
.aufgabe { display: grid; gap: var(--a-1); padding: var(--a-3) 0; border-top: 1px solid var(--linie); }
.aufgabe:first-child { border-top: 0; padding-top: 0; }
.aufgabe:last-child { padding-bottom: 0; }
.aufgabe__titel { font-weight: 600; }
.aufgabe__titel::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blau); margin-right: var(--a-2); vertical-align: 1px; }
.aufgabe--konflikt .aufgabe__titel::before { background: var(--rot); }
.aufgabe p { color: var(--grau); font-size: 14px; }
.aufgabe .knopf { justify-self: start; margin-top: var(--a-2); }

/* Mannschaft mit Wochenleiste */
.mannschaft { padding: 14px 0; border-top: 1px solid var(--linie); }
.mannschaft:first-child { border-top: 0; padding-top: 0; }
.mannschaft:last-child { padding-bottom: 0; }
.mannschaft__kopf { display: flex; justify-content: space-between; align-items: baseline; }
.mannschaft__kopf b { font: 600 20px var(--schrift-zahl); letter-spacing: .02em; }
.mannschaft__kopf span { font-size: var(--s-klein); color: var(--grau); }
.wochenleiste { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--a-1); margin: 10px 0; }
.wochenleiste span { font-size: 11px; color: var(--grau); text-align: center; padding-top: var(--a-2); border-top: 3px solid var(--linie); }
.wochenleiste .an { border-color: var(--blau); color: var(--tinte); font-weight: 600; }
.wochenleiste .konflikt { border-color: var(--rot); color: var(--rot); font-weight: 600; }

/* Belegungsplan einer Halle */
.belegung { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--r-karte); overflow: hidden; display: grid; grid-template-columns: 64px repeat(6, minmax(0, 1fr)); }
.belegung > div { border-left: 1px solid var(--linie); border-top: 1px solid var(--linie); min-height: 44px; padding: var(--a-1); }
.belegung__tag { font-size: var(--s-klein); font-weight: 600; padding: 10px var(--a-2) !important; min-height: 0 !important; border-top: 0 !important; }
.belegung__tag span { display: block; font-weight: 400; color: var(--grau); }
.belegung__uhr { border-left: 0 !important; font-size: 12px; color: var(--grau); padding: 6px 10px !important; }
.slot { height: 100%; border-radius: 4px; padding: var(--a-1) var(--a-2); font-size: 12px; line-height: 1.3; }
.slot b { display: block; font-weight: 600; }
.slot--deins { background: var(--blau); color: var(--weiss); }
.slot--andere { background: var(--flaeche); color: var(--grau); }
.slot--frei { border: 1px dashed var(--frei); color: var(--frei); background: var(--weiss); }
.slot--konflikt { background: var(--rot-flaeche); color: var(--rot); box-shadow: inset 3px 0 0 var(--rot); }

/* Knöpfe: höchstens ein Hauptknopf je Ansicht */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: var(--a-2); min-height: 38px; padding: 0 var(--a-4); border-radius: var(--r); border: 1px solid transparent; font: 600 14px var(--schrift); text-decoration: none; cursor: pointer; }
.knopf--haupt { background: var(--blau); color: var(--weiss); }
.knopf--haupt:hover { background: var(--blau-dunkel); }
.knopf--neben { background: var(--weiss); color: var(--tinte); border-color: var(--linie); }
.knopf--neben:hover { border-color: var(--grau); }
.knopf--hell { background: var(--weiss); color: var(--navy); }
.knopf--gefahr { background: var(--weiss); color: var(--rot); border-color: var(--linie); }
.knopf--gefahr:hover { border-color: var(--rot); }
.knopf:disabled { opacity: .6; cursor: wait; }

/* Hinweis und Meldung */
.hinweis { display: flex; flex-wrap: wrap; gap: var(--a-1) var(--a-3); align-items: baseline; padding: var(--a-3) var(--a-4); border-radius: var(--r); background: var(--flaeche); }
.hinweis__titel { font-weight: 600; }
.hinweis--konflikt { background: var(--rot-flaeche); color: var(--rot); }
.hinweis--erfolg { background: #e6f2ea; color: var(--frei); }
.meldung:empty { display: none; }
.meldung { padding: 10px var(--a-3); border-radius: var(--r); background: var(--blau-flaeche); }
.meldung.fehler { background: var(--rot-flaeche); color: var(--rot); }

/* Formular */
.formular { display: grid; gap: var(--a-4); }
.formular--zeile { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; }
.feld { display: grid; gap: 6px; }
.feld__name { font-size: var(--s-klein); font-weight: 600; }
.feld input, .feld select, .tabelle select {
  font: inherit; color: var(--tinte); min-height: 40px; padding: 0 var(--a-3);
  border: 1px solid var(--linie); border-radius: var(--r); background: var(--weiss);
}
.feld input:focus, .feld select:focus, .tabelle select:focus { outline: 2px solid var(--blau); outline-offset: -1px; border-color: transparent; }
.feld__hilfe { font-size: var(--s-klein); color: var(--grau); }
.feld--fehler input, .feld--fehler select { border-color: var(--rot); }
.feld--fehler .feld__hilfe { color: var(--rot); }
.feld--code input { font: 600 24px var(--schrift-zahl); letter-spacing: .3em; max-width: 220px; }

/* Tabelle */
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th { text-align: left; font-size: var(--s-klein); font-weight: 600; color: var(--grau); padding: var(--a-3) var(--a-4); border-bottom: 1px solid var(--linie); }
.tabelle td { padding: var(--a-3) var(--a-4); border-bottom: 1px solid var(--linie); vertical-align: middle; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle td:last-child { text-align: right; }

/* Leerer Zustand */
.leer { padding: var(--a-6) var(--a-5); }
.leer__titel { font-weight: 600; font-size: var(--s-titel); margin-bottom: var(--a-1); }
.leer p { color: var(--grau); max-width: 52ch; }
.leer .leer__titel { color: var(--tinte); }

/* Anmeldung (ohne Navigation) */
.anmeldeseite { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.anmeldeseite__marke { background: var(--navy); color: var(--weiss); padding: 40px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.anmeldeseite__marke::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(var(--blau) 50%, var(--rot) 50%); }
.anmeldeseite__marke .nav__marke { padding: 0; }
.anmeldeseite__marke p { margin-top: auto; color: var(--navy-text); max-width: 34ch; }
.anmeldeseite__inhalt { padding: 40px; display: flex; flex-direction: column; justify-content: center; }
.anmeldeseite__box { width: 100%; max-width: 400px; }
.anmeldeseite h1 { font-size: 26px; font-weight: 700; margin-bottom: var(--a-2); }
.anmeldeseite__box > p { color: var(--grau); margin-bottom: var(--a-5); }

/* 5. Schmale Bildschirme ---------------------------------------------------------------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .nav { display: none; }
  .mobilkopf { display: flex; align-items: center; gap: 10px; background: var(--navy); color: var(--weiss); padding: var(--a-3) var(--a-4); }
  .mobilkopf img { width: 32px; height: 32px; }
  .mobilkopf b { font-weight: 700; }
  .mobilkopf .nav__abmelden { margin: 0 0 0 auto; }
  .mobilnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: sticky; bottom: 0; background: var(--weiss); border-top: 1px solid var(--linie); z-index: 5; }
  .mobilnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; justify-content: center; font-size: 11px; color: var(--grau); text-decoration: none; font-weight: 500; }
  .mobilnav a svg { width: 22px; height: 22px; }
  .mobilnav .nav__punkt { padding: 0; border-radius: 0; gap: 2px; color: var(--grau); }
  .mobilnav .nav__punkt:hover { background: none; color: var(--tinte); }
  .mobilnav .nav__punkt[aria-current="page"] { background: none; color: var(--blau); font-weight: 600; }
  .mobilnav .nav__punkt[aria-current="page"]::before { left: 25%; right: 25%; top: 0; bottom: auto; width: auto; height: 3px; background: var(--blau); border-radius: 0 0 2px 2px; }
  .inhalt { padding: 20px var(--a-4) var(--a-6); }
  .seitenkopf h1 { font-size: 24px; }
  .seitenkopf__rechts { margin-left: 0; }
  .zweispaltig { grid-template-columns: 1fr; gap: 28px; }
  .naechstes { grid-template-columns: 1fr; gap: var(--a-3); }
  .agenda__tag { grid-template-columns: 96px minmax(0, 1fr); }
  .agenda__datum { padding-left: 14px; }
  .eintrag { grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; }
  .eintrag__zeit { grid-column: 1 / -1; font-size: var(--s-klein); color: var(--grau); }
  .eintrag__hinweis { grid-column: 1 / -1; }
  .belegung-rahmen { overflow-x: auto; }
  .belegung { min-width: 640px; }
  .formular--zeile { grid-template-columns: 1fr; }
  .tabelle thead { display: none; }
  .tabelle, .tabelle tbody, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle tr { padding: var(--a-3) var(--a-4); border-bottom: 1px solid var(--linie); }
  .tabelle tr:last-child { border-bottom: 0; }
  .tabelle td { border: 0; padding: 2px 0; text-align: left !important; }
  .tabelle td:last-child { padding-top: var(--a-2); }
  .anmeldeseite { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .anmeldeseite__marke { padding: var(--a-4); }
  .anmeldeseite__marke::after { top: auto; left: 0; width: auto; height: 4px; background: linear-gradient(90deg, var(--blau) 50%, var(--rot) 50%); }
  .anmeldeseite__marke p { display: none; }
  .anmeldeseite__inhalt { padding: var(--a-6) var(--a-4); justify-content: flex-start; }
}
.formular + .feld__hilfe { margin-top: var(--a-3); }
