/* Mein Mattelly — Design-System „Ivory × Black × Olive“ (Plan mattelly-onboarding-portal §3.1).
   Tokens 1:1 aus mattelly/web/app/globals.css (Quelle bleibt dort, Abgleich:
   uv run python -m scripts.portal_design_tokens --check). Drei Regeln: Olive markiert den Weg, die
   eine Handlung trägt Tinte, Flächen statt Rahmen; dunkle Zäsur nur auf „Fertig. Danke!“.
   Keine Inline-Styles (CSP style-src 'self'), keine fremden Hosts. */

@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("fonts/newsreader-latin.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/plex-mono-latin-400.woff2") format("woff2"); }

:root {
  /* tokens:start */
  --papier:       #F5F2EA;
  --karte:        #FCFBF8;
  --tinte:        #171714;
  --olive:        #59614B;
  --linie:        #DEDAD0;
  --grau:         #5F5C56;
  --grau-leise:   #6E6B64;
  --linie-stark:  #C9C4B6;
  --linie-leise:  #E8E4DA;
  --tinte-tief:   #0F0F0D;
  --olive-tint:   rgba(89, 97, 75, 0.08);
  --olive-kante:  rgba(89, 97, 75, 0.28);
  --olive-hell:   #A8B096;
  --papier-tief:  #F1EDE3;
  --go:           #3F6B33;
  --hold:         #7D5F12;
  --stop:         #9B3B2E;
  --rund:    14px;
  --rund-s:  8px;
  --schatten-s: 0 1px 2px rgba(23,23,20,.04), 0 6px 18px -10px rgba(23,23,20,.14);
  /* tokens:end */
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --body:    "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono:    "IBM Plex Mono", "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--tinte); font-family: var(--body);
  font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
:focus-visible { outline: 2px solid var(--olive); outline-offset: 3px; border-radius: 2px; }
::selection { background: rgba(89, 97, 75, .18); }

.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--linie); }
.marke { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--tinte); }
.marke .wort { height: 14px; width: auto; }
.firma { font-size: 14px; color: var(--grau); text-align: right; }

.seite { width: 100%; max-width: 640px; margin: 0 auto; padding: 28px 20px 48px; flex: 1; }
.fuss { max-width: 640px; width: 100%; margin: 0 auto; padding: 16px 20px 28px; font-size: 14px;
  color: var(--grau-leise); border-top: 1px solid var(--linie); }
.fuss a { color: var(--grau); }
/* Links im Text: Tinte, olive unterstrichen — nie Browser-Blau (sechs Farben, kein siebter Wert). */
.seite a:not(.knopf):not(.link) { color: var(--tinte); text-decoration-color: var(--olive);
  text-underline-offset: 3px; }

h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: -0.021em; line-height: 1.12; }
h1 { font-size: clamp(30px, 7vw, 40px); margin: 6px 0 12px; }
h2 { font-size: 24px; margin: 4px 0 8px; }
h2.klein { font-size: 20px; }
.lead { font-size: 18px; color: var(--tinte); margin: 0 0 18px; }
.hilfe { color: var(--grau); margin: -6px 0 18px; }
.leise { color: var(--grau-leise); font-size: 14px; }
.kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--olive);
  font-weight: 600; margin: 0 0 6px; }
