/* ---------------------------------------------------------------
   Fristenwächter — Aussehen

   Eine Datei, keine fremden Server. Keine Schriftart wird nachgeladen;
   benutzt wird die, die auf dem Gerät ohnehin da ist. Das ist keine
   Sparmaßnahme — es ist die Zusage, dass der Browser des Kunden mit
   niemandem spricht außer mit diesem Server.

   Zuerst fürs Handy gebaut, dann für den Schreibtisch erweitert.
   Ein Werkstattmeister bedient das im Transporter.
   --------------------------------------------------------------- */

:root {
  --grund:        #F5F7F8;
  --flaeche:      #FFFFFF;
  --flaeche-2:    #EDF1F3;
  --schrift:      #16202A;
  --schrift-2:    #47555F;
  --schrift-3:    #6F7E89;
  --linie:        #DBE2E7;
  --linie-2:      #C2CCD4;
  --akzent:       #0E6B68;
  --akzent-sanft: #E0EEED;

  --gut:          #1D7148;
  --gut-sanft:    #E2F0E8;
  --warnung:      #8E6209;
  --warnung-sanft:#F6EEDB;
  --ernst:        #9C3229;
  --ernst-sanft:  #F6E4E2;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --rand: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund:        #0F151B;
    --flaeche:      #161F27;
    --flaeche-2:    #1D2730;
    --schrift:      #E6ECF1;
    --schrift-2:    #B3C0CB;
    --schrift-3:    #83939F;
    --linie:        #27323C;
    --linie-2:      #374652;
    --akzent:       #4FB3AA;
    --akzent-sanft: #12302E;

    --gut:          #5FBF8C;
    --gut-sanft:    #12291F;
    --warnung:      #D8A64A;
    --warnung-sanft:#2B2313;
    --ernst:        #E08579;
    --ernst-sanft:  #2D1916;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--grund);
  color: var(--schrift);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Kopfleiste ---------- */

.kopf {
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  position: sticky;
  top: 0;
  z-index: 30;
}

.kopf-innen {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  flex-wrap: wrap;
}

.marke {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-right: 8px;
  text-decoration: none;
  color: var(--schrift);
}

.marke span { color: var(--akzent); }

nav.haupt { display: flex; gap: 2px; flex: 1; overflow-x: auto; }

nav.haupt a {
  padding: 8px 12px;
  border-radius: var(--rand);
  text-decoration: none;
  color: var(--schrift-2);
  font-size: 15px;
  white-space: nowrap;
}

nav.haupt a:hover { background: var(--flaeche-2); color: var(--schrift); }
nav.haupt a[aria-current="page"] { background: var(--akzent-sanft); color: var(--akzent); font-weight: 500; }

.wer { font-size: 13px; color: var(--schrift-3); display: flex; align-items: center; gap: 10px; }
.wer a { color: var(--schrift-3); }

/* ---------- Rumpf ---------- */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 18px; font-weight: 600; margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
p  { margin: 0; }

.leise { color: var(--schrift-2); font-size: 14px; }
.winzig { color: var(--schrift-3); font-size: 12.5px; line-height: 1.45; }
.zahl { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.kopfzeile { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Kacheln ---------- */

.kacheln {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--linie);
  border: 1px solid var(--linie);
  border-radius: var(--rand);
  overflow: hidden;
}

.kachel { background: var(--flaeche); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kachel .wert { font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1.1; }
.kachel .name { font-size: 13px; color: var(--schrift-2); }
.kachel.ernst .wert { color: var(--ernst); }
.kachel.warnung .wert { color: var(--warnung); }

/* ---------- Karten ---------- */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--rand);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.karte.schmal { padding: 14px 16px; }

/* ---------- Liste von Vorgängen ---------- */

.liste { display: flex; flex-direction: column; border: 1px solid var(--linie);
         border-radius: var(--rand); background: var(--flaeche); overflow: hidden; }

.zeile {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--linie);
  text-decoration: none;
  color: inherit;
}

.zeile:last-child { border-bottom: none; }
a.zeile:hover { background: var(--flaeche-2); }
.zeile .titel { font-weight: 500; }
.zeile .unter { font-size: 13px; color: var(--schrift-3); }

/* ---------- Marken ---------- */

.marker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  white-space: nowrap;
  display: inline-block;
}

