/* Lebensplaner – ruhige Oberfläche mit Pixel-Icons. Alle Farben kommen aus den Tokens in index.html. */

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 17px; -webkit-text-size-adjust: 100%; }
html[data-groesse="klein"] { font-size: 15.5px; }
html[data-groesse="gross"] { font-size: 19px; }

body {
  margin: 0;
  font-family: var(--schrift);
  font-size: 1rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--tinte);
  background: var(--grund);
  -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--akzent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--akzent) 45%, transparent); outline-offset: 2px; border-radius: 8px; }

/* Pixel-Icons: scharf bleiben, nie weichzeichnen */
.ico { display: inline-block; flex: none; vertical-align: middle; background-size: 100% 100%; background-repeat: no-repeat; image-rendering: pixelated; width: 24px; height: 24px; }

/* ---------- Grundaufbau ---------- */

.app { max-width: 1040px; margin: 0 auto; padding-top: env(safe-area-inset-top, 0px); padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; }
.marke-app { display: flex; align-items: center; gap: 8px; color: var(--tinte); font-weight: 600; font-size: .94rem; min-width: 0; }
.kopf-rechts { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stand { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 500; color: var(--tinte-2); background: var(--karte); border-radius: 999px; padding: 4px 10px; white-space: nowrap; box-shadow: var(--schatten); }

.menue {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--leiste-grund);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--linie);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.menue a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; color: var(--tinte-2); font-size: .66rem; font-weight: 500; border-radius: 10px; }
.menue a .ico { width: 28px; height: 28px; opacity: .55; filter: grayscale(1); transition: opacity .15s, filter .15s; }
.menue a.ist-aktiv { color: var(--akzent); }
.menue a.ist-aktiv .ico { opacity: 1; filter: none; }

.ansicht { display: grid; gap: 16px; min-width: 0; padding-top: 6px; }
.ansicht > * { min-width: 0; }

@media (min-width: 880px) {
  .app { display: grid; grid-template-columns: 200px minmax(0, 1fr); column-gap: 36px; align-items: start; padding-bottom: 48px; }
  .kopf { grid-column: 1 / -1; padding-top: 22px; }
  .menue { position: sticky; top: 20px; flex-direction: column; justify-content: flex-start; gap: 2px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 0; padding: 0; }
  .menue a { flex: none; flex-direction: row; gap: 12px; padding: 8px 12px; font-size: .94rem; color: var(--tinte); }
  .menue a .ico { width: 24px; height: 24px; opacity: 1; filter: none; }
  .menue a:hover { background: var(--flaeche); }
  .menue a.ist-aktiv { background: var(--karte); color: var(--tinte); font-weight: 600; box-shadow: var(--schatten); }
}

/* ---------- Seitenkopf und Karten ---------- */

.seitenkopf { display: grid; gap: 4px; padding: 6px 2px 4px; }
.seitenkopf h1 { font-family: var(--schrift-titel); font-size: 2rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; text-wrap: balance; }
.seitenkopf .datumzeile { font-size: .8rem; font-weight: 600; color: var(--tinte-2); text-transform: uppercase; letter-spacing: .04em; }
.seitenkopf .matt { max-width: 60ch; }

.kasten { background: var(--karte); border-radius: 18px; padding: 18px; box-shadow: var(--schatten); }
.kasten > * + * { margin-top: 14px; }
.kasten-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kasten-kopf h2 { flex: 1 1 0%; min-width: 8rem; }
.kasten-kopf .knoepfe { display: flex; flex-wrap: nowrap; gap: 6px; }
.kasten--flach { background: var(--flaeche); box-shadow: none; padding: 12px; }

h2 { font-family: var(--schrift-titel); font-size: 1.18rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; text-wrap: balance; }
h3 { font-size: 1rem; font-weight: 600; line-height: 1.3; }

