@font-face {
  font-family: "Recursive";
  font-style: oblique 0deg 15deg;
  font-weight: 300 1000;
  font-display: swap;
  src: url(/static/recursive-latin.woff2) format("woff2");
}

:root {
  --fliese: #f2f5f1;
  --kachel: #ffffff;
  --rosmarin: #1d3127;
  --salbei: #6b8576;
  --fuge: #dce4de;
  --safran: #f0b232;
  --safran-text: #2a2108;
  --safran-tief: #9a6a05;
  --schatten: 0 1px 2px rgb(29 49 39 / 0.06), 0 6px 18px rgb(29 49 39 / 0.07);

  --display: "Recursive", ui-rounded, system-ui, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Recursive", ui-monospace, monospace;

  --r: 14px;
  --tabbar: 64px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fliese: #0f1713;
    --kachel: #18231d;
    --rosmarin: #e4ede7;
    --salbei: #8ea596;
    --fuge: #26342c;
    --safran-tief: #f0b232;
    --schatten: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  overscroll-behavior-y: contain;
  background: var(--fliese);
  color: var(--rosmarin);
  font: 17px/1.4 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--safran); outline-offset: 2px; border-radius: 6px; }

.mono { font-family: var(--mono); font-variation-settings: "MONO" 1, "CASL" 0; }

/* ---------- Kopf ---------- */

.kopf {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: calc(env(safe-area-inset-top) + 10px) 20px 10px;
  background: color-mix(in srgb, var(--fliese) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.marke {
  font-family: var(--display);
  font-variation-settings: "CASL" 1, "MONO" 0;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0;
}

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

.neu-laden {
  border: 0;
  background: none;
  color: var(--salbei);
  font-size: 15px;
  padding: 6px 2px;
  cursor: pointer;
}

.kopf-rechts { display: flex; gap: 14px; }

.verbindung {
  margin: 0 16px 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--safran) 22%, var(--kachel));
  font-size: 14px;
  font-weight: 600;
}

.blatt.ohne-bild { padding-top: 22px; }
.blatt .hinweis { margin: 0 20px; }

/* ---------- Spalten / Ansichten ---------- */

main {
  padding: 0 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 96px);
}

.ansicht { display: none; }
.ansicht.aktiv { display: block; }

.titel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 4px 14px;
}

.titel h2 {
  font-family: var(--display);
  font-variation-settings: "CASL" 1, "MONO" 0;
  font-weight: 850;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}

.titel .unter {
  display: block;
  font: 14px/1.3 var(--text);
  color: var(--salbei);
  margin-top: 6px;
  letter-spacing: 0;
  font-weight: 400;
}

/* ---------- Woche ---------- */

.wochennav { display: flex; gap: 6px; }

.wochennav button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--fuge);
  background: var(--kachel);
  font-size: 18px;
  cursor: pointer;
}

.tag {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 14px 4px;
  border-top: 1px solid var(--fuge);
  transition: background 0.15s;
  border-radius: 10px;
}

.tag.ziel { background: color-mix(in srgb, var(--safran) 22%, transparent); }

.datum { padding-top: 2px; }

.datum .wt {
  display: block;
  font-family: var(--display);
  font-variation-settings: "CASL" 1, "MONO" 0;
  font-weight: 850;
  font-size: 22px;
  line-height: 1;
}

.datum .nr { font-size: 13px; color: var(--salbei); }

.tag.heute .wt { color: var(--safran-tief); }
.datum .heute-marke { display: block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--safran-tief); }

.kacheln {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-right: -20px;
  padding-right: 20px;
  min-height: 64px;
}

.kacheln::-webkit-scrollbar { display: none; }

.kachel {
  flex: 0 0 132px;
  background: var(--kachel);
  border-radius: var(--r);
  box-shadow: var(--schatten);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.15s, opacity 0.15s;
}

.kachel img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--fuge);
  pointer-events: none;
}

