/* deft LAB – Gestaltung wie deft FIT. Schrift Montserrat lokal (OFL, siehe fonts/OFL.txt). */
@font-face {
  font-family: "Montserrat";
  src: url("fonts/Montserrat-Variable.ef2306ad45ba.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --grund: #f1f1f1;
  --flaeche: #ffffff;
  --flaeche-2: #f7f7f7;
  --text: #141414;
  --leise: #666666;
  --linie: #dcdcdc;
  --akzent: #8cc63f;
  --akzent-dunkel: #4b8a17;
  --akzent-text: #ffffff;
  --link: #4b8a17;
  --ok: #3b861a;
  --warn: #a86f00;
  --fehler: #b3261e;
  --ok-grund: #e6f2dc;
  --warn-grund: #fbf0d9;
  --fehler-grund: #f8e1df;
  --neutral-grund: #ececec;
  --marke-lab: #8a8a8a;
  --schatten: 0 1px 2px rgba(0, 0, 0, .06);
  --radius: 8px;
  --balken-farbe: #4b8a17;  /* geprüft gegen #ffffff: Helligkeit, Sättigung, Kontrast */
}
:root[data-modus="dunkel"] {
  color-scheme: dark;
  --grund: #121212;
  --flaeche: #1d1d1d;
  --flaeche-2: #252525;
  --text: #ededed;
  --leise: #a3a3a3;
  --linie: #363636;
  --akzent: #8cc63f;
  --akzent-dunkel: #4b8a17;
  --link: #9fd35a;
  --ok: #7cc25a;
  --warn: #e0a83a;
  --fehler: #f08a80;
  --ok-grund: #1f3315;
  --warn-grund: #3a2c0f;
  --fehler-grund: #3d1a17;
  --neutral-grund: #2c2c2c;
  --marke-lab: #9a9a9a;
  --schatten: none;
  --balken-farbe: #6ea52c;  /* geprüft gegen #1d1d1d */
}

* { box-sizing: border-box; }
html { font-size: 16px; scrollbar-gutter: stable; }  /* Platz für die Bildlaufleiste immer reserviert: nichts springt beim Seitenwechsel */
body { margin: 0; font-family: "Montserrat", system-ui, sans-serif; background: var(--grund); color: var(--text); line-height: 1.5; }
a { color: var(--link); }
h1 { font-size: 1.45rem; font-weight: 700; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin: 1.6rem 0 .6rem; }

/* Kopf mit Schriftzug: „deft“ schwarz, „LAB“ grau */
/* Eine gemeinsame, zentrierte Breite für Kopf, Menü und Inhalt auf allen Seiten; nur die Pipeline-Spalten dürfen breiter sein */
body { --breite: 1200px; }
.kopf { background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.kopf-innen { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; max-width: var(--breite); margin: 0 auto; padding: .5rem 1rem; box-sizing: border-box; }
.kopf a { color: var(--text); text-decoration: none; }
.marke { font-size: 1.4rem; font-weight: 700; letter-spacing: -.01em; }
.marke .lab { color: var(--marke-lab); font-weight: 600; }
/* Menü in eigener Zeile unter Schriftzug und Konto: passt so auf jede Breite, ohne sich in eine schmale Spalte zu quetschen */
.hauptnav { display: flex; flex-wrap: wrap; gap: .1rem; order: 3; flex-basis: 100%; margin: 0 -.75rem; }
.hauptnav a { padding: .55rem .75rem; border-radius: var(--radius); font-weight: 500; border-bottom: 3px solid transparent; }
.hauptnav a:hover { background: var(--flaeche-2); }
.hauptnav a.aktiv { border-bottom-color: var(--akzent); font-weight: 600; }
.konto { display: flex; align-items: center; gap: .7rem; margin-left: auto; }
.konto form { margin: 0; }
button.link { background: none; border: 0; color: var(--leise); font: inherit; cursor: pointer; padding: .55rem 0; text-decoration: underline; min-height: 0; }
button.modus { min-height: 38px; padding: .3rem .6rem; font-weight: 500; }
.hinweis-prototyp { background: var(--warn-grund); color: var(--warn); text-align: center; font-size: .8rem; padding: .2rem; }
.hinweis-sicherung { background: var(--fehler-grund); color: var(--fehler); text-align: center; font-size: .85rem; padding: .3rem 1rem; }
.hinweis-sicherung a { color: inherit; font-weight: 600; }

main { max-width: var(--breite); margin: 0 auto; padding: 1rem; box-sizing: border-box; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--schatten); }
.karte.schmal { max-width: 440px; margin: 2rem auto; }

/* Formulare */
form p, label { display: block; margin: 0 0 .9rem; }
label, .feld > label { font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=tel], input[type=datetime-local], select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .6rem .7rem; font: inherit; font-weight: 400; color: var(--text);
  border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); min-height: 46px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent); outline-offset: 0; border-color: var(--akzent); }
