/*
 * Wartungssystem – eigenes, schlankes Stylesheet (PRD 12.1).
 * Systemschrift, keine Webfonts/CDNs. Branding über CSS-Custom-Properties
 * (--farbe-haupt/--farbe-akzent, im <head> gesetzt). Signalfarben fix.
 */

:root {
    --farbe-haupt: #1F3864;
    --farbe-akzent: #2E5496;

    /* Feste Signalfarben (nicht durch Branding überschreibbar) */
    --rot: #b3261e;
    --rot-bg: #fdecea;
    --orange: #9a6700;
    --orange-bg: #fff4d6;
    --gruen: #1b7f4b;
    --gruen-bg: #e7f5ec;
    --grau: #5f6b7a;

    --text: #1c2430;
    --text-schwach: #5f6b7a;
    --rahmen: #d4d9e0;
    --flaeche: #ffffff;
    --flaeche-2: #f4f6f9;
    --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--flaeche-2);
}

a { color: var(--farbe-akzent); }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }

/* ---------- Kopf / Navigation ---------- */
.kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--farbe-haupt);
    color: #fff;
    padding: .6rem 1.25rem;
    flex-wrap: wrap;
}
.marke { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; }
.marke:hover { text-decoration: none; }
.logo { max-height: 40px; width: auto; background: #fff; padding: 2px; border-radius: 4px; }
.firmenname { font-weight: 600; font-size: 1.1rem; }

.benutzer-menue { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.benutzer-menue a { color: #fff; }
.benutzer-name { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.rolle-kennung { font-size: .75rem; opacity: .8; }

.haupt-nav { background: var(--flaeche); border-bottom: 1px solid var(--rahmen); }
.haupt-nav ul { list-style: none; margin: 0; padding: 0 1rem; display: flex; flex-wrap: wrap; }
.haupt-nav a {
    display: block;
    padding: .7rem 1rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 3px solid transparent;
}
.haupt-nav a:hover { background: var(--flaeche-2); text-decoration: none; }
.haupt-nav a.aktiv { border-bottom-color: var(--farbe-akzent); font-weight: 600; color: var(--farbe-haupt); }

/* ---------- Layout ---------- */
.inhalt { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
body.oeffentlich .inhalt { max-width: 480px; margin-top: 3rem; }

.fuss {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    color: var(--text-schwach);
    font-size: .8rem;
    border-top: 1px solid var(--rahmen);
}

.seiten-kopf { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.kopf-aktionen { display: flex; gap: .5rem; flex-wrap: wrap; }
.brotkrume { color: var(--text-schwach); font-size: .85rem; margin-bottom: .5rem; }

.block { margin: 1.5rem 0; }
.block-kopf { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.karte { background: var(--flaeche); border: 1px solid var(--rahmen); border-radius: var(--radius); padding: 1.25rem; }
.karte.schmal { max-width: 460px; margin: 0 auto; }

/* ---------- Flash / Meldungen ---------- */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.flash-erfolg { background: var(--gruen-bg); border-color: var(--gruen); color: #14562f; }
.flash-fehler { background: var(--rot-bg); border-color: var(--rot); color: #7a1a15; }
.flash-warnung { background: var(--orange-bg); border-color: var(--orange); color: #6b4a00; }
.flash-info { background: #e8eef7; border-color: var(--farbe-akzent); color: #223; }

/* ---------- Kacheln ---------- */
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kachel { display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem 1.25rem; background: var(--flaeche); border: 1px solid var(--rahmen); border-left: 5px solid var(--farbe-akzent); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.kachel:hover { text-decoration: none; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.kachel-zahl { font-size: 2rem; font-weight: 700; color: var(--farbe-haupt); }
.kachel-label { color: var(--text-schwach); font-size: .9rem; }
.kachel-orange { border-left-color: var(--orange); }
.kachel-orange .kachel-zahl { color: var(--orange); }
.kachel-rot { border-left-color: var(--rot); }
.kachel-rot .kachel-zahl { color: var(--rot); }

/* ---------- Tabellen ---------- */
.tabelle-wrap { overflow-x: auto; border: 1px solid var(--rahmen); border-radius: var(--radius); background: var(--flaeche); }
.tabelle { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabelle th, .tabelle td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--rahmen); vertical-align: top; }
.tabelle thead th { background: var(--flaeche-2); white-space: nowrap; position: sticky; top: 0; }
.tabelle tbody tr:hover { background: #fafbfd; }
.sortier-kopf { color: var(--text); text-decoration: none; white-space: nowrap; }
.sortier-kopf:hover { text-decoration: underline; }
.aktionen { white-space: nowrap; }
.aktionen a, .aktionen .btn-link { margin-right: .5rem; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .82rem; }
.zelle-rot { color: var(--rot); font-weight: 600; }
.details-zelle { max-width: 380px; overflow-wrap: anywhere; font-size: .82rem; color: var(--text-schwach); }
.zeile-fehler { background: var(--rot-bg); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-gruen { background: var(--gruen-bg); color: #14562f; }
.badge-rot { background: var(--rot-bg); color: #7a1a15; }
.badge-orange { background: var(--orange-bg); color: #6b4a00; }
.badge-grau { background: #e7ebf0; color: var(--grau); }

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: .5rem .9rem; border: 1px solid var(--rahmen); background: var(--flaeche); color: var(--text); border-radius: var(--radius); cursor: pointer; text-decoration: none; font-size: .9rem; line-height: 1.2; }
.btn:hover { background: var(--flaeche-2); text-decoration: none; }
.btn-haupt { background: var(--farbe-akzent); border-color: var(--farbe-akzent); color: #fff; }
.btn-haupt:hover { background: var(--farbe-haupt); }
.btn-gefahr { background: var(--rot); border-color: var(--rot); color: #fff; }
.btn-gefahr:hover { background: #8f1e17; }
.btn-klein { padding: .3rem .6rem; font-size: .82rem; }
.btn-inaktiv { opacity: .55; pointer-events: none; }
.btn-link { background: none; border: none; color: var(--farbe-akzent); cursor: pointer; padding: 0; font: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-link.btn-gefahr { background: none; color: var(--rot); }
.btn-link.btn-inaktiv { color: var(--text-schwach); }

/* ---------- Formulare ---------- */
.formular .feld, .feld { margin-bottom: 1rem; }
.feld label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.feld input[type=text], .feld input[type=email], .feld input[type=password], .feld input[type=number],
.feld input[type=search], .feld input[type=file], .feld select, .feld textarea,
.filter-leiste input, .filter-leiste select, .formular-inline input, .formular-inline select {
    width: 100%;
    padding: .5rem .6rem;
    border: 1px solid var(--rahmen);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}
.feld textarea { resize: vertical; }
.feld .readonly, input.readonly { background: var(--flaeche-2); color: var(--text-schwach); }
.feld-gruppe { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.feld-fehler input, .feld-fehler select, .feld-fehler textarea { border-color: var(--rot); }
.feld-meldung { display: block; color: var(--rot); font-size: .82rem; margin-top: .25rem; }
.hinweis-inline { font-weight: 400; color: var(--text-schwach); font-size: .82rem; }
.hinweis { color: var(--text-schwach); font-size: .85rem; }
.hinweis-liste { color: var(--text-schwach); font-size: .88rem; }
.formular-aktionen { display: flex; gap: .5rem; margin-top: 1rem; }
.formular-inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.formular-inline input, .formular-inline select { width: auto; flex: 1 1 160px; }
.filter-leiste { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filter-leiste input, .filter-leiste select { width: auto; flex: 0 1 auto; }
.inline-form { display: inline; }
.schnellwahl { display: inline-flex; gap: .3rem; margin-top: .4rem; }
.checkbox-zeile { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; margin: .5rem 0; }
.checkbox-zeile input { margin-top: .2rem; }
.farb-eingabe { display: flex; gap: .5rem; align-items: center; }
.farb-eingabe input[type=color] { width: 44px; height: 38px; padding: 2px; flex: 0 0 auto; }
.auswahl-suche { margin-bottom: .4rem; }
.pw-staerke { display: block; font-size: .8rem; margin-top: .25rem; color: var(--text-schwach); }

/* ---------- Datenliste ---------- */
.datenliste { display: grid; grid-template-columns: 220px 1fr; gap: .4rem 1rem; margin: 0; }
.datenliste dt { font-weight: 600; color: var(--text-schwach); }
.datenliste dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Dialoge (native details) ---------- */
.aktions-reihe { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-start; }
.aktion-dialog { display: inline-block; }
.aktion-dialog > summary { list-style: none; }
.aktion-dialog > summary::-webkit-details-marker { display: none; }
.dialog-form { margin-top: .5rem; padding: .75rem; border: 1px solid var(--rahmen); border-radius: var(--radius); background: var(--flaeche); display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.dialog-form input { width: auto; }

/* ---------- Gefahrenbereich ---------- */
.gefahrenbereich { margin-top: 2.5rem; padding: 1.25rem; border: 2px solid var(--rot); border-radius: var(--radius); background: var(--rot-bg); }
.gefahrenbereich h2 { color: var(--rot); }

/* ---------- Sonstiges ---------- */
.leer { color: var(--text-schwach); padding: 1rem 0; }
.pre-block { background: var(--flaeche-2); border: 1px solid var(--rahmen); border-radius: var(--radius); padding: .75rem; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .82rem; }
.changelog { max-height: 480px; overflow-y: auto; }
.summe-liste { list-style: none; padding: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.text-rot { color: var(--rot); }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }
.pagi-info { color: var(--text-schwach); font-size: .85rem; }
.logo-vorschau img { max-height: 80px; background: #fff; border: 1px solid var(--rahmen); padding: 4px; border-radius: 4px; }
.fehlerseite { text-align: center; }
.fehler-details { text-align: left; }

@media (max-width: 720px) {
    .feld-gruppe { grid-template-columns: 1fr; }
    .datenliste { grid-template-columns: 1fr; }
    .datenliste dt { margin-top: .5rem; }
}