.kachel .name {
  padding: 8px 10px 2px;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 560;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kachel .zeit { padding: 0 10px 10px; font-size: 12px; color: var(--salbei); }

.kachel.weg { opacity: 0.25; }

.geist {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  transform: rotate(-3deg) scale(1.05);
  box-shadow: 0 18px 40px rgb(29 49 39 / 0.25);
}

.frei {
  flex: 1;
  border: 1.5px dashed var(--fuge);
  border-radius: var(--r);
  color: var(--salbei);
  font-size: 14px;
  display: grid;
  place-items: center;
  min-height: 56px;
}

.hinweis { color: var(--salbei); font-size: 13px; margin: 14px 4px 0; }

/* ---------- Einkauf ---------- */

.rezepte { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 4px 18px; }

.rezepte > span {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--kachel);
  border: 1px solid var(--fuge);
}

.gruppe { margin-bottom: 22px; }

.gruppe h3, .gruppe summary {
  font: 600 13px/1.2 var(--text);
  color: var(--salbei);
  margin: 0 4px 8px;
  letter-spacing: 0.02em;
}

.gruppe summary { cursor: pointer; padding: 4px 0; }

.liste {
  background: var(--kachel);
  border-radius: var(--r);
  box-shadow: var(--schatten);
  overflow: hidden;
}

.zeile {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-top: 1px solid var(--fuge);
  cursor: pointer;
}

.zeile:first-child { border-top: 0; }
.zeile.aus .zname, .zeile.aus .streifen { opacity: 0.55; }

.haken {
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--fuge);
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.haken svg { width: 14px; height: 14px; opacity: 0; }

.zeile.an .haken { background: var(--rosmarin); border-color: var(--rosmarin); }
.zeile.an .haken svg { opacity: 1; color: var(--fliese); }

.zname { font-weight: 560; }

.marke-klein {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 99px;
  border: 1px solid var(--fuge);
  color: var(--salbei);
  vertical-align: 2px;
}

.streifen {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--salbei);
  line-height: 1.5;
}

.streifen .op { margin: 0 5px; }
.streifen .wer { font-family: var(--text); font-size: 12px; }

.ergebnis {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 1px;
}

.zeile.an .ergebnis {
  background: linear-gradient(transparent 12%, var(--safran) 12%, var(--safran) 88%, transparent 88%);
  color: var(--safran-text);
}


.aktion {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--safran);
  color: var(--safran-text);
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 8px 24px rgb(154 106 5 / 0.3);
  cursor: pointer;
}

.aktion:disabled { background: var(--fuge); color: var(--salbei); box-shadow: none; }

.rezepte .wann { color: var(--salbei); }

.ergebnis.spaeter { background: none !important; color: var(--safran-tief) !important; box-shadow: inset 0 0 0 1.5px var(--safran); }

.protokoll .zeile { grid-template-columns: 44px 1fr; cursor: default; font-size: 14px; }
.protokoll .zeit { color: var(--salbei); font-size: 12px; padding-top: 2px; }

/* ---------- Ideen ---------- */

.suche { display: flex; gap: 8px; margin: 0 0 14px; }

.suche input {
  flex: 1;
  min-width: 0;
  font: 16px var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--fuge);
  background: var(--kachel);
  color: var(--rosmarin);
}

.suche input:focus { outline: none; border-color: var(--safran); }

.chip {
  border: 1.5px solid var(--fuge);
  background: var(--kachel);
  border-radius: 99px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chip.an { background: var(--rosmarin); border-color: var(--rosmarin); color: var(--fliese); }

.ideen-reihe { margin: 0 0 22px; padding-bottom: 6px; }
.ideen-reihe:empty { display: none; }
.kachel.idee { border: 0; padding: 0; text-align: left; font: inherit; cursor: pointer; }

dialog#einplanen {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 520px;
  border-radius: 22px 22px 0 0;
  background: var(--kachel);
  color: var(--rosmarin);
}

dialog#einplanen::backdrop { background: rgb(15 23 19 / 0.45); }

.blatt { padding: 0 0 calc(env(safe-area-inset-bottom) + 18px); display: grid; gap: 14px; }
.blatt img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 22px 22px 0 0; }
.blatt > :not(img) { margin: 0 20px; }
.blatt h3 { font-family: var(--display); font-variation-settings: "CASL" 1, "MONO" 0; font-weight: 850; font-size: 24px; line-height: 1.15; }
.blatt .link { color: var(--safran-tief); font-weight: 600; text-decoration: none; font-size: 15px; }
.tageswahl { display: flex; flex-wrap: wrap; gap: 8px; }
.schliessen { border: 0; background: none; color: var(--salbei); font-size: 15px; padding: 4px; cursor: pointer; }

