/* Layout: eine Spalte, Handy zuerst, Reiter-Leiste unten wie bei einer iPhone-App.
   Farben: Jagdgrün (Turnier-Sakko) als Akzent, Leder-Braun für Hinweise. */
:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --ink: #18221c;
  --muted: #5f6b63;
  --line: #dde3dc;
  --accent: #24412f;
  --accent-ink: #ffffff;
  --accent-soft: #e3ece4;
  --leather: #8a5a2b;
  --good: #1d7a3a;
  --bad: #b3362f;
  --font: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: Newsreader, "New York", "Iowan Old Style", Georgia, serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101512;
    --surface: #18201b;
    --ink: #eef2ee;
    --muted: #9eaaa2;
    --line: #2a352e;
    --accent: #8fc4a0;
    --accent-ink: #0f1a13;
    --accent-soft: #213027;
    --leather: #d6a26c;
    --good: #6fcf8c;
    --bad: #f0857d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden; /* Sicherheitsnetz: nie seitlich wackeln */
  overflow-x: clip;
}
button, a, label, summary { touch-action: manipulation; }
h1, h2 { margin: 0; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
[hidden] { display: none !important; }

/* Kopfzeile */
.topbar {
  background: var(--accent);
  color: var(--accent-ink);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 640px; margin: 0 auto;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) 22px max(16px, env(safe-area-inset-left, 0px));
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.eyebrow { font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.topbar h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 600; line-height: 1.1; overflow-wrap: anywhere; }
.badge {
  font-size: .75rem; font-weight: 600; padding: 5px 10px; border-radius: 99px;
  background: var(--leather); color: #fff; white-space: nowrap;
}
.badge.soft { background: rgba(255,255,255,.16); color: var(--accent-ink); }
.topbar-titles { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.topbar-chips { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.wrap {
  max-width: 640px; margin: 0 auto;
  padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.view { display: flex; flex-direction: column; gap: 14px; }
#overview-content { display: flex; flex-direction: column; gap: 14px; }

/* Karten */
.card, .hero, .empty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.hero { background: var(--accent-soft); border-color: transparent; border-radius: 18px; gap: 4px; padding: 16px 18px; }
.label { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hero-num {
  font-family: var(--font-display); font-size: 2.8rem; font-weight: 500; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.hero-profit {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: .85rem; color: var(--muted);
}
.hero-profit strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.sub, .muted, .hint { color: var(--muted); font-size: .9rem; }
.hint { color: var(--leather); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
}
.num { font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* Wert-Paare */
.pairs { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pairs div { display: flex; justify-content: space-between; gap: 12px; }
.pairs dt { color: var(--muted); }
.pairs dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.pairs .total { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

/* Kategorie-Balken */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .92rem; }
.bar-row .val { font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-track { grid-column: 1 / -1; height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }

/* Formulare */
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.grid2 > *, .form label { min-width: 0; }
input, select, textarea {
  font: inherit; font-size: 16px; /* 16px verhindert das Hineinzoomen auf dem iPhone */
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; width: 100%; min-width: 0; max-width: 100%;
}
/* iPhone: Safari-eigenes Aussehen abschalten, sonst sind Datumsfelder breiter als ihre Spalte */
input:not([type="checkbox"]):not([type="radio"]), select, textarea { -webkit-appearance: none; appearance: none; }
input[type="date"] {
  display: block; min-height: 46px; line-height: 1.3; text-align: left;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .6; }
select {
  min-height: 46px; padding-right: 36px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23808a83' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-msg { min-height: 1.2em; font-size: .9rem; color: var(--good); }
.form-msg.error { color: var(--bad); }

/* Knöpfe */
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 12px; padding: 12px 16px; border: 1px solid transparent;
  background: var(--accent-soft); color: var(--ink);
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost.danger { background: transparent; color: var(--bad); border-color: var(--line); }
.btn.block { width: 100%; }
.btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--leather); outline-offset: 2px; }
.confirm { border: 1px solid var(--bad); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }

/* Liste */
.count { color: var(--muted); font-weight: 400; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.li-main { min-width: 0; }
.li-title { font-weight: 600; }
.li-meta { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.li-amt { font-variant-numeric: tabular-nums; font-weight: 650; }
.li-del {
  border: 0; background: transparent; color: var(--muted); font-size: 1.2rem;
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
}
.li-del.armed { background: var(--bad); color: #fff; font-size: .75rem; width: auto; padding: 0 10px; }

.empty h2 { font-family: var(--font-display); font-size: 1.4rem; }

/* Reiter-Leiste unten */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.tab {
  font: inherit; font-size: .72rem; font-weight: 600; cursor: pointer;
  background: transparent; border: 0; color: var(--muted);
  padding: 8px 4px 10px; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--accent); font-weight: 700; }

/* Turniere */
:root { --warn-bg: #fbecc8; --warn-ink: #6b4a00; --crit-bg: #f8d9d6; --crit-ink: #8e231d; --ok-bg: #dcefe0; --ok-ink: #1c5a2e; }
@media (prefers-color-scheme: dark) {
  :root { --warn-bg: #4a3a12; --warn-ink: #f6d58a; --crit-bg: #4d1f1c; --crit-ink: #f6b0aa; --ok-bg: #1f3a28; --ok-ink: #9fdcb0; }
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  font-size: .75rem; font-weight: 600; padding: 3px 8px; border-radius: 99px;
  background: var(--accent-soft); color: var(--ink); white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.warn::before { content: "! "; }
.chip.crit { background: var(--crit-bg); color: var(--crit-ink); }
.chip.crit::before { content: "× "; }
.chip.muted { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.chip.plain { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.chip.result { background: var(--leather); color: #fff; }
.list.events li { grid-template-columns: auto 1fr; align-items: start; gap: 12px; cursor: pointer; }
.list.events li:focus-visible { outline: 2px solid var(--leather); outline-offset: 2px; border-radius: 8px; }
.ev-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 54px; padding: 7px 0; border-radius: 12px; background: var(--accent-soft);
  font-variant-numeric: tabular-nums; line-height: 1.05; gap: 2px;
}
.ev-wd { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ev-dm { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; }
.ev-date.result { background: var(--leather); color: #fff; }
.ev-date.result .ev-wd { color: #fff; opacity: .9; }
.ev-date.result .ev-dm { font-size: 1.25rem; }
.next-event {
  font: inherit; text-align: left; cursor: pointer; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
}
.ne-icon, .ne-chev { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ne-icon { width: 22px; height: 22px; }
.ne-chev { width: 16px; height: 16px; opacity: .8; }
.ne-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.next-event.warn { border-color: transparent; background: var(--warn-bg); color: var(--warn-ink); }
.next-event.warn .ne-meta { color: var(--warn-ink); }
.ne-title { font-weight: 700; font-size: .95rem; }
.ne-meta { color: var(--muted); font-size: .82rem; }
.result-fields { border: 1px dashed var(--line); border-radius: 12px; padding: 8px 12px 12px; margin: 0; }
.result-fields legend { font-size: .8rem; color: var(--muted); padding: 0 4px; }
#ev-delete.armed { background: var(--bad); color: #fff; }

/* Belege & Unterlagen */
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.upload { display: flex; flex-direction: column; gap: 8px; }
.upload-btn { text-align: center; display: block; }
.upload input:focus-visible + .check, .upload-btn:focus-within { outline: 2px solid var(--leather); }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb {
  position: relative; width: 64px; height: 84px; border-radius: 8px; overflow: hidden;
  background: var(--accent-soft); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-x {
  position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 99px;
  border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer;
}
.pdf-tag { font-size: .75rem; font-weight: 700; letter-spacing: .06em; color: var(--bad); }
.receipt-btn {
  font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; margin-top: 4px;
  padding: 3px 8px; border-radius: 99px; border: 1px dashed var(--line); background: transparent; color: var(--muted);
}
.receipt-btn.has { border-style: solid; border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.tip { font-size: .85rem; color: var(--muted); }
.tip summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.tip p { margin-top: 6px; }
.btn.small { padding: 6px 10px; font-size: .82rem; border-radius: 9px; text-decoration: none; }
.btn.armed { background: var(--bad) !important; color: #fff !important; }
.list.docs li { grid-template-columns: auto 1fr; cursor: pointer; }
.list.docs .thumb { width: 44px; height: 58px; }

.viewer {
  width: min(600px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); padding: 16px;
}
.viewer[open] { display: flex; flex-direction: column; gap: 12px; }
.viewer::backdrop { background: rgba(10, 20, 14, .55); }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.viewer-list { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.viewer-item { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.viewer-item img { width: 100%; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.viewer-item figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.viewer-item figcaption span { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.pdf-block { height: 90px; border-radius: 8px; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }

.backup-last { font-weight: 600; font-size: .92rem; }
.btn:disabled { opacity: .5; cursor: wait; }

/* Pflegeplan */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; margin-top: 6px; }
.list.care li { grid-template-columns: 1fr auto; align-items: center; }
.care-actions { display: flex; flex-direction: column; gap: 6px; }
.btn.done { background: var(--accent); color: var(--accent-ink); }
.sub-form { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.next-event.crit { border-color: var(--crit-ink); background: var(--crit-bg); }
.next-event.crit .label, .next-event.crit .ne-title { color: var(--crit-ink); }
.linklike { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 600; }

/* Aufklappbare Bereiche im Formular */
.more { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.more-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; resize: vertical;
}

/* Verkaufsordner */
.variant { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.form label.variant-opt, .variant-opt {
  flex-direction: row; align-items: flex-start; gap: 8px; cursor: pointer; color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px;
}
.variant-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.variant-opt input { margin-top: 3px; accent-color: var(--accent); }
.variant-opt span { display: flex; flex-direction: column; gap: 2px; }
.variant-opt small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.checks { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }

/* Neues Design: Ausgaben-Formular */
.small-note { font-size: .8rem; }
.field-label { font-size: .88rem; color: var(--muted); }
.amount-row { display: flex; align-items: flex-end; gap: 12px; }
.form label.amount-field { flex: 1; min-width: 0; }
.amount-input { display: flex; align-items: baseline; gap: 4px; border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.amount-input input {
  border: 0; outline: none; background: transparent; padding: 0; border-radius: 0;
  font-family: var(--font-display); font-size: 2.2rem; font-weight: 500; color: var(--ink);
}
.amount-input input:focus { outline: none; }
.amount-input span { font-family: var(--font-display); font-size: 1.6rem; color: var(--muted); }
.form label.date-field { width: 150px; flex: none; }
.cat-pick { display: flex; flex-direction: column; gap: 6px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
  min-height: 38px; padding: 7px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.chip-btn.more { border-style: dashed; color: var(--muted); background: transparent; }
.chip-btn:focus-visible { outline: 2px solid var(--leather); outline-offset: 2px; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-row .btn { min-height: 48px; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; font-size: 1rem; padding: 10px 8px; white-space: nowrap; }
.form .action-row .scan-btn { background: var(--accent-soft); color: var(--accent); border: 1.5px dashed var(--accent); }
.variant-opt input[type="radio"] { width: 18px; height: 18px; flex: none; padding: 0; }
.scan-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#expense-form.editing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Neues Design: Ausgabenliste nach Monaten */
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 4px 0; }
.list-head h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; }
.month-groups { display: flex; flex-direction: column; gap: 14px; }
.month { display: flex; flex-direction: column; gap: 6px; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; }
.month-head h3 { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.month-head span { font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.month ul { list-style: none; margin: 0; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.exp-item { border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 4px; }
.exp-item:last-child { border-bottom: 0; }
.exp-open {
  font: inherit; color: inherit; text-align: left; cursor: pointer; background: none; border: 0;
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 0;
}
.exp-open:focus-visible { outline: 2px solid var(--leather); outline-offset: 2px; border-radius: 8px; }
.cat-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center;
}
.cat-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.exp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.exp-text strong { font-size: .93rem; }
.exp-text span { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.exp-amt { font-weight: 700; font-size: .93rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 12px 0; }

/* Neues Design: Steckbrief, Pflege-Status */
.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.facts div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.facts dt { font-size: .75rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; }
.pony-desc { font-size: .9rem; color: var(--muted); }
.list.care li { position: relative; padding-left: 14px; }
.list.care li::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 4px; background: var(--line); }
.list.care li.st-ok::before { background: var(--good); }
.list.care li.st-warn::before { background: #c98a00; }
.list.care li.st-crit::before { background: var(--bad); }

/* Foto-Galerie */
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.photo-tile { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--accent-soft); }
.photo-open { all: unset; cursor: pointer; display: block; width: 100%; height: 100%; }
.photo-open:focus-visible { outline: 2px solid var(--leather); outline-offset: -2px; }
.photo-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-star {
  position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 99px; border: 0; cursor: pointer;
  background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center;
}
.photo-star svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.photo-star[aria-pressed="true"] { background: var(--leather); }
.photo-star[aria-pressed="true"] svg { fill: currentColor; }
.pony-cover { width: 100%; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; display: block; }

/* Fütterungsplan */
.feed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed-time { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 0 4px; }
.feed-time:first-child { padding-top: 0; }
.feed-row { border-bottom: 1px solid var(--line); }
.feed-open {
  font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: left; width: 100%;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; min-height: 44px;
}
.feed-open:focus-visible { outline: 2px solid var(--leather); outline-offset: 2px; border-radius: 8px; }
.feed-name { font-weight: 600; }
.feed-amount { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); }
.feed-note { grid-column: 1 / -1; font-size: .82rem; color: var(--muted); }
.feed-note:empty { display: none; }
.form-label-plain { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; color: var(--muted); }

/* Mehrere Ponys */
.ponies-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pony-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pony-row:last-child { border-bottom: 0; }
.pony-row-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.pony-row.active .pony-row-name { font-family: var(--font-display); font-size: 1.15rem; }
button.badge.switch { border: 0; cursor: pointer; font: inherit; font-size: .75rem; font-weight: 600; min-height: 32px; }

/* Diagramme */
.footnote { color: var(--muted); font-size: .8rem; margin-top: -6px; }
.chart-box { width: 100%; }
.chart { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.c-grid { stroke: var(--line); stroke-width: 1; }
.c-axis { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.c-tick { fill: var(--muted); font-size: 10px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.c-label { fill: var(--good); font-size: 10.5px; font-weight: 600; font-family: var(--font); }
.c-s1 { fill: var(--accent); }
.c-s2 { fill: var(--leather); }
.c-bar rect.c-s1, .c-bar rect.c-s2 { opacity: .55; transition: opacity .15s; }
.c-bar.on rect.c-s1, .c-bar.on rect.c-s2 { opacity: 1; }
.c-hit { fill: transparent; cursor: pointer; }
.c-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.c-area { fill: var(--accent); opacity: .1; stroke: none; }
.c-proj { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 4; opacity: .6; }
.c-target { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 6 4; }
.c-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.c-cross { stroke: var(--muted); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.sw-s1 { background: var(--accent); }
.sw-s2 { background: var(--leather); }
.sw-line { height: 2px; background: var(--accent); }
.sw-proj { height: 0; border-top: 2px dashed var(--accent); opacity: .6; }
.sw-target { height: 0; border-top: 2px dashed var(--good); }
.chart-readout { font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 1.3em; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 360px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .hero-num { font-size: 2.1rem; }
  .amount-row { flex-direction: column; align-items: stretch; }
  .form label.date-field { width: 100%; }
  .variant { grid-template-columns: minmax(0, 1fr); }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar h1 { font-size: 1.7rem; }
}
