/*
 * Oberfläche der Mini-PWA (Etappe 6.3). Bewusst ohne Framework und ohne Bauschritt: eine Datei,
 * die jeder Browser direkt versteht — dadurch bleibt die PWA das, was sie sein soll, nämlich ein
 * dünner Client der Kern-API (Architektur-Regel 3).
 *
 * Gestaltet fürs Handy: dunkel (morgens/abends angenehm), große Tippflächen, Reiter unten in
 * Daumen-Reichweite. Die hellen Farben kommen automatisch, wenn das Gerät auf Hell steht.
 */

:root {
  --grund: #12161f;
  --flaeche: #1a2030;
  --flaeche-hoch: #222a3d;
  --rand: #2b3348;
  --text: #e8ecf5;
  --text-leise: #98a2ba;
  --akzent: #34d399;
  --warnung: #f87171;
  --achtung: #fbbf24;
  --ruhig: #60a5fa;
  --radius: 16px;
  --sicher-unten: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: light) {
  :root {
    --grund: #f4f6fb;
    --flaeche: #ffffff;
    --flaeche-hoch: #eef1f8;
    --rand: #dde2ee;
    --text: #17203a;
    --text-leise: #5b6782;
    --akzent: #0ea472;
    --warnung: #dc2626;
    --achtung: #b45309;
    --ruhig: #2563eb;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Muss stehen bleiben: Ohne dies gewinnt jede eigene display-Regel (z.B. display:grid) gegen das
   hidden-Attribut — die Anmeldung wäre dann trotz "versteckt" sichtbar. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ---------- Anmeldung ---------- */

.anmeldung {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.anmelde-karte {
  width: 100%;
  max-width: 380px;
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
}

.anmelde-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.anmelde-karte h1 {
  margin: 12px 0 4px;
  font-size: 24px;
}

.hinweis {
  color: var(--text-leise);
  font-size: 14px;
  margin: 12px 0;
  text-align: left;
}

.befehl {
  display: block;
  background: var(--grund);
  border: 1px solid var(--rand);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--akzent);
  overflow-x: auto;
  white-space: nowrap;
  text-align: left;
}

#anmelde-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--rand);
  background: var(--grund);
  color: var(--text);
  font: inherit;
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
}

#anmelde-form button {
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--akzent);
  color: #06231a;
  font-weight: 600;
}

.fehler {
  color: var(--warnung);
  font-size: 14px;
  margin: 12px 0 0;
}

/* ---------- Kopf & Reiter ---------- */

.kopf {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top, 0px)) 18px 12px;
  background: color-mix(in srgb, var(--grund) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rand);
}

.kopf-datum {
  margin: 0;
  font-size: 13px;
  color: var(--text-leise);
}

.kopf-titel {
  margin: 2px 0 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.rund {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--rand);
  background: var(--flaeche);
  font-size: 20px;
  line-height: 1;
}

.rund.laedt {
  animation: dreht 0.9s linear infinite;
}

@keyframes dreht {
  to {
    transform: rotate(360deg);
  }
}

.stand {
  margin: 0;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--achtung);
  background: color-mix(in srgb, var(--achtung) 12%, transparent);
}

.inhalt {
  padding: 16px 18px calc(96px + var(--sicher-unten));
  max-width: 720px;
  margin: 0 auto;
}

.reiter {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px 8px calc(6px + var(--sicher-unten));
  background: color-mix(in srgb, var(--grund) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--rand);
}

.reiter button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: none;
  border-radius: 12px;
  background: none;
  color: var(--text-leise);
  font-size: 11px;
}

.reiter button span {
  font-size: 20px;
  line-height: 1.2;
}

.reiter button.aktiv {
  color: var(--akzent);
  background: var(--flaeche);
}

/* ---------- Inhalte ---------- */

.abschnitt {
  margin: 0 0 26px;
}

.abschnitt h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-leise);
}

.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-left: 3px solid var(--rand);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.karte.ueberfaellig {
  border-left-color: var(--warnung);
}
.karte.heuteFaellig {
  border-left-color: var(--achtung);
}
.karte.dran {
  border-left-color: var(--akzent);
}
.karte.wartet,
.karte.blockiert {
  border-left-color: var(--ruhig);
}
.karte.festgefahren {
  border-left-color: var(--text-leise);
}
/* Unterziel/Gewohnheit unter einem Oberziel (Baumansicht, Fehler 18b): gestrichelter Rand als
   Zugehörigkeits-Signal — die Einrückung setzt app.js je Verschachtelungs-Ebene per Inline-Stil. */
.karte.unterziel {
  border-left-style: dashed;
}

.titel {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.zeile {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-leise);
  overflow-wrap: anywhere;
}

.zeile b {
  color: var(--text);
  font-weight: 600;
}

.marken {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.marke {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--flaeche-hoch);
  color: var(--text-leise);
}

.marke.aktiv {
  color: var(--akzent);
}
.marke.blockiert {
  color: var(--ruhig);
}
.marke.festgefahren {
  color: var(--achtung);
}
.marke.warnung {
  color: var(--warnung);
}
/* Nur ein Hinweis, kein bedienbarer Knopf (Fehler 18c: Schreiben im Dashboard folgt mit Fehler 17) —
   deshalb bewusst kein Button-Look, sondern derselbe stumme Marken-Stil wie die anderen Kennzeichen. */
.marke.hinweis {
  font-style: italic;
}

/* Aufklappbare Schrittliste eines Projekts */
details {
  margin-top: 10px;
}

summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--akzent);
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

.schritte {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.schritte li {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--rand);
  font-size: 14px;
}

.schritte li:first-child {
  border-top: none;
  padding-top: 0;
}

.schritte li span:first-child {
  flex: none;
  color: var(--text-leise);
}

/* Fortschrittsbalken bei Zielen */
.balken {
  height: 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--flaeche-hoch);
  overflow: hidden;
}

.balken > div {
  height: 100%;
  border-radius: 999px;
  background: var(--akzent);
  transition: width 0.4s ease;
}

.leer {
  text-align: center;
  color: var(--text-leise);
  padding: 48px 12px;
}

.leer .gross {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

.abmelden {
  display: block;
  margin: 28px auto 0;
  padding: 10px 18px;
  border: 1px solid var(--rand);
  border-radius: 999px;
  background: none;
  color: var(--text-leise);
  font-size: 13px;
}
