/* Handy-Schalter · ALMAS-Webdesign-System v2 (hell, roter Bär, mobil-first) */
:root {
  --rot: #FF2325; --rot-text: #D81020; --rot-hell: #fff1f1; --rot-rand: #ffd2d3;
  --text: #1c1c1e; --text-2: #5b5d63; --text-3: #686b72;
  --flaeche: #ffffff; --grund: #f6f6f8; --linie: #e8e8ec;
  --gruen: #12804a; --gruen-hell: #e9f7ef; --gelb: #8a5a00; --gelb-hell: #fff6e0; --blau: #1d5bd6; --blau-hell: #eaf1ff; --grau-hell: #f0f0f3;
  --radius: 16px; --radius-k: 10px;
  --schatten: 0 1px 2px rgba(20,20,30,.04), 0 4px 12px rgba(20,20,30,.05), 0 12px 32px rgba(20,20,30,.04);
  --schatten-hoch: 0 2px 4px rgba(20,20,30,.06), 0 10px 24px rgba(20,20,30,.08), 0 24px 56px rgba(20,20,30,.08);
  --schrift: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --unten-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--schrift); color: var(--text); background: var(--grund); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sprung { position: absolute; left: -999px; top: 8px; background: var(--flaeche); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.sprung:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--rot-rand); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- Rahmen ---------- */