.hinweis { background: var(--olive-tint); border-radius: var(--rund-s); padding: 12px 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.karte { background: var(--karte); border-radius: var(--rund); padding: 20px; margin: 18px 0;
  box-shadow: var(--schatten-s); }
.als-naechstes h2 { margin-top: 2px; }

/* Die eine Handlung trägt Tinte. */
.knopf { display: inline-block; background: var(--tinte); color: var(--karte); border: 0;
  border-radius: var(--rund-s); padding: 13px 22px; font: 600 16px/1.2 var(--body);
  text-decoration: none; cursor: pointer; min-height: 48px; }
.knopf:hover { background: var(--tinte-tief); }
.knopf.hell { background: transparent; color: var(--tinte); box-shadow: inset 0 0 0 1px var(--linie-stark); }
.link { background: none; border: 0; padding: 8px 0; color: var(--grau); font: inherit;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Olive markiert den Weg. */
.fortschritt { display: flex; align-items: center; gap: 12px; margin: 8px 0 6px; }
.balken { flex: 1; height: 6px; background: var(--linie); border-radius: 4px; overflow: hidden; }
.balken i { display: block; height: 100%; background: var(--olive); width: 0; }
.zahl { font-size: 14px; color: var(--grau); font-variant-numeric: tabular-nums; white-space: nowrap; }
.anteil-0 { width: 0 !important; } .anteil-5 { width: 5% !important; } .anteil-10 { width: 10% !important; }
.anteil-15 { width: 15% !important; } .anteil-20 { width: 20% !important; } .anteil-25 { width: 25% !important; }
.anteil-30 { width: 30% !important; } .anteil-35 { width: 35% !important; } .anteil-40 { width: 40% !important; }
.anteil-45 { width: 45% !important; } .anteil-50 { width: 50% !important; } .anteil-55 { width: 55% !important; }
.anteil-60 { width: 60% !important; } .anteil-65 { width: 65% !important; } .anteil-70 { width: 70% !important; }
.anteil-75 { width: 75% !important; } .anteil-80 { width: 80% !important; } .anteil-85 { width: 85% !important; }
.anteil-90 { width: 90% !important; } .anteil-95 { width: 95% !important; } .anteil-100 { width: 100% !important; }

.liste { list-style: none; padding: 0; margin: 24px 0; }
.liste li { border-bottom: 1px solid var(--linie-leise); }
.liste a, .liste li > span { display: flex; align-items: center; gap: 12px; padding: 12px 2px;
  color: var(--tinte); text-decoration: none; }
.liste .haken { width: 22px; text-align: center; color: var(--grau-leise); }
.liste .fertig .haken { color: var(--olive); font-weight: 600; }
.liste .fertig .titel { color: var(--grau); }
.liste .an { margin-left: auto; font-size: 14px; color: var(--grau-leise); }
.marke-klein { font-size: 12px; color: var(--olive); border: 1px solid var(--olive-kante);
  border-radius: 6px; padding: 1px 6px; }
.abmelden { margin-top: 32px; }

.schrittkopf { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.schrittkopf a { color: var(--grau); }

form.stapel { display: flex; flex-direction: column; gap: 10px; }
label { font-weight: 500; }
label.nebenbei { font-weight: 400; color: var(--grau); font-size: 15px; margin-top: 6px; }
input, textarea { font: inherit; color: var(--tinte); background: var(--karte); border: 0;
  box-shadow: inset 0 0 0 1px var(--linie-stark); border-radius: var(--rund-s); padding: 12px 14px;
  width: 100%; min-height: 48px; }
input:focus, textarea:focus { outline: 2px solid var(--olive); outline-offset: 1px; }
input.code { font-family: var(--mono); font-size: 26px; letter-spacing: .3em; max-width: 220px; }
fieldset { border: 0; margin: 0; padding: 0; }

.wahl { display: grid; gap: 8px; }
.wahl.zwei { grid-template-columns: 1fr 1fr; }
.wahl.drei { grid-template-columns: 1fr; }
@media (min-width: 520px) { .wahl.drei { grid-template-columns: repeat(3, 1fr); } }
.opt { display: flex; align-items: center; gap: 10px; background: var(--karte); border-radius: var(--rund-s);
  padding: 12px 14px; box-shadow: inset 0 0 0 1px var(--linie); cursor: pointer; font-weight: 500; min-height: 48px; }
.opt input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--olive); box-shadow: none; }
.opt:has(input:checked) { box-shadow: inset 0 0 0 2px var(--olive); background: var(--olive-tint); }
.opt.klein { font-weight: 400; background: transparent; box-shadow: none; padding: 4px 0; min-height: 0; }

.vorschlag .wert { font-size: 18px; }
.werte { margin: 0; padding-left: 18px; }
dl.werte { padding: 0; display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; }
dl.werte dt { color: var(--grau-leise); }
dl.werte dd { margin: 0; }

/* „Korrigieren“ öffnet das Feld — eine Sache pro Bildschirm; ohne :has bleibt es sichtbar. */
.korrektur { display: flex; flex-direction: column; gap: 10px; }
@supports selector(:has(*)) {
  .korrektur { display: none; }
  .antwort:has(input[name="stimmt"][value="nein"]:checked) .korrektur { display: flex; }
}

.aktionen { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.gespeichert { margin: 0; text-align: right; }
.neben { display: flex; flex-direction: column; gap: 8px; margin-top: 36px; padding-top: 16px;
  border-top: 1px solid var(--linie); }
details summary { cursor: pointer; color: var(--grau); padding: 8px 0; }
details[open] summary { color: var(--tinte); }
.weitergeben form { margin-top: 8px; }

.anleitung-kopf { margin: 6px 0 4px; }
.anleitung-kopf p { margin: 2px 0; }
.anleitung { list-style: none; padding: 0; margin: 0 0 18px; }
.anleitung .karte { margin: 12px 0; }
.anleitung .karte > p { margin: 0 0 10px; }
.zeichnung { display: block; width: 100%; height: auto; border-radius: var(--rund-s); background: var(--papier-tief); margin: 6px 0 12px; }
.klappt-nicht summary { font-size: 15px; }
.klappt-nicht p { color: var(--grau); margin: 4px 0 0; }
.anleitung-klappe { margin: 0 0 16px; }
.treppe h2 { margin-top: 0; }
.vertragstext { margin: 12px 0 18px; }
.vertragstext .text { max-height: 60vh; overflow: auto; font-size: 15px; }
.vertragstext table { border-collapse: collapse; width: 100%; font-size: 13px; }
.vertragstext th, .vertragstext td { border-bottom: 1px solid var(--linie); padding: 4px 6px; text-align: left; vertical-align: top; }
code { font-family: var(--mono); font-size: 0.9em; }
.stufe h3 { font-family: var(--display); font-weight: 400; font-size: 21px; margin: 2px 0 6px; }
.stufe .balken { display: block; margin: 10px 0 8px; }
.stufe p { margin: 0 0 6px; }

/* Dunkle Zäsur — nur einmal: „Fertig. Danke!“ */
body.zaesur { background: var(--tinte); color: var(--karte); }
body.zaesur .kopf, body.zaesur .fuss { border-color: rgba(252, 251, 248, .12); }
body.zaesur .marke, body.zaesur .lead { color: var(--karte); }
body.zaesur .marke .wort { filter: invert(1); }
body.zaesur .firma, body.zaesur .fuss, body.zaesur .fuss a { color: var(--olive-hell); }
body.zaesur .liste li { border-color: rgba(252, 251, 248, .12); }
body.zaesur .liste .titel { color: var(--olive-hell); }
body.zaesur .liste .fertig .haken { color: var(--olive-hell); }
.seite .schrittkopf a:not(.knopf):not(.link) { color: var(--grau); text-decoration-color: currentColor; }
.vertragstext hr { border: 0; border-top: 1px solid var(--linie); margin: 18px 0; }
