/* Zuhause – ruhig, warm, mobil zuerst. */
:root {
  --bg: #f5efe6;
  --surface: #fffaf3;
  --surface-2: #efe6d8;
  --text: #2f2a25;
  --muted: #6d6257;
  --line: #e6dccc;
  --accent: #b9573a;
  --accent-ink: #fffaf3;
  --accent-soft: #f6e0d2;
  --hero-a: #fbe6d6;
  --hero-b: #f6eedb;
  --sage: #55744f;
  --sage-soft: #e0ead9;
  --quest: #8a6420;
  --quest-line: #dccba4;
  --quest-paper: #fbf3df;
  --shadow: 0 1px 2px rgba(80, 60, 40, .06), 0 8px 24px rgba(80, 60, 40, .06);
  --radius: 18px;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --surface: #26221f;
    --surface-2: #322c28;
    --text: #efe7dc;
    --muted: #ab9f91;
    --line: #3a332e;
    --accent: #e39270;
    --accent-ink: #2a1810;
    --accent-soft: #40291f;
    --hero-a: #3a2a22;
    --hero-b: #2c2a22;
    --sage: #a3bf9c;
    --sage-soft: #2a3528;
    --quest: #d8b56c;
    --quest-line: #4a4030;
    --quest-paper: #2d2820;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
  word-break: normal;
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Grundgerüst ---------- */
.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px)
           calc(env(safe-area-inset-right, 0px) + var(--gutter))
           calc(env(safe-area-inset-bottom, 0px) + 96px)
           calc(env(safe-area-inset-left, 0px) + var(--gutter));
}
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 20px;
}
.top-text { min-width: 0; flex: 1 1 200px; }
.top h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.dateline { color: var(--muted); margin-top: 4px; }
.status { color: var(--muted); font-size: .875rem; margin-top: 4px; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
/* Schmal: eine Spalte; Reihenfolge Jetzt -> Questlog -> Rest. */
.col { display: contents; }
.cols > .col > * { order: 3; min-width: 0; }
.cols > .col > #now { order: 1; }
.cols > .col > #sec-quests { order: 2; }
@media (min-width: 900px) {
  .col { display: grid; gap: 28px; align-content: start; min-width: 0; }
  .cols > .col > * { order: 0 !important; }
  .app { padding-top: 36px; }
  .cols { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 32px; }
  .top h1 { font-size: 2.1rem; }
}

.sec { min-width: 0; }
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 10px;
}
.sec-head h2, .fold summary > span:first-child { font-size: 1.05rem; font-weight: 650; }
.sec-head h2 { flex: 0 0 auto; }
.sec-note { color: var(--muted); font-size: .875rem; text-align: right; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.btn-small { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.btn-claude { min-height: 42px; padding: 8px 16px; font-size: .9rem; color: var(--muted); }
.btn-claude span { color: var(--accent); }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- Jetzt ---------- */
.hero {
  border-radius: 24px;
  padding: 22px 20px 18px;
  background: linear-gradient(140deg, var(--hero-a), var(--hero-b));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero.is-quiet { background: var(--surface); }
.eyebrow {
  font-size: .8rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h2 { font-size: 1.7rem; line-height: 1.2; margin-top: 8px; letter-spacing: -.01em; }
.hero.is-quiet h2 { font-size: 1.3rem; }
.hero-detail { margin-top: 8px; font-size: 1.05rem; }
.hero-next { margin-top: 10px; color: var(--muted); }
.hero-next strong { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.hero-actions .btn-primary { flex: 1 1 100%; min-height: 54px; font-size: 1.1rem; }
.hero-actions .btn:not(.btn-primary) { flex: 1 1 0; background: transparent; border-color: color-mix(in srgb, var(--text) 18%, transparent); }
@media (min-width: 520px) {
  .hero { padding: 28px 28px 22px; }
  .hero h2 { font-size: 2rem; }
  .hero.is-quiet h2 { font-size: 1.4rem; }
  .hero-actions .btn-primary { flex: 2 1 0; }
}
.hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: .9rem;
}
.hero-foot .btn { margin-right: -8px; }

/* ---------- 5-Minuten-Menü ---------- */
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 620px) { .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 96px;
  padding: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .08s ease, background-color .25s ease, border-color .25s ease;
}
.quick-card:active { transform: scale(.97); }
.quick-title { font-weight: 600; line-height: 1.25; hyphens: auto; }
.quick-card > * { min-width: 0; max-width: 100%; }
.quick-meta { color: var(--muted); font-size: .82rem; line-height: 1.3; }
.quick-card.is-done { background: var(--sage-soft); border-color: transparent; }
.quick-card.is-done .quick-meta { color: var(--sage); font-weight: 600; }

/* ---------- Listen ---------- */
.list > li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 16px;
  min-height: 60px;
}
.list > li + li { border-top: 1px solid var(--line); }
.item-main { flex: 1 1 auto; min-width: 0; }
.item-title { font-weight: 550; line-height: 1.3; }
.item-meta { color: var(--muted); font-size: .875rem; margin-top: 2px; }
.item-when {
  flex: 0 0 auto;
  min-width: 52px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
  font-size: .9rem;
}
.check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--muted) 45%, transparent);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
}
.check:active { background: var(--sage-soft); border-color: var(--sage); color: var(--sage); }
.item-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex: 0 0 auto; }