textarea { min-height: 90px; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; vertical-align: middle; margin-right: .4rem; accent-color: var(--akzent-dunkel); }
input[type=file] { display: block; margin-top: .4rem; font: inherit; }
.feld { margin-bottom: 1rem; }
.feld .hilfe, .hilfe { display: block; color: var(--leise); font-size: .85rem; font-weight: 400; }
.feld .errorlist, .errorlist { color: var(--fehler); margin: .2rem 0; padding-left: 1.1rem; }
.felder-zwei { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 1.2rem; }
.feld.breit { grid-column: 1 / -1; }
.auswahl-reihe { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin-top: .3rem; font-weight: 400; }
.auswahl-reihe label { font-weight: 400; margin: 0; }
.mit-knopf { display: flex; gap: .5rem; align-items: flex-end; }
.mit-knopf select { flex: 1; }

button, .knopf {
  display: inline-block; min-height: 46px; padding: .6rem 1.1rem; font: inherit; font-weight: 600;
  border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); color: var(--text);
  cursor: pointer; text-decoration: none; text-align: center;
}
button:hover, .knopf:hover { border-color: var(--leise); }
button.haupt, .knopf.haupt { background: var(--akzent-dunkel); color: var(--akzent-text); border-color: var(--akzent-dunkel); }
button.haupt:hover, .knopf.haupt:hover { filter: brightness(1.08); }
button.gefahr, .knopf.gefahr { color: var(--fehler); border-color: var(--fehler); }
button:disabled { opacity: .45; cursor: not-allowed; }
.knopfleiste { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; align-items: center; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; background: var(--flaeche); }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: .8rem; color: var(--leise); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.zahl, th.zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.klickbar { cursor: pointer; }
tr.klickbar:hover { background: var(--flaeche-2); }
tr.summe td { font-weight: 700; border-top: 2px solid var(--linie); }
.tabelle-rahmen { overflow-x: auto; border: 1px solid var(--linie); border-radius: var(--radius); }
table.positionen td { vertical-align: middle; }
table.positionen textarea { min-width: 16rem; }
table.positionen input[type=number] { width: 8.5rem; text-align: right; }
table.positionen tfoot th { font-size: 1rem; color: var(--text); text-transform: none; }

dl.angaben { display: grid; grid-template-columns: minmax(150px, max-content) 1fr; gap: .35rem 1rem; margin: 0; }
dl.angaben dt { color: var(--leise); }
dl.angaben dd { margin: 0; white-space: pre-line; }

