@font-face {
  font-family: 'Archivo';
  src: url('../assets/fonts/archivo-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('../assets/fonts/ibmplexsans-latin.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --blue: #0a24e0;
  --blue-deep: #061aa6;
  --blue-soft: #e6eaff;
  --blue-mid: #4a64ff;
  --accent-text: #0a24e0;
  --warn: #ffb21f;
  --warn-text: #b86e00;
  --danger: #c43b3b;
  --bg: #eef1fb;
  --card: #ffffff;
  --text: #070b24;
  --muted: #5a6285;
  --line: rgba(7, 11, 36, 0.09);
  --field: #eceffa;
  --shadow: 0 1px 2px rgba(7, 11, 36, 0.04), 0 10px 28px -16px rgba(7, 11, 36, 0.2);
  --display: 'Archivo', ui-rounded, system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 22px;
  --tab-h: 64px;
  --col: 560px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent-text: #8ea0ff;
    --warn-text: #ffc24d;
    --danger: #ff7a7a;
    --bg: #04061c;
    --card: #0c1235;
    --text: #f1f3ff;
    --muted: #98a1d3;
    --line: rgba(255, 255, 255, 0.09);
    --field: #141b48;
    --blue-soft: #151e57;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.sheet-open,
html.sheet-open body {
  overflow: hidden;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.4 var(--body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
input {
  font: inherit;
}
h1,
h2,
h3,
p {
  margin: 0;
}
:focus-visible {
  outline: 2px solid var(--blue-mid);
  outline-offset: 2px;
}
.ic {
  display: block;
  flex: none;
}

#app {
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100dvh;
}
.warn-bar {
  background: var(--warn);
  color: #1b1200;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  font-size: 13.5px;
  font-weight: 500;
}

/* ---------- Kopf (blau) ---------- */

.hero {
  background: var(--blue);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 56px;
  border-radius: 0 0 34px 34px;
}
.hero-sm {
  padding-bottom: 54px;
}
.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.hero-title h1 {
  font: 700 24px/1.1 var(--display);
  letter-spacing: -0.015em;
}
.hero-title p {
  margin-top: 4px;
  font-size: 14px;
  opacity: 0.8;
}
.hero-tools {
  display: flex;
  gap: 8px;
  flex: none;
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 0;
  flex: none;
}
.icon-btn:active {
  transform: scale(0.94);
}
.pill {
  margin-top: 10px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.hero-main {
  margin-top: 28px;
}
.big {
  font: 800 clamp(84px, 27vw, 116px) / 0.86 var(--display);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.big-label {
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.82;
}
.big.over,
.big-label.over {
  color: var(--warn);
  opacity: 1;
}
.ruler {
  margin-top: 24px;
  height: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.ruler i {
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  transition: background-color 0.3s ease;
}
.ruler i.major {
  height: 20px;
}
.ruler i.on {
  background: #fff;
}
.ruler i.on.over {
  background: var(--warn);
}
.hero-sub {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  min-height: 44px;
}
.hero-sub b {
  font: 700 15px var(--display);
}
.hero-cta {
  border: 0;
  background: #fff;
  color: var(--blue);
  padding: 13px 20px;
  border-radius: 999px;
  font: 700 15px var(--display);
}

/* ---------- Inhalt ---------- */

.stack {
  padding: 0 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 48px);
  margin-top: -30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.card-title {
  font: 700 17px var(--display);
  margin-bottom: 8px;
}
.muted {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}
.macros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.m-top {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.m-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.m-val b {
  font: 700 21px var(--display);
  font-variant-numeric: tabular-nums;
}
.m-val small {
  font-size: 12px;
  color: var(--muted);
}
.bar {
  margin-top: 9px;
  height: 6px;
  border-radius: 3px;
  background: var(--blue-soft);
  overflow: hidden;
}
.bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar.over i {
  background: var(--warn);
}
@media (prefers-color-scheme: dark) {
  .bar i {
    background: var(--blue-mid);
  }
}

.meal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.meal-head h2 {
  font: 700 17px var(--display);
}
.meal-kcal b {
  font: 700 17px var(--display);
  font-variant-numeric: tabular-nums;
}
.meal-kcal small {
  margin-left: 4px;
  font-size: 12px;
  color: var(--muted);
}
.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entry {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  text-align: left;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
}
.e-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.e-name {
  font-weight: 500;
  font-size: 15.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.e-sub {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.e-kcal {
  font: 700 16px var(--display);
  font-variant-numeric: tabular-nums;
}
.add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 0 2px;
  background: none;
  border: 0;
  color: var(--accent-text);
  font-weight: 600;
  font-size: 15px;
}
.entries + .add-row {
  border-top: 1px solid var(--line);
  margin-top: 0;
  padding-top: 12px;
}
.add-row .ic {
  width: 26px;
  height: 26px;
  padding: 4px;
  border-radius: 50%;
  background: var(--blue-soft);
}
.empty {
  padding: 20px 18px;
  background: var(--card);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: 14.5px;
}
.empty b {
  color: var(--text);
  font: 700 16px var(--display);
}
.empty.small {
  margin-top: 12px;
}
.note-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--blue-soft);
  color: var(--accent-text);
  border-radius: 14px;
  padding: 6px 8px 6px 14px;
  font-size: 14px;
  font-weight: 500;
}
.note-bar button {
  border: 0;
  background: none;
  color: var(--accent-text);
  font-weight: 700;
  padding: 8px 10px;
}
.today[data-swipe-days] {
  touch-action: pan-y;
}
.slide-next {
  animation: slide-next 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.slide-prev {
  animation: slide-prev 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slide-next {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
}
@keyframes slide-prev {
  from {
    opacity: 0;
    transform: translateX(-26px);
  }
}

/* ---------- Tab-Leiste ---------- */

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 420px);
  height: var(--tab-h);
  display: grid;
  grid-template-columns: 1fr 78px 1fr;
  align-items: center;
  border-radius: 32px;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 14px 34px -14px rgba(4, 15, 107, 0.45), 0 0 0 1px var(--line);
  z-index: 20;
}
html.sheet-open .tabbar {
  visibility: hidden;
}
.tab {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  background: none;
  border: 0;
}
.tab.on {
  color: var(--accent-text);
}
.tab-plus {
  justify-self: center;
  width: 60px;
  height: 60px;
  margin-top: -20px;
  border-radius: 50%;
  border: 0;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 24px -8px rgba(10, 36, 224, 0.75), 0 0 0 4px var(--bg);
  transition: transform 0.15s ease;
}
.tab-plus:active {
  transform: scale(0.94);
}

/* ---------- Blatt von unten ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 40, 0.55);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.sheet.open .sheet-backdrop {
  opacity: 1;
}
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: var(--col);
  height: min(92dvh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.2, 0.9, 0.25, 1);
  box-shadow: 0 -24px 60px -24px rgba(0, 0, 0, 0.5);
}
.sheet.open .sheet-panel {
  transform: translateY(0);
}
.sheet.closing .sheet-panel {
  transform: translateY(100%);
}
.sheet-grab {
  height: 28px;
  display: grid;
  place-items: center;
  touch-action: none;
  flex: none;
  cursor: grab;
}
.sheet-grab i {
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  background: color-mix(in srgb, var(--muted) 45%, transparent);
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(env(safe-area-inset-bottom) + 16px);
}
.sheet .icon-btn {
  background: var(--field);
  color: var(--text);
}
.sheet .icon-btn.danger {
  background: transparent;
  color: var(--danger);
}
.s-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 12px;
  background: var(--bg);
}
.s-title {
  flex: 1;
  font: 700 18px var(--display);
}
.seg {
  flex: 1;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--field);
  border-radius: 16px;
}
.seg button {
  flex: 1;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 4px;
  white-space: nowrap;
}
.seg button.on {
  background: var(--blue);
  color: #fff;
}
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  background: var(--field);
  border-radius: 16px;
  color: var(--muted);
}
.searchbar:focus-within,
.f-input:focus-within,
.amount-field:focus-within,
.inline-input:focus-within {
  box-shadow: 0 0 0 2px var(--blue-mid);
}
.searchbar input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}
.quick {
  display: flex;
  gap: 10px;
  margin: 12px 0 4px;
}
.qbtn {
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.qbtn.off {
  opacity: 0.55;
}
.qbtn em {
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-text);
}
.r-head {
  margin: 18px 4px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 14px;
  text-align: left;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.result:active {
  transform: scale(0.99);
}
.r-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.r-name {
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.r-sub {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.r-kcal {
  text-align: right;
  flex: none;
}
.r-kcal b {
  font: 700 17px var(--display);
  font-variant-numeric: tabular-nums;
}
.r-kcal small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: -2px;
}
.r-warn {
  display: inline-block;
  margin-left: 6px;
  color: var(--warn-text);
  vertical-align: -2px;
}
.r-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 6px;
  color: var(--muted);
  font-size: 14px;
}
.r-state.err {
  color: var(--danger);
  justify-content: space-between;
}
.r-state button {
  border: 0;
  background: var(--field);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 600;
}
.r-hint {
  margin: 10px 4px;
  color: var(--muted);
  font-size: 14px;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--field);
  border-top-color: var(--blue-mid);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 4px 20px;
  background: none;
  border: 0;
  color: var(--accent-text);
  font-weight: 600;
}
.food-row .icon-btn {
  width: 40px;
  height: 40px;
}

/* ---------- Menge ---------- */

.detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 96px;
}
.d-name {
  margin-top: 4px;
  font: 800 27px/1.1 var(--display);
  letter-spacing: -0.02em;
}
.d-sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: -6px;
}
.hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.35;
  background: color-mix(in srgb, var(--warn) 20%, var(--card));
}
.hint .ic {
  color: var(--warn-text);
  margin-top: 1px;
}
.amount {
  display: flex;
  align-items: center;
  gap: 10px;
}
.step {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 18px;
  background: var(--field);
  color: var(--text);
  font: 600 28px var(--display);
}
.step:active {
  transform: scale(0.95);
}
.amount-field {
  flex: 1;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--field);
  border-radius: 18px;
}
.amount-field input {
  width: 5.5ch;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: right;
  color: var(--text);
  font: 800 30px var(--display);
  font-variant-numeric: tabular-nums;
}
.amount-field span {
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border-radius: 19px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
}
.chip.on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.preview {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 24px;
  background: var(--blue);
  color: #fff;
}
.pv-kcal b {
  font: 800 54px/0.9 var(--display);
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.pv-kcal small {
  margin-left: 6px;
  opacity: 0.8;
}
.pv-macros {
  display: flex;
  gap: 14px;
  margin: 0;
}
.pv-macros dt {
  font-size: 11px;
  opacity: 0.78;
}
.pv-macros dd {
  margin: 0;
  font: 700 16px var(--display);
  font-variant-numeric: tabular-nums;
}
.meal-label {
  margin: 2px 0 -8px;
}
.s-cta {
  position: sticky;
  bottom: 0;
  z-index: 3;
  padding: 14px 0 6px;
  background: linear-gradient(to top, var(--bg) 72%, transparent);
}

/* ---------- Formulare ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 54px;
  border: 0;
  border-radius: 18px;
  font: 700 16px var(--display);
}
.btn:active {
  transform: scale(0.985);
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:disabled {
  opacity: 0.4;
}
.btn-ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
}
.btn-sm {
  width: auto;
  height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 15px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.f-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.f-input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 14px;
  background: var(--field);
  border-radius: 16px;
}
.f-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}
.f-input input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}
.f-input em {
  font-style: normal;
  font-size: 14px;
  color: var(--muted);
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.manual {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 8px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--blue);
}
.form-error {
  min-height: 1.2em;
  font-size: 14px;
  color: var(--danger);
}
.scan {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 12px;
}
.scan-view {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  overflow: hidden;
  background: #000;
}
.scan-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-frame {
  position: absolute;
  inset: 24% 10%;
  border: 3px solid #fff;
  border-radius: 16px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.38);
}
.manual-code {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Verlauf und Einstellungen ---------- */

.seg-blue {
  display: flex;
  gap: 4px;
  width: fit-content;
  margin-top: 20px;
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.15);
}
.seg-blue button {
  height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}
.seg-blue button.on {
  background: #fff;
  color: var(--blue);
}
.stat-big {
  font: 800 46px/1 var(--display);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.stat-big small {
  margin-left: 8px;
  font: 600 14px var(--body);
  letter-spacing: 0;
  color: var(--muted);
}
.stat-big.muted-n {
  color: var(--muted);
}
.chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 8px;
}
.chart .b {
  fill: color-mix(in srgb, var(--blue-mid) 42%, transparent);
}
.chart .b.today {
  fill: var(--blue);
}
.chart .b.over {
  fill: var(--warn);
}
.chart .b.none {
  fill: var(--line);
}
.chart .goal {
  stroke: var(--text);
  stroke-opacity: 0.4;
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}
.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .ax {
  font: 500 10.5px var(--body);
  fill: var(--muted);
}
.chart .ax.now {
  fill: var(--text);
  font-weight: 700;
}
.chart .line {
  fill: none;
  stroke: var(--blue-mid);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .dot {
  fill: var(--card);
  stroke: var(--blue-mid);
  stroke-width: 2;
}
.inline-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.inline-input {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--field);
}
.inline-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}
.inline-input span {
  color: var(--muted);
}
.row-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 0;
  border: 0;
  background: none;
  font-weight: 600;
}
.row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.fine {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  margin: 6px 0 0;
}

