/* Research: ruhige Arbeitsfläche, Zahlen in Tabellenziffern, Farbe nur für den Lebenslauf eines Werts
   (Vorschlag gelb, gültig grün, abgelehnt rot). Ohne fremde Schriften, hell und dunkel. */
:root {
  --grund: #f4f6f5;
  --flaeche: #ffffff;
  --text: #1f2a37;
  --leise: #5b6875;
  --linie: #d8dedb;
  --linie-stark: #b9c2be;
  --gueltig: #0e6b5c;
  --gueltig-hell: #e3f1ed;
  --vorschlag: #96600f;
  --vorschlag-hell: #fbf1de;
  --fehler: #b42318;
  --fehler-hell: #fbe9e7;
  --fokus: #2563c9;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #111518;
    --flaeche: #192024;
    --text: #e2e8ea;
    --leise: #9aa7ae;
    --linie: #2c363b;
    --linie-stark: #425056;
    --gueltig: #5cc2ad;
    --gueltig-hell: #16302b;
    --vorschlag: #e4ad52;
    --vorschlag-hell: #33280f;
    --fehler: #f08a7e;
    --fehler-hell: #3a1c19;
    --fokus: #7aa7f5;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grund); color: var(--text); font: 16px/1.5 var(--schrift);
  font-variant-numeric: tabular-nums;
}
a { color: var(--gueltig); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; font-weight: 650; }
p { max-width: 70ch; }
small, .leise { color: var(--leise); }
code { font-size: .92em; background: var(--grund); padding: 0 .25em; border-radius: 3px; }
.verborgen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Kopf */
.kopf { background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.kopf-innen { max-width: 76rem; margin: 0 auto; padding: .5rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.marke { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { padding: .4rem .6rem; border-radius: 4px; text-decoration: none; color: var(--leise); white-space: nowrap; }
.nav a[aria-current="page"] { color: var(--text); background: var(--grund); font-weight: 600; }
.nav .zahl { display: inline-block; min-width: 1.4em; padding: 0 .35em; margin-left: .2em; border-radius: 1em;
  background: var(--vorschlag-hell); color: var(--vorschlag); font-size: .8em; font-weight: 700; text-align: center; }
.kopf form { margin: 0; }
@media (max-width: 640px) { .nav { order: 3; flex-basis: 100%; } }

main { max-width: 76rem; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.seitenkopf { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* Meldungen */
.meldung, .fehler, .warnung { padding: .65rem .9rem; border-radius: 4px; margin: 0 0 1rem; max-width: 70ch; }
.meldung { background: var(--gueltig-hell); border-left: 4px solid var(--gueltig); }
.fehler { background: var(--fehler-hell); border-left: 4px solid var(--fehler); }
.warnung { background: var(--vorschlag-hell); border-left: 4px solid var(--vorschlag); }
.warnung ul, .fehler ul { margin: .25rem 0 0; padding-left: 1.2rem; }

/* Flächen und Abschnitte */
.flaeche { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
.raster { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
dl.daten { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
dl.daten dt { color: var(--leise); }
dl.daten dd { margin: 0; }

/* Tabellen */
.tabelle-rahmen { overflow-x: auto; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 6px; margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .45rem .7rem; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: top; }
thead th { font-weight: 600; color: var(--leise); font-size: .9rem; border-bottom-color: var(--linie-stark); white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.z, th.z { text-align: right; white-space: nowrap; }
.zeitreihe th:first-child, .zeitreihe td:first-child { position: sticky; left: 0; background: var(--flaeche); z-index: 1;
  min-width: 11rem; box-shadow: 1px 0 0 var(--linie); }
.zeitreihe a { color: inherit; text-decoration: none; }
.zeitreihe a:hover { text-decoration: underline; }
.berechnet { color: var(--leise); font-style: italic; }
.vorschlag-markiert { background: var(--vorschlag-hell); }

/* Status eines Werts */
.status { display: inline-block; padding: 0 .45em; border-radius: 3px; font-size: .85rem; font-weight: 600; }
.status-vorschlag { background: var(--vorschlag-hell); color: var(--vorschlag); }
.status-freigegeben, .status-ok { background: var(--gueltig-hell); color: var(--gueltig); }
.status-abgelehnt, .status-nicht_vergleichbar { background: var(--fehler-hell); color: var(--fehler); }
.status-ersetzt, .status-zurueckgezogen, .status-fehlend { background: var(--grund); color: var(--leise); }

/* Formulare */
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; }
label .leise { font-weight: 400; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=date], input[type=number],
input:not([type]), select, textarea {
  width: 100%; max-width: 32rem; padding: .5rem .6rem; border: 1px solid var(--linie-stark); border-radius: 4px;
  background: var(--flaeche); min-height: 2.6rem;
}
textarea { min-height: 6rem; max-width: 48rem; }
input.feld-fehler { border-color: var(--fehler); background: var(--fehler-hell); }
.zeile { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.zeile > div { flex: 1 1 10rem; }
.zeile label { margin-top: .5rem; }
button, .knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.6rem;
  padding: .45rem 1rem; border-radius: 4px; border: 1px solid var(--gueltig); background: var(--gueltig);
  color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
}
@media (prefers-color-scheme: dark) { button, .knopf { color: #0c1714; } }
button.zweitrangig, .knopf.zweitrangig { background: transparent; color: var(--gueltig); }
button.gefahr { background: transparent; border-color: var(--fehler); color: var(--fehler); }
button.klein, .knopf.klein { min-height: 2rem; padding: .2rem .6rem; font-size: .9rem; }
button.link { background: none; border: 0; color: var(--leise); padding: .4rem .6rem; min-height: 0; font-weight: 400; }
.aktionen { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
form.inline { display: inline; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0; }
label.ankreuzen { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
label.ankreuzen input { width: auto; min-height: 0; margin-top: .3rem; }

/* Reiter der Firmenseite */
.reiter { display: flex; gap: .25rem; border-bottom: 1px solid var(--linie); margin: 1rem 0; overflow-x: auto; }
.reiter a { padding: .55rem .8rem; text-decoration: none; color: var(--leise); border-bottom: 3px solid transparent;
  margin-bottom: -1px; white-space: nowrap; }
.reiter a[aria-current="page"] { color: var(--text); border-bottom-color: var(--gueltig); font-weight: 600; }
.filter { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; align-items: center; }
.filter a { padding: .25rem .65rem; border: 1px solid var(--linie); border-radius: 2rem; text-decoration: none;
  color: var(--leise); font-size: .92rem; background: var(--flaeche); }
.filter a[aria-current="true"] { border-color: var(--gueltig); color: var(--gueltig); font-weight: 600; }

/* Erfassen */
.erfassung td { vertical-align: middle; }
.erfassung input { min-width: 7rem; max-width: 11rem; }
.erfassung select { min-width: 5rem; max-width: 7rem; }
.erfassung .fundstelle { min-width: 7rem; max-width: 9rem; }
.herkunft { display: block; font-size: .82rem; color: var(--vorschlag); margin-top: .15rem; }
.bisher { display: block; font-size: .82rem; color: var(--leise); white-space: nowrap; }
.vorschau { display: block; font-size: .82rem; color: var(--gueltig); white-space: nowrap; }
.fehlertext { display: block; font-size: .82rem; color: var(--fehler); }
.schritte { color: var(--leise); margin: 0 0 1rem; padding: 0; list-style: none; display: flex; gap: 1rem; flex-wrap: wrap; }
.schritte li[aria-current="step"] { color: var(--text); font-weight: 600; }

/* Freigaben: ein Wert je Zeile, links der Status als Balken */
.gruppe { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 6px; margin-bottom: 1.5rem; }
.gruppe > header { padding: .8rem 1rem; border-bottom: 1px solid var(--linie); }
.gruppe > header h2 { margin: 0; font-size: 1.05rem; }
.gruppe .warnung { margin: .75rem 1rem 0; }
.vorschlag { display: grid; grid-template-columns: minmax(10rem, 1.2fr) minmax(9rem, 1fr) minmax(14rem, 1.4fr);
  gap: .5rem 1rem; padding: .75rem 1rem; border-top: 1px solid var(--linie); border-left: 4px solid var(--vorschlag); }
.gruppe > header + .warnung + .vorschlag, .gruppe > header + .vorschlag { border-top: 0; }
.vorschlag.ist-freigegeben { border-left-color: var(--gueltig); }
.vorschlag.ist-abgelehnt { border-left-color: var(--fehler); }
.vorschlag.ist-zurueckgezogen { border-left-color: var(--linie-stark); }
.vorschlag .neu { font-size: 1.15rem; font-weight: 650; }
.vorschlag .entscheidung { display: flex; gap: .4rem; flex-wrap: wrap; align-items: flex-start; }
.vorschlag .entscheidung input { flex: 1 1 9rem; min-height: 2.3rem; }
.vorschlag .entscheidung button { min-height: 2.3rem; }
@media (max-width: 760px) { .vorschlag { grid-template-columns: 1fr; } }

/* Anmeldung */
.schmal { max-width: 26rem; margin: 3rem auto; }
.schmal input { max-width: none; }
.codes { columns: 2; font-size: 1.1rem; padding-left: 1.2rem; }
.qr svg { display: block; width: 240px; max-width: 100%; height: auto; background: #fff; padding: 8px; border-radius: 4px; }

.link-ausgabe { word-break: break-all; padding: .6rem; background: var(--grund); border: 1px dashed var(--linie-stark); border-radius: 4px; }

@media print {
  .kopf, .nav, .aktionen, button { display: none !important; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