/* Status */
.status { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--neutral-grund); white-space: nowrap; }
.status.gut { background: var(--ok-grund); color: var(--ok); }
.status.seite { background: var(--fehler-grund); color: var(--fehler); }
.status.warn { background: var(--warn-grund); color: var(--warn); }
.nummer { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 600; white-space: nowrap; }
.ohne-nummer { color: var(--leise); font-style: italic; }
.statusweg { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0 .8rem; padding: 0; list-style: none; }
.statusweg li { padding: .25rem .6rem; border-radius: 999px; background: var(--neutral-grund); color: var(--leise); font-size: .8rem; }
.statusweg li.erledigt { background: var(--ok-grund); color: var(--ok); }
.statusweg li.aktuell { background: var(--akzent-dunkel); color: #fff; font-weight: 600; }
.fehlt { background: var(--warn-grund); border: 1px solid var(--warn); border-radius: var(--radius); padding: .6rem .9rem; margin: .5rem 0; color: var(--text); }
.fehlt ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.unvollstaendig, .warn-text { color: var(--warn); font-size: .85rem; }
.ueberfaellig { color: var(--fehler); font-weight: 600; }

.meldungen { list-style: none; padding: 0; margin: 0 0 1rem; }
.meldungen li { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .4rem; background: var(--neutral-grund); }
.meldungen li.success { background: var(--ok-grund); color: var(--ok); }
.meldungen li.error { background: var(--fehler-grund); color: var(--fehler); }
.meldungen li.warning { background: var(--warn-grund); color: var(--warn); }
p.fehler { color: var(--fehler); }
.leise { color: var(--leise); }

.reiter { display: flex; gap: .3rem; margin-bottom: .8rem; flex-wrap: wrap; }
.reiter a { padding: .45rem .85rem; border-radius: var(--radius); border: 1px solid var(--linie); background: var(--flaeche); text-decoration: none; color: var(--text); font-weight: 500; }
.reiter a.aktiv { background: var(--akzent-dunkel); color: #fff; border-color: var(--akzent-dunkel); }

.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.kachel { display: block; background: var(--flaeche); border: 1px solid var(--linie); border-left: 4px solid var(--akzent); border-radius: var(--radius); padding: .9rem 1.1rem; text-decoration: none; color: var(--text); }
.kachel:hover { border-color: var(--akzent); }
.kachel b { display: block; font-size: .95rem; font-weight: 600; color: var(--leise); margin-bottom: .2rem; }
.kachel .zahl { font-size: 1.7rem; font-weight: 700; }

.foto { max-width: 100%; max-height: 360px; border-radius: var(--radius); border: 1px solid var(--linie); }
details.audit summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }
.audit td { font-size: .85rem; }
.wechsel-form { display: inline-block; margin: 0; }
dialog { border: 1px solid var(--linie); border-radius: var(--radius); max-width: 560px; width: 94%; background: var(--flaeche); color: var(--text); padding: 1.2rem; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }

/* Verlauf */
.verlauf { list-style: none; padding: 0; margin: 0; }
.verlauf li { border-left: 3px solid var(--linie); padding: .3rem 0 .6rem .9rem; margin-left: .3rem; }
.verlauf li .kopfzeile { font-size: .85rem; color: var(--leise); }
.verlauf li.anruf { border-left-color: var(--akzent); }
.verlauf li.mail { border-left-color: #6b8fb3; }
.verlauf li.besuch { border-left-color: var(--warn); }

/* Wiedervorlagen */
.kopf-mit-knopf { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.wv-liste { list-style: none; padding: 0; margin: 0; }
.wv-liste li.wv { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; border-left: 4px solid var(--linie); padding: .5rem .2rem .5rem .8rem; margin: .4rem 0; }
.wv-liste li.wv .kopfzeile { font-size: .85rem; color: var(--leise); }
.wv-liste li.heute { border-left-color: var(--akzent); }
.wv-liste li.ueberfaellig-wv { border-left-color: var(--fehler); }
.wv-liste li.erledigt { opacity: .6; }
.wv-knoepfe { display: flex; gap: .4rem; align-items: center; }
.wv-knoepfe form { margin: 0; }

/* Kanban */
/* Pipeline-Spalten: bis 1600 px breit, über die Inhaltsbreite hinaus, aber zur Seitenmitte zentriert (ohne transform, damit das Ziehen stimmt) */
.board-rahmen { --board-max: min(1600px, 100vw - 3rem); width: var(--board-max); margin-left: calc((100% - var(--board-max)) / 2); display: flex; justify-content: center; }
.board { display: flex; gap: .8rem; overflow-x: auto; padding-bottom: .8rem; align-items: flex-start; }
.board-rahmen .board { min-width: 0; max-width: 100%; }
.spalte { flex: 0 0 250px; background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: var(--radius); padding: .5rem; min-height: 200px; }
.spalte.seite { background: var(--fehler-grund); }
.spalte h3 { font-size: .85rem; margin: .2rem .2rem .5rem; display: flex; justify-content: space-between; gap: .4rem; }
.spalte h3 .summe { color: var(--leise); font-weight: 500; }
.spalte.ziel-ok { outline: 3px solid var(--akzent); }
.spalte.ziel-hier { background: var(--ok-grund); }
.spalte.ziel-hier:not(.ziel-ok) { background: var(--fehler-grund); }
.karte-k:focus-visible { outline: 2px solid var(--akzent); }
.karte-fehler { margin-top: .4rem; font-size: .8rem; background: var(--warn-grund); border: 1px solid var(--warn); border-radius: 6px; padding: .3rem .5rem; color: var(--text); }
.karte-fehler ul { margin: .2rem 0 0; padding-left: 1rem; }
.klein { font-size: .8rem; }
.karte-k { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .55rem .65rem; margin-bottom: .5rem; cursor: grab; touch-action: none; user-select: none; box-shadow: var(--schatten); }
.karte-k .nummer { font-size: .8rem; }
.karte-k .firma { font-weight: 600; display: block; margin: .1rem 0; }
.karte-k .zeile { font-size: .8rem; color: var(--leise); display: flex; justify-content: space-between; gap: .4rem; }
.karte-k.zieht { position: fixed; z-index: 50; pointer-events: none; opacity: .9; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: grabbing; }
.karte-k.zurueck { animation: wackeln .4s; border-color: var(--fehler); }
@keyframes wackeln { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Forecast */
.balken-liste { margin: .4rem 0; }
.balken-zeile { display: grid; grid-template-columns: minmax(110px, 180px) 1fr 110px; gap: .6rem; align-items: center; padding: .2rem .3rem; border-radius: 4px; font-size: .9rem; }
.balken-zeile:hover { background: var(--flaeche-2); }
.balken-zeile .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.balken-spur { display: block; border-left: 1px solid var(--linie); }
.balken { display: block; height: 16px; background: var(--balken-farbe); border-radius: 0 4px 4px 0; min-width: 2px; }
.auswertungen { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 1rem; }
/* schmale Karten: Name und Betrag in einer Zeile, Balken darunter über die volle Breite */
.auswertungen .balken-zeile { grid-template-columns: 1fr auto; row-gap: .2rem; }
.auswertungen .balken-spur { grid-column: 1 / -1; grid-row: 2; }
/* Sparten nebeneinander (Forecast „Alle“): kleine Diagramme im selben Maßstab, Kreuztabellen ohne Summe */
.nebeneinander { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .4rem 1.2rem; }
.nebeneinander h3 { margin: .4rem 0 .2rem; font-size: 1rem; }
.nebeneinander .balken-zeile { grid-template-columns: 1fr auto; row-gap: .2rem; }
.nebeneinander .balken-spur { grid-column: 1 / -1; grid-row: 2; }
.kreuz-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)); gap: 0 1rem; }
table.je-sparte tbody th[scope="row"] { font-size: inherit; color: var(--text); font-weight: 500; text-transform: none; letter-spacing: normal; text-align: left; }
table.je-sparte td.zahl, table.je-sparte th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Sparten-Umschalter über Pipeline und Forecast */
.umschalter { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: 0 0 .7rem; }
.umschalter .leise { margin-right: .3rem; font-size: .9rem; }
.umschalter a { padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--linie); background: var(--flaeche); text-decoration: none; color: var(--text); font-size: .9rem; }
.umschalter a:hover { border-color: var(--akzent); }
.umschalter a.aktiv { border-color: var(--akzent-dunkel); background: var(--flaeche-2); font-weight: 600; box-shadow: inset 0 -2px 0 var(--akzent-dunkel); }
.sparte-marke { font-size: .72rem; padding: 0 .4rem; border-radius: 999px; border: 1px solid var(--linie); color: var(--leise); white-space: nowrap; }
.filterzeile { display: flex; gap: .8rem; align-items: center; margin: 1.2rem 0 .4rem; }
.filterzeile select { width: auto; margin-left: .4rem; }