/* ---------- Meldung ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + var(--tab-h) + 30px);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  max-width: min(92vw, 460px);
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
  font-size: 14.5px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.2, 0.9, 0.25, 1);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
html.sheet-open .toast {
  bottom: calc(env(safe-area-inset-bottom) + 24px);
}
.toast button {
  border: 0;
  background: none;
  font-weight: 700;
  color: #7f93ff;
  padding: 4px 2px;
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
  .toast button {
    color: var(--blue);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Zeitleiste und Tagesverlauf ---------- */

.entry {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
}
.e-time {
  font: 600 13.5px var(--display);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.muted-p {
  margin: 2px 0 6px;
  color: var(--muted);
  font-size: 14.5px;
}
.add-row.first {
  border-top: 0;
  padding-top: 6px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}
.f-input input[type='time'] {
  -webkit-appearance: none;
  appearance: none;
  min-height: 32px;
  text-align: left;
}
.f-input input[type='time']::-webkit-date-and-time-value {
  text-align: left;
}
.parts .part + .part {
  margin-top: 14px;
}
.p-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.p-name {
  font-weight: 600;
  font-size: 15px;
}
.p-name small {
  margin-left: 8px;
  font-weight: 400;
  font-size: 12.5px;
  color: var(--muted);
}
.p-val b {
  font: 700 16px var(--display);
  font-variant-numeric: tabular-nums;
}
.p-val small {
  font-size: 12.5px;
  color: var(--muted);
}
.ai-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--blue-soft);
}
.ai-row b {
  display: block;
  font: 700 14.5px var(--display);
}
.ai-row span {
  font-size: 13px;
  color: var(--muted);
}
.ai-row em {
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-text);
}