.klein { font-size: .84rem; }
.matt { color: var(--tinte-2); }
.gut { color: var(--gut); }
.schlecht { color: var(--schlecht); }
.gold { color: var(--gold); }
.rechts { text-align: right; }
.zahlen { font-variant-numeric: tabular-nums; white-space: nowrap; }
.gross { font-family: var(--schrift-titel); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.raster { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.raster > * { min-width: 0; }
.reihe { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.reihe--ende { justify-content: flex-end; }
.reihe--weit { justify-content: space-between; }
.reihe > .wachs { flex: 1 1 140px; min-width: 0; }
.stapel { display: grid; gap: 10px; }
.stapel > * { min-width: 0; }

.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 16px; }
.kennzahl { display: grid; gap: 2px; min-width: 0; }
.kennzahl span { font-size: .8rem; color: var(--tinte-2); }

/* ---------- Knöpfe und Felder ---------- */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: var(--akzent); color: var(--akzent-tinte);
  font-weight: 500; line-height: 1.2; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.knopf:hover { filter: brightness(1.06); }
.knopf:active { transform: scale(.97); }
.knopf--gruen { background: var(--gut); color: #fff; }
.knopf--rot { background: var(--schlecht); color: #fff; }
.knopf--blank { background: var(--flaeche); color: var(--akzent); }
.knopf--klein { min-height: 32px; padding: 0 14px; font-size: .88rem; }
.knopf--symbol { min-width: 32px; padding: 0 8px; }
.knopf[disabled] { opacity: .4; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--akzent); cursor: pointer; font-weight: 500; text-align: left; }
.link:hover { text-decoration: underline; }

.feld {
  display: block; width: 100%; min-width: 0; min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--linie); border-radius: 10px;
  background: var(--feld); color: var(--tinte);
}
.feld:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 25%, transparent); }
select.feld { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--tinte-2) 50%), linear-gradient(135deg, var(--tinte-2) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.feld { resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .82rem; }
.feld--kurz { width: 7.5em; }
label.zeile { display: grid; gap: 5px; font-weight: 500; font-size: .88rem; min-width: 0; }
label.zeile small { font-weight: 400; color: var(--tinte-2); }
.form { display: grid; gap: 14px; }
.form .zwei, .zwei { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.haken { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.haken input { flex: none; appearance: none; width: 22px; height: 22px; margin: 0; border: 1.5px solid var(--tinte-2); border-radius: 50%; background: var(--feld); cursor: pointer; transition: background .15s, border-color .15s; }
.haken input:checked { border-color: var(--gut); background: var(--gut) url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M6 12.5l4 4 8-9'/></svg>") center / 15px no-repeat; }
.haken input[type="radio"]:checked { border-color: var(--akzent); background: var(--feld); box-shadow: inset 0 0 0 5px var(--akzent); }
/* Schalter für Ein/Aus-Einstellungen in den Optionen */
.haken input.schalter { width: 46px; height: 28px; border: 0; border-radius: 999px; background: var(--flaeche); position: relative; box-shadow: inset 0 0 0 1px var(--linie); }
.haken input.schalter::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.haken input.schalter:checked { background: var(--gut); box-shadow: none; }
.haken input.schalter:checked::after { transform: translateX(18px); }
.haken span { min-width: 0; overflow-wrap: anywhere; }
.haken.ist-erledigt span { text-decoration: line-through; color: var(--tinte-2); }

/* Segmentierte Auswahl */
.reiter { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: color-mix(in srgb, var(--tinte-2) 16%, transparent); }
.reiter button { flex: 1 1 auto; min-width: 0; border: 0; border-radius: 8px; padding: 6px 6px; background: none; color: var(--tinte); font-size: .86rem; font-weight: 500; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reiter button.ist-aktiv { background: var(--karte); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- Leisten, Marken, Listen ---------- */

.leiste { height: 8px; border-radius: 999px; background: var(--flaeche); overflow: hidden; }
.leiste i { display: block; height: 100%; border-radius: 999px; background: var(--gut); transition: width .3s; }
.leiste.ist-warn i { background: var(--warn); }
.leiste.ist-schlecht i { background: var(--schlecht); }
.leiste.ist-blau i { background: var(--akzent); }
.leiste.ist-lila i { background: var(--lila); }
.leiste.ist-gold i { background: #ff9f0a; }
.messwert { display: grid; gap: 6px; }
.messwert .reihe { justify-content: space-between; font-size: .88rem; gap: 4px 10px; }

.marke { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: .72rem; font-weight: 600; line-height: 1.6; color: #fff; background: var(--f, var(--tinte-2)); white-space: nowrap; }
.pille { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .76rem; font-weight: 500; line-height: 1.6; background: var(--flaeche); color: var(--tinte-2); white-space: nowrap; }
.pille.ist-schlecht { background: color-mix(in srgb, var(--schlecht) 14%, transparent); color: var(--schlecht); }
.pille.ist-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.pille.ist-gut { background: color-mix(in srgb, var(--gut) 16%, transparent); color: var(--gut); }

.liste { display: grid; }
.liste > li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 0.5px solid var(--linie); min-width: 0; }
.liste > li:last-child { border-bottom: 0; }
.liste .mitte { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.liste .mitte small { display: block; color: var(--tinte-2); font-size: .8rem; margin-top: 1px; }
.liste button.zeile-knopf { all: unset; flex: 1 1 0; min-width: 0; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.liste button.zeile-knopf:focus-visible { outline: 3px solid color-mix(in srgb, var(--akzent) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
.gruppe { font-size: .76rem; font-weight: 600; color: var(--tinte-2); text-transform: uppercase; letter-spacing: .04em; padding: 14px 0 4px; display: flex; align-items: center; gap: 8px; }
.liste > li.gruppe { border-bottom: 0; padding-bottom: 2px; }
.punkt { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--f, var(--tinte-2)); }

.leer { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 18px 8px; }
.leer .ico { width: 48px; height: 48px; }
.leer p { color: var(--tinte-2); max-width: 42ch; }
.hinweis { background: var(--flaeche); border-radius: 12px; padding: 10px 14px; font-size: .88rem; color: var(--tinte-2); }
.hinweis.ist-info { background: color-mix(in srgb, var(--akzent) 9%, var(--karte)); }

.quests li { padding: 6px 0; border: 0; }
.quests .ico { width: 18px; height: 18px; }
.quests .offen { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid var(--tinte-2); }

/* ---------- Diagramme ---------- */

.saeulen { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; align-items: end; height: 150px; padding: 6px 4px 0; border-bottom: 0.5px solid var(--linie); }
.saeulen .monat { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; min-width: 0; }
.saeulen .monat i { display: block; width: min(14px, 42%); border-radius: 4px 4px 0 0; background: var(--gut); min-height: 2px; }
.saeulen .monat i + i { background: var(--schlecht); opacity: .85; }
.saeulen-achse { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; padding: 4px 4px 0; text-align: center; font-size: .74rem; color: var(--tinte-2); }
.saeulen-achse .ist-aktiv { color: var(--tinte); font-weight: 600; }
.legende { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--tinte-2); }
.legende span { display: inline-flex; align-items: center; gap: 6px; }

.streifen { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--flaeche); gap: 2px; }
.streifen i { display: block; height: 100%; background: var(--f); }
.verlauf { display: block; width: 100%; height: 90px; }

/* ---------- Kalender ---------- */

.monatsgitter { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.monatsgitter .wt { text-align: center; font-size: .72rem; font-weight: 600; color: var(--tinte-2); padding: 2px 0 6px; }
.tag { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 48px; padding: 4px 2px; border-radius: 10px; min-width: 0; overflow: hidden; }
.tag:hover { background: var(--flaeche); }
.tag:focus-visible { outline: 3px solid color-mix(in srgb, var(--akzent) 45%, transparent); }
.tag .nr { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: .9rem; font-weight: 500; line-height: 1; }
.tag.ist-fremd { color: var(--tinte-2); opacity: .5; }
.tag.ist-frei .nr { color: var(--schlecht); }
.tag.ist-heute .nr { color: var(--schlecht); font-weight: 700; }
.tag.ist-gewaehlt .nr { background: var(--tinte); color: var(--karte); font-weight: 600; }
.tag.ist-heute.ist-gewaehlt .nr { background: var(--schlecht); color: #fff; }
.tag .punkte { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.tag .punkte i { width: 5px; height: 5px; border-radius: 50%; background: var(--akzent); }
.tag .punkte i.frist { background: var(--schlecht); }
.tag .punkte i.geld { background: #ff9f0a; }
.tag .punkte i.fremd { background: var(--lila); }
.tag .titel { display: none; align-self: stretch; font-size: .68rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--akzent) 12%, transparent); }
@media (min-width: 640px) {
  .tag { min-height: 84px; align-items: stretch; }
  .tag .nr { align-self: flex-end; }
  .tag .titel { display: block; }
  .tag .punkte { display: none; }
}

/* ---------- Essen ---------- */

.mahl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 11px 0; border-bottom: 0.5px solid var(--linie); }
.mahl:last-of-type { border-bottom: 0; }
.mahl .wo { font-size: .74rem; font-weight: 600; color: var(--tinte-2); text-transform: uppercase; letter-spacing: .03em; }
.mahl .was { min-width: 0; }
.mahl .was .link { font-size: 1rem; color: var(--tinte); font-weight: 500; overflow-wrap: anywhere; }
.mahl .knoepfe { display: flex; gap: 4px; }
.mahl .knoepfe .knopf--symbol { background: var(--flaeche); }
.mahl .knoepfe .knopf--symbol[aria-pressed="true"] { background: color-mix(in srgb, var(--akzent) 18%, transparent); }
details.tagkarte > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
details.tagkarte > summary::-webkit-details-marker { display: none; }
details.tagkarte > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--tinte-2); border-bottom: 2px solid var(--tinte-2); transform: rotate(-45deg); margin-left: 4px; transition: transform .2s; }
details.tagkarte[open] > summary::after { transform: rotate(45deg); }
details.tagkarte > summary h3 { flex: 1 1 auto; font-size: 1.05rem; }
details > summary { cursor: pointer; font-weight: 500; color: var(--akzent); }
details.tagkarte > summary { color: var(--tinte); }

.angebot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 14px; align-items: start; padding: 12px 0; border-bottom: 0.5px solid var(--linie); }
.angebot:last-child { border-bottom: 0; }
.angebot .preis { font-size: 1.05rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.4; }
.angebot .statt { text-decoration: line-through; color: var(--tinte-2); font-size: .8rem; font-weight: 400; }
.angebot h3 { font-size: .98rem; overflow-wrap: anywhere; }

.zutaten li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 0.5px solid var(--linie); }
.zutaten li span:last-child { text-align: right; white-space: nowrap; color: var(--tinte-2); }
.schritte { counter-reset: schritt; display: grid; gap: 10px; }
.schritte li { counter-increment: schritt; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
.schritte li::before { content: counter(schritt); font-size: .78rem; font-weight: 700; background: var(--akzent); color: var(--akzent-tinte); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }

/* ---------- Fenster und Meldungen ---------- */

dialog.fenster { border: 0; padding: 0; margin: auto; width: min(540px, calc(100% - 24px)); max-height: calc(100% - 40px); background: var(--karte); color: var(--tinte); border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden; }
dialog.fenster[open] { display: flex; flex-direction: column; }
dialog.fenster--schmal { width: min(380px, calc(100% - 24px)); }
dialog.fenster::backdrop { background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.fenster-kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 6px 20px; }
.fenster-kopf .knopf--blank { min-height: 30px; min-width: 30px; padding: 0; border-radius: 50%; color: var(--tinte-2); }
.fenster-inhalt { padding: 6px 20px 20px; overflow: auto; min-height: 0; display: grid; gap: 14px; }
.fenster-inhalt > * { min-width: 0; }

.meldungen { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; width: max-content; max-width: calc(100% - 32px); pointer-events: none; }
.meldung { background: color-mix(in srgb, var(--tinte) 88%, transparent); color: var(--grund); padding: 9px 16px; border-radius: 999px; font-size: .88rem; font-weight: 500; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); animation: auftauchen .25s ease-out; }
.meldung.ist-gut { background: var(--gut); color: #fff; }
.meldung.ist-schlecht { background: var(--schlecht); color: #fff; }
.meldung.ist-gold { background: #ff9f0a; color: #fff; }
@keyframes auftauchen { from { opacity: 0; transform: translateY(8px); } }

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