@media (max-width: 640px) {
  dl.angaben { grid-template-columns: 1fr; }
  dl.angaben dt { margin-top: .4rem; }
  .balken-zeile { grid-template-columns: 100px 1fr 85px; font-size: .85rem; }
  .kreuz-raster { grid-template-columns: 1fr; }
}

/* Einkauf an Angebotspositionen (Anlagenverkauf, nur mit Befugnis „Einkauf sehen“) */
tr.einkauf td { border-top: 0; padding-top: 0; background: var(--flaeche-2); }
.einkauf-felder { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: end; }
.einkauf-felder label { display: flex; flex-direction: column; font-size: .8rem; color: var(--leise); }
.einkauf-felder input, .einkauf-felder select { width: 9rem; }
.einkauf-titel { font-size: .8rem; font-weight: 600; color: var(--leise); align-self: center; }
.einkauf-werte { margin-top: .3rem; }
tr.einkauf-summe td { font-size: .85rem; color: var(--leise); background: var(--flaeche-2); }

/* M6 Geräte (v1.3): Fälligkeit bald, kompakte Tabellen, Regelkarte */
.bald { color: var(--warn); font-weight: 600; }
table.kompakt { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.kompakt th, table.kompakt td { padding: .3rem .4rem; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: top; }
table.kompakt .zahl { text-align: right; font-variant-numeric: tabular-nums; }
ul.schlicht { list-style: none; padding: 0; margin: 0; }
ul.schlicht li { padding: .3rem 0; border-bottom: 1px solid var(--linie); }
.knopf-zelle { white-space: nowrap; text-align: right; }
.knopf-zelle form { display: inline; }
.pruefsumme { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.regelkarte { padding: .6rem 0 1rem; border-top: 1px solid var(--linie); }
.regelkarte:first-of-type { border-top: 0; }
.regelkarte-svg { width: 100%; height: auto; max-width: 900px; display: block; margin: .4rem 0; overflow: visible; }
.rk-raster { stroke: var(--linie); stroke-width: 1; }
.rk-basis { stroke: var(--leise); stroke-width: 1; }
.rk-achse { fill: var(--leise); font-size: 11px; }
.rk-grenze { stroke-width: 1.5; }
.rk-grenze.rk-eingriff { stroke: var(--fehler); }
.rk-grenze.rk-warn { stroke: var(--warn); stroke-dasharray: 6 4; }
.rk-grenze.rk-soll { stroke: var(--leise); stroke-dasharray: 2 3; }
.rk-grenztext { font-size: 11px; fill: var(--text); }
.rk-linie { fill: none; stroke: var(--balken-farbe); stroke-width: 2; stroke-linejoin: round; }
.rk-treffer { fill: transparent; }
.rk-marke { fill: var(--balken-farbe); stroke: var(--flaeche); stroke-width: 2; }
.rk-warn .rk-marke { fill: var(--warn); }
.rk-eingriff .rk-marke { fill: var(--fehler); }
.rk-punkt:hover .rk-marke { stroke: var(--text); }

/* Paket 1b: Hinweis (z. B. vorhandener Halter beim Wareneingang), Pfade auf dem Speicher in der Halle */
.hinweis { background: var(--ok-grund); border: 1px solid var(--ok); border-radius: var(--radius); padding: .6rem .9rem; margin: .5rem 0; color: var(--text); }
.hinweis ul { margin: .3rem 0 0; padding-left: 1.2rem; }
code.pfad { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85rem; word-break: break-all; }

/* Paket 2: Freigabe-Ampel und Bilder im Bericht */
ul.ampel { list-style: none; padding: 0; margin: .3rem 0 .8rem; }
ul.ampel li { padding: .35rem .6rem; border-left: 4px solid var(--linie); margin: .25rem 0; background: var(--flaeche-2); border-radius: 4px; }
ul.ampel li.gruen { border-left-color: var(--ok); }
ul.ampel li.rot { border-left-color: var(--fehler); }
ul.ampel li.offen { border-left-color: var(--warn); }
ul.ampel .ampel-marke { display: inline-block; width: 1.2em; font-weight: 700; }
ul.ampel li.gruen .ampel-marke { color: var(--ok); }
ul.ampel li.rot .ampel-marke { color: var(--fehler); }
figure.bericht-bild { margin: .8rem 0; }
figure.bericht-bild img { max-width: min(100%, 480px); max-height: 320px; border: 1px solid var(--linie); border-radius: 4px; }
figure.bericht-bild figcaption { font-size: .9rem; margin-top: .3rem; }

/* QM: PDF-Seiten als Bilder in der Freigabe */
.seiten { display: flex; flex-direction: column; align-items: center; gap: 1rem; max-height: 80vh; overflow: auto; padding: .5rem; background: var(--grund); border-radius: 6px; margin-bottom: 1rem; }
.seiten figure { margin: 0; text-align: center; }
.seiten img { display: block; width: 100%; max-width: 900px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
