/* ELFIS24-CI (Farben und Klassen aus ELFIS2024/frontend/templates/index.html), auf Touch vergroessert. */
:root {
  --red: #E5342B; --red2: #C92E26; --red-bg: #FCE4E2;
  --bg: #EDF0F3; --white: #fff; --card: #fff;
  --border: #D7DCE3; --border2: #E6E9ED;
  --text: #11151C; --muted: #5B6573;
  --row-hover: #F6F7F9;
  --sidebar: #16181E; --s-text: #9AA3B2;
  --green: #16A34A; --green-bg: #DCFCE7; --green-text: #15803D;
  --amber: #D97706; --amber-bg: #FCEFC7; --amber-text: #B45309;
  --blue: #1D4ED8; --blue-bg: #DBE8FE; --blue-text: #1D4ED8;
  --gray-bg: #ECEEF1; --gray-text: #5B6573;
  --radius: 6px;
  --sh: 0 1px 3px rgba(16,21,28,.06), 0 1px 2px rgba(16,21,28,.04);
  --sh2: 0 16px 48px rgba(16,21,28,.22);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216; --white: #1B1E25; --card: #1B1E25;
    --border: #333844; --border2: #2A2E38;
    --text: #E9ECF1; --muted: #A0A8B6;
    --row-hover: #242832;
    --red-bg: #3D1B19; --red2: #FF6B63;
    --green-bg: #12331F; --green-text: #5FD58B;
    --amber-bg: #3A2C0E; --amber-text: #F0B654;
    --blue-bg: #17264A; --blue-text: #8DB2FF;
    --gray-bg: #2A2E38; --gray-text: #B4BBC8;
    --sh: 0 1px 2px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', 'Segoe UI', Roboto, -apple-system, system-ui, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg);
  overflow: hidden; overscroll-behavior: none;
  touch-action: manipulation;
}
a { color: var(--red2); }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 22px 0 8px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.unterzeile { color: var(--muted); margin: 0 0 16px; }
.klein { font-size: 13px; color: var(--muted); }
.versteckt { display: none !important; }

