/* ============================================================
   Gerätewartung – Feuerwehr
   ------------------------------------------------------------
   Gestaltung abgeleitet aus der Formensprache deutscher
   Feuerwehrtechnik:
     · RAL 3000 Feuerrot + RAL 7016 Anthrazitgrau
       (Lackierung moderner Lösch- und Hilfeleistungsfahrzeuge)
     · schmallaufende Versalien wie die Fahrzeugbeschriftung
     · Warnmarkierung nach DIN 30710 als Signaturelement
     · Statustafel-Optik für das Lagebild
   Keine externen Schriften oder Bibliotheken.
   ============================================================ */

:root {
    /* Flächen */
    --papier:        #f1f2f3;   /* RAL 9002 Grauweiß */
    --weiss:         #ffffff;
    --rand:          #dcdfe2;
    --rand-stark:    #bcc2c8;

    /* Institutionsfarben */
    --rot:           #a6231c;   /* RAL 3000 Feuerrot */
    --rot-hell:      #c33127;
    --rot-tief:      #7d1a15;
    --anthrazit:     #2f3438;   /* RAL 7016 Anthrazitgrau */
    --anthrazit-2:   #3d444a;
    --anthrazit-3:   #545c63;

    /* Text */
    --text:          #1c2124;
    --text-leise:    #626b73;
    --text-invers:   #f4f5f6;

    /* Statusfarben */
    --io-bg:      #e4f0e8;  --io-tx:      #1c6b3d;  --io-kant:      #2f9159;
    --dem-bg:     #fbeed4;  --dem-tx:     #7d5100;  --dem-kant:     #d79512;
    --offen-bg:   #e5e9ec;  --offen-tx:   #4a545c;  --offen-kant:   #78838c;
    --faellig-bg: #f8e0de;  --faellig-tx: #94201a;

    /* Form */
    --radius:     4px;
    --radius-gr:  6px;
    --schatten:   0 1px 2px rgba(28, 33, 36, .07), 0 2px 6px rgba(28, 33, 36, .05);
    --schatten-h: 0 2px 4px rgba(28, 33, 36, .10), 0 6px 16px rgba(28, 33, 36, .08);

    /* Schrift */
    --schrift-text: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --schrift-eng:  "Arial Narrow", "Liberation Sans Narrow", "Roboto Condensed",
                    "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--schrift-text);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--papier);
}

/* Schmallaufende Versalien – die "Fahrzeugbeschriftung" der Oberfläche */
h1, h2,
.marke-text,
.nav a,
.btn,
.badge,
.tabelle th,
.kennzahl-label,
.eyebrow {
    font-family: var(--schrift-eng);
    font-stretch: condensed;
    text-transform: uppercase;
    letter-spacing: .045em;
}

h1 { font-size: 1.6rem; font-weight: 700; margin: 0; line-height: 1.15; }
h2 {
    font-size: 1rem; font-weight: 700; margin: 0 0 .9rem;
    color: var(--anthrazit);
    display: flex; align-items: center; gap: .55rem;
}
/* Rote Marke vor jeder Abschnittsüberschrift – Ordnungszeichen, keine Deko */
h2::before {
    content: "";
    width: 3px; height: 1em;
    background: var(--rot);
    border-radius: 1px;
    flex: none;
}

a { color: var(--rot-tief); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--rot); }