/* ---------- Heute (Zeitstrahl) ---------- */
.timeline { padding: 8px 16px; }
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 46px 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 0;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 62px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.timeline li:first-child::before { top: 50%; }
.timeline li:last-child::before { bottom: 50%; }
.timeline li:only-child::before { display: none; }
.tl-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }
.tl-dot {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid color-mix(in srgb, var(--muted) 55%, var(--surface));
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  color: var(--surface);
}
.tl-title { line-height: 1.3; min-width: 0; }
.tl-state { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.timeline .is-done .tl-dot { background: var(--sage); border-color: var(--sage); }
.timeline .is-done .tl-title { color: var(--muted); }
.timeline .is-skipped .tl-title, .timeline .is-expired .tl-title { color: var(--muted); opacity: .7; }
.timeline .is-skipped .tl-dot, .timeline .is-expired .tl-dot { border-style: dotted; }
.timeline .is-skipped .tl-time, .timeline .is-expired .tl-time, .timeline .is-expired .tl-state { opacity: .7; }
.timeline .is-sent .tl-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline .is-sent .tl-title { font-weight: 650; }
.timeline .is-sent .tl-state { color: var(--accent); font-weight: 600; }
.timeline .is-later .tl-dot { border-color: var(--accent); }

/* ---------- Questlog (ruhiges Reisetagebuch, kein Punktestand) ---------- */
.questlog {
  position: relative;
  padding: 4px 16px;
  background: linear-gradient(180deg, var(--quest-paper), var(--surface));
  border-color: var(--quest-line);
}
.questlog::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--quest-line);
  border-radius: calc(var(--radius) - 4px);
  opacity: .6;
  pointer-events: none;
}
.quest { position: relative; padding: 16px 2px 14px; }
.quest + .quest { border-top: 1px dashed var(--quest-line); }
.quest-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.quest-head h3 { min-width: 0; hyphens: auto; }
.quest-mark { flex: 0 0 auto; color: var(--quest); font-size: .8rem; transform: translateY(-1px); }
.quest h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: .005em;
}
.quest-step { margin: 6px 0 0 22px; line-height: 1.4; }
.quest-label {
  display: block;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--quest);
}
.quest-step.is-empty { color: var(--muted); font-style: italic; }
.quest-step a { color: var(--accent); text-underline-offset: 2px; }
.quest-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 10px 0 0 22px; }
.quest-done { border-color: var(--quest-line); background: transparent; }
.quest-form { margin: 10px 0 0 22px; display: grid; gap: 8px; }
.quest-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--quest-line);
  background: var(--surface);
  font-size: 16px;
}
.quest-form input::placeholder { color: var(--muted); opacity: .85; }
.quest-form-actions { display: flex; gap: 8px; }
.quest-log { margin: 0; flex: 1 1 100%; }
.quest-row .quest-log:only-child { margin-left: -12px; }
.quest-log summary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .9rem;
  cursor: pointer;
  list-style: none;
}
.quest-log summary::-webkit-details-marker { display: none; }
.quest-log summary::after { content: "▾"; margin-left: 6px; font-size: .8em; }
.quest-log[open] summary::after { content: "▴"; }
.quest-row.has-button .quest-log { flex: 0 1 auto; }
.quest-row.has-button .quest-log[open] { flex: 1 1 100%; }
.quest-journal { padding: 2px 0 4px 12px; }
.quest-journal li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 6px;
  padding: 5px 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.35;
}
.quest-journal .j-mark { color: var(--sage); font-weight: 700; }
.quest-journal .j-date { font-variant-numeric: tabular-nums; font-size: .82rem; white-space: nowrap; }
.quest-journal .j-more { grid-template-columns: minmax(0, 1fr); font-style: italic; padding-left: 24px; }