/* ---------- Eintragen mit einem Tipp, Ladegerüst ---------- */

.result-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.result-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
  border: 0;
  border-radius: 16px;
  background: none;
}
.result-main:active {
  background: color-mix(in srgb, var(--blue-soft) 70%, transparent);
}
.result-add {
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: 8px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--accent-text);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.result-add:active {
  transform: scale(0.92);
}
.result-add.done {
  background: var(--blue);
  color: #fff;
}
.skeleton-list {
  margin-top: 2px;
}
.skel {
  height: 68px;
  margin-bottom: 8px;
  padding: 15px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.skel i {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--field) 0%, color-mix(in srgb, var(--field) 35%, var(--card)) 50%, var(--field) 100%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skel i:first-child {
  width: 55%;
}
.skel i:last-child {
  width: 34%;
  height: 10px;
}
@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* ---------- Zeitleiste mit Tageszeit-Farben ---------- */

:root {
  --pt-morgen: #a9b9ff;
  --pt-mittag: #6079ff;
  --pt-nachmittag: #2f4af2;
  --pt-abend: #0a24e0;
  --pt-nacht: #0b1c91;
}
@media (prefers-color-scheme: dark) {
  :root {
    --pt-morgen: #cbd5ff;
    --pt-mittag: #95a8ff;
    --pt-nachmittag: #6a84ff;
    --pt-abend: #4560ff;
    --pt-nacht: #8c93d8;
  }
}
.log .entries li {
  position: relative;
}
.log .entry::before {
  content: '';
  position: absolute;
  left: 63px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: color-mix(in srgb, var(--muted) 28%, transparent);
  pointer-events: none;
}
.log .entries li:first-child .entry::before {
  top: 50%;
}
.log .entries li:last-child .entry::before {
  bottom: 50%;
}
.log .entries li:only-child .entry::before {
  display: none;
}
.log .entry {
  position: relative;
  grid-template-columns: 46px 12px minmax(0, 1fr) auto;
  border-top: 0;
  padding: 11px 0;
  border-radius: 12px;
  background: var(--card);
}
.log .entry:active {
  background: color-mix(in srgb, var(--blue-soft) 70%, var(--card));
}
.e-dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  justify-self: center;
  box-shadow: 0 0 0 3px var(--card);
}
.e-dot.p-morgen,
.part.p-morgen .bar i {
  background: var(--pt-morgen);
}
.e-dot.p-mittag,
.part.p-mittag .bar i {
  background: var(--pt-mittag);
}
.e-dot.p-nachmittag,
.part.p-nachmittag .bar i {
  background: var(--pt-nachmittag);
}
.e-dot.p-abend,
.part.p-abend .bar i {
  background: var(--pt-abend);
}
.e-dot.p-nacht,
.part.p-nacht .bar i {
  background: var(--pt-nacht);
}
.log .add-row {
  border-top: 0;
}

