:root {
  --tinte: #16202b;
  --gedaempft: #5d6b7a;
  --linie: #dde3ea;
  --flaeche: #ffffff;
  --grund: #f4f6f9;
  --marke: #0b3d63;
  --marke-hell: #e8f0f7;
  --gut: #0f7b4f;
  --warnung: #9a6100;
  --warnung-flaeche: #fdf3e0;
  --fehler: #a32219;
  --fehler-flaeche: #fdeceb;
  /* Interne Werte bekommen eine eigene, unverwechselbare Farbe. Wer diese
     Flaeche in einem Kundengespraech auf dem Schirm hat, sieht es sofort. */
  --intern: #6b21a8;
  --intern-flaeche: #f6eefc;
}

* { box-sizing: border-box; }

/* Das hidden-Attribut setzt display:none — aber nur mit der schwachen
   Voreinstellung des Browsers. Jede eigene display-Regel (etwa
   `.mitte { display: flex }`) sticht sie aus, und die vermeintlich
   verborgene Anmeldemaske steht dann mitten in der angemeldeten Sitzung.
   Deshalb hier ausdruecklich und mit Vorrang: */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--tinte);
  background: var(--grund);
}

a { color: var(--marke); }

/* --- Anmeldeseiten ----------------------------------------------------- */
.mitte {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 10px;
  padding: 28px;
}

.karte.schmal { width: 100%; max-width: 380px; }

.marke { font-size: 22px; font-weight: 600; color: var(--marke); }
.untertitel { color: var(--gedaempft); margin-bottom: 20px; }

label { display: block; margin: 14px 0 5px; font-size: 13px; color: var(--gedaempft); }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--linie);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--tinte);
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--marke);
  outline-offset: 1px;
}

button {
  margin-top: 18px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: var(--marke);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: #0d4a78; }
button[disabled] { opacity: .55; cursor: default; }

button.flach, button.klein {
  width: auto;
  margin: 0;
  padding: 6px 12px;
  font-weight: 500;
  font-size: 13px;
}

button.flach { background: transparent; color: var(--marke); border: 1px solid var(--linie); }
button.flach:hover { background: var(--marke-hell); }
button.gefahr { background: #7a1d16; }

.klein { font-size: 13px; margin-top: 16px; }
.fehler {
  background: var(--fehler-flaeche);
  color: var(--fehler);
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 13px;
  margin: 14px 0 0;
}
.hinweis {
  background: var(--marke-hell);
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 13px;
}

/* --- Rahmen ------------------------------------------------------------ */
.kopf {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 56px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  z-index: 5;
}

.klein-marke { font-size: 17px; }
.klein-marke .sub { color: var(--gedaempft); font-weight: 400; }

#navigation { display: flex; gap: 4px; flex: 1; }
#navigation a {
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--gedaempft);
  font-size: 14px;
}
#navigation a:hover { background: var(--grund); }
#navigation a.aktiv { background: var(--marke-hell); color: var(--marke); font-weight: 600; }

.kopf-rechts { display: flex; align-items: center; gap: 10px; font-size: 13px; }

.schild {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--marke-hell);
  color: var(--marke);
}
.schild.nova { background: var(--intern-flaeche); color: var(--intern); }

main { padding: 24px 20px 60px; max-width: 1180px; margin: 0 auto; }

.fuss {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  padding: 7px 20px;
  background: var(--flaeche);
  border-top: 1px solid var(--linie);
  font-size: 12px;
  color: var(--gedaempft);
}

h1 { font-size: 21px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 26px 0 10px; }
.unterzeile { color: var(--gedaempft); margin: 0 0 20px; font-size: 14px; }

/* --- Tabellen und Kacheln ---------------------------------------------- */
.block {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gedaempft);
  padding: 8px 10px;
  border-bottom: 1px solid var(--linie);
}
td { padding: 11px 10px; border-bottom: 1px solid var(--linie); font-size: 14px; }
tr:last-child td { border-bottom: 0; }
tbody tr.klickbar { cursor: pointer; }
tbody tr.klickbar:hover { background: var(--grund); }

.leer { color: var(--gedaempft); padding: 28px 10px; text-align: center; }

.felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.feld .bez { font-size: 12px; color: var(--gedaempft); }
.feld .wert { font-size: 15px; margin-top: 2px; }