/* ---------- Chips (antippen statt tippen) ---------- */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips-label { color: var(--muted); font-size: .875rem; flex: 0 0 100%; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  max-width: 100%;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: .95rem;
  line-height: 1.3;
  text-align: left;
  transition: transform .08s ease, background-color .15s ease;
}
.chip:active { transform: scale(.97); background: var(--surface-2); }
.chip[disabled] { opacity: .5; }
.chip-link { border-color: transparent; background: transparent; color: var(--muted); font-size: .875rem; padding: 8px 6px; text-decoration: underline; text-underline-offset: 3px; }
.quest-chips { margin: 8px 0 0 22px; }
.quest-chips .chip { border-color: var(--quest-line); }
.quest-chips .chip-link { border-color: transparent; }
.shop-suggest { padding: 0 12px 14px; }
.shop-suggest .chip { border-radius: 999px; min-height: 40px; background: var(--bg); }

.timeline li.is-tappable { cursor: pointer; }
.timeline li.is-tappable:focus-visible { outline-offset: -2px; border-radius: 10px; }
.tl-actions { grid-column: 3 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 6px; }
.timeline .is-open .tl-title { color: var(--text); opacity: 1; }

/* ---------- Aufs Handy (QR) ---------- */
.top-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-phone { display: none; }
@media (min-width: 900px) { .btn-phone { display: inline-flex; } }
.qr-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  text-align: center;
}
.qr-dialog::backdrop { background: rgba(28, 25, 23, .5); }
.qr-dialog h2 { font-size: 1.2rem; }
.qr-code {
  width: 240px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 16px auto 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}
.qr-code svg { display: block; width: 100%; height: 100%; }
.qr-hint { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }

/* ---------- Essen ---------- */
.dinner { padding: 18px 18px 16px; }
.dinner h3 { font-size: 1.35rem; line-height: 1.25; margin-top: 6px; }
.dinner-meta { color: var(--muted); margin-top: 4px; font-size: .9rem; }
.week { border-top: 1px solid var(--line); padding: 6px 18px 10px; }
.week li, .proposal-meals li {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 0;
  align-items: baseline;
}
.week li + li, .proposal-meals li + li { border-top: 1px dashed var(--line); }
.week-day { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.week-min { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.week .is-today .week-day { color: var(--accent); font-weight: 600; }
.empty { padding: 18px; color: var(--muted); }
.proposal { margin-top: 12px; padding: 18px; background: var(--accent-soft); border-color: transparent; }
.proposal h3 { font-size: 1.1rem; margin-top: 6px; }
.proposal p { margin-top: 6px; }
.proposal-meals { margin-top: 8px; }
.proposal-meals li + li { border-top-color: color-mix(in srgb, var(--text) 14%, transparent); }
.proposal-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.proposal-foot span { color: var(--muted); font-size: .875rem; }

/* ---------- Einkauf ---------- */
.aisle { padding: 6px 8px 4px; }
.aisle + .aisle { border-top: 1px solid var(--line); }
.aisle h3 {
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px 2px;
}
.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}
.shop-item:active { background: var(--surface-2); }
.shop-box {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1.5px solid color-mix(in srgb, var(--muted) 55%, transparent);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: transparent;
  transition: background-color .15s ease, border-color .15s ease;
}
.shop-text { min-width: 0; flex: 1 1 auto; }
.shop-note { color: var(--muted); font-size: .875rem; margin-left: 6px; }
.shop-item.is-ticked .shop-box { background: var(--sage); border-color: var(--sage); color: var(--surface); }
.shop-item.is-ticked .shop-text { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.shop-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.shop-form input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 16px; /* verhindert iOS-Zoom */
}
.shop-form input::placeholder { color: var(--muted); opacity: .8; }
.shop-form .btn { width: 46px; padding: 0; font-size: 1.35rem; font-weight: 500; flex: 0 0 auto; }

/* ---------- Aufräumen ---------- */
.fold summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary .sec-note::after { content: "  ▾"; }
.fold[open] summary .sec-note::after { content: "  ▴"; }
.fold[open] summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.fold .list > li { flex-wrap: wrap; }
.fold .item-main { flex-basis: 150px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: min(calc(100vw - 32px), 520px);
  padding: 6px 6px 6px 18px;
  min-height: 52px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: toast-in .2s ease-out;
}
.toast #toast-msg { padding: 6px 12px 6px 0; line-height: 1.3; font-size: .95rem; }
.toast button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 0;
  background: color-mix(in srgb, var(--bg) 16%, transparent);
  color: inherit;
  font-weight: 650;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- Vollbild-Hinweise ---------- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  text-align: center;
}
.screen-box { max-width: 340px; display: grid; gap: 12px; justify-items: center; }
.screen-box img { border-radius: 20px; }
.screen-box h1 { font-size: 1.4rem; line-height: 1.25; }
.screen-box p { color: var(--muted); }
.screen-box .btn { margin-top: 8px; }

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