.m-gut     { background: var(--gut-sanft);     color: var(--gut); }
.m-warnung { background: var(--warnung-sanft); color: var(--warnung); }
.m-ernst   { background: var(--ernst-sanft);   color: var(--ernst); }
.m-ruhig   { background: var(--flaeche-2);     color: var(--schrift-3); }
.m-akzent  { background: var(--akzent-sanft);  color: var(--akzent); }

/* ---------- Formular ---------- */

.feld { display: flex; flex-direction: column; gap: 5px; }

.feld > label { font-size: 14px; font-weight: 500; }

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
  font-family: inherit;
  font-size: 16px;          /* unter 16px zoomt iOS beim Antippen hinein */
  padding: 10px 12px;
  border: 1px solid var(--linie-2);
  border-radius: var(--rand);
  background: var(--flaeche);
  color: var(--schrift);
  width: 100%;
  min-width: 0;
}

textarea { resize: vertical; min-height: 70px; line-height: 1.5; }

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

.hinweis { font-size: 12.5px; color: var(--schrift-3); line-height: 1.45; }

button, .knopf {
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--rand);
  border: 1px solid var(--linie-2);
  background: var(--flaeche);
  color: var(--schrift);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

button:hover, .knopf:hover { background: var(--flaeche-2); }

button.wichtig, .knopf.wichtig {
  background: var(--akzent);
  border-color: var(--akzent);
  color: #fff;
}

button.wichtig:hover, .knopf.wichtig:hover { filter: brightness(1.08); }

.knopfreihe { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Der Kern: Wert mit Fundstelle ---------- */

.pruefblock {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--linie);
  border-left: 3px solid var(--linie-2);
  border-radius: var(--rand);
  background: var(--flaeche);
}

.pruefblock.unsicher  { border-left-color: var(--warnung); }
.pruefblock.ungeprueft{ border-left-color: var(--ernst); }
.pruefblock.sicher    { border-left-color: var(--gut); }

.fundstelle {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--schrift-2);
  background: var(--flaeche-2);
  border-radius: 2px;
  padding: 10px 12px;
}

.fundstelle q { font-style: normal; }
.fundstelle .herkunft { display: block; margin-top: 5px; font-family: var(--mono); font-size: 11.5px; color: var(--schrift-3); }

.rechenweg {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--schrift-2);
  background: var(--flaeche-2);
  border-left: 2px solid var(--akzent);
  padding: 10px 12px;
  border-radius: 2px;
}

/* ---------- Meldungen ---------- */

.hinweisband {
  padding: 12px 16px;
  border-radius: var(--rand);
  border: 1px solid var(--linie);
  background: var(--akzent-sanft);
  color: var(--schrift);
  font-size: 14.5px;
}

.hinweisband.fehler { background: var(--ernst-sanft); border-color: var(--ernst); }

/* ---------- Datei hineinwerfen ---------- */

.ablage {
  border: 2px dashed var(--linie-2);
  border-radius: var(--rand);
  padding: 26px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  background: var(--flaeche);
}

.ablage.bereit { border-color: var(--akzent); background: var(--akzent-sanft); }
.ablage input[type="file"] { max-width: 100%; }

/* ---------- Leerer Zustand ---------- */

.leer { padding: 34px 18px; text-align: center; color: var(--schrift-3); font-size: 14.5px; }

/* ---------- Fußzeile ---------- */

footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px 40px;
  color: var(--schrift-3);
  font-size: 12.5px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- Anmeldung ---------- */

.anmeldeseite {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

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

/* ---------- Schreibtisch ---------- */

@media (min-width: 720px) {
  /* Wert links, Fundstelle rechts daneben — sie gehören zusammen und
     sollen nebeneinander stehen, nicht untereinander. */
  .pruefblock { grid-template-columns: 300px 1fr; align-items: start; }
  .pruefblock .fundstelle { grid-column: 2; }

  /* Der Regelblock ist die Ausnahme: dort steht der Wortlaut oben über
     die ganze Breite und die Zerlegung darunter. Ohne diese Rücknahme
     landet die Fundstelle in einer zweiten Spalte, die es gar nicht
     gibt — und der Block bekommt rechts ein totes Feld. */
  .pruefblock.breit { grid-template-columns: 1fr; }
  .pruefblock.breit .fundstelle { grid-column: 1; }

  .zeile { grid-template-columns: 1fr auto auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Die Zerlegung einer Regel: Frist, Einheit, Bezug nebeneinander,
   solange Platz ist — auf dem Handy untereinander. */
.regelfelder {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