/* ---------- Zahl, Übergänge ---------- */

.big .sep {
  opacity: 0.55;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.tab-in {
  animation: tab-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes tab-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.log .e-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  line-height: 1.3;
}

/* ---------- Wischen zum Löschen ---------- */

.swipe {
  overflow: hidden;
  border-radius: 12px;
  touch-action: pan-y;
}
.swipe .entry {
  will-change: transform;
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.swipe-act {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 12px;
  background: #d23a3a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  visibility: hidden; /* erst beim Wischen sichtbar, sonst blitzt Rot an den runden Ecken der Zeile */
}
.swipe.swiping .swipe-act {
  visibility: visible;
}

/* ---------- Stundenstreifen, Fakten ---------- */

.chart.hours {
  margin: 4px 0 14px;
}
.hb {
  fill: var(--pt-nacht);
}
.hb.p-morgen {
  fill: var(--pt-morgen);
}
.hb.p-mittag {
  fill: var(--pt-mittag);
}
.hb.p-nachmittag {
  fill: var(--pt-nachmittag);
}
.hb.p-abend {
  fill: var(--pt-abend);
}
.hb.p-nacht {
  fill: var(--pt-nacht);
}
.hb.none {
  fill: var(--line);
}
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 0;
}
.facts > div {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--field);
}
.facts dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.facts dd {
  margin: 2px 0 0;
  font: 700 17px var(--display);
  font-variant-numeric: tabular-nums;
}
.facts dd small {
  display: block;
  margin-top: 1px;
  font: 500 12px var(--body);
  color: var(--muted);
}

