/*
 * automaten – Oberfläche.
 * Grundlage: GPAIFW ui.css (Design-Tokens und Basisklassen), eigene Farben und Ergänzungen unten.
 * Keine Inline-Styles (CSP style-src 'self').
 */
:root {
    --blau: #1f3a4d;
    --blau-hell: #2f6f8f;
    --akzent: #c9a227;
    --bg: #f4f6f9;
    --karte: #ffffff;
    --rand: #e2e7ee;
    --text: #1c2733;
    --dezent: #6b7787;
    --ok: #1f8a4c;
    --warn: #b3261e;
    --radius: 10px;
    --schatten: 0 1px 3px rgba(16,32,56,.08), 0 4px 14px rgba(16,32,56,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}
a { color: var(--blau-hell); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
    display: flex; align-items: center; gap: 1.5rem;
    background: var(--blau); color: #fff;
    padding: 0 1.25rem; height: 56px;
}
.topbar .brand a { color: #fff; font-weight: 600; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.topbar .brand a:hover { text-decoration: none; }
.logo {
    display: inline-grid; place-items: center;
    width: 30px; height: 30px; border-radius: 6px;
    background: var(--akzent); color: var(--blau); font-weight: 800; font-size: .8rem;
}
.hauptnav { display: flex; gap: 1.1rem; margin-left: .5rem; }
.hauptnav a { color: #d7e2f0; font-size: .95rem; }
.hauptnav a:hover { color: #fff; text-decoration: none; }
.benutzer { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.benutzer .wer { color: #cdd9e8; font-size: .9rem; }
.btn-abmelden { color: #fff; border: 1px solid rgba(255,255,255,.35); padding: .3rem .7rem; border-radius: 6px; font-size: .85rem; }
.btn-abmelden:hover { background: rgba(255,255,255,.12); text-decoration: none; }

/* Layout */
.wrap { max-width: 1100px; margin: 2rem auto; padding: 0 1.25rem; }
h1 { font-size: 1.5rem; margin: 0 0 .3rem; }
h2 { font-size: 1.15rem; margin: 1.8rem 0 .6rem; }
.dezent { color: var(--dezent); }
.unter { color: var(--dezent); margin: 0 0 1.5rem; }

/* Kachel-Dashboard */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.kachel {
    display: block; background: var(--karte); border: 1px solid var(--rand);
    border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--schatten);
    transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease;
}
.kachel:hover { transform: translateY(-2px); border-color: var(--blau-hell); text-decoration: none; box-shadow: 0 6px 20px rgba(16,32,56,.12); }
.kachel .kicon {
    display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 9px;
    background: #eef3f9; font-size: 1.3rem; margin-bottom: .7rem;
}
.kachel .knam { font-weight: 600; color: var(--text); font-size: 1.02rem; }
.kachel .kbeschr { color: var(--dezent); font-size: .88rem; margin-top: .25rem; min-height: 2.4em; }
.kachel .krolle { display: inline-block; margin-top: .6rem; font-size: .72rem; color: var(--blau);
    background: #e7eff7; border-radius: 20px; padding: .12rem .6rem; }

.leer { background: var(--karte); border: 1px dashed var(--rand); border-radius: var(--radius);
    padding: 2rem; text-align: center; color: var(--dezent); }

/* Login */
.login-box { max-width: 360px; margin: 6vh auto; background: var(--karte); border: 1px solid var(--rand);
    border-radius: var(--radius); padding: 2rem; box-shadow: var(--schatten); }
.login-box h1 { text-align: center; margin-bottom: 1.2rem; font-size: 1.2rem; color: var(--dezent); font-weight: 500; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 700;
    font-size: 1.15rem; color: var(--blau); margin-bottom: .3rem; }
.login-brand .logo { width: 34px; height: 34px; font-size: .9rem; }

/* Formular */
.feld { margin-bottom: 1rem; }
.feld label { display: block; font-size: .85rem; color: var(--dezent); margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=email], select {
    width: 100%; padding: .55rem .65rem; border: 1px solid var(--rand); border-radius: 7px;
    font-size: .95rem; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--blau-hell); outline-offset: -1px; border-color: var(--blau-hell); }
.btn { display: inline-block; background: var(--blau); color: #fff; border: 0; border-radius: 7px;
    padding: .55rem 1.1rem; font-size: .95rem; cursor: pointer; }
.btn:hover { background: var(--blau-hell); }
.btn.sekundaer { background: #eef2f7; color: var(--blau); }
.btn.gefahr { background: var(--warn); }
.btn.klein { padding: .3rem .6rem; font-size: .82rem; }
.voll { width: 100%; }
.zeile { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.zeile .feld { margin-bottom: 0; }

/* Meldungen */
.meldung { padding: .7rem .9rem; border-radius: 7px; margin-bottom: 1rem; font-size: .92rem; }
.meldung.fehler { background: #fdecea; color: var(--warn); border: 1px solid #f5c6c2; }
.meldung.ok { background: #e7f6ec; color: var(--ok); border: 1px solid #bfe6cd; }
.meldung.info { background: #eaf1fb; color: var(--blau); border: 1px solid #cbdcf3; }

/* Tabellen (Verwaltung) */
.karte-box { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius);
    box-shadow: var(--schatten); padding: 1.2rem 1.3rem; margin-bottom: 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--rand); vertical-align: middle; }
th { color: var(--dezent); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafbfd; }
.tabelle-scroll { overflow-x: auto; }
.badge { display: inline-block; font-size: .72rem; padding: .1rem .5rem; border-radius: 20px; }
.badge.admin { background: #fdeccd; color: #96591a; }
.badge.user { background: #e7eff7; color: var(--blau); }
.badge.aus { background: #fdecea; color: var(--warn); }
.badge.an { background: #e7f6ec; color: var(--ok); }

/* Admin-Subnav */
.subnav { display: flex; gap: 1rem; border-bottom: 1px solid var(--rand); margin-bottom: 1.4rem; }
.subnav a { padding: .55rem .2rem; color: var(--dezent); border-bottom: 2px solid transparent; }
.subnav a.aktiv { color: var(--blau); border-bottom-color: var(--akzent); font-weight: 600; }
.subnav a:hover { text-decoration: none; color: var(--blau); }

.aktion-form { display: inline; }
.rechts { text-align: right; }
.rechts-block { display: block; margin-top: .6rem; text-align: right; }
.kicon-klein { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
    background: #eef3f9; font-size: .95rem; vertical-align: middle; margin-right: .3rem; }
textarea { width: 100%; padding: .55rem .65rem; border: 1px solid var(--rand); border-radius: 7px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .85rem; resize: vertical; }
.zeile label { font-size: .9rem; color: var(--text); display: inline-flex; align-items: center; gap: .35rem; }
.fuss { max-width: 1100px; margin: 2rem auto; padding: 1rem 1.25rem; color: var(--dezent);
    font-size: .82rem; display: flex; justify-content: space-between; border-top: 1px solid var(--rand); }


/* ---- Ergänzungen automaten ---- */
/* Breite Bildschirme nutzen: bis 1920px, darunter fast die ganze Fensterbreite */
.wrap { max-width: min(1920px, 97vw); }
.fuss { max-width: min(1920px, 97vw); }
.hauptnav a.aktiv { color: #fff; border-bottom: 2px solid var(--akzent); padding-bottom: 2px; }
.benutzer .wer { color: #cdd9e8; font-size: .9rem; }
button.btn-abmelden { background: transparent; cursor: pointer; }
input[type=text], input[type=password], input[type=email], select, textarea { max-width: 100%; }
textarea { font-family: inherit; font-size: .9rem; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .82rem; word-break: break-all; }
.nowrap { white-space: nowrap; }
.ohne-abstand { margin-top: 0; }
.schmal { max-width: 460px; }
.klein-link { font-size: .8rem; font-weight: 400; margin-left: .6rem; }

.suchmaske .zeile { align-items: flex-end; }
.feld.breit { flex: 1 1 320px; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 1rem; }
.raster .breit { grid-column: 1 / -1; }

.treffer { padding: .9rem 1.1rem; margin-bottom: .8rem; }
.treffer-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; }
.treffer-titel { font-weight: 600; font-size: 1.02rem; }
.fundort { color: var(--dezent); font-size: .82rem; word-break: break-all; }
.fundort.fehlt, tr.fehlt td { text-decoration: line-through; color: var(--dezent); }
.stelle { margin-top: .35rem; font-size: .9rem; }
.stelle a { font-size: .78rem; margin-right: .4rem; }
mark { background: #fbe7a1; padding: 0 .1em; border-radius: 2px; }
.blaettern { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }

.spalten { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .spalten { grid-template-columns: minmax(0, 1fr); } }
.seitentext { white-space: pre-wrap; font-size: .8rem; background: #fafbfc; border: 1px solid var(--rand); border-radius: 6px; padding: .7rem; max-height: 70vh; overflow: auto; }
details { margin-bottom: .5rem; }
summary { cursor: pointer; font-weight: 600; }
.verlauf { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.verlauf li { padding: .25rem 0; border-bottom: 1px solid var(--rand); }
.verlauf li.fehler { color: var(--warn); }
tr.zeile-fehler td { background: #fdf3f2; }

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .8rem; margin: 1rem 0; }
.kennzahlen div { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); padding: .7rem .9rem; }
.kennzahlen strong { display: block; font-size: 1.4rem; color: var(--blau); }
.kennzahlen span { color: var(--dezent); font-size: .8rem; }

@media (max-width: 700px) {
    .topbar { flex-wrap: wrap; height: auto; padding: .5rem 1rem; gap: .5rem 1rem; }
    .hauptnav { flex-wrap: wrap; margin-left: 0; }
}

/* Stufe 2: Dokumentansicht, Prüfliste, Stammdaten */
.vorschau { width: 100%; height: 86vh; border: 1px solid var(--rand); border-radius: 6px; background: #fff; }
.metafeld { margin-bottom: .7rem; }
.vorschlaege { display: flex; flex-wrap: wrap; gap: .3rem .6rem; margin-top: .2rem; font-size: .76rem; color: var(--dezent); }
.vorschlaege span { background: #eef3f9; border-radius: 4px; padding: .05rem .4rem; cursor: help; }
.meta-zeile { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .86rem; margin: .2rem 0 .3rem; }
.meta-zeile span:not(:last-child)::after { content: "·"; margin-left: .9rem; color: var(--dezent); }
.knopfzeile { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
button[disabled] { opacity: .5; cursor: not-allowed; }

/* Liveansicht und Fragen */
.live-karten { display: grid; gap: .8rem; margin-bottom: .8rem; }
.live-karte { margin-bottom: 0; }
.live-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .8rem; }
.live-titel { font-weight: 600; }
.live-meldung { margin: .4rem 0; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .85rem; word-break: break-all; }
.live-zahlen { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .88rem; color: var(--dezent); }
.live-zahlen strong { color: var(--text); }
.live-punkt { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #5ad17a; vertical-align: middle; animation: puls 1.2s ease-in-out infinite; }
.badge.puls { animation: puls 1.2s ease-in-out infinite; }
@keyframes puls { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-punkt, .badge.puls { animation: none; } }
tr.neu-eingetroffen td { animation: aufleuchten 2s ease-out; }
@keyframes aufleuchten { from { background: #fff6d6; } to { background: transparent; } }
.nav-zahl { display: inline-block; min-width: 1.2rem; padding: 0 .3rem; border-radius: 9px; background: var(--akzent); color: var(--blau); font-size: .72rem; font-weight: 700; text-align: center; }
.plan { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { background: #eef3f9; border: 1px solid var(--rand); border-radius: 20px; padding: .15rem .6rem; font-size: .86rem; }
.chip small { color: var(--dezent); }
tfoot th { border-top: 2px solid var(--rand); text-transform: none; font-size: .88rem; color: var(--text); }

.ablage-vorschlag { background: #f6f9f3; border: 1px solid #d6e6cc; border-radius: 6px; padding: .5rem .7rem; }
.ablage-vorschlag .mono { font-size: .88rem; color: var(--text); }

[hidden] { display: none !important; }

/* Themen aus Ordnern */
.baum details { margin: 0; }
.baum summary { font-weight: normal; padding: .15rem 0; }
.baum-kinder { margin-left: 1.4rem; border-left: 1px solid var(--rand); padding-left: .6rem; }
.baum-blatt { padding: .15rem 0 .15rem 1.1rem; }
.baum-zeile { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; }
.baum-zeile .wahl.klein { font-size: .8rem; margin: 0; }
.einzug { display: inline-block; }
.baum .baum-blatt { display: block; }
.einzug.tiefe-1 { padding-left: 1.2rem; } .einzug.tiefe-2 { padding-left: 2.4rem; } .einzug.tiefe-3 { padding-left: 3.6rem; }
.einzug.tiefe-4 { padding-left: 4.8rem; } .einzug.tiefe-5 { padding-left: 6rem; } .einzug.tiefe-6 { padding-left: 7.2rem; }

/* Dokumentansicht: Vorschau breiter als die Metadaten; lange Pfade im Ablagevorschlag umbrechen */
.spalten.dokument { grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr); }
@media (max-width: 1100px) { .spalten.dokument { grid-template-columns: minmax(0, 1fr); } }
.ablage-vorschlag .mono { overflow-wrap: anywhere; }
.baum-zeile .ausschluss { color: var(--warn); }
ol.schritte li { margin-bottom: 1rem; }

/* ---- Automatenabrechnung: Periodenseite ---------------------------------------------------- */
.seitenkopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.seitenkopf h1 { margin: 0; }
.seitenkopf .unter { margin: .25rem 0 0; }
.kennzahlen.breit { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.kennzahlen.breit div { min-width: 0; }
.kennzahlen.breit strong { white-space: nowrap; font-size: 1.45rem; display: block; }
.kennzahlen.breit div.hervor { border-left: 4px solid var(--akzent); }

.schrittliste { list-style: none; margin: 0; padding: 0; }
.schrittliste li { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: center; gap: .9rem;
    padding: .75rem .4rem; border-bottom: 1px solid var(--rand); }
.schrittliste li:last-child { border-bottom: none; }
.schrittliste .punkt { width: 2rem; height: 2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem; background: #eef1f5; color: var(--dezent); border: 2px solid var(--rand); }
.schrittliste li.erledigt .punkt { background: var(--ok); border-color: var(--ok); color: #fff; }
.schrittliste li.dran .punkt { background: #fff; border-color: var(--akzent); color: var(--blau); }
.schrittliste li.dran { background: #fffbea; border-radius: 8px; }
.schrittliste li.gesperrt .titel { color: var(--dezent); }
.schrittliste .titel { font-weight: 600; }
.schrittliste .info { color: var(--dezent); font-size: .85rem; margin-top: .1rem; }
.schrittliste .info a { font-weight: 600; }
.schrittliste .tun { display: flex; gap: .4rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.schrittliste .tun form { margin: 0; }
.schrittliste .btn { min-width: 9.5rem; }
.schrittliste .btn.sekundaer { background: #fff; color: var(--blau); border: 1px solid var(--rand); }
.datei-wahl { font-size: .85rem; max-width: 16rem; }
.datei-wahl::file-selector-button { border: 1px solid var(--rand); background: #fff; border-radius: 6px; padding: .3rem .6rem;
    margin-right: .5rem; cursor: pointer; color: var(--blau); }
.hinweis-fuss { color: var(--dezent); font-size: .85rem; margin: .8rem 0 0; }
.art-chip { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: #eef1f5; color: var(--blau); white-space: nowrap; }
td.mono.dezent { font-size: .78rem; }
.zwei-spalten { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 900px) {
    .zwei-spalten { grid-template-columns: 1fr; }
    .schrittliste li { grid-template-columns: 2.2rem 1fr; }
    .schrittliste .tun { grid-column: 2; justify-content: flex-start; }
}

/* ---- Statistik ------------------------------------------------------------------------------ */
.filterleiste { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.filterleiste .feld { margin: 0; min-width: 9rem; }
.filterleiste #geraet { max-width: 26rem; }
table.statistik td.fett { font-weight: 700; }
td.balken-zelle { width: 16%; min-width: 8rem; }
meter { width: 100%; height: .9rem; }
meter::-webkit-meter-optimum-value { background: var(--blau-hell); }
meter::-moz-meter-bar { background: var(--blau-hell); }
.knopfzeile { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---- Mail-Vorschau ------------------------------------------------------------------------- */
.mail-form textarea { width: 100%; font-family: inherit; }
.mail-an { padding: .45rem .6rem; background: #f4f6f9; border-radius: 6px; font-weight: 600; }
ul.anhaenge { margin: .2rem 0 0; padding-left: 1.1rem; }
ul.anhaenge li { margin: .2rem 0; }
.vorschau-box { display: flex; flex-direction: column; }
iframe.pdf-vorschau { width: 100%; min-height: 34rem; flex: 1; border: 1px solid var(--rand); border-radius: 6px; }

/* ---- Ertrag & Steuern ----------------------------------------------------------------------- */
.seitenkopf .subnav { margin-top: .5rem; }
.pfad { margin: 0 0 1rem; font-size: .95rem; }
.pfad a { font-weight: 600; }
svg.aufteilung { width: 100%; height: 2.2rem; border-radius: 6px; overflow: hidden; display: block; margin: .4rem 0 .8rem; }
.staat-mwst { fill: #b3261e; background: #b3261e; }
.staat-vst { fill: #e07a5f; background: #e07a5f; }
.wirt { fill: #2f6f8f; background: #2f6f8f; }
.leasing { fill: #9aa5b1; background: #9aa5b1; }
.firma { fill: #1f8a4c; background: #1f8a4c; }
ul.legende { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin: 0; padding: 0; font-size: .9rem; }
ul.legende .farbe { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
table.statistik tfoot th { border-top: 2px solid var(--rand); }

.pruefen-box { display: flex; justify-content: space-between; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.pruefen-box > div { flex: 1 1 28rem; }
details.karte-box > summary { cursor: pointer; font-weight: 600; }
.login-oder { text-align: center; color: var(--dezent); margin: .9rem 0 .6rem; font-size: .85rem; }
a.btn.voll { text-align: center; box-sizing: border-box; }

/* Anmeldung und Sicherheit (0.989) */
.hinweis-box { border-left: 4px solid var(--akzent); }
ol.codes { columns: 2; font-size: 1.05rem; }
ol.codes code, code.schluessel { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; }
code.schluessel { display: inline-block; background: #eef2f7; padding: .15rem .4rem; border-radius: 5px; }
input.voll { width: 100%; }
details.login-oder { text-align: left; }
details.login-oder summary { cursor: pointer; text-align: center; }
[data-passkey-block] input[name="geraet"] { min-width: 14rem; }

/* Menü am Handy (0.990): Reiter hinter „Menü“, klappt unter dem Kopf auf */
.menue-knopf { display: none; }
@media (max-width: 899px) {
    .topbar { flex-wrap: wrap; height: auto; min-height: 52px; gap: .6rem; padding: .4rem .9rem; }
    .topbar .produkt { display: none; }
    .menue-knopf { display: inline-block; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35);
        border-radius: 6px; padding: .3rem .7rem; font: inherit; font-size: .9rem; cursor: pointer; }
    .hauptnav { display: none; order: 10; width: 100%; flex-direction: column; gap: 0; margin: 0 0 .4rem; }
    .topbar.offen .hauptnav { display: flex; }
    .hauptnav a { padding: .55rem .2rem; border-top: 1px solid rgba(255,255,255,.12); }
    .benutzer { gap: .5rem; }
    .benutzer .wer { font-size: .85rem; }
    .wrap { margin: 1rem auto; }
}

/* Funktionen des aktiven Bereichs (0.992): zweite Zeile direkt unter dem Kopf */
.funktionsnav { background: #fff; border-bottom: 1px solid var(--rand); }
.funktionsnav-innen { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; display: flex; gap: 1.4rem; overflow-x: auto; scrollbar-width: none; }
.funktionsnav a { padding: .65rem 0 .55rem; color: var(--dezent); border-bottom: 2px solid transparent; white-space: nowrap; font-size: .93rem; }
.funktionsnav a:hover { color: var(--blau); text-decoration: none; }
.funktionsnav a.aktiv { color: var(--blau); border-bottom-color: var(--akzent); font-weight: 600; }
@media (max-width: 899px) { .funktionsnav-innen { padding: 0 .9rem; gap: 1.1rem; } }

/* Übersicht: zwei Bereichskacheln mit Funktionskacheln */
.bereichskacheln { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
@media (min-width: 900px) { .bereichskacheln { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.bereichskachel { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); box-shadow: var(--schatten); padding: 1.1rem 1.2rem; }
.bereichskachel > h2 { margin: 0 0 .2rem; display: flex; align-items: center; gap: .5rem; }
.bereichskachel > .unter { margin-bottom: .9rem; }
.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.kennzahl { background: #f4f6f9; border-radius: 8px; padding: .5rem .7rem; }
.kennzahl .l { font-size: .75rem; color: var(--dezent); }
.kennzahl .w { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.funktionskacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.funktionskachel { display: block; border: 1px solid var(--rand); border-radius: 8px; padding: .7rem .8rem; color: var(--text); background: #fff; }
.funktionskachel:hover { border-color: var(--blau-hell); text-decoration: none; box-shadow: var(--schatten); }
.funktionskachel b { display: block; color: var(--blau); }
.funktionskachel span { font-size: .8rem; color: var(--dezent); }
.funktionskachel.einrichten { background: #f7f8fa; border-style: dashed; }
.funktionskachel.einrichten b { color: var(--dezent); }
.funktionskachel.warn span { color: var(--warn); font-weight: 600; }

/* Einstellungen → Funktionen */
.schalterliste { display: flex; flex-direction: column; gap: .55rem; margin: 1rem 0 1.2rem; }
.schalterliste .schalter { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.schalterliste .schalter input { margin-top: .2rem; width: auto; }
.schalterliste .schalter.eingerueckt { margin-left: 1.8rem; }
.schalterliste .schalter.gesperrt { opacity: .6; cursor: default; }
.qr-feld { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; } .qr-feld svg.qr { border: 1px solid var(--rand); border-radius: 6px; }

/* Einstellungen → Ampel: Tabelle je Gruppe, Spalten gelb/rot */
.ampel-einstellung .ampel-gruppe { margin: 1.2rem 0 .4rem; font-size: .95rem; color: var(--blau); }
.ampel-tabelle { width: 100%; border-collapse: collapse; }
.ampel-tabelle th { text-align: left; font-size: .75rem; color: var(--dezent); font-weight: 600; padding: .35rem .5rem; border-bottom: 1px solid var(--rand); }
.ampel-tabelle td { padding: .4rem .5rem; border-bottom: 1px solid var(--rand); vertical-align: middle; }
.ampel-tabelle td:first-child { width: 28%; }
.ampel-tabelle th.gelb, .ampel-tabelle th.rot { width: 7.5rem; }
.ampel-tabelle th.gelb::before, .ampel-tabelle th.rot::before { content: ""; display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }
.ampel-tabelle th.gelb::before { background: #e0a800; } .ampel-tabelle th.rot::before { background: #c8102e; }
.ampel-tabelle input.ampelzahl { width: 6rem; text-align: right; }
@media (max-width: 699px) { .ampel-tabelle .weg { display: none; } .ampel-tabelle td:first-child { width: auto; } }
.ampel-tabelle { table-layout: fixed; }
.ampel-tabelle td:nth-child(4), .ampel-tabelle th:nth-child(4) { width: 9rem; }
.ampel-tabelle td.gelb, .ampel-tabelle td.rot { width: 7.5rem; }
/* 1.021: Funktionen – Karten je Hauptfunktion, dreiteilige Schalterleiste */
.fn-legende { list-style: none; padding: 0; margin: .4rem 0 1rem; display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; font-size: .88rem; color: #4a5563; }
.fn-punkt { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }
.fn-punkt.aus { background: #b5bfcc; } .fn-punkt.vorschau { background: #e0b04a; } .fn-punkt.an { background: #1f8a4c; }
.fn-karte { border: 1px solid #dde4ec; border-radius: 10px; margin-bottom: .9rem; overflow: hidden; background: #fff; }
.fn-zeile { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1rem; border-top: 1px solid #edf1f5; }
.fn-zeile:first-child { border-top: 0; background: #f7f9fc; }
.fn-zeile.tiefe-1 { padding-left: 2.2rem; } .fn-zeile.tiefe-2 { padding-left: 3.6rem; } .fn-zeile.tiefe-3 { padding-left: 5rem; }
.fn-zeile.tiefe-1 .fn-text, .fn-zeile.tiefe-2 .fn-text, .fn-zeile.tiefe-3 .fn-text { border-left: 2px solid #dde4ec; padding-left: .8rem; }
.fn-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1 1 auto; }
.fn-text b { font-size: .97rem; } .fn-text span { font-size: .86rem; color: #5b6676; }
.fn-hinweis { font-size: .8rem; color: #8a5a00; }
.fn-zeile.ruht .fn-text b, .fn-zeile.ruht .fn-text span { color: #9aa4b1; }
.fn-zeile.gesperrt { opacity: .6; }
.fn-wahl { display: inline-flex; flex: 0 0 auto; border: 1px solid #c9d3df; border-radius: 8px; overflow: hidden; }
.fn-wahl label { position: relative; margin: 0; cursor: pointer; }
.fn-wahl label + label { border-left: 1px solid #c9d3df; }
.fn-wahl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fn-wahl span { display: block; padding: .38rem .85rem; font-size: .85rem; color: #4a5563; background: #fff; min-width: 4.2rem; text-align: center; }
.fn-wahl label:hover span { background: #f1f5f9; }
.fn-wahl input:focus-visible + span { outline: 2px solid #004890; outline-offset: -2px; }
.fn-wahl .fn-aus input:checked + span { background: #6b7787; color: #fff; font-weight: 600; }
.fn-wahl .fn-vorschau input:checked + span { background: #e0b04a; color: #3b2a00; font-weight: 600; }
.fn-wahl .fn-an input:checked + span { background: #1f8a4c; color: #fff; font-weight: 600; }
.fn-zeile.gesperrt .fn-wahl label { cursor: default; }
@media (max-width: 700px) { .fn-zeile { flex-direction: column; align-items: stretch; } .fn-wahl { align-self: flex-start; } }
.fn-link { font-size: .84rem; margin-top: .15rem; }

/* Vorführinstanz (config 'demo') */
.demo-schild { background: #fff4c2; color: #5a4400; border-bottom: 1px solid #e6cf6e; padding: .35rem 1rem; font-size: .9rem; text-align: center; }
