/* Fortepair Business – das Aussehen.
   Die Farben, Radien, Schatten und Schriftgrößen kommen aus `design.css`, das
   `bauen.mjs` aus shared/design/vorlagen.json erzeugt. Wird im Admin eine andere
   Vorgabe-Vorlage gewählt, ändert sich das Portal mit, ohne dass hier etwas
   angefasst werden muss. Hier steht nur die Anordnung. */

* { box-sizing: border-box; }
/* Jede Regel hier setzt `display` (grid, flex) und schlägt damit das `display: none`,
   das der Browser einem `hidden`-Element gibt – Autor-CSS geht vor Browser-CSS. Ohne
   diese Zeile blieben Startschirm, Kopf und Fuß sichtbar, obwohl app.js sie versteckt. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--schrift);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
h1 { font-size: var(--gross-size); font-weight: var(--gross-weight); letter-spacing: var(--gross-tracking); line-height: 1.15; }
h2 { font-size: var(--titel-size); font-weight: var(--titel-weight); letter-spacing: var(--titel-tracking); }
h3 { font-size: var(--h2-size); font-weight: var(--h2-weight); }
p { margin: 0; }
.leise { color: var(--muted); font-size: var(--klein-size); }
.mittig { text-align: center; }
.zahl { font-variant-numeric: tabular-nums; font-family: var(--schrift-zahl); }

/* ---------- Startschirm ---------- */
.startschirm { min-height: 100vh; display: grid; place-items: center; }
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: dreh 0.8s linear infinite;
}
@keyframes dreh { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- Kopf ---------- */
header {
  display: flex; align-items: center; gap: 18px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: var(--linie) solid var(--border);
  position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
}
.marke { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; }
.marke:hover { text-decoration: none; }
.marke-zeichen { width: 25px; height: 30px; color: var(--text); flex: none; }
.marke-text b { font-weight: 800; color: var(--primary); }
header nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
header nav a {
  padding: 7px 13px; border-radius: var(--r-pill); color: var(--muted);
  font-size: var(--klein-size); font-weight: 600;
}
header nav a:hover { background: var(--surface2); text-decoration: none; }
header nav a.hier { background: var(--primary); color: var(--onPrimary); }
.kopf-rechts { display: flex; align-items: center; gap: 10px; }
.guthaben {
  background: var(--surface2); border-radius: var(--r-pill); padding: 6px 13px;
  font-weight: 700; font-size: var(--klein-size); color: var(--text);
}
.guthaben:hover { text-decoration: none; background: var(--surface3); }

main { max-width: 1060px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-left)) 70px; }
.kopfzeile { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }

footer {
  border-top: var(--linie) solid var(--border); padding: 18px 16px 30px;
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
  color: var(--muted); font-size: var(--klein-size);
}
footer a { color: var(--muted); }

