/* LUNA Analytics – Portal. Eine Schriftfamilie (IBM Plex Sans), tabellarische Ziffern, Primärfarbe je Mandant (--primaer). */
:root {
  --papier: #F6F7F9;
  --flaeche: #FFFFFF;
  --tinte: #1E2A33;
  --tinte-2: #52606B;
  --tinte-3: #7A8791;
  --linie: #D9DFE5;
  --linie-2: #EBEFF2;
  --primaer: #0F5C63;
  --primaer-hell: color-mix(in srgb, var(--primaer) 10%, white);
  --gut: #2E7D4F;
  --gut-hell: #E3F1E8;
  --warn: #B7791F;
  --warn-hell: #FBF0DC;
  --fehler: #B3261E;
  --fehler-hell: #FBE5E3;
  --radius: 6px;
  --schrift: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--schrift); color: var(--tinte); background: var(--papier); line-height: 1.5;
       font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
a { color: var(--primaer); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--primaer); outline-offset: 2px; }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 2rem 0 .6rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 1.4rem 0 .4rem; }
p { margin: .4rem 0 .8rem; max-width: 75ch; }
code, pre, .sql { font-family: "IBM Plex Mono", ui-monospace, Consolas, monospace; font-size: .86rem; }
pre { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .8rem; overflow: auto; max-height: 32rem; }