.werkzeuge { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.werkzeuge input, .werkzeuge select { width: auto; min-width: 170px; }

/* --- Status ------------------------------------------------------------ */
.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--grund);
  border: 1px solid var(--linie);
}
.status.ANGEFRAGT, .status.IN_PRUEFUNG { background: #fff7e6; border-color: #f0d9a8; color: var(--warnung); }
.status.ZUGEWIESEN, .status.ANGENOMMEN { background: var(--marke-hell); border-color: #bcd4e7; color: var(--marke); }
.status.ABGEHOLT, .status.UNTERWEGS { background: #eef4ff; border-color: #c4d4f5; color: #1c4fa8; }
.status.ZUGESTELLT, .status.ABRECHENBAR, .status.ABGERECHNET { background: #e8f6ef; border-color: #b3ddc7; color: var(--gut); }
.status.STORNIERT { background: var(--fehler-flaeche); border-color: #f0c2bf; color: var(--fehler); }

/* --- Interner Bereich: unverwechselbar --------------------------------- */
.intern {
  background: var(--intern-flaeche);
  border: 1px solid #d9b8f0;
  border-left: 4px solid var(--intern);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.intern .kennzeichnung {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  color: var(--intern);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.intern .wert { color: var(--intern); font-weight: 600; }

/* --- Warnungen --------------------------------------------------------- */
.warnblock {
  background: var(--warnung-flaeche);
  border: 1px solid #f0d9a8;
  border-left: 4px solid var(--warnung);
  border-radius: 8px;
  padding: 13px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.warnblock.schwer {
  background: var(--fehler-flaeche);
  border-color: #f0c2bf;
  border-left-color: var(--fehler);
}

.merkmal { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; }
.merkmal.GEPRUEFT { background: #e8f6ef; color: var(--gut); }
.merkmal.UNGEPRUEFT { background: var(--warnung-flaeche); color: var(--warnung); }
.merkmal.LAEUFT_AB { background: var(--warnung-flaeche); color: var(--warnung); }
.merkmal.ABGELAUFEN, .merkmal.FEHLT { background: var(--fehler-flaeche); color: var(--fehler); }
.merkmal.OK { background: #e8f6ef; color: var(--gut); }
.merkmal.DENIED { background: var(--fehler-flaeche); color: var(--fehler); }
.merkmal.FAIL { background: var(--fehler-flaeche); color: var(--fehler); }

/* --- Verlauf ----------------------------------------------------------- */
.verlauf { list-style: none; margin: 0; padding: 0; }
.verlauf li {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 2px solid var(--linie);
  font-size: 14px;
}
.verlauf li:last-child { border-left-color: transparent; padding-bottom: 0; }
.verlauf li::before {
  content: "";
  position: absolute;
  left: -6px; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--marke);
}
.verlauf .zeit { color: var(--gedaempft); font-size: 12px; }

/* --- Meldung ----------------------------------------------------------- */
.meldung {
  position: fixed;
  right: 18px;
  bottom: 44px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--tinte);
  color: #fff;
  font-size: 14px;
  z-index: 40;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}
.meldung.schlecht { background: var(--fehler); }
.meldung.gut { background: var(--gut); }

.schritte { display: flex; gap: 8px; flex-wrap: wrap; }
.schritte button { width: auto; margin: 0; }

.dateizeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dateizeile input[type=file] { width: auto; flex: 1; min-width: 200px; }

@media (max-width: 720px) {
  .kopf { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  #navigation { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 16px 14px 60px; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tbody tr { border: 1px solid var(--linie); border-radius: 8px; margin-bottom: 10px; padding: 6px; }
  td { border: 0; padding: 6px 8px; }
  td::before { content: attr(data-bez) " "; color: var(--gedaempft); font-size: 12px; }
}

/* --- Feinheiten, die frueher als style-Attribut im Markup standen -------- */
/* Inline-Stile sind unter `style-src 'self'` gesperrt — und das soll so
   bleiben: wer sie zulaesst, oeffnet dieselbe Tuer, die CSP schliessen
   soll. Also stehen sie hier. */
h2.erste { margin-top: 0; }
.dateizeile.abstand { margin-top: 16px; }
.versetzt { margin-left: 10px; }
.versetzt-klein { margin-left: 6px; }
.warnblock.gut {
  background: #e8f6ef;
  border-color: #b3ddc7;
  border-left-color: var(--gut);
}