/* ------------------------------------------------------------------ Geruest */
.app { display: flex; height: 100dvh; }
.seite {
  width: 216px; flex: none; background: var(--sidebar); color: var(--s-text);
  padding: calc(10px + env(safe-area-inset-top)) 10px 10px calc(10px + env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 6px; overflow-y: auto;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 6px 8px 14px; }
.logo-icon { width: 34px; height: 34px; background: var(--red); border-radius: 7px; display: grid; place-items: center; font-weight: 700; flex: none; }
.logo-text { font-weight: 700; line-height: 1.1; }
.logo-text small { display: block; font-weight: 400; color: var(--s-text); font-size: 12px; margin-top: 2px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
.ni {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 10px; border-radius: 7px;
  color: var(--s-text); text-decoration: none; font-size: 15px;
}
.ni:hover { background: rgba(255,255,255,.06); color: #fff; }
.ni.active { background: var(--red); color: #fff; font-weight: 600; }
.ni .symbol { width: 22px; text-align: center; flex: none; }
.ni .zahl { margin-left: auto; background: #fff; color: var(--red2); border-radius: 20px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.haupt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kopf {
  display: flex; align-items: center; gap: 10px; flex: none; background: var(--white); border-bottom: 1px solid var(--border);
  padding: calc(6px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 6px 10px;
}
.kopf-knopf { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text); display: grid; place-items: center; cursor: pointer; flex: none; }
.kopf-titel { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-konto { text-decoration: none; color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; }
.content {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 18px calc(20px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) 20px;
}
.schmal { max-width: 860px; margin: 0 auto; }

/* Hochformat: Menue als Leiste unten, Daumen erreichen es besser. */
@media (max-width: 820px) {
  .app { flex-direction: column-reverse; }
  .seite { width: 100%; flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); overflow-x: auto; }
  .logo { display: none; }
  #nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .ni { flex-direction: column; gap: 0; min-height: 52px; min-width: 62px; font-size: 11px; justify-content: center; padding: 4px; position: relative; }
  .ni .zahl { position: absolute; top: 2px; right: 8px; margin: 0; }
  .haupt { min-height: 0; }
  .content { padding-left: 16px; padding-right: 16px; }
}

/* --------------------------------------------------------------- Bausteine */
.karte { background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--sh); padding: 16px; margin-bottom: 12px; }
.gitter { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: stretch; }
.gitter .karte { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.gitter .karte .knopfreihe { margin-top: auto; padding-top: 6px; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.leiste { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.btn {
  min-height: 44px; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--border); background: var(--white);
  cursor: pointer; font: inherit; font-size: 15px; color: var(--text); text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--row-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-p { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
.btn-p:hover { background: #C92E26; }
.btn-d { color: var(--red2); border-color: var(--red2); margin-right: auto; }
.btn-s { min-height: 38px; padding: 5px 11px; font-size: 14px; }
.btn:focus-visible, .fc:focus-visible, a:focus-visible { outline: 3px solid rgba(229,52,43,.45); outline-offset: 1px; }

.b { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 20px; font-weight: 500; white-space: nowrap; }
.bg { background: var(--green-bg); color: var(--green-text); }
.br { background: var(--red-bg); color: var(--red2); }
.ba { background: var(--amber-bg); color: var(--amber-text); }
.bb { background: var(--blue-bg); color: var(--blue-text); }
.bx { background: var(--gray-bg); color: var(--gray-text); }

.fg { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.fl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.fc {
  min-height: 44px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 16px;
  background: var(--white); color: var(--text); width: 100%;
}
textarea.fc { min-height: 84px; resize: vertical; }
.fc:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(229,52,43,.14); }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 13px; }
@media (max-width: 620px) { .g2 { grid-template-columns: 1fr; } }
/* Haken und Text stehen immer in einer Zeile. */
.haken { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; cursor: pointer; }
.haken input { width: 24px; height: 24px; flex: none; accent-color: var(--red); margin: 0; }

.hinweis { border-left: 4px solid var(--amber); background: var(--amber-bg); color: var(--text); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 10px 0; }
.hinweis.fehler { border-color: var(--red); background: var(--red-bg); }
.hinweis.gut { border-color: var(--green); background: var(--green-bg); }
.hinweis.info { border-color: var(--blue); background: var(--blue-bg); }

.ptabs { display: flex; gap: 3px; border-bottom: 3px solid var(--red); margin-bottom: 14px; overflow-x: auto; }
.ptabs button { min-height: 44px; padding: 8px 14px; background: var(--white); border: 1px solid var(--border); border-bottom: none; border-radius: 7px 7px 0 0; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ptabs button.active { background: var(--red); color: #fff; border-color: var(--red); }

/* ------------------------------------------------------- Modal (.mo > .md) */
.mo { position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 12px; }
.md { background: var(--white); border-radius: 11px; width: min(620px, 96vw); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; box-shadow: var(--sh2); overflow: hidden; }
.md.breit { width: min(860px, 96vw); }
.md-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; font-weight: 700; font-size: 16px; }
.md-x { width: 44px; height: 44px; border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); margin: -8px -8px -8px 0; }
.md-body { padding: 17px; flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.md-foot { padding: 11px 17px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex: none; flex-wrap: wrap; }

#benachrichtigungen { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 2000; display: grid; gap: 6px; width: min(520px, 92vw); pointer-events: none; }
.notiz { padding: 11px 15px; border-radius: 9px; box-shadow: var(--sh2); background: var(--white); border-left: 4px solid var(--blue); }
.notiz.s { border-color: var(--green); } .notiz.e { border-color: var(--red); } .notiz.w { border-color: var(--amber); }

/* ------------------------------------------------------- Listen (DataTable-Art) */
.tw { overflow: visible; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--border2); vertical-align: top; }
/* Kopfzeile bleibt stehen, nur die Zeilen scrollen. Braucht einen deckenden Hintergrund. */
.content thead th { position: sticky; top: -18px; z-index: 3; background: var(--white); font-size: 13px; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; user-select: none; }
.content thead tr.filter th { top: 24px; z-index: 2; cursor: default; padding: 4px 6px 8px; border-bottom: 1px solid var(--border); }
.filter .fc { min-height: 36px; padding: 5px 8px; font-size: 14px; }
.tw tbody tr { cursor: pointer; }
.tw tbody tr:hover { background: var(--row-hover); }
.tw tbody tr.ausgewaehlt { background: var(--red-bg); }
.tw tbody tr:last-child td { border-bottom: none; }
th.oben::after { content: " ▲"; } th.unten::after { content: " ▼"; }
.tw-fuss { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 11px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
@media (max-width: 820px) { .tw { overflow-x: auto; } }

/* ------------------------------------------------------------- Lernen, Pruefung */
.fortschritt { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.balken { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.balken > div { height: 100%; background: var(--red); transition: width .2s; }
.frage-text { font-size: 19px; font-weight: 600; margin: 4px 0 14px; }
.antworten { display: grid; gap: 9px; }
.antwort { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--border); border-radius: 10px; padding: 13px 14px; cursor: pointer; background: var(--card); min-height: 56px; font-size: 16px; }
.antwort input { width: 24px; height: 24px; flex: none; accent-color: var(--red); margin: 0; }
.antwort.gewaehlt { border-color: var(--red); background: var(--red-bg); }
.antwort.richtig { border-color: var(--green); background: var(--green-bg); }
.antwort.falsch { border-color: var(--red); background: var(--red-bg); }
.antwort.gesperrt { cursor: default; }
.uhr { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
.uhr.knapp { color: var(--red2); }
.sprung { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.sprung button { width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--border); background: var(--white); color: var(--text); font: inherit; cursor: pointer; }
.sprung button.beantwortet { background: var(--gray-bg); font-weight: 700; }
.sprung button.aktuell { border: 2px solid var(--red); }
.zahlen { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.zahl { flex: 1 1 120px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--card); }
.zahl b { display: block; font-size: 26px; line-height: 1.1; }
.zahl span { font-size: 13px; color: var(--muted); }
.ergebnis { font-size: 22px; font-weight: 700; }
.ergebnis.gut { color: var(--green-text); } .ergebnis.schlecht { color: var(--red2); }

/* ------------------------------------------------------------------ Abnahme */
.stand-leiste { position: sticky; top: -18px; z-index: 4; background: var(--bg); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.punkt { background: var(--card); border: 1px solid var(--border); border-left: 5px solid var(--border); border-radius: 8px; padding: 11px 13px; margin-bottom: 8px; }
.punkt.io { border-left-color: var(--green); } .punkt.wdh { border-left-color: var(--amber); }
.punkt.nio { border-left-color: var(--red); } .punkt.entfaellt { border-left-color: var(--gray-text); }
.punkt-kopf { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 9px; }
.punkt-nr { font-weight: 700; color: var(--muted); min-width: 22px; flex: none; }
.s-merker { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; flex: none; margin-top: 2px; }
.wahl { display: flex; flex-wrap: wrap; gap: 6px; }
.wahl button { flex: 1 1 88px; min-height: 46px; border: 2px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.wahl button.io.aktiv { background: var(--green); border-color: var(--green); color: #fff; }
.wahl button.wdh.aktiv { background: var(--amber); border-color: var(--amber); color: #fff; }
.wahl button.nio.aktiv { background: var(--red); border-color: var(--red); color: #fff; }
.wahl button.entfaellt.aktiv { background: var(--gray-text); border-color: var(--gray-text); color: #fff; }
.wahl button:disabled { cursor: default; }
.bem { margin-top: 8px; }
.bem textarea { min-height: 60px; }
details.karte > summary { cursor: pointer; font-weight: 600; min-height: 28px; }
.unterschriften { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.unterschrift canvas { display: block; width: 100%; height: 150px; border: 2px dashed var(--border); border-radius: 8px; background: #fff; touch-action: none; }
.unterschrift img { max-width: 100%; height: 110px; background: #fff; border-radius: 8px; border: 1px solid var(--border); }

.schritt { display: flex; gap: 14px; }
.schritt-nr { width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.regel { padding: 9px 0; border-bottom: 1px solid var(--border2); }
.regel:last-child { border-bottom: none; }
.anmeldung { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.anmeldung .karte { width: min(420px, 100%); }
pre.eingabe { white-space: pre-wrap; }

.warum { font-size: 14px; color: var(--muted, inherit); margin: -4px 2px 2px 14px; }
.quellenverweis { margin: 10px 0; }
.quellenverweis > summary { cursor: pointer; font-weight: 600; min-height: 28px; }
.quellenverweis blockquote { margin: 6px 0; padding: 8px 12px; border-left: 4px solid var(--border); background: var(--card); white-space: pre-line; }
.quellenverweis .btn { margin-top: 8px; }
.quellenverweis ul { margin: 10px 0 0; padding-left: 20px; font-size: 14px; }