/* Rahmen: Navigation links, Inhalt rechts */
.rahmen { display: grid; grid-template-columns: 15.5rem 1fr; min-height: 100vh; }
.navi { background: var(--tinte); color: #C9D2D9; padding: 1.2rem 0 2rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.navi .marke { display: flex; align-items: center; gap: .6rem; padding: 0 1.2rem 1.2rem; color: #fff; text-decoration: none; }
.navi .marke img { max-height: 28px; max-width: 120px; background: #fff; border-radius: 4px; padding: 2px 4px; }
.navi .marke b { font-size: 1.05rem; font-weight: 600; }
.navi .mandant { padding: 0 1.2rem 1rem; font-size: .82rem; color: #9AA7B1; border-bottom: 1px solid #2E3D48; margin-bottom: .6rem; }
.navi .mandant select { width: 100%; margin-top: .3rem; background: #2A3842; color: #fff; border: 1px solid #3B4B57; }
.navi .gruppe { padding: .9rem 1.2rem .2rem; font-size: .78rem; color: #8D9AA4; }
.navi a { display: block; padding: .32rem 1.2rem .32rem 1.4rem; color: #DCE3E8; text-decoration: none; border-left: 3px solid transparent; font-size: .93rem; }
.navi a:hover { background: #26343E; }
.navi a.aktiv { border-left-color: var(--primaer-navi, #5FB3B9); background: #26343E; color: #fff; font-weight: 500; }
.navi a .zahl { float: right; font-size: .78rem; background: var(--warn); color: #fff; border-radius: 9px; padding: 0 .45rem; }
.navi .fuss { padding: 1.2rem; font-size: .82rem; color: #8D9AA4; }
.navi .fuss button { background: none; border: 0; color: #C9D2D9; padding: 0; text-decoration: underline; cursor: pointer; font: inherit; }
main { padding: 1.8rem 2.4rem 4rem; max-width: 1500px; min-width: 0; }
.kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.kopf .unter { color: var(--tinte-2); margin: 0; }
.aktionen { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Meldungen */
.meldung { padding: .65rem .9rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid; max-width: 90ch; }
.meldung.ok { background: var(--gut-hell); border-color: #B7DCC4; }
.meldung.fehler { background: var(--fehler-hell); border-color: #F0B9B4; }
.meldung.hinweis { background: var(--warn-hell); border-color: #EBCF9E; }
.einmalig { font-family: "IBM Plex Mono", monospace; background: #fff; padding: .4rem .6rem; border: 1px dashed var(--warn); display: inline-block; user-select: all; }

/* Tabellen */
.tab-rahmen { overflow-x: auto; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-weight: 500; color: var(--tinte-2); background: #F0F3F5; padding: .5rem .7rem; border-bottom: 1px solid var(--linie); white-space: nowrap; position: sticky; top: 0; }
td { padding: .45rem .7rem; border-bottom: 1px solid var(--linie-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FAFBFC; }
td.zahl, th.zahl { text-align: right; }
td.leise, .leise { color: var(--tinte-3); }
td.knapp { white-space: nowrap; }
.leer { padding: 1.6rem; color: var(--tinte-2); }

/* Status: Text + Farbe */
.status { display: inline-block; font-size: .8rem; padding: .05rem .5rem; border-radius: 3px; white-space: nowrap; border: 1px solid transparent; }
.status.ok, .status.verarbeitet, .status.freigegeben, .status.erledigt { background: var(--gut-hell); color: var(--gut); }
.status.warnung, .status.beantragt, .status.laeuft, .status.wartet, .status.offen { background: var(--warn-hell); color: #8A5A0E; }
.status.fehler, .status.abgelehnt { background: var(--fehler-hell); color: var(--fehler); }
.status.ignoriert, .status.entwurf, .status.verworfen, .status.neu { background: #EEF1F3; color: var(--tinte-2); }

/* Ladeband: die letzten Läufe als Striche */
.ladeband { display: inline-flex; gap: 2px; align-items: flex-end; height: 18px; vertical-align: middle; }
.ladeband i { display: block; width: 6px; height: 18px; border-radius: 1px; background: #D9DFE5; }
.ladeband i.ok { background: var(--gut); }
.ladeband i.warnung { background: var(--warn); height: 13px; }
.ladeband i.fehler { background: var(--fehler); height: 8px; }
.ladeband i.laeuft { background: var(--primaer); opacity: .5; }

/* Formulare */
form.block { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.1rem 1.2rem; max-width: 980px; }
.feld { display: grid; grid-template-columns: 14rem 1fr; gap: .3rem 1rem; align-items: start; margin-bottom: .75rem; }
.feld > label { padding-top: .4rem; font-weight: 500; font-size: .92rem; }
.feld .hilfe { grid-column: 2; font-size: .82rem; color: var(--tinte-3); margin-top: -.15rem; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid #C3CCD4; border-radius: 4px; padding: .38rem .55rem; width: 100%; max-width: 46rem; }
textarea { min-height: 7rem; }
textarea.sql, textarea.code { font-family: "IBM Plex Mono", monospace; font-size: .85rem; min-height: 14rem; }
input:focus, select:focus, textarea:focus { border-color: var(--primaer); outline: 2px solid var(--primaer-hell); }
.knopf, button { font: inherit; font-weight: 500; border-radius: 4px; padding: .4rem .9rem; border: 1px solid var(--primaer); background: var(--primaer);
                 color: #fff; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.4; }
.knopf.zweit, button.zweit { background: #fff; color: var(--primaer); }
.knopf.gefahr, button.gefahr { background: #fff; color: var(--fehler); border-color: #E2A29C; }
.knopf.klein, button.klein { padding: .15rem .55rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }
.reihe { display: flex; gap: .8rem; flex-wrap: wrap; align-items: end; }
.reihe .feldchen { display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; }
.reihe .feldchen input, .reihe .feldchen select { min-width: 10rem; }
fieldset { border: 1px solid var(--linie); border-radius: var(--radius); padding: .8rem 1rem; margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 600; padding: 0 .4rem; }

/* Start: Arbeitsliste */
.spalten { display: grid; grid-template-columns: repeat(auto-fit, minmax(25rem, 1fr)); gap: 1.4rem; }
.liste { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
.liste h2 { margin: 0; padding: .8rem 1rem; font-size: 1rem; border-bottom: 1px solid var(--linie); display: flex; justify-content: space-between; }
.liste ul { list-style: none; margin: 0; padding: 0; }
.liste li { padding: .6rem 1rem; border-bottom: 1px solid var(--linie-2); display: flex; justify-content: space-between; gap: 1rem; }
.liste li:last-child { border-bottom: 0; }
.liste .leer { padding: 1rem; }

tr.neu td { background: var(--gut-hell); }
tr.entfallen td { background: var(--fehler-hell); color: var(--tinte-2); }

/* Berichtsdesigner */
.designer { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(20rem, 1fr); gap: 1.4rem; align-items: start; }
.designer > div:last-child { position: sticky; top: 1rem; }
.designer .spalte-feld { display: block; font-size: .75rem; color: var(--tinte-3); font-family: "IBM Plex Mono", monospace; margin-bottom: .1rem; }
@media (max-width: 1250px) { .designer { grid-template-columns: 1fr; } .designer > div:last-child { position: static; } }
.designer iframe { width: 100%; height: 78vh; border: 1px solid var(--linie); border-radius: var(--radius); background: #fff; }
.designer table input, .designer table select { padding: .2rem .35rem; font-size: .85rem; }
.designer #spalten td, .designer #spalten th { padding: .35rem .4rem; }
.reiter { display: flex; gap: 0; border-bottom: 1px solid var(--linie); margin-bottom: 1rem; }
.reiter a { padding: .45rem .9rem; text-decoration: none; color: var(--tinte-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.reiter a.aktiv { color: var(--tinte); border-bottom-color: var(--primaer); font-weight: 500; }
.farbe { display: inline-flex; align-items: center; gap: .4rem; }
.farbe input[type=color] { width: 2.4rem; height: 2rem; padding: 0; border: 1px solid #C3CCD4; border-radius: 4px; background: #fff; }

/* Anmeldung */
.anmeldung { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.anmeldung form { width: min(26rem, 100%); background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.8rem; }
.anmeldung h1 { margin-bottom: 1.2rem; }
.anmeldung label { display: block; margin: .8rem 0 .25rem; font-weight: 500; }

@media (max-width: 900px) {
  .rahmen { grid-template-columns: 1fr; }
  .navi { position: static; height: auto; }
  main { padding: 1.2rem 1rem 3rem; }
  .feld { grid-template-columns: 1fr; }
  .feld .hilfe { grid-column: 1; }
  .designer { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.feld > input[type=checkbox] { justify-self: start; }
#felder select[name=f_entfernen] { min-width: 6.8rem; }
#felder select[name=f_typ] { min-width: 6.5rem; }
.sso { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--linie); display: grid; gap: .5rem; }
.sso span { color: var(--tinte-3); font-size: .85rem; text-align: center; }
.sso .knopf { text-align: center; }
/* Planung */
.planraster input.zelle { width: 6.5rem; text-align: right; padding: .15rem .3rem; font-size: .85rem; border-color: transparent; background: #F7F9FA; }
.planraster input.zelle:hover { border-color: #C3CCD4; }
.planraster input.zelle.geaendert { background: var(--warn-hell); border-color: var(--warn); }
tfoot td { background: #F0F3F5; border-top: 1px solid var(--linie); }
td.neg { color: var(--fehler); }
.diagramm-rahmen { position: relative; height: 320px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .8rem; }
/* Abschlusskalender */
.fortschritt { height: 8px; background: var(--linie-2); border-radius: 4px; margin: -.4rem 0 1.2rem; overflow: hidden; max-width: 40rem; }
.fortschritt i { display: block; height: 100%; background: var(--gut); }
tr.ueberfaellig td:first-child { box-shadow: inset 3px 0 0 var(--fehler); }
details.inline-details { display: inline-block; margin-left: .3rem; }
details.inline-details summary { cursor: pointer; font-size: .82rem; }
/* Cockpits */
.kachelraster { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; }
.cockpit-karte { display: grid; gap: .3rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.1rem;
                 text-decoration: none; color: var(--tinte); }
.cockpit-karte:hover { border-color: var(--primaer); }
.cockpit-karte b { font-size: 1.05rem; color: var(--primaer); }
.filterleiste { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; }
.cockpit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.cockpit .element { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .9rem 1rem; min-width: 0; }
.cockpit .element h2 { margin: 0 0 .5rem; font-size: .92rem; font-weight: 500; color: var(--tinte-2); }
.cockpit .b1 { grid-column: span 1; } .cockpit .b2 { grid-column: span 2; } .cockpit .b3 { grid-column: span 3; } .cockpit .b4 { grid-column: span 4; }
.cockpit .kennzahl .wert { font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.cockpit .veraenderung { font-size: .85rem; margin-top: .2rem; }
.cockpit .veraenderung.gut { color: var(--gut); } .cockpit .veraenderung.schlecht { color: var(--fehler); }
.cockpit .klein { font-size: .8rem; }
.cockpit .diagramm { position: relative; height: 260px; }
.cockpit .element.b3 .diagramm, .cockpit .element.b4 .diagramm { height: 300px; }
.elementfehler { color: var(--fehler); font-size: .85rem; }
@media (max-width: 1100px) { .cockpit { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cockpit .b3, .cockpit .b4 { grid-column: span 2; } }
@media (max-width: 640px) { .cockpit { grid-template-columns: 1fr; } .cockpit .element { grid-column: span 1 !important; } }
.navi .sprachwahl { margin: .4rem 0; display: flex; flex-wrap: wrap; gap: .2rem .6rem; }
.navi .sprachwahl button[aria-current] { text-decoration: none; color: #fff; font-weight: 500; }
.planraster tbody td:last-child, .planraster thead th:last-child, .planraster tfoot td:last-child { position: sticky; right: 0; background: #F0F3F5; box-shadow: -1px 0 0 var(--linie); }

/* hidden-Attribut hat Vorrang vor display-Regeln (z. B. Bezugsauswahl im Kalender) */
[hidden] { display: none !important; }

/* Planung: Kommentare und Teilfreigaben */
.planraster td.kommentiert { position: relative; }
.planraster td.kommentiert::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 7px 7px 0;
  border-color: transparent var(--warn) transparent transparent; }
.planraster tr.fest td { background: var(--papier); color: var(--tinte-2); }
.kommentar-marke { color: var(--warn); font-size: .7rem; }
ul.kommentare { list-style: none; margin: 0; padding: 0; max-height: 26rem; overflow: auto; }
ul.kommentare li { padding: .7rem 1rem; border-bottom: 1px solid var(--linie); display: grid; gap: .2rem; }
ul.kommentare li.erledigt { opacity: .6; }
.zahl-marke { display: inline-block; min-width: 1.4rem; padding: 0 .4rem; border-radius: 1rem; background: var(--warn); color: #fff;
  font-size: .75rem; text-align: center; vertical-align: middle; }

/* Cockpits: Lesezeichen und Drill-down */
details.lesezeichen { margin: -.4rem 0 1rem; }
details.lesezeichen summary { cursor: pointer; color: var(--primaer); font-size: .9rem; }
.lesezeichen-inhalt { padding: .6rem 0; display: grid; gap: .6rem; }
.lesezeichen-inhalt ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.lesezeichen-inhalt li { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
a.drill { font-size: .82rem; }
.cockpit .element.kennzahl a.drill { display: inline-block; margin-top: .4rem; }
.ansicht { margin: 0 0 1.4rem; border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; background: var(--flaeche); }
.ansicht iframe { display: block; width: 100%; height: 72vh; border: 0; }
.fortschritt.klein { display: inline-block; width: 6rem; height: 6px; margin: 0 .4rem 0 0; vertical-align: middle; }
fieldset.monate { border: 1px solid var(--linie); border-radius: var(--radius); padding: .3rem .6rem .5rem; display: flex; flex-wrap: wrap; gap: .2rem .7rem; }
fieldset.monate legend { font-size: .82rem; color: var(--tinte-2); padding: 0 .3rem; }
fieldset.monate label { font-size: .85rem; white-space: nowrap; }
.planraster th { white-space: nowrap; }

.seitenhinweis { margin: -.4rem 0 1rem; }
tr.gruppe th { background: var(--flaeche-2, #F3F5F7); text-align: left; font-weight: 600; padding-top: .7rem; }
.cockpit-karte .kurz { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* 2.8 Teil D: Stammdaten und Produktion – SVG-Diagramme, Vergleichstabelle der Treffergruppen */
.diagramm-svg { max-width: 46rem; display: block; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .4rem; }
.diagramm-svg.verlauf { display: inline-block; border: 0; padding: 0; background: none; vertical-align: middle; }
.ds-text { font-size: 11px; fill: var(--tinte-2); }
.ds-wert { font-size: 11px; fill: var(--tinte); }
.ds-balken { fill: var(--primaer); }
.ds-balken.ds-neg { fill: var(--fehler); }
.ds-linie { fill: none; stroke: var(--warn); stroke-width: 2; }
.ds-punkt { fill: var(--warn); }
.ds-hilfslinie { stroke: var(--tinte-3); stroke-dasharray: 4 3; }
table.vergleich td.anders { background: var(--warn-hell); }
table.vergleich td.golden { background: var(--gut-hell); font-weight: 500; }
.definitionen { font-size: .85rem; color: var(--tinte-2); }
/* 3.0 SIM: Schichtsimulation – Heatmap (Auslastung je Schicht) und Gantt-Auszug; Stufen zusätzlich als Zahl in der Zelle */
.sim-heat.leer { fill: var(--linie-2); }
.sim-heat.s1 { fill: #E3F1E8; } .sim-heat.s2 { fill: #B7DCC4; } .sim-heat.s3 { fill: #FBF0DC; }
.sim-heat.s4 { fill: #EBCF9E; } .sim-heat.s5 { fill: #B3261E; }
.sim-heat-text { fill: var(--tinte); } .sim-heat-text.s5 { fill: #fff; }
.sim-gantt { stroke: var(--flaeche); stroke-width: .5; }
.sim-gantt.g0 { fill: #0F5C63; } .sim-gantt.g1 { fill: #3D8B91; } .sim-gantt.g2 { fill: #6FAFB4; }
.sim-gantt.g3 { fill: #B7791F; } .sim-gantt.g4 { fill: #52606B; } .sim-gantt.g5 { fill: #2E7D4F; }
table.sim-vergleich td.empfohlen, table.sim-vergleich th.empfohlen { background: var(--gut-hell); font-weight: 500; }
.sim-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .6rem 1rem; }
