/* App-Zentrale – „Sicherungskasten“
   Fläche wie ein Verteilerkasten (RAL 7035), Apps als Sicherungsautomaten auf der Hutschiene.
   Farbe nur für Zustände (Kontrollleuchten), Blau für Bedienung. */

@font-face { font-family: "Heros Cn"; src: url("fonts/heros-cn-bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Heros Cn"; src: url("fonts/heros-cn-regular.woff") format("woff"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: light;
  --kasten: #dde1dd;      /* Gehäuse lichtgrau */
  --kasten2: #d2d7d3;     /* Vertiefung, Hutschiene */
  --platte: #f7f8f6;      /* Abdeckplatte / Flächen */
  --modul: #fbfbfa;       /* Kunststoff der Automaten */
  --linie: #c3c9c4;
  --linie-fein: #dfe3e0;
  --tinte: #1c2320;
  --tinte2: #3f4843;
  --leise: #66706a;
  --blau: #1f63a8;
  --blau-text: #ffffff;
  --blau-hell: #dce8f4;
  --an: #1f9a4b;   --an-bg: #dff1e5;
  --gelb: #b7790a; --gelb-led: #e8a90e; --gelb-bg: #f8eccf;
  --rot: #c8352b;  --rot-bg: #f7dfdc;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948; --s9: #9a9993;
  --schrift-schmal: "Heros Cn", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --nav-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --kasten: #151918; --kasten2: #0f1211; --platte: #1d2220; --modul: #262c2a;
    --linie: #3a423e; --linie-fein: #2c3330; --tinte: #e6ebe8; --tinte2: #c3cbc6; --leise: #8e9892;
    --blau: #5a9fe4; --blau-text: #071526; --blau-hell: #17283a;
    --an: #3cc46c; --an-bg: #15301f; --gelb: #f0b43a; --gelb-led: #f0b43a; --gelb-bg: #3a2d10; --rot: #ff6f62; --rot-bg: #3d1916;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s9: #77766f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --kasten: #151918; --kasten2: #0f1211; --platte: #1d2220; --modul: #262c2a;
  --linie: #3a423e; --linie-fein: #2c3330; --tinte: #e6ebe8; --tinte2: #c3cbc6; --leise: #8e9892;
  --blau: #5a9fe4; --blau-text: #071526; --blau-hell: #17283a;
  --an: #3cc46c; --an-bg: #15301f; --gelb: #f0b43a; --gelb-led: #f0b43a; --gelb-bg: #3a2d10; --rot: #ff6f62; --rot-bg: #3d1916;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s9: #77766f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--kasten); color: var(--tinte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums; overflow-x: clip;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
}
a { color: var(--blau); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--blau); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--schrift-schmal); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: .005em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.3rem; margin: 30px 0 10px; }
h3 { font-size: 1.1rem; }
p { margin: 6px 0; max-width: 72ch; }
small, .leise { color: var(--leise); }
.zweit { color: var(--tinte2); }
code { font-size: .86em; background: var(--kasten2); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Kopf */
.kopf {
  position: sticky; top: 0; z-index: 20; background: var(--kasten);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--linie);
}
.kopf .marke { display: flex; align-items: center; gap: 10px; font: 700 1.2rem/1 var(--schrift-schmal); text-decoration: none; color: var(--tinte); }
.kopf .marke img { width: 30px; height: 30px; border-radius: 7px; }
.kopf .rechts { margin-left: auto; display: flex; gap: 6px; }
.glocke { position: relative; }
.glocke .zahl { position: absolute; top: -5px; right: -5px; background: var(--rot); color: #fff; font: 700 .72rem/18px var(--schrift-schmal); min-width: 18px; height: 18px; border-radius: 9px; text-align: center; padding: 0 4px; }
.sym-svg { width: 20px; height: 20px; display: inline-block; vertical-align: middle; }

main { max-width: 1180px; margin: 0 auto; padding: 14px 16px 24px; }

/* Navigation */
nav.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  background: var(--platte); border-top: 1px solid var(--linie); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
nav.leiste a { flex: 1; text-align: center; text-decoration: none; color: var(--leise); font: 400 .8rem/1.2 var(--schrift-schmal); padding: 4px 2px; border-radius: 6px; }
nav.leiste a svg { display: block; margin: 0 auto 3px; width: 24px; height: 24px; }
nav.leiste a.aktiv { color: var(--blau); font-weight: 700; }
@media (min-width: 900px) {
  body { padding-bottom: 24px; padding-left: 220px; }
  nav.leiste { top: 0; right: auto; width: 220px; flex-direction: column; justify-content: flex-start; gap: 2px; border-top: 0; border-right: 1px solid var(--linie); padding: 78px 12px 12px; background: var(--kasten2); }
  nav.leiste a { display: flex; align-items: center; gap: 12px; text-align: left; font-size: 1.05rem; padding: 10px 12px; flex: 0; }
  nav.leiste a svg { margin: 0; width: 22px; height: 22px; }
  nav.leiste a.aktiv { background: var(--platte); box-shadow: inset 3px 0 0 var(--blau); }
  .kopf { padding-left: 24px; }
  main { padding: 18px 36px 36px; }
}

/* ---------- Der Verteiler (Startseite) ---------- */
.verteiler {
  margin-top: 14px; background: var(--platte); border: 1px solid var(--linie); border-radius: 12px;
  padding: 18px 14px 14px; position: relative;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 1px 0 rgba(0,0,0,.04);
}
.verteiler .schiene-titel { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 4px 10px; font: 400 .95rem/1.2 var(--schrift-schmal); color: var(--leise); }
.verteiler .schiene-titel b { color: var(--tinte); font-weight: 700; font-size: 1.05rem; }
.schiene {
  display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(0,0,0,.035) 6px 7px), var(--kasten2);
  border-radius: 6px; padding: 10px 6px; position: relative;
}
@media (max-width: 420px) { .schiene { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1300px) { .schiene { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
.automat {
  position: relative; display: flex; flex-direction: column; align-items: stretch; text-decoration: none; color: inherit;
  background: var(--modul); border: 1px solid var(--linie); border-radius: 5px; min-height: 196px; padding: 10px 10px 0; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 2px 3px rgba(0,0,0,.08);
}
.automat:focus-visible { outline-offset: -2px; }
.automat .oben { display: flex; align-items: center; height: 22px; padding-right: 30px; }
.led { width: 11px; height: 11px; border-radius: 50%; background: var(--linie); flex: none; box-shadow: inset 0 -1px 1px rgba(0,0,0,.2); }
.led.gruen { background: var(--an); box-shadow: 0 0 0 3px color-mix(in srgb, var(--an) 22%, transparent), inset 0 -1px 1px rgba(0,0,0,.15); }
.led.gelb { background: var(--gelb-led); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gelb-led) 25%, transparent); }
.led.rot { background: var(--rot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rot) 25%, transparent); }
.automat .version { font: 400 .78rem/1 var(--schrift-schmal); color: var(--leise); margin-left: 8px; margin-right: auto; }
/* Schalthebel: oben = eingeschaltet, unten = ausgelöst */
.hebel-feld { margin: 10px auto 12px; width: 46px; height: 64px; border-radius: 6px; background: var(--kasten2); border: 1px solid var(--linie); position: relative; }
.hebel { position: absolute; left: 6px; right: 6px; height: 30px; border-radius: 4px; background: var(--blau); top: 5px; transition: top .25s ease;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 1px 2px rgba(0,0,0,.2); }
.hebel::after { content: ''; position: absolute; left: 8px; right: 8px; top: 9px; height: 2px; background: rgba(255,255,255,.55); border-radius: 1px; box-shadow: 0 5px 0 rgba(255,255,255,.55); }
.automat.ausgeloest .hebel { top: 27px; background: var(--rot); }
.automat.ausgeloest .hebel-feld::before { content: ''; position: absolute; left: 6px; right: 6px; top: 5px; height: 18px; background: repeating-linear-gradient(45deg, var(--rot) 0 4px, transparent 4px 8px); opacity: .35; border-radius: 3px; }
/* Beschriftungsstreifen */
.streifen { margin: auto -10px 0; padding: 8px 10px 10px; background: #fff; border-top: 2px solid var(--blau); display: flex; gap: 8px; align-items: flex-start; height: 76px; }
:root[data-theme="dark"] .streifen { background: #e9ece9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .streifen { background: #e9ece9; } }
.streifen .bild { width: 28px; height: 28px; border-radius: 7px; overflow: hidden; flex: none; display: grid; place-items: center; font-size: 1.1rem; background: #eef0ee; }
.streifen .bild img { width: 100%; height: 100%; object-fit: cover; }
.streifen .name { display: block; font: 700 1.02rem/1.1 var(--schrift-schmal); color: #1c2320; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: normal; }
.streifen > span:last-child { min-width: 0; }
.streifen .grund { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.streifen .grund { display: block; font: 400 .8rem/1.15 var(--schrift-schmal); color: #5d6661; margin-top: 2px; }
.automat.gelb .streifen .grund { color: #8a5a00; }
.automat.ausgeloest .streifen .grund { color: #b02d24; }
.automat .details { position: absolute; top: 4px; right: 4px; width: 30px; height: 26px; border: 0; background: transparent; color: var(--leise); border-radius: 4px; cursor: pointer; font-size: 1.05rem; line-height: 1; }
.automat .details:hover { background: var(--kasten2); }

/* Prüfprotokoll unter dem Verteiler */
.protokoll { margin-top: 14px; display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--linie); }
@media (min-width: 760px) { .protokoll { grid-template-columns: repeat(3, 1fr); border-top: 0; gap: 0; } .protokoll a + a { border-left: 1px solid var(--linie); } }
.protokoll a { display: block; padding: 12px 6px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--linie); }
@media (min-width: 760px) { .protokoll a { border-bottom: 0; padding: 4px 18px; } .protokoll a:first-child { padding-left: 4px; } }
.protokoll .was { font: 400 .95rem/1.2 var(--schrift-schmal); color: var(--leise); }
.protokoll .wert { font: 700 1.7rem/1.15 var(--schrift-schmal); }
.protokoll .dazu { font-size: .85rem; color: var(--tinte2); }

/* Flächen & Listen */
.karte { background: var(--platte); border: 1px solid var(--linie); border-radius: 10px; padding: 14px 16px; }
.karte + .karte { margin-top: 12px; }
.blatt { background: var(--platte); border: 1px solid var(--linie); border-radius: 10px; overflow: hidden; }
.zeile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--linie-fein); min-height: 54px; }
.zeile:last-child { border-bottom: 0; }
.zeile .mitte { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.zeile .titel { font-weight: 600; }
.zeile .unter { color: var(--leise); font-size: .86rem; overflow-wrap: anywhere; }
a.zeile { color: inherit; text-decoration: none; }
a.zeile:hover { background: color-mix(in srgb, var(--platte) 70%, var(--kasten)); }
.zeile > .signal, summary > .signal, .zeile summary .signal { flex: none; max-width: 42%; }
.zeile .app-bild { width: 34px; height: 34px; border-radius: 8px; overflow: hidden; flex: none; display: grid; place-items: center; font-size: 1.25rem; background: var(--kasten2); }
.zeile .app-bild img { width: 100%; height: 100%; object-fit: cover; }

/* Kennzahlen (Unterseiten) */
.kennzahlen { display: grid; gap: 0; grid-template-columns: repeat(2, 1fr); margin: 14px 0; border: 1px solid var(--linie); border-radius: 10px; background: var(--platte); overflow: hidden; }
.kennzahlen > * { border-right: 1px solid var(--linie-fein); border-bottom: 1px solid var(--linie-fein); }
.kennzahlen > :last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 760px) { .kennzahlen { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } .kennzahlen > :last-child:nth-child(odd) { grid-column: auto; } }
.kennzahl { padding: 12px 14px; text-decoration: none; color: inherit; display: block; }
.kennzahl .wert { font: 700 1.6rem/1.15 var(--schrift-schmal); }
.kennzahl .name { color: var(--leise); font: 400 .92rem/1.2 var(--schrift-schmal); }
.kennzahl .zusatz { color: var(--tinte2); font-size: .82rem; }

/* Zustandszeichen: Leuchte + Wort */
.signal { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 4px; max-width: 100%; overflow-wrap: anywhere; line-height: 1.35; }
.signal::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.signal.gruen { color: var(--an); background: var(--an-bg); }
.signal.gelb { color: var(--gelb); background: var(--gelb-bg); }
.signal.rot { color: var(--rot); background: var(--rot-bg); }
.signal.grau { color: var(--leise); background: var(--kasten2); }
.punkt { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.punkt.gruen { background: var(--an); } .punkt.gelb { background: var(--gelb-led); } .punkt.rot { background: var(--rot); } .punkt.grau { background: var(--linie); }

/* Hinweise */
.hinweis { border-radius: 8px; padding: 12px 14px; margin: 10px 0; display: flex; gap: 12px; align-items: flex-start; border-left: 4px solid; background: var(--platte); }
.hinweis .sym { font-size: 1.1rem; line-height: 1.3; }
.hinweis.warn { border-color: var(--gelb-led); background: var(--gelb-bg); }
.hinweis.rot { border-color: var(--rot); background: var(--rot-bg); }
.hinweis.info { border-color: var(--blau); background: var(--blau-hell); }
.hinweis.gut { border-color: var(--an); background: var(--an-bg); }
.hinweis .knopf { margin-top: 8px; }

/* Knöpfe wie Taster */
.knopf, button.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--linie); background: var(--modul);
  color: var(--tinte); border-radius: 6px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 42px;
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
}
.knopf:active { transform: translateY(1px); box-shadow: none; }
.knopf.haupt { background: var(--blau); border-color: var(--blau); color: var(--blau-text); }
.knopf.gefahr { color: var(--rot); border-color: color-mix(in srgb, var(--rot) 45%, var(--linie)); }
.knopf.klein { padding: 5px 12px; min-height: 34px; font-size: .88rem; }
.knopf:disabled { opacity: .55; cursor: default; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
label.feld { display: block; margin: 12px 0; }
label.feld > span { display: block; font-size: .88rem; color: var(--tinte2); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], input[type=month], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--linie); background: var(--modul); color: var(--tinte);
}
textarea { min-height: 90px; resize: vertical; }
label.schalter { display: flex; align-items: center; gap: 10px; margin: 10px 0; cursor: pointer; }
label.schalter input { width: 20px; height: 20px; accent-color: var(--blau); }
.code-eingabe { letter-spacing: .3em; font-size: 1.3rem !important; text-align: center; max-width: 220px; }

/* Tabellen */
.tabelle-huelle { overflow-x: auto; border: 1px solid var(--linie); border-radius: 10px; background: var(--platte); }
table.tabelle { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabelle th { text-align: left; font: 700 .92rem/1.2 var(--schrift-schmal); color: var(--tinte2); padding: 10px 12px; border-bottom: 1px solid var(--linie); white-space: nowrap; background: var(--kasten2); }
.tabelle td { padding: 9px 12px; border-bottom: 1px solid var(--linie-fein); vertical-align: top; }
.tabelle tr:last-child td { border-bottom: 0; }
.tabelle td.z, .tabelle th.z { text-align: right; white-space: nowrap; }
.tabelle tr.summe td { font-weight: 700; border-top: 2px solid var(--linie); }

/* Balken & Verlauf */
.balken { height: 8px; background: var(--kasten2); border-radius: 2px; overflow: hidden; min-width: 60px; }
.balken i { display: block; height: 100%; background: var(--blau); }
.balken.warn i { background: var(--gelb-led); } .balken.rot i { background: var(--rot); }
.verlauf { display: flex; gap: 2px; height: 16px; align-items: stretch; }
.verlauf i { flex: 1; border-radius: 1px; background: var(--an); min-width: 2px; opacity: .85; }
.verlauf i.aus { background: var(--rot); opacity: 1; }

/* Diagramm */
.diagramm { position: relative; }
.diagramm svg { display: block; width: 100%; height: auto; overflow: visible; }
.diagramm .achse { fill: var(--leise); font-size: 11px; }
.diagramm .gitter { stroke: var(--linie-fein); stroke-width: 1; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .85rem; color: var(--tinte2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.tipp { position: absolute; pointer-events: none; background: var(--tinte); color: var(--platte); padding: 8px 10px; border-radius: 6px; font-size: .82rem; z-index: 5; min-width: 150px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.tipp b { display: block; margin-bottom: 4px; }
.tipp div { display: flex; justify-content: space-between; gap: 12px; }

/* Dialoge */
dialog { border: 1px solid var(--linie); border-radius: 12px; padding: 0; background: var(--platte); color: var(--tinte); width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 12px 40px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(12, 16, 14, .5); }
dialog .inhalt { padding: 18px 20px 20px; overflow-y: auto; max-height: calc(100vh - 40px); }
@media (max-width: 600px) { dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 14px 14px 0 0; padding-bottom: env(safe-area-inset-bottom); } }

/* Anmeldung */
.anmelde { max-width: 430px; margin: 7vh auto 0; padding: 0 16px; }
.anmelde .logo { width: 68px; height: 68px; border-radius: 16px; display: block; margin-bottom: 18px; }
.qr { background: #fff; padding: 8px; border-radius: 8px; display: inline-block; border: 1px solid var(--linie); }
.qr svg { width: 210px; height: 210px; display: block; }

.fortschritt { height: 6px; border-radius: 3px; background: var(--kasten2); overflow: hidden; margin: 10px 0; }
.fortschritt i { display: block; height: 100%; background: var(--blau); transition: width .3s; }
.drehen { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: drehen .8s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--tinte); color: var(--platte); padding: 10px 16px; border-radius: 8px; z-index: 100; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.fehler { background: var(--rot); color: #fff; }

details.klapp { border: 1px solid var(--linie); border-radius: 10px; background: var(--platte); margin-top: 10px; }
details.klapp > summary { padding: 12px 14px; cursor: pointer; font-weight: 600; list-style: none; }
details.klapp > summary::after { content: '▾'; float: right; color: var(--leise); }
details.klapp[open] > summary::after { content: '▴'; }
details.klapp > .innen { padding: 0 14px 14px; }
.log { font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--kasten2); padding: 10px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 4px; background: var(--kasten2); font-size: .82rem; margin: 2px 4px 2px 0; text-decoration: none; color: var(--tinte2); }
.leer { color: var(--leise); padding: 18px; text-align: center; }
.schritte { counter-reset: s; list-style: none; padding: 0; }
.schritte li { counter-increment: s; position: relative; padding-left: 38px; margin: 12px 0; }
.schritte li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 6px; background: var(--blau); color: var(--blau-text); display: grid; place-items: center; font: 700 .95rem/1 var(--schrift-schmal); }
.hilfe-kapitel { scroll-margin-top: 80px; }
.hilfe-kapitel ul { padding-left: 20px; }

/* Breite Tabellen auf dem Handy als Karten (Spaltenname links, Wert rechts) */
@media (max-width: 640px) {
  table.stapel thead { display: none; }
  table.stapel, table.stapel tbody, table.stapel tr, table.stapel td { display: block; width: auto; }
  .tabelle-huelle:has(table.stapel) { overflow-x: visible; }
  table.stapel tr { padding: 10px 12px; border-bottom: 1px solid var(--linie-fein); }
  table.stapel tr:last-child { border-bottom: 0; }
  table.stapel td { border: 0; padding: 2px 0 2px 8.5em; position: relative; text-align: left !important; white-space: normal !important; overflow-wrap: anywhere; min-height: 1.3em; }
  table.stapel td::before { content: attr(data-l); position: absolute; left: 0; top: 3px; width: 8em; font: 600 .82rem/1.25 var(--schrift-schmal); color: var(--tinte2); overflow-wrap: anywhere; }
  table.stapel td:first-child { padding-left: 0; font-weight: 700; margin-bottom: 4px; }
  table.stapel td:first-child::before { display: none; }
  table.stapel td:empty, table.stapel td.leer-zelle { display: none; }
  table.stapel td[colspan] { padding-left: 0; }
  table.stapel td[colspan]::before { display: none; }
  table.stapel .balken { max-width: 160px; }
}

/* Offene Punkte */
.kennzahlen.drei { grid-template-columns: repeat(3, 1fr); }
.kennzahlen.drei > :last-child:nth-child(odd) { grid-column: auto; }
.kennzahlen.drei .zusatz { font-size: .8rem; }
.offen-kopf { display: flex; align-items: center; gap: 10px; }
.offen-kopf .app-bild { width: 30px; height: 30px; border-radius: 7px; overflow: hidden; display: grid; place-items: center; font-size: 1.1rem; background: var(--kasten2); flex: none; }
.offen-kopf .app-bild img { width: 100%; height: 100%; object-fit: cover; }
.offen-kopf .leise { font-weight: 400; font-size: .95rem; }
.punkt-zeile { align-items: flex-start; }
.punkt-fuss { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.punkt-fuss .signal { margin-right: auto; }
.leise-knopf { color: var(--leise); }
.offen-leiste { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 12px 0; border: 1px solid var(--linie); border-left: 4px solid var(--gelb-led); border-radius: 10px; background: var(--platte); color: inherit; text-decoration: none; }
.offen-leiste.rot { border-left-color: var(--rot); }
.offen-leiste > span:nth-child(2) { flex: 1; min-width: 0; }
