/* Better Life – Design-System. Dunkel als Standard, Glas-Kacheln, iOS-Anmutung. */
:root {
  --bg: #000;
  --bg-elev: #0d0d10;
  --card: rgba(28, 28, 32, 0.72);
  --card-solid: #1c1c20;
  --card-border: rgba(255, 255, 255, 0.07);
  --fill: rgba(120, 120, 128, 0.24);
  --fill-2: rgba(120, 120, 128, 0.14);
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.62);
  --text-3: rgba(235, 235, 245, 0.36);
  --sep: rgba(84, 84, 88, 0.5);
  /* Akzente; in der Farbschwäche-Palette werden sie umgestellt */
  --blue: #0a84ff; --green: #30d158; --orange: #ff9f0a; --red: #ff453a; --purple: #bf5af2;
  --teal: #64d2ff; --yellow: #ffd60a; --pink: #ff375f; --indigo: #5e5ce6;
  --kcal: var(--orange); --protein: var(--pink); --carbs: var(--teal); --fat: var(--yellow);
  --ok: var(--green); --bad: var(--red);
  --radius: 18px; --radius-s: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f2f2f7; --bg-elev: #fff; --card: rgba(255, 255, 255, 0.82); --card-solid: #fff;
  --card-border: rgba(0, 0, 0, 0.06); --fill: rgba(120, 120, 128, 0.2); --fill-2: rgba(120, 120, 128, 0.12);
  --text: #1c1c1e; --text-2: rgba(60, 60, 67, 0.65); --text-3: rgba(60, 60, 67, 0.35); --sep: rgba(60, 60, 67, 0.2);
  --blue: #007aff; --green: #248a3d; --orange: #c93400; --red: #d70015; --purple: #8944ab; --teal: #0071a4;
  --yellow: #a05a00; --pink: #d30f45; --indigo: #3634a3;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #f2f2f7; --bg-elev: #fff; --card: rgba(255, 255, 255, 0.82); --card-solid: #fff;
    --card-border: rgba(0, 0, 0, 0.06); --fill: rgba(120, 120, 128, 0.2); --fill-2: rgba(120, 120, 128, 0.12);
    --text: #1c1c1e; --text-2: rgba(60, 60, 67, 0.65); --text-3: rgba(60, 60, 67, 0.35); --sep: rgba(60, 60, 67, 0.2);
    --blue: #007aff; --green: #248a3d; --orange: #c93400; --red: #d70015; --purple: #8944ab; --teal: #0071a4;
    --yellow: #a05a00; --pink: #d30f45; --indigo: #3634a3;
    color-scheme: light;
  }
}
/* Farbschwäche (Rot-Grün): Blau/Orange-Achse statt Grün/Rot, Gelb statt Grün für "ok" */
:root[data-cvd="1"] {
  --green: #3d9bff; --red: #ff8c1a; --ok: #3d9bff; --bad: #ff8c1a; --pink: #e86bff; --teal: #9ad7ff; --yellow: #ffe066;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
body { min-height: 100dvh; overflow-x: hidden; }
#app, .sheet { overflow-wrap: anywhere; }
.sheet > * { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; }

/* ---------- Gerüst ---------- */
#app { max-width: 640px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 10px 2px 14px; }
.page-head h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.page-head .sub { color: var(--text-2); font-size: 14px; font-weight: 500; }
.page-head .sub::first-letter { text-transform: uppercase; }
.page-head .btn, .page-head .icon-btn { white-space: nowrap; flex: none; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); font-size: 17px; background: none; border: 0; padding: 6px 0; cursor: pointer; }
.section-title { font-size: 20px; font-weight: 700; margin: 24px 2px 10px; display: flex; justify-content: space-between; align-items: center; }
.section-title .link { font-size: 15px; font-weight: 500; }

.tabbar { position: fixed; inset: auto 0 0 0; z-index: 20; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: space-around; background: rgba(18, 18, 20, 0.78); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 0.5px solid var(--sep); }
:root[data-theme="light"] .tabbar { background: rgba(249, 249, 249, 0.85); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-3); font-size: 10.5px; font-weight: 500; }
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a.active { color: var(--blue); }