@media (min-width: 600px) {
  dialog#einplanen { margin: auto; border-radius: 22px; }
  .blatt { padding-bottom: 20px; }
}

/* ---------- Bring ---------- */

#bring-neu { margin-bottom: 18px; }

.ptr {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top) + 50px);
  z-index: 4;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--salbei);
  opacity: 0;
  pointer-events: none;
}

.bring .zeile { grid-template-columns: 30px 1fr auto; align-items: center; transition: opacity 0.2s; }

.gang-wahl {
  position: relative;
  width: 34px;
  height: 34px;
  margin: -4px -6px -4px 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--salbei);
}

.gang-wahl svg { width: 18px; height: 18px; }

.gang-wahl select {
  position: absolute;
  inset: 0;
  opacity: 0;
  font-size: 16px;
  cursor: pointer;
}

.gang-wahl:focus-within { outline: 3px solid var(--safran); }

.gang-klein {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  color: var(--salbei);
  vertical-align: 1px;
}
.bring .angabe { color: var(--salbei); font-size: 14px; margin-left: 8px; }

.leer {
  padding: 28px 18px;
  text-align: center;
  color: var(--salbei);
  font-size: 15px;
}

/* ---------- Tabbar, Meldungen ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--kachel) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--fuge);
}

.tabbar button {
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--salbei);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.tabbar button[aria-selected="true"] { color: var(--rosmarin); }
.tabbar svg { width: 24px; height: 24px; }
.tabbar .zahl {
  font-family: var(--mono);
  font-variation-settings: "MONO" 1;
  font-size: 11px;
  margin-left: 3px;
  color: var(--safran-tief);
}

.meldung {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 84px);
  transform: translate(-50%, 20px);
  opacity: 0;
  z-index: 60;
  background: var(--rosmarin);
  color: var(--fliese);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
  display: flex;
  gap: 14px;
  align-items: center;
  max-width: calc(100vw - 32px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.meldung.da { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.meldung button { border: 0; background: none; color: var(--safran); font-weight: 700; padding: 0; cursor: pointer; }

.laedt { opacity: 0.5; transition: opacity 0.2s; }

@media (min-width: 980px) {
  main {
    display: grid;
    grid-template-columns: minmax(380px, 1.15fr) minmax(340px, 1fr) minmax(280px, 0.8fr);
    gap: 28px;
    padding: 0 28px 48px;
    align-items: start;
  }
  .ansicht { display: block; }
  #woche { grid-column: 1; grid-row: 1; }
  #ideen { grid-column: 1; grid-row: 2; }
  #einkauf { grid-column: 2; grid-row: 1 / span 2; }
  #bring { grid-column: 3; grid-row: 1 / span 2; }
  .tabbar { display: none; }
}

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

/* ---------- Anmelden ---------- */

.anmelden { max-width: 420px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 48px) 24px 40px; display: block; }
.anmelden h1 { font-size: 40px; margin-bottom: 28px; }
.anmelden p { color: var(--salbei); }
.anmelden details { margin-top: 22px; }
.anmelden summary { cursor: pointer; color: var(--salbei); font-weight: 600; padding: 6px 0; }
.formular { display: grid; gap: 12px; margin-top: 14px; }
.formular input {
  font: 17px var(--text); padding: 14px; border-radius: 14px; border: 2px solid var(--fuge);
  background: var(--kachel); color: var(--rosmarin);
}
.formular input:focus { outline: none; border-color: var(--safran); }
.anmelden .schliessen { display: block; text-align: center; margin-top: 14px; text-decoration: none; }
.fehler { color: #b3412c; min-height: 1.4em; font-size: 15px; margin-top: 16px; }

.blatt h4 { margin: 6px 20px 0; font-size: 13px; color: var(--salbei); letter-spacing: 0.02em; }
.konto-zeile { grid-template-columns: 1fr auto; cursor: default; align-items: center; }