.rahmen { min-height: 100dvh; display: block; }
.seitenleiste { display: none; }
main { min-width: 0; padding: 12px 16px calc(var(--unten-h) + 96px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; outline: none; }
.kopf { display: flex; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 0 12px; min-width: 0; }
.kopftext { min-width: 0; flex: 1; }
.kopf h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.unterzeile { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.kopfbaer { border-radius: 8px; }

/* ---------- Karten ---------- */
.karten { display: grid; gap: 12px; min-width: 0; }
.karte { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px; min-width: 0; margin-bottom: 12px; }
.karte h2 { font-size: 17px; margin: 0 0 6px; }
.aktion { cursor: default; display: grid; gap: 10px; animation: rein .28s ease both; }
.aktion-kopf { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.aktion-titel { min-width: 0; flex: 1; }
.aktion-kopf h3 { font-size: 17px; margin: 0; line-height: 1.3; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.art { font-size: 12px; color: var(--text-2); text-transform: none; margin: 0; }
.abschnitt { background: var(--grund); border-radius: var(--radius-k); padding: 10px 12px; min-width: 0; }
.abschnitt h4 { margin: 0 0 4px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.abschnitt p { margin: 0; overflow-wrap: anywhere; }
.abschnitt.leitstand { background: var(--blau-hell); }
.mehr { margin-top: 6px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--blau); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.abschnitt.warnung { background: var(--gelb-hell); color: var(--gelb); box-shadow: inset 0 0 0 1.5px #f0d38a; font-weight: 600; }
.abschnitt.warnung h4 { color: var(--gelb); }
.pruefzeile { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; }
.pruefzeile .pruefcode { font-size: 18px; font-weight: 700; color: var(--text); padding: 4px 10px; }
.kartenmeldung { margin: 0; padding: 10px 12px; border-radius: var(--radius-k); background: var(--rot-hell); color: var(--rot-text); font-weight: 600; overflow-wrap: anywhere; }
.knopf.leise.bestaetigen { background: var(--rot-hell); color: var(--rot-text); box-shadow: inset 0 0 0 1.5px var(--rot-rand); }
.blatt .aktion-kopf h3 { display: none; }
.blatt.zurueck { transition: transform .2s ease; }
.fingerabdruck code { font-family: var(--mono); font-weight: 700; }
.pruefcode { font-family: var(--mono); font-size: 15px; letter-spacing: .06em; background: var(--grau-hell); padding: 2px 8px; border-radius: 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--text-2); font-size: 13px; }
.aktionsknoepfe { display: flex; gap: 10px; flex-wrap: wrap; }
.aktionsknoepfe .knopf { flex: 1 1 140px; }
pre.befehle, pre.ausgabe { font-family: var(--mono); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; background: #15161a; color: #f3f3f5; padding: 12px; border-radius: var(--radius-k); margin: 6px 0 0; max-height: 320px; overflow: auto; }
pre.ausgabe { background: var(--grau-hell); color: var(--text); }
.leer { text-align: center; color: var(--text-2); padding: 40px 16px; }
.leer img { opacity: .9; margin-bottom: 8px; }
.skelett { height: 160px; border-radius: var(--radius); background: linear-gradient(90deg, #ececf0 0%, #f6f6f9 50%, #ececf0 100%); background-size: 200% 100%; animation: glanz 1.2s linear infinite; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--grau-hell); color: var(--text-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.rot { background: var(--rot-hell); color: var(--rot-text); }
.badge.gruen { background: var(--gruen-hell); color: var(--gruen); }
.badge.gelb { background: var(--gelb-hell); color: var(--gelb); }
.badge.blau { background: var(--blau-hell); color: var(--blau); }
.umgebung { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--gelb); background: var(--gelb-hell); padding: 1px 6px; border-radius: 6px; vertical-align: 1px; }

/* ---------- Knöpfe ---------- */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 12px; border: 0; cursor: pointer; font-weight: 600; text-decoration: none; background: var(--rot-text); color: #fff; box-shadow: 0 1px 2px rgba(216,16,32,.25), 0 6px 16px rgba(216,16,32,.18); transition: transform .12s ease, box-shadow .2s ease, background .2s ease; }
.knopf:hover { background: #c20d1c; }
.knopf:active { transform: scale(.98); }
.knopf[disabled] { opacity: .55; cursor: not-allowed; }
.knopf.zweit { background: var(--flaeche); color: var(--rot-text); box-shadow: inset 0 0 0 1.5px var(--rot-rand); }
.knopf.zweit:hover { background: var(--rot-hell); }
.knopf.leise { background: var(--grau-hell); color: var(--text); box-shadow: none; }
.knopf.gefahr { background: var(--rot-text); }

/* ---------- Schalter ---------- */
.schalter { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.schalter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.spur { width: 52px; height: 32px; border-radius: 999px; background: #d9d9de; position: relative; transition: background .2s ease; flex: none; }
.spur::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s ease; }
.schalter input:checked + .spur { background: var(--rot); }
.schalter input:checked + .spur::after { transform: translateX(20px); }
.schalter input:focus-visible + .spur { outline: 3px solid var(--rot-rand); outline-offset: 2px; }

.hilfe { color: var(--text-2); margin: 0 0 12px; }
.hilfe.klein { font-size: 13px; margin-top: 8px; }
.schluessel { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.schluessel li { background: var(--grund); border-radius: var(--radius-k); padding: 10px 12px; font-size: 14px; overflow-wrap: anywhere; }
.fingerabdruck { font-family: var(--mono); background: var(--gruen-hell); color: var(--gruen); padding: 10px 12px; border-radius: var(--radius-k); margin: 12px 0 0; overflow-wrap: anywhere; }
.meldung { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--blau-hell); color: var(--blau); box-shadow: var(--schatten); overflow-wrap: anywhere; }
.meldung.fehler { background: var(--rot-hell); color: var(--rot-text); }
.meldung.gut { background: var(--gruen-hell); color: var(--gruen); }

/* ---------- Unten-Navigation (Handy) ---------- */
.unten { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--linie); padding-bottom: env(safe-area-inset-bottom); }
.unten-knopf { position: relative; min-height: var(--unten-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; border: 0; color: var(--text-3); font-size: 12px; cursor: pointer; }
.unten-knopf.aktiv { color: var(--rot-text); font-weight: 600; }
.punkt { position: absolute; top: 8px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--rot-text); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }

/* ---------- FAB Not-Aus ---------- */
.fab { position: fixed; right: 16px; bottom: calc(var(--unten-h) + 16px + env(safe-area-inset-bottom)); z-index: 21; display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer; background: var(--flaeche); color: var(--rot-text); font-weight: 700; box-shadow: var(--schatten-hoch), inset 0 0 0 1.5px var(--rot-rand); }
.fab:active { transform: scale(.97); }
.fab.an { background: var(--rot-text); color: #fff; box-shadow: var(--schatten-hoch); }
@media (max-width: 959px) {
  .fab:not(.an) { width: 56px; height: 56px; min-height: 56px; padding: 0; justify-content: center; }
  .fab:not(.an) span { display: none; }
  .meldung { position: fixed; left: 16px; right: 16px; bottom: calc(var(--unten-h) + 84px + env(safe-area-inset-bottom)); z-index: 22; margin: 0; }
}

/* ---------- Bottom-Sheet ---------- */
.blatt-hintergrund { position: fixed; inset: 0; background: rgba(20,20,30,.32); z-index: 30; animation: blenden .2s ease both; }
.blatt { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 88dvh; display: flex; flex-direction: column; background: var(--flaeche); border-radius: 20px 20px 0 0; box-shadow: var(--schatten-hoch); padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); animation: hoch .26s cubic-bezier(.2,.8,.2,1) both; touch-action: pan-y; }
.griff { width: 40px; height: 5px; border-radius: 3px; background: #d4d4da; margin: 4px auto 8px; }
.blatt-kopf { display: flex; align-items: center; gap: 8px; }
.blatt-kopf h2 { flex: 1; margin: 0; font-size: 18px; min-width: 0; overflow-wrap: anywhere; }
.zu { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--grau-hell); font-size: 24px; cursor: pointer; }
.blatt-inhalt { overflow: auto; padding-top: 10px; display: grid; gap: 10px; min-width: 0; }

/* ---------- Desktop ---------- */
@media (min-width: 960px) {
  .rahmen { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
  .seitenleiste { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 20px 14px; background: var(--flaeche); border-right: 1px solid var(--linie); }
  .marke { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
  .marke strong { display: block; font-size: 16px; }
  .seitennav { display: grid; gap: 4px; }
  .navknopf { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--text-2); cursor: pointer; text-align: left; font-weight: 500; }
  .navknopf:hover { background: var(--grund); }
  .navknopf.aktiv { background: var(--rot-hell); color: var(--rot-text); font-weight: 600; }
  .navknopf .zahl { margin-left: auto; background: var(--rot-text); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 8px; }
  .seitenfuss { margin-top: auto; display: grid; gap: 4px; font-size: 12px; color: var(--text-3); padding: 0 8px; }
  main { padding: 28px 40px 120px; }
  .kopfbaer { display: none; }
  .unten { display: none; }
  .fab { bottom: 28px; right: 32px; }
  .blatt { left: auto; right: 24px; bottom: 24px; width: 560px; border-radius: 20px; }
  .griff { display: none; }
}

@keyframes rein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hoch { from { transform: translateY(100%); } to { transform: none; } }
@keyframes blenden { from { opacity: 0; } to { opacity: 1; } }
@keyframes glanz { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