/* ---------- Karten ---------- */
.card { background: var(--card); border: 0.5px solid var(--card-border); border-radius: var(--radius); padding: 16px;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); margin-bottom: 12px; }
.card.tap { cursor: pointer; transition: transform .15s ease; }
.card.tap:active { transform: scale(0.98); }
.card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 > .card { margin-bottom: 0; }
.big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.big small { font-size: 15px; color: var(--text-2); font-weight: 500; margin-left: 2px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Listen im iOS-Stil */
.list { background: var(--card); border: 0.5px solid var(--card-border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 50px; position: relative; cursor: default; }
.list-item + .list-item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); }
.list-item.tap { cursor: pointer; }
.list-item.tap:active { background: var(--fill-2); }
.list-item .chev { color: var(--text-3); font-size: 20px; }
.list-item .value { color: var(--text-2); font-variant-numeric: tabular-nums; }
.list-head { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.03em; margin: 18px 16px 6px; }
.list-foot { font-size: 13px; color: var(--text-3); margin: -4px 16px 14px; }

/* ---------- Bedienelemente ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 14px; padding: 12px 18px;
  font-weight: 600; font-size: 16px; cursor: pointer; background: var(--blue); color: #fff; transition: opacity .15s, transform .1s; }
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn.secondary { background: var(--fill); color: var(--text); }
.btn.danger { background: transparent; color: var(--red); }
.btn.block { width: 100%; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--fill); color: var(--blue);
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; flex: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 5px 5px 4px; margin-left: -5px; margin-right: -5px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; background: var(--fill); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 500; cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); }
.seg { display: flex; background: var(--fill-2); border-radius: 10px; padding: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 4px; font-size: 13.5px; font-weight: 500; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--text); color: var(--bg); font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.seg.few button.on::before { content: "✓ "; }
.seg button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Viele Optionen (z. B. 5 Mahlzeiten): nicht abschneiden, sondern waagerecht wischen */
.seg.many { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg.many::-webkit-scrollbar { display: none; }
.seg.many button { flex: 1 0 auto; padding: 7px 10px; overflow: visible; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--text-2); margin: 0 4px 6px; }
input.input, select.input, textarea.input { width: 100%; background: var(--fill-2); border: 0.5px solid var(--card-border); border-radius: 12px;
  padding: 12px 14px; font-size: 17px; outline: none; -webkit-appearance: none; appearance: none; }
textarea.input { min-height: 90px; resize: vertical; }
input.input:focus, textarea.input:focus, select.input:focus { border-color: var(--blue); }
.inline-input { background: none; border: 0; text-align: right; font-size: 17px; width: 110px; outline: none; color: var(--text-2); }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--fill); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%;
  transition: .2s; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }

/* ---------- Ringe & Balken ---------- */
.ring { position: relative; flex: none; }
.ring svg { display: block; transform: rotate(-90deg); }
.ring .track { stroke: var(--fill-2); }
.ring .bar { transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); stroke-linecap: round; }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring .center b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ring .center span { font-size: 11px; color: var(--text-2); }
.bar-h { height: 8px; border-radius: 99px; background: var(--fill-2); overflow: hidden; }
.bar-h > div { height: 100%; border-radius: 99px; transition: width .6s ease; }
/* Überschreitung zusätzlich mit Muster kennzeichnen, nicht nur Farbe */
.bar-h.over > div { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.35) 0 4px, transparent 4px 8px) !important; }
.macro { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.macro .lbl { font-size: 12px; color: var(--text-2); margin-bottom: 6px; display: flex; flex-direction: column; gap: 1px; }
.macro .lbl span:last-child { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Habits ---------- */
.habit { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.habit .ico { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none;
  background: color-mix(in srgb, var(--c) 22%, transparent); }
.habit .meta { font-size: 13px; color: var(--text-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--c); background: transparent; flex: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: #fff; transition: transform .15s, background .2s; }
.check:active { transform: scale(0.88); }
.check.done { background: var(--c); }
.check.partial { background: conic-gradient(var(--c) calc(var(--p) * 1%), transparent 0); }
.check.relapse { border-style: dashed; }
.check.auto { border-style: dotted; cursor: default; }
.pop { animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.18); } }

/* Kalender & Raster: Zustand IMMER zusätzlich per Symbol */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal .wd { font-size: 11px; color: var(--text-3); font-weight: 600; }
.cal .day { aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12px; background: var(--fill-2); position: relative; cursor: pointer; }
.cal .day .n { font-size: 10px; color: var(--text-3); position: absolute; top: 3px; left: 5px; }
.cal .day .s { font-size: 15px; font-weight: 800; }
.cal .day.done { background: color-mix(in srgb, var(--c) 85%, transparent); color: #fff; }
.cal .day.done .n { color: rgba(255,255,255,.75); }
.cal .day.partial { background: color-mix(in srgb, var(--c) 35%, transparent); }
.cal .day.missed .s { color: var(--bad); }
.cal .day.paused { background: repeating-linear-gradient(45deg, var(--fill-2) 0 5px, transparent 5px 10px); }
.cal .day.today { outline: 2px solid var(--text); outline-offset: -2px; }
.cal .day.empty { background: none; cursor: default; }
.cal .day.clean { background: color-mix(in srgb, var(--c) 70%, transparent); color: #fff; }
.cal .day.relapse .s { color: var(--bad); }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 11px; height: 11px; border-radius: 3px; background: var(--fill-2); display: block; position: relative; }
/* Füllgrad: Größe des inneren Quadrats wächst mit der Quote (nicht nur Helligkeit) */
.heat i::after { content: ""; position: absolute; inset: calc((1 - var(--f, 0)) * 5px); border-radius: 2px; background: var(--c, var(--green)); opacity: calc(.35 + var(--f, 0) * .65); }
.heat i.none::after { display: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend b { font-weight: 800; margin-right: 3px; }

/* ---------- Sheets, Toasts ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease; }
.sheet { width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; background: var(--bg-elev); border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(var(--safe-b) + 20px); animation: up .28s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--fill); margin: 0 auto 10px; }
.sheet h2 { font-size: 20px; margin: 4px 0 16px; display: flex; justify-content: space-between; align-items: center; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); transform: translateX(-50%); z-index: 60;
  background: var(--card-solid); border: 0.5px solid var(--card-border); padding: 11px 18px; border-radius: 14px; font-size: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: fade .2s ease; max-width: calc(100% - 32px); }
.toast.err { color: var(--bad); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty-state .e { font-size: 44px; margin-bottom: 8px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--fill); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.fab-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.fab { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px; border-radius: 16px; border: 0;
  background: var(--card); border: 0.5px solid var(--card-border); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.fab .i { font-size: 26px; }
.fab:active { transform: scale(0.95); }
.scanner { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4/3; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .line { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: var(--red); box-shadow: 0 0 10px var(--red); }
.scanner .frame { position: absolute; inset: 28% 8%; border: 2px solid rgba(255,255,255,.7); border-radius: 12px; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--fill); }
.conf-high { color: var(--ok); } .conf-medium { color: var(--orange); } .conf-low { color: var(--bad); }
.chart { width: 100%; height: 160px; display: block; }
.chart text { fill: var(--text-3); font-size: 10px; }
.timer { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.set-row { display: grid; grid-template-columns: 34px 1fr 1fr 44px; gap: 8px; align-items: center; padding: 6px 0; }
.set-row.head { font-size: 12px; color: var(--text-3); padding: 0; }
.set-row input { background: var(--fill-2); border: 0; border-radius: 9px; padding: 9px 6px; text-align: center; font-size: 16px; width: 100%;
  font-variant-numeric: tabular-nums; }
.set-row .idx { text-align: center; color: var(--text-2); font-weight: 600; font-size: 14px; cursor: pointer; }
.set-row.done input { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.set-row .prev { grid-column: 2 / 4; font-size: 11.5px; color: var(--text-3); margin-top: -4px; }
.set-ok { width: 40px; height: 36px; border-radius: 9px; border: 0; background: var(--fill); font-size: 18px; cursor: pointer; font-weight: 800; }
.set-ok.on { background: var(--ok); color: #fff; }
.scale5 { display: flex; gap: 8px; }
.scale5 button { flex: 1; border: 0; padding: 10px 0; border-radius: 12px; background: var(--fill-2); font-size: 22px; cursor: pointer; }
.scale5 button.on { background: var(--blue); outline: 2px solid var(--text); outline-offset: -2px; }
.login-wrap { min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; }
.logo { width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 14px; display: block; }
.center { text-align: center; }
hr.sep { border: 0; border-top: 0.5px solid var(--sep); margin: 14px 0; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.photo-grid img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; }

/* Icon-Kacheln und Monogramme statt Emojis */
.icon-tile { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.mono { font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.habit .ico.mono { background: var(--c); font-size: 16px; }
.fab svg { width: 26px; height: 26px; color: var(--blue); }
.card h3 svg { width: 16px; height: 16px; }
.chip svg, .btn svg { width: 17px; height: 17px; }
.scale-caps { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin: 6px 4px 0; }
.scale5 button { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.empty-state .e svg { width: 44px; height: 44px; color: var(--text-3); }

/* ---------- Kalorienbalken ---------- */
:root { --warn: var(--orange); --low: rgba(160,160,175,.55); }
:root[data-cvd="1"] { --warn: #ffe066; }
.kg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.kg-pill { font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 12px; max-width: 58%; text-align: right; line-height: 1.3;
  background: color-mix(in srgb, var(--zc) 18%, transparent); color: var(--zc); animation: pill-in .5s .4s both; }
.kg-sym { font-weight: 800; margin-right: 5px; }
.z-ok { --zc: var(--ok); } .z-warn { --zc: var(--warn); } .z-bad { --zc: var(--bad); } .z-low { --zc: var(--low); }
.kg-wrap { position: relative; padding-top: 22px; }
.kg-bar { position: relative; height: 22px; border-radius: 11px; background: var(--fill-2); overflow: hidden; }
.kg-zone { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--zc) 14%, transparent); }
.kg-zone.z-bad { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--zc) 16%, transparent) 0 5px, transparent 5px 10px); }
.kg-fill { position: absolute; top: 0; bottom: 0; background: var(--zc); }
.kg-fill.z-warn { background-image: radial-gradient(rgba(0,0,0,.28) 1.2px, transparent 1.4px); background-size: 6px 6px; background-color: var(--zc); }
.kg-fill.z-bad { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.4) 0 4px, transparent 4px 8px); background-color: var(--zc); }
.kg-train { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(-45deg, rgba(255,255,255,.16) 0 3px, transparent 3px 7px); }
.kg-mark { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 2px; animation: mark-in .5s both; }
.kg-mark.m-burn { width: 0; margin-left: 0; background: none; border-left: 2.5px dashed var(--text); }
.kg-labels { position: absolute; inset: 0; pointer-events: none; }
.kg-label { position: absolute; top: 0; font-size: 11.5px; color: var(--text-2); white-space: nowrap; transform: translateX(-50%); animation: fade .4s .6s both; }
.kg-label.a-end { transform: translateX(-100%); } .kg-label.a-start { transform: none; }
.kg-label.down { top: auto; bottom: 0; }
.kg-label b { color: var(--text); }
.kg-wrap.two { padding-bottom: 20px; }
.kg-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 12px; }
.kg-foot b { margin-left: 5px; font-variant-numeric: tabular-nums; }
.kg-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.kg-key { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--zc); }
.kg-key.z-warn { background-image: radial-gradient(rgba(0,0,0,.35) 1px, transparent 1.2px); background-size: 4px 4px; }
.kg-key.z-bad { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.45) 0 2px, transparent 2px 4px); }
.kg-key.kg-train-key { background: repeating-linear-gradient(-45deg, var(--text-2) 0 2px, transparent 2px 4px); }
@keyframes mark-in { from { opacity: 0; transform: scaleY(0); } }
@keyframes pill-in { from { opacity: 0; transform: translateY(-4px) scale(.96); } }