/* Zahlen in Tabellen und Kennzahlen laufen auf gleicher Breite */
.tabelle, .kennzahl-wert, .datenliste dd { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------
   Sprunglink (Tastaturbedienung)
   ------------------------------------------------------------ */
.sprunglink {
    position: absolute; left: -9999px;
    background: var(--weiss); color: var(--rot-tief);
    padding: .6rem 1rem; z-index: 100;
    border-radius: 0 0 var(--radius) 0; font-weight: 600;
}
.sprunglink:focus { left: 0; top: 0; }

/* ------------------------------------------------------------
   Kopfleiste
   ------------------------------------------------------------ */
.topbar {
    background: var(--anthrazit);
    color: var(--text-invers);
}
.topbar-inner {
    max-width: 1180px; margin: 0 auto;
    padding: .7rem 1.25rem;
    display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    min-height: 58px;
}

.marke {
    display: flex; align-items: center; gap: .7rem;
    color: #fff; text-decoration: none;
}
.marke:hover { color: #fff; }
.marke-icon {
    display: grid; place-items: center;
    width: 34px; height: 34px; flex: none;
    background: var(--rot);
    border-radius: var(--radius);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.marke-icon svg { display: block; width: 22px; height: 22px; }
.marke-text {
    font-size: 1.12rem; font-weight: 700; line-height: 1.1;
    letter-spacing: .07em;
}

.nav { display: flex; gap: .2rem; margin-right: auto; flex-wrap: wrap; }
.nav a {
    color: rgba(244, 245, 246, .72);
    text-decoration: none;
    font-size: .92rem; font-weight: 700;
    padding: .45rem .75rem;
    border-radius: var(--radius);
    border-bottom: 2px solid transparent;
}
.nav a:hover { background: var(--anthrazit-2); color: #fff; }
.nav-aktiv {
    color: #fff !important;
    background: var(--anthrazit-2);
    border-bottom-color: var(--rot);
}

.nav-benutzer { display: flex; align-items: center; gap: .8rem; }
.benutzer-name {
    color: rgba(244, 245, 246, .68);
    font-size: .82rem;
    padding-right: .8rem;
    border-right: 1px solid var(--anthrazit-3);
}

/* Kopfleisten-Schaltflächen heben sich vom dunklen Grund ab */
.topbar .btn {
    background: transparent; color: rgba(244, 245, 246, .9);
    border-color: var(--anthrazit-3);
}
.topbar .btn:hover { background: var(--anthrazit-2); color: #fff; border-color: var(--anthrazit-3); }

/* ------------------------------------------------------------
   SIGNATUR: Warnmarkierung nach DIN 30710
   Die rot-weiße Schrägmarkierung vom Heck jedes Einsatzfahrzeugs.
   Einmal unter der Kopfleiste – und dort wieder, wo tatsächlich
   gewarnt wird (unwiderrufliche Aktionen).
   ------------------------------------------------------------ */
.warnmarkierung {
    height: 7px;
    background: repeating-linear-gradient(
        115deg,
        var(--rot) 0 15px,
        #f7f7f7 15px 30px
    );
    border-bottom: 1px solid rgba(0, 0, 0, .12);
}

/* ------------------------------------------------------------
   Grundlayout
   ------------------------------------------------------------ */
.inhalt {
    max-width: 1180px;
    margin: 1.75rem auto;
    padding: 0 1.25rem;
    display: flex; flex-direction: column; gap: 1.25rem;
}

.kopfzeile {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    padding-bottom: .35rem;
}
.aktionen { display: flex; gap: .5rem; flex-wrap: wrap; }

.karte {
    background: var(--weiss);
    border: 1px solid var(--rand);
    border-radius: var(--radius-gr);
    box-shadow: var(--schatten);
    padding: 1.15rem 1.3rem 1.25rem;
    overflow-x: auto;
}
.karte-schmal {
    max-width: 430px; margin: 3rem auto;
    padding: 1.6rem 1.6rem 1.7rem;
    box-shadow: var(--schatten-h);
    border-top: 3px solid var(--rot);
}
/* Gefahrenbereich: dieselbe Warnmarkierung wie am Fahrzeugheck */
.karte-gefahr {
    border-color: #e3bdb9;
    position: relative;
    padding-top: 1.4rem;
}
.karte-gefahr::before {
    content: "";
    position: absolute; inset: 0 0 auto 0; height: 6px;
    border-radius: var(--radius-gr) var(--radius-gr) 0 0;
    background: repeating-linear-gradient(115deg, var(--rot) 0 13px, #f7f7f7 13px 26px);
}

.fusszeile {
    max-width: 1180px; margin: 2.5rem auto 2rem; padding: 1rem 1.25rem 0;
    color: var(--text-leise); font-size: .8rem;
    border-top: 1px solid var(--rand);
}

/* ------------------------------------------------------------
   Statustafel (Kennzahlen)
   Ein zusammenhängendes Anthrazit-Feld statt vier lose Kacheln –
   das Lagebild auf einen Blick, wie die Tafel im Gerätehaus.
   ------------------------------------------------------------ */
.kennzahlen {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--anthrazit-3);
    border: 1px solid var(--anthrazit);
    border-radius: var(--radius-gr);
    overflow: hidden;
    box-shadow: var(--schatten);
}
.kennzahl {
    background: var(--anthrazit);
    padding: .95rem 1.1rem 1rem;
    display: flex; flex-direction: column; gap: .1rem;
    position: relative;
}
/* Farbiger Statusbalken je Feld */
.kennzahl::before {
    content: "";
    position: absolute; inset: 0 auto 0 0; width: 4px;
    background: var(--offen-kant);
}
.kennzahl-wert {
    font-size: 2.1rem; font-weight: 700; line-height: 1;
    color: #fff; letter-spacing: -.01em;
}
.kennzahl-label {
    color: rgba(244, 245, 246, .62);
    font-size: .82rem; font-weight: 700;
}
.kennzahl.st-faellig::before    { background: #e4564a; }
.kennzahl.st-offen::before      { background: var(--offen-kant); }
.kennzahl.st-demnaechst::before { background: var(--dem-kant); }
.kennzahl.st-io::before         { background: var(--io-kant); }
.kennzahl.st-faellig .kennzahl-wert { color: #ff8b80; }

/* ------------------------------------------------------------
   Tabellen
   ------------------------------------------------------------ */
.tabelle { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tabelle th, .tabelle td {
    text-align: left; padding: .6rem .65rem;
    border-bottom: 1px solid var(--rand);
    vertical-align: top;
}
.tabelle th {
    font-size: .78rem; font-weight: 700;
    color: var(--anthrazit-3);
    background: #f7f8f9;
    border-bottom: 2px solid var(--rand-stark);
    white-space: nowrap;
}
.tabelle tbody tr:hover { background: #f7f8f9; }
.tabelle tbody tr:last-child td { border-bottom: none; }
.tabelle a { font-weight: 600; }
.tabelle-fuss {
    margin: .75rem 0 0; color: var(--text-leise); font-size: .8rem;
    font-family: var(--schrift-eng); text-transform: uppercase; letter-spacing: .04em;
}
.tabelle-plan td { vertical-align: middle; }
.tabelle-plan input[type=number] { width: 8rem; }

/* ------------------------------------------------------------
   Statuskennzeichnung
   ------------------------------------------------------------ */
.badge {
    display: inline-block;
    padding: .16rem .55rem .18rem;
    border-radius: 3px;
    font-size: .76rem; font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge.st-io         { background: var(--io-bg);      color: var(--io-tx);      border-color: #bcdcc8; }
.badge.st-demnaechst { background: var(--dem-bg);     color: var(--dem-tx);     border-color: #ecd3a0; }
.badge.st-offen      { background: var(--offen-bg);   color: var(--offen-tx);   border-color: #ccd3d8; }
.badge.st-faellig    { background: var(--faellig-bg); color: var(--faellig-tx); border-color: #e6b5b0; }
.badge.st-neutral,
.badge.st-ausgemustert { background: var(--offen-bg); color: var(--offen-tx); border-color: #ccd3d8; }

/* ------------------------------------------------------------
   Formulare
   ------------------------------------------------------------ */
.formular { display: flex; flex-direction: column; gap: 1rem; }
.formular label {
    display: flex; flex-direction: column; gap: .35rem;
    font-size: .85rem; font-weight: 600; color: var(--anthrazit-2);
}
.formular input[type=text],
.formular input[type=password],
.formular input[type=date],
.formular input[type=number],
.formular input[type=search],
.formular input[type=file],
.formular select,
.formular textarea {
    font: inherit; font-size: .95rem; font-weight: 400; color: var(--text);
    padding: .55rem .65rem;
    border: 1px solid var(--rand-stark);
    border-radius: var(--radius);
    background: var(--weiss);
    width: 100%;
}
.formular input:hover, .formular select:hover, .formular textarea:hover { border-color: var(--anthrazit-3); }
.formular textarea { resize: vertical; line-height: 1.5; }
.feldgruppe { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
/* Breite Formulare (Gerät, Benutzer) nutzen den Platz besser aus */
.formular-breit .feldgruppe { grid-template-columns: repeat(3, 1fr); }
.formular-aktionen {
    display: flex; gap: .6rem;
    padding-top: .25rem;
}
.check {
    flex-direction: row !important; align-items: center; gap: .55rem;
    font-size: .9rem; font-weight: 500; color: var(--text);
}
.check input { width: auto; accent-color: var(--rot); }

/* ------------------------------------------------------------
   Filterleiste
   ------------------------------------------------------------ */
.filter {
    display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
    background: var(--weiss);
    border: 1px solid var(--rand);
    border-left: 3px solid var(--anthrazit);
    border-radius: var(--radius-gr);
    padding: .8rem .95rem;
    box-shadow: var(--schatten);
}
.filter input[type=search],
.filter select {
    font: inherit; font-size: .92rem;
    padding: .48rem .6rem;
    border: 1px solid var(--rand-stark);
    border-radius: var(--radius);
    background: var(--weiss); color: var(--text);
}
.filter input[type=search] { min-width: 250px; flex: 1 1 250px; }
.filter .check { font-size: .86rem; }

/* ------------------------------------------------------------
   Schaltflächen
   ------------------------------------------------------------ */
.btn {
    display: inline-block; cursor: pointer;
    font-size: .86rem; font-weight: 700;
    padding: .5rem .9rem;
    border-radius: var(--radius);
    border: 1px solid var(--rand-stark);
    background: var(--weiss); color: var(--anthrazit);
    text-decoration: none; line-height: 1.25;
}
.btn:hover { background: #eceef0; color: var(--anthrazit); border-color: var(--anthrazit-3); }
.btn:active { transform: translateY(1px); }
.btn-klein { padding: .32rem .6rem; font-size: .78rem; }

.btn-primaer {
    background: var(--rot); border-color: var(--rot); color: #fff;
    box-shadow: 0 1px 2px rgba(126, 26, 21, .3);
}
.btn-primaer:hover { background: var(--rot-hell); border-color: var(--rot-hell); color: #fff; }

.btn-gefahr { color: var(--rot-tief); border-color: #ddb3ae; background: var(--weiss); }
.btn-gefahr:hover { background: var(--faellig-bg); color: var(--rot-tief); border-color: #cf9a94; }

/* ------------------------------------------------------------
   Datenliste (Gerätedetail)
   ------------------------------------------------------------ */
.datenliste {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 0 2rem; margin: 0;
}
.datenliste > div {
    display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
    padding: .5rem 0;
    border-bottom: 1px dotted var(--rand-stark);
}
.datenliste dt {
    color: var(--text-leise); font-size: .85rem;
    white-space: nowrap;
}
.datenliste dd { margin: 0; text-align: right; font-weight: 600; }
.bemerkung {
    margin: 1rem 0 0; padding: .7rem .9rem;
    background: #f7f8f9;
    border-left: 3px solid var(--rand-stark);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: .92rem;
}

/* ------------------------------------------------------------
   Meldungen und Kleinteile
   ------------------------------------------------------------ */
.flash {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    border-left-width: 4px;
    font-size: .92rem; font-weight: 500;
}
.flash-ok     { background: var(--io-bg);      color: var(--io-tx);      border-color: #bcdcc8; border-left-color: var(--io-kant); }
.flash-fehler { background: var(--faellig-bg); color: var(--faellig-tx); border-color: #e6b5b0; border-left-color: var(--rot); }

.hinweis { color: var(--text-leise); font-size: .88rem; margin: 0 0 .8rem; }
.hinweis code {
    background: #eceef0; padding: .05rem .3rem; border-radius: 3px;
    font-size: .88em;
}
.hinweis-inline { color: var(--text-leise); font-weight: 400; font-size: .8rem; }
.leer { color: var(--text-leise); font-style: italic; margin: 0; }
.eyebrow { font-size: .78rem; color: var(--text-leise); margin: 0 0 .2rem; }

.inline-form { display: inline-block; margin: 0; }
.zellen-aktionen { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.pw-form { margin-top: .4rem; display: flex; gap: .35rem; }
.pw-form input {
    padding: .3rem .5rem; font: inherit; font-size: .85rem;
    border: 1px solid var(--rand-stark); border-radius: var(--radius);
}
.dropdown summary { list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }

/* ------------------------------------------------------------
   Tastaturbedienung
   ------------------------------------------------------------ */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 2px solid var(--rot);
    outline-offset: 2px;
    border-radius: 2px;
}
.topbar a:focus-visible { outline-color: #fff; }

/* ------------------------------------------------------------
   Kleinere Bildschirme
   ------------------------------------------------------------ */
@media (max-width: 1020px) {
    .formular-breit .feldgruppe { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
    .kennzahlen { grid-template-columns: repeat(2, 1fr); }
    .feldgruppe,
    .formular-breit .feldgruppe { grid-template-columns: 1fr; }
    .datenliste { grid-template-columns: 1fr; }
    .topbar-inner { gap: .8rem; }
    .benutzer-name { border-right: none; padding-right: 0; }
    h1 { font-size: 1.35rem; }
}

@media (max-width: 520px) {
    .kennzahl-wert { font-size: 1.7rem; }
    .filter input[type=search] { min-width: 100%; }
    .inhalt { margin: 1.25rem auto; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation: none !important; transition: none !important; }
    .btn:active { transform: none; }
}

/* ------------------------------------------------------------
   Druck – Prüfnachweis auf Papier
   ------------------------------------------------------------ */
@media print {
    body { background: #fff; font-size: 11pt; }
    .topbar, .warnmarkierung, .nav, .nav-benutzer, .filter,
    .btn, .aktionen, .karte-gefahr, .fusszeile, .sprunglink { display: none !important; }
    .inhalt { margin: 0; padding: 0; max-width: none; gap: 1rem; }
    .karte {
        border: 1px solid #999; box-shadow: none; break-inside: avoid;
        padding: .6rem .8rem;
    }
    .kennzahlen { border: 1px solid #999; }
    .kennzahl { background: #fff; }
    .kennzahl-wert { color: #000; }
    .kennzahl-label { color: #333; }
    .badge { border: 1px solid #666; background: #fff !important; color: #000 !important; }
    .tabelle th { background: #eee; }
    a { color: #000; text-decoration: none; }
}