/* ---------- Karten und Raster ---------- */
.karte {
  background: var(--surface); border: var(--linie) solid var(--border);
  border-radius: var(--r-lg); padding: var(--karte); box-shadow: var(--schatten1);
  display: flex; flex-direction: column; gap: 10px;
}
.karte + .karte { margin-top: var(--luft); }
.karte.wichtig { border-color: var(--primary); border-width: 2px; }
.raster { display: grid; gap: var(--luft); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.raster.weit { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.reihe { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.reihe.ende { justify-content: flex-end; }
.spalte { display: flex; flex-direction: column; gap: 10px; }
.dazwischen { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.wachs { flex: 1; min-width: 0; }

.kennzahl .wert { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.kennzahl .name { color: var(--muted); font-size: var(--klein-size); font-weight: 600; }
.kennzahl.betont .wert { color: var(--primary); }

/* ---------- Knöpfe ---------- */
.knopf {
  font: inherit; font-weight: 600; font-size: var(--klein-size);
  padding: 10px 17px; border-radius: var(--r-md); border: var(--linie) solid transparent;
  background: var(--primary); color: var(--onPrimary); cursor: pointer;
  transition: filter var(--schnell) var(--kurve), background var(--schnell) var(--kurve);
}
.knopf:hover:not(:disabled) { filter: brightness(1.08); }
.knopf:active:not(:disabled) { filter: brightness(0.94); }
.knopf:disabled { opacity: 0.45; cursor: not-allowed; }
.knopf.zweit { background: var(--surface2); color: var(--text); border-color: var(--border); }
.knopf.geist { background: transparent; color: var(--muted); }
.knopf.geist:hover:not(:disabled) { background: var(--surface2); color: var(--text); }
.knopf.gefahr { background: var(--danger); color: #fff; }
.knopf.gross { padding: 13px 24px; font-size: var(--body-size); }
.knopf.klein { padding: 6px 12px; }

/* ---------- Felder ---------- */
label.feld { display: flex; flex-direction: column; gap: 5px; font-size: var(--klein-size); font-weight: 600; color: var(--muted); }
label.feld > input, label.feld > select, label.feld > textarea,
input.eingabe, select.eingabe, textarea.eingabe {
  font: inherit; font-size: var(--body-size); color: var(--text); font-weight: 400;
  background: var(--surface3); border: var(--linie) solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px; width: 100%;
}
label.feld > textarea { min-height: 76px; resize: vertical; }
label.feld > input:focus, label.feld > select:focus, label.feld > textarea:focus {
  outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary);
}
.feld .hinweis-klein { font-weight: 400; color: var(--muted); font-size: 12px; }
label.schalter { display: flex; align-items: center; gap: 9px; font-size: var(--body-size); font-weight: 400; cursor: pointer; }
label.schalter input { width: 18px; height: 18px; accent-color: var(--primary); }
fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

/* ---------- Marken, Chips ---------- */
.marke-chip, .chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface2); border-radius: var(--r-pill);
  padding: 4px 11px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.chip.an { background: var(--primary); color: var(--onPrimary); }
.chip.waehlbar { cursor: pointer; border: var(--linie) solid var(--border); }
.chip.gut { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chip.warn { background: color-mix(in srgb, var(--warn, #B45309) 18%, transparent); color: var(--warn, #B45309); }
.chip.schlecht { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

/* ---------- Tabellen ---------- */
.tabellenrand { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--klein-size); }
th, td { text-align: left; padding: 9px 10px; border-bottom: var(--linie) solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Diagramm ---------- */
.diagramm { width: 100%; height: auto; display: block; }
.diagramm .flaeche { fill: color-mix(in srgb, var(--primary) 16%, transparent); }
.diagramm .linie-kurve { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.diagramm .gitter { stroke: var(--border); stroke-width: 1; }
.diagramm .achse { fill: var(--muted); font-size: 10px; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legende i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* ---------- Fortschritt ---------- */
.balken { height: 7px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.balken > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }

/* ---------- Schritte des Assistenten ---------- */
.schritte { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.schritte .schritt {
  flex: 1; min-width: 120px; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--surface2); color: var(--muted); font-size: 12px; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.schritte .schritt.hier { background: var(--surface); color: var(--text); border-bottom-color: var(--primary); }
.schritte .schritt.fertig { color: var(--ok); }

/* ---------- Vorschau der Anzeige ---------- */
.vorschau-rahmen {
  background: var(--bg); border: var(--linie) solid var(--border); border-radius: var(--r-lg);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.vorschau-anzeige {
  background: var(--surface2); border-radius: var(--r-lg); padding: var(--karte);
  display: flex; flex-direction: column; gap: 7px;
}
.vorschau-anzeige img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--r-bild); display: block; background: var(--surface3); }
.vorschau-anzeige .kennzeichnung { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.vorschau-anzeige .titel { font-size: var(--titel-size); font-weight: 700; }
.vorschau-leer { aspect-ratio: 16/9; display: grid; place-items: center; background: var(--surface3); border-radius: var(--r-bild); color: var(--muted); font-size: 12px; }

/* ---------- Meldungen ---------- */
.meldung { border-radius: var(--r-sm); padding: 10px 13px; font-size: var(--klein-size); font-weight: 600; }
.meldung.fehler { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.meldung.gut { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.meldung.info { background: var(--surface2); color: var(--muted); }
.hinweis {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: var(--r-pill);
  font-size: var(--klein-size); font-weight: 600; box-shadow: var(--schatten3); z-index: 50;
}

.leer { text-align: center; color: var(--muted); padding: 44px 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ---------- Anmelden ---------- */
.anmeldeseite { max-width: 460px; margin: 7vh auto; }
.anmeldeseite.breit { max-width: 760px; }
.anmeldeseite .marke-gross { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 8px; }
.anmeldeseite .marke-gross .marke-zeichen { width: 36px; height: 44px; }
.reiter { display: flex; gap: 4px; background: var(--surface2); border-radius: var(--r-md); padding: 4px; }
.reiter button {
  flex: 1; font: inherit; font-size: var(--klein-size); font-weight: 600; cursor: pointer;
  padding: 9px; border: none; border-radius: var(--r-sm); background: transparent; color: var(--muted);
}
.reiter button.hier { background: var(--surface); color: var(--text); box-shadow: var(--schatten1); }

@media (max-width: 640px) {
  header { gap: 10px; }
  .marke-text { display: none; }
  main { padding-top: 16px; }
  h1 { font-size: 26px; }
  th, td { padding: 7px 8px; }
}