/* ---------- Allgemeine Animationen ---------- */
.rise { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.list-item.tap, .card.tap, .btn, .chip, .fab { transition: transform .15s ease, background-color .2s ease, opacity .15s; }
.list-item.tap:active { transform: scale(.985); }
.toast { animation: toast-in .35s cubic-bezier(.2,.8,.2,1); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.check.done { animation: check-fill .35s ease; }
@keyframes check-fill { from { transform: scale(.8); } 60% { transform: scale(1.12); } }
.bar-h > div { transition: width .9s cubic-bezier(.2,.8,.2,1); }
.big { transition: color .3s; }

/* Formularfehler direkt am Feld */
.field-error { color: var(--bad); font-size: 13.5px; margin: 6px 4px 0; min-height: 0; }
.field-error:empty { display: none; }
.field-error::before { content: "▲ "; font-size: 11px; }
input.input.invalid { border-color: var(--bad); }

button[aria-busy="true"] { opacity: 0.55; pointer-events: none; }

/* Hinweise dürfen nie Knöpfe verdecken bzw. Taps abfangen */
.toast { pointer-events: none; }

/* ---------- Navigation mit zentralem Plus ---------- */
.tabbar a, .tabbar .tab-plus-wrap { flex: 1; }
.tab-plus-wrap { display: flex; align-items: flex-start; justify-content: center; }
.tab-plus { width: 56px; height: 56px; margin-top: -18px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(10,132,255,.45), 0 0 0 5px var(--bg); transition: transform .15s; }
.tab-plus svg { width: 28px; height: 28px; stroke-width: 2.6; }
.tab-plus:active { transform: scale(.92); }

/* ---------- Schwebende Leisten ---------- */
#floats { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 26px); z-index: 19; display: flex; flex-direction: column;
  gap: 6px; padding: 0 12px; max-width: 640px; margin: 0 auto; pointer-events: none; }
#floats > * { pointer-events: auto; }
#app { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px + var(--floats-h, 0px)); }
.float-bar { position: relative; overflow: hidden; display: flex; align-items: center; gap: 8px; padding: 9px 10px 9px 14px; border-radius: 16px;
  background: var(--card-solid); border: 0.5px solid var(--card-border); box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: up .25s ease; }
.float-bar > * { position: relative; }
.float-bar .chip { padding: 6px 10px; font-size: 13px; }
.rest-fill { position: absolute !important; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--blue) 22%, transparent); transition: width .25s linear; }
.rest-time { font-size: 20px; font-variant-numeric: tabular-nums; }
.live-bar { color: inherit; text-decoration: none; }
.live-bar .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: pulse 1.4s ease infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* Hinweis mit Aktion (Rückgängig) */
.toast.action { display: flex; align-items: center; gap: 14px; }
.toast-btn { pointer-events: auto; border: 0; background: none; color: var(--blue); font-weight: 700; font-size: 15px; cursor: pointer; padding: 4px; }

/* Schnellmenü */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.quick-tile { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px; border-radius: 16px; border: 0;
  background: var(--fill-2); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text); text-align: center; }
.quick-tile .icon-tile { width: 42px; height: 42px; border-radius: 12px; }
.quick-tile .icon-tile svg { width: 22px; height: 22px; }
.quick-tile:active { transform: scale(.95); }
.quick-tile.big { grid-column: span 2; flex-direction: row; justify-content: center; font-size: 15px; padding: 14px 8px; }
.food-quick { flex: none; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--blue) 18%, transparent); color: var(--blue);
  font-weight: 700; font-size: 13px; padding: 7px 11px; cursor: pointer; white-space: nowrap; }