/* ---------- Zusammenfassung der KI ---------- */

.ai-row .btn-sm {
  flex: none;
}
.ai-row .form-error {
  margin-top: 4px;
}
.ai-sum {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--blue-soft);
}
.ai-sum-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.ai-sum-head b {
  font: 700 14.5px var(--display);
}
.ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.ai-text {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
}
.ai-sum-foot {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.ai-sum-foot button {
  flex: none;
  border: 0;
  background: none;
  padding: 8px 0 8px 10px;
  color: var(--accent-text);
  font-weight: 700;
}
.ai-sum .form-error {
  margin-top: 6px;
}
.lines {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.lines i {
  display: block;
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-text) 12%, transparent) 0%, color-mix(in srgb, var(--accent-text) 30%, transparent) 50%, color-mix(in srgb, var(--accent-text) 12%, transparent) 100%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
.lines i:nth-child(1) {
  width: 96%;
}
.lines i:nth-child(2) {
  width: 88%;
}
.lines i:nth-child(3) {
  width: 52%;
}

/* ---------- Einstellungen: KI, Sicherung ---------- */

.sub-title {
  margin: 16px 0 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.small-gap {
  margin: 12px 0 0;
}
.row-btn {
  position: relative;
}
.row-btn.danger {
  color: var(--danger);
}
.state {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.state.good {
  color: var(--accent-text);
}
.state.bad {
  color: var(--danger);
}
.row-switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-weight: 600;
}
.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: color-mix(in srgb, var(--muted) 35%, var(--field));
  transition: background-color 0.2s ease;
}
.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.switch[aria-checked='true'] {
  background: var(--blue);
}
.switch[aria-checked='true'] i {
  transform: translateX(20px);
}
.masked {
  -webkit-text-security: disc;
  text-security: disc;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.settings .inline-form {
  margin: 4px 0 4px;
}
.settings .form-error {
  margin: 6px 0 2px;
}

/* ---------- KI im Blatt ---------- */

.ai {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 12px;
}
.ai-key {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.ai-key .muted {
  margin: 0;
}
.ai-photo {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-empty {
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed color-mix(in srgb, var(--muted) 40%, transparent);
  border-radius: 22px;
  color: var(--muted);
  font-weight: 600;
}
.ai-img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 22px;
  background: var(--field);
}
.ai-pick {
  display: flex;
  gap: 10px;
}
.ai-pick .btn {
  flex: 1;
  padding: 0 10px;
}
.file-btn {
  position: relative;
  cursor: pointer;
}
.ai-hint {
  margin: -4px 2px 0;
  font-size: 13px;
  color: var(--muted);
}
.ai-privacy {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}
.ai-privacy .ic {
  margin-top: 2px;
}
.ai-busy {
  display: flex;
  flex-direction: column;
}
.ai-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 96px;
}
.hint.est {
  background: var(--blue-soft);
}
.hint.est .ic {
  color: var(--accent-text);
}
.ai-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease;
}
.ai-item.off {
  opacity: 0.5;
}
.ai-check input {
  width: 22px;
  height: 22px;
  margin: 6px 0 0;
  accent-color: var(--blue);
}
.ai-name {
  width: 100%;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: 600 15.5px var(--body);
}
.ai-name:focus {
  border-bottom-color: var(--blue-mid);
}
.ai-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.conf {
  font-weight: 600;
  color: var(--warn-text);
}
.ai-amount {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.step.sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 22px;
}
.ai-qty {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--field);
}
.ai-qty:focus-within {
  box-shadow: 0 0 0 2px var(--blue-mid);
}
.ai-qty input {
  width: 4.5ch;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: right;
  color: var(--text);
  font: 700 16px var(--display);
  font-variant-numeric: tabular-nums;
}
.ai-qty span {
  font-size: 14px;
  color: var(--muted);
}
.ai-kcal {
  padding-top: 4px;
  text-align: right;
}
.ai-kcal b {
  font: 700 17px var(--display);
  font-variant-numeric: tabular-nums;
}
.ai-kcal small {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Übernehmen im Blatt ---------- */

.copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 96px;
}
.copy-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.copy-top .muted {
  margin: 0;
}
.link-btn {
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-weight: 700;
}
.copy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.copy-row {
  display: grid;
  grid-template-columns: auto 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease;
}
.copy-row.off {
  opacity: 0.5;
}
.copy-row input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--blue);
}

/* ---------- Sicherung im Blatt ---------- */

.bk {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 96px;
}
.bk .muted {
  margin: 0;
}
.code-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  -webkit-user-select: all;
  user-select: all;
}
.code-box span {
  padding: 8px 0;
  border-radius: 10px;
  background: var(--field);
  text-align: center;
  font: 700 19px var(--display);
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums slashed-zero;
}
.f-input input.mono {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums slashed-zero;
}
.ok-msg {
  min-height: 1.2em;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-text);
}
.bk-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
}
.bk-facts > div {
  padding: 10px 6px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}
.bk-facts dt {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.bk-facts dd {
  margin: 2px 0 0;
  font: 800 20px var(--display);
  font-variant-numeric: tabular-nums;
}
