﻿*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fbfcf8;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --text: #111827;
  --text-strong: #1f2937;
  --text-soft: #4b5563;
  --text-muted-2: #465161;
  --text-muted-3: #5d6675;
  --text-detail-strong: #2f3745;
  --text-empty-title: #2c3442;
  --text-empty-sub: #747d8c;
  --text-empty: #808999;
  --text-hero-sub: #697080;
  --text-brand: #101828;
  --text-pill: #333b4a;
  --text-placeholder: #9aa3af;
  --text-clear: #384152;
  --bg-clear: #eef0ee;
  --bg-clear-hover: #e1e5df;
  --bg-pill-soft: rgba(255, 255, 255, 0.78);
  --bg-pill-mid: rgba(255, 255, 255, 0.76);
  --bg-search: rgba(255, 255, 255, 0.78);
  --bg-save: rgba(255, 255, 255, 0.82);
  --bg-source: rgba(255, 255, 255, 0.76);
  --bg-save-mobile: rgba(255, 255, 255, 0.92);
  --border-pill: rgba(22, 163, 74, 0.42);
  --border-faint: #d9dee7;
  --border-faint-hover: #b6becb;
  --muted: #7b8494;
  --line: #e6e8df;
  --line-strong: #d6ddcf;
  --green: #16a34a;
  --green-dark: #138a40;
  --green-soft: #edf9ef;
  --green-tint-1: rgba(22, 163, 74, 0.045);
  --green-tint-2: rgba(22, 163, 74, 0.015);
  --green-tile-1: rgba(22, 163, 74, 0.11);
  --green-tile-2: rgba(22, 163, 74, 0.05);
  --red: #f0444e;
  --red-soft: #fff0f1;
  --red-tint-1: rgba(240, 68, 78, 0.055);
  --red-tint-2: rgba(240, 68, 78, 0.018);
  --red-tile-1: rgba(240, 68, 78, 0.12);
  --red-tile-2: rgba(240, 68, 78, 0.05);
  --amber: #d8901d;
  --amber-soft: #fff7e7;
  --amber-tint-1: rgba(216, 144, 29, 0.055);
  --amber-tint-2: rgba(216, 144, 29, 0.018);
  --amber-tile-1: rgba(216, 144, 29, 0.13);
  --amber-tile-2: rgba(216, 144, 29, 0.05);
  --blue: #2f80ed;
  --blue-soft: #eff6ff;
  --violet: #8b5cf6;
  --violet-soft: #f5f0ff;
  --neutral: #475569;
  --neutral-soft: #f3f5f7;
  --favorite: #b98a1d;
  --favorite-soft: rgba(185, 138, 29, 0.13);
  --favorite-border: rgba(185, 138, 29, 0.30);
  --chip-bg: rgba(255, 255, 255, 0.62);
  --chip-border: rgba(17, 24, 39, 0.10);
  --chip-alias-border: rgba(240, 68, 78, 0.18);
  --chip-alt-border: rgba(22, 163, 74, 0.22);
  --footer-bg: rgba(255, 255, 255, 0.38);
  --action-bg: rgba(255, 255, 255, 0.58);
  --detail-icon-bg: rgba(71, 85, 105, 0.10);
  --green-icon-bg: rgba(22, 163, 74, 0.10);
  --red-icon-bg: rgba(240, 68, 78, 0.10);
  --amber-icon-bg: rgba(216, 144, 29, 0.12);
  --state-border-veg: rgba(22, 163, 74, 0.24);
  --state-border-car: rgba(240, 68, 78, 0.22);
  --state-border-itd: rgba(216, 144, 29, 0.24);
  --card-overlay: rgba(255, 255, 255, 0.90);
  --ink-shadow: none;
  --small-shadow: none;
  --ring: none;
  --focus-ring: rgba(22, 163, 74, 0.45);
  --body-bg: linear-gradient(180deg, #fffefb 0%, #fbfcf8 42%, #f7faf2 100%);
  --radius: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg: #11151a;
  --surface: #1a2027;
  --surface-strong: #1a2027;
  --text: #e7e9ec;
  --text-strong: #f1f3f5;
  --text-soft: #b3b8be;
  --text-muted-2: #b3b8be;
  --text-muted-3: #a0a6ac;
  --text-detail-strong: #d8dce0;
  --text-empty-title: #e7e9ec;
  --text-empty-sub: #a0a6ac;
  --text-empty: #8a8f95;
  --text-hero-sub: #a0a6ac;
  --text-brand: #e7e9ec;
  --text-pill: #d8dce0;
  --text-placeholder: #6b7077;
  --text-clear: #d8dce0;
  --bg-clear: #232a32;
  --bg-clear-hover: #2d3540;
  --bg-pill-soft: #1a2027;
  --bg-pill-mid: #1a2027;
  --bg-search: #1a2027;
  --bg-save: #1a2027;
  --bg-source: #1a2027;
  --bg-save-mobile: #1a2027;
  --border-pill: #2d3540;
  --border-faint: #2d3540;
  --border-faint-hover: #3d4754;
  --muted: #8a8f95;
  --line: #232a32;
  --line-strong: #2d3540;
  --green: #4ade80;
  --green-dark: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.16);
  --green-tint-1: rgba(34, 197, 94, 0.075);
  --green-tint-2: rgba(34, 197, 94, 0.025);
  --green-tile-1: rgba(34, 197, 94, 0.12);
  --green-tile-2: rgba(34, 197, 94, 0.04);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.16);
  --red-tint-1: rgba(251, 113, 133, 0.09);
  --red-tint-2: rgba(251, 113, 133, 0.03);
  --red-tile-1: rgba(251, 113, 133, 0.12);
  --red-tile-2: rgba(251, 113, 133, 0.04);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.16);
  --amber-tint-1: rgba(251, 191, 36, 0.085);
  --amber-tint-2: rgba(251, 191, 36, 0.028);
  --amber-tile-1: rgba(251, 191, 36, 0.14);
  --amber-tile-2: rgba(251, 191, 36, 0.04);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.16);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.18);
  --neutral: #94a3b8;
  --neutral-soft: #232a32;
  --favorite: #d6a53a;
  --favorite-soft: rgba(214, 165, 58, 0.16);
  --favorite-border: rgba(214, 165, 58, 0.32);
  --chip-bg: rgba(2, 14, 28, 0.32);
  --chip-border: rgba(125, 211, 252, 0.16);
  --chip-alias-border: rgba(251, 113, 133, 0.24);
  --chip-alt-border: rgba(34, 197, 94, 0.26);
  --footer-bg: transparent;
  --action-bg: rgba(2, 14, 28, 0.34);
  --detail-icon-bg: #232a32;
  --green-icon-bg: rgba(34, 197, 94, 0.16);
  --red-icon-bg: rgba(251, 113, 133, 0.16);
  --amber-icon-bg: rgba(251, 191, 36, 0.18);
  --state-border-veg: rgba(34, 197, 94, 0.30);
  --state-border-car: rgba(251, 113, 133, 0.28);
  --state-border-itd: rgba(251, 191, 36, 0.30);
  --card-overlay: transparent;
  --ink-shadow: none;
  --small-shadow: none;
  --ring: none;
  --focus-ring: rgba(74, 222, 128, 0.45);
  --body-bg: linear-gradient(180deg, #11151a 0%, #161b22 50%, #11151a 100%);
}

html {
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-variation-settings: "opsz" 14;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background: var(--body-bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.page-shell {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 24px clamp(10px, 3vw, 44px) 42px;
}

.offline-banner {
  display: grid;
  place-items: center;
  min-height: 0;
  margin: -8px 0 10px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 48px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 10px;
  color: var(--text-brand);
  text-decoration: none;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-logo {
  display: block;
  width: 112px;
  height: auto;
  max-height: 42px;
}

[data-theme="light"] .logo-dark,
[data-theme="dark"] .logo-light {
  display: none;
}

.brand-text {
  display: none;
}

.top-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 17px;
  border: 1px solid var(--border-pill);
  border-radius: var(--radius);
  background: var(--bg-pill-soft);
  color: var(--green-dark);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: none;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.nav-pill:hover,
.nav-pill.active {
  background: var(--green);
  color: #fff;
  box-shadow: none;
  transform: translateY(-1px);
}

.fav-count {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
  color: currentColor;
  font-size: 0.74rem;
}

.theme-toggle,
.theme-toggle {
  position: relative;
  min-width: 46px;
  padding: 0;
  color: var(--green-dark);
}

.theme-toggle .theme-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  transition: opacity 200ms ease, transform 200ms ease;
}

[data-theme="light"] .theme-toggle .icon-sun,
[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
  pointer-events: none;
}

[data-theme="light"] .theme-toggle .icon-moon,
[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.nav-pill.active .fav-count,
.nav-pill:hover .fav-count {
  background: rgba(255, 255, 255, 0.22);
}

.hero {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: calc(100svh - 96px);
  padding: clamp(52px, 10vh, 118px) 0 28px;
  text-align: center;
  transition: min-height 520ms var(--ease), padding 520ms var(--ease);
}

.hero.compact {
  min-height: 0;
  padding: 34px 0 24px;
}

.hero-copy {
  margin-bottom: 24px;
  transition: transform 520ms var(--ease), margin 520ms var(--ease);
}

.hero.compact .hero-copy {
  margin-bottom: 18px;
  transform: scale(0.88);
  transform-origin: center top;
}

.hero h1 {
  line-height: 0;
}

.hero-logo {
  display: block;
  width: min(100%, 328px);
  height: auto;
  margin: 0 auto;
}

.hero p {
  margin-top: 12px;
  color: var(--text-hero-sub);
  font-size: clamp(1rem, 2vw, 1.22rem);
  font-weight: 400;
}

.search-panel {
  width: min(100%, 720px);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 66px;
  border: 2px solid rgba(22, 163, 74, 0.70);
  border-radius: var(--radius);
  background: var(--bg-search);
  box-shadow: none;
}

.search-box:focus-within {
  border-color: var(--green);
  box-shadow: none;
}

.search-icon {
  position: absolute;
  left: 24px;
  color: var(--green);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 18px 64px 18px 66px;
  font-size: 1.14rem;
  font-weight: 400;
}

.search-box input::placeholder {
  color: var(--text-placeholder);
}

.clear-btn {
  position: absolute;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: var(--text-clear);
  background: var(--bg-clear);
  transition: background 150ms ease, transform 150ms ease;
}

.clear-btn:hover {
  background: var(--bg-clear-hover);
  transform: scale(1.04);
}

.filters {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  overflow: hidden;
  transition: opacity 240ms ease, max-height 360ms var(--ease), margin 260ms ease;
}

.filters.visible {
  position: relative;
  overflow: visible;
  z-index: 80;
  max-height: 320px;
  margin-top: 26px;
  padding-top: 4px;
  opacity: 1;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-pill-mid);
  color: var(--text-pill);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: none;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease;
}

.filter-btn:hover {
  border-color: currentColor;
  transform: translateY(-1px);
}

.filter-btn.active {
  color: #fff;
  box-shadow: none;
}

.filter-separator {
  width: min(100%, 520px);
  height: 1px;
  background: var(--line);
}

.filter-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}

.filter-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: -2px;
  color: currentColor;
  opacity: 0.85;
  outline: none;
}

.filter-help svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-help::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 9px);
  width: max-content;
  max-width: min(260px, calc(100vw - 36px));
  transform: translateX(-50%) translateY(-4px);
  padding: 7px 10px;
  border-radius: 7px;
  background: #111827;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  z-index: 80;
}

.filter-help::before {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + 3px);
  transform: translateX(-50%) translateY(-4px);
  border: 5px solid transparent;
  border-bottom-color: #111827;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  z-index: 80;
}

.filter-help:hover::after,
.filter-help:focus-visible::after,
.filter-help.tooltip-open::after,
.filter-help:hover::before,
.filter-help:focus-visible::before,
.filter-help.tooltip-open::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.filter-all,
.filter-type-all {
  color: var(--neutral);
}

.filter-vegan {
  color: var(--green);
}

.filter-carnist {
  color: var(--red);
}

.filter-depends {
  color: var(--amber);
}

.filter-colorants {
  color: var(--violet);
}

.filter-ins {
  color: var(--blue);
}

.filter-all.active,
.filter-type-all.active {
  border-color: var(--neutral);
  background: var(--neutral);
}

.filter-vegan.active {
  border-color: var(--green);
  background: var(--green);
}

.filter-carnist.active {
  border-color: var(--red);
  background: var(--red);
}

.filter-depends.active {
  border-color: var(--amber);
  background: var(--amber);
}

.filter-colorants.active {
  border-color: var(--violet);
  background: var(--violet);
}

.filter-ins.active {
  border-color: var(--blue);
  background: var(--blue);
}

[data-theme="dark"] .filter-btn {
  border-color: #3d4754;
  background: #171d24;
  color: #d8dce0;
}

[data-theme="dark"] .filter-btn:hover {
  background: #202832;
  border-color: currentColor;
}

[data-theme="dark"] .filter-all,
[data-theme="dark"] .filter-type-all {
  color: #cbd5e1;
}

[data-theme="dark"] .filter-vegan {
  color: #86efac;
}

[data-theme="dark"] .filter-carnist {
  color: #fda4af;
}

[data-theme="dark"] .filter-depends {
  color: #fcd34d;
}

[data-theme="dark"] .filter-colorants {
  color: #c4b5fd;
}

[data-theme="dark"] .filter-ins {
  color: #93c5fd;
}

[data-theme="dark"] .filter-btn.active {
  color: #0f141a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .filter-all.active,
[data-theme="dark"] .filter-type-all.active {
  border-color: #94a3b8;
  background: #94a3b8;
}

[data-theme="dark"] .filter-vegan.active {
  border-color: #86efac;
  background: #86efac;
}

[data-theme="dark"] .filter-carnist.active {
  border-color: #fda4af;
  background: #fda4af;
}

[data-theme="dark"] .filter-depends.active {
  border-color: #fcd34d;
  background: #fcd34d;
}

[data-theme="dark"] .filter-colorants.active {
  border-color: #c4b5fd;
  background: #c4b5fd;
}

[data-theme="dark"] .filter-ins.active {
  border-color: #93c5fd;
  background: #93c5fd;
}

.stats-bar {
  position: relative;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

.stats-bar.visible {
  display: flex;
}

.stats {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 22px;
  color: #788190;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 180ms ease;
}

.stats.visible {
  opacity: 1;
}

.stats-total {
  margin-right: 2px;
}

.stats-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
}

.stats-count svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stats-vegan { color: var(--green); }
.stats-carnist { color: var(--red); }
.stats-depends { color: var(--amber); }

.stats-actions {
  position: relative;
  z-index: 75;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stats-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.stats-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-faint);
  border-radius: var(--radius);
  background: var(--action-bg);
  color: var(--neutral);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.stats-icon-btn[hidden] {
  display: none;
}

.stats-icon-btn:hover,
.stats-icon-btn[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.stats-icon-btn:hover {
  transform: translateY(-1px);
}

.stats-icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

.stats-icon-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 9px);
  transform: translateX(-50%) translateY(-4px);
  padding: 6px 10px;
  border-radius: 7px;
  background: #111827;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  z-index: 90;
}

.stats-icon-btn::before {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + 3px);
  transform: translateX(-50%) translateY(-4px);
  border: 5px solid transparent;
  border-bottom-color: #111827;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  z-index: 90;
}

.stats-icon-btn:hover::after,
.stats-icon-btn:focus-visible::after,
.stats-icon-btn:hover::before,
.stats-icon-btn:focus-visible::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .stats-icon-btn::after {
  background: #f1f3f5;
  color: #11151a;
}

[data-theme="dark"] .stats-icon-btn::before {
  border-bottom-color: #f1f3f5;
}

[data-theme="dark"] .filter-help::after {
  background: #f1f3f5;
  color: #11151a;
}

[data-theme="dark"] .filter-help::before {
  border-bottom-color: #f1f3f5;
}

.results-section {
  width: min(100%, 720px);
  margin: 0 auto;
}

.results-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.result-item {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 340ms var(--ease) forwards;
  overflow: visible;
}

.result-item.vegan {
  border-left-color: var(--green);
  background:
    linear-gradient(135deg, var(--green-tint-1), var(--green-tint-2) 42%, var(--card-overlay)),
    var(--surface);
}

.result-item.carnist {
  border-left-color: var(--red);
  background:
    linear-gradient(135deg, var(--red-tint-1), var(--red-tint-2) 42%, var(--card-overlay)),
    var(--surface);
}

.result-item.itDepends {
  border-left-color: var(--amber);
  background:
    linear-gradient(135deg, var(--amber-tint-1), var(--amber-tint-2) 42%, var(--card-overlay)),
    var(--surface);
}

.result-item:hover {
  z-index: 20;
  border-color: var(--line-strong);
  box-shadow: none;
}

.result-item:focus-within,
.result-item:has(.header-state.tooltip-open) {
  z-index: 20;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 18px 38px;
  border-bottom: 0;
}

.result-item.expanded .result-header {
  border-bottom: 1px solid var(--line);
}

.header-code {
  font-size: 1.34rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.header-name {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-strong);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.18;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-item.vegan .header-code { color: var(--green); }
.result-item.carnist .header-code { color: var(--red); }
.result-item.itDepends .header-code { color: var(--amber); }

.header-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
  flex: 0 0 auto;
}

.header-dataset {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.header-dataset svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-dataset.colorants { color: var(--violet); }
.header-dataset.ins { color: var(--blue); }

.header-state {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  cursor: help;
  outline: none;
  flex: 0 0 auto;
  transition: transform 0.18s var(--ease);
}

.header-state:hover,
.header-state:focus-visible {
  transform: scale(1.18);
}

.header-state:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 50%;
}

.header-state svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1.5px rgba(17, 24, 39, 0.18));
}

.header-state.vegan { color: var(--green); }
.header-state.carnist { color: var(--red); }
.header-state.itDepends { color: var(--amber); }

.header-state::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 6px 11px;
  background: #111827;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  z-index: 30;
}

.header-state::before {
  content: '';
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  border: 5px solid transparent;
  border-bottom-color: #111827;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  z-index: 30;
}

.header-state:hover::after,
.header-state:focus-visible::after,
.header-state.tooltip-open::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.header-state:hover::before,
.header-state:focus-visible::before,
.header-state.tooltip-open::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .header-state svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

[data-theme="dark"] .header-state::after {
  background: #f1f3f5;
  color: #11151a;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .header-state::before {
  border-bottom-color: #f1f3f5;
}

.result-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 0;
}

.save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border-faint);
  border-radius: var(--radius);
  background: var(--bg-save);
  color: var(--neutral);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.result-header .save-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
}

.result-header .save-btn span {
  display: none;
}

.save-btn:hover,
.save-btn.saved {
  border-color: var(--border-faint-hover);
  background: var(--neutral-soft);
  color: var(--text-strong);
}

.save-btn.saved {
  border-color: var(--favorite-border);
  background: var(--favorite-soft);
  color: var(--favorite);
}

.save-btn.saved svg {
  fill: currentColor;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-faint);
  border-radius: var(--radius);
  background: var(--action-bg);
  color: var(--neutral);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.share-btn:hover {
  border-color: var(--border-faint-hover);
  background: var(--neutral-soft);
  color: var(--text-strong);
}

.share-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-btn .share-icon-done {
  display: none;
}

.share-btn.copied {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.share-btn.copied .share-icon-default {
  display: none;
}

.share-btn.copied .share-icon-done {
  display: block;
}

.result-body {
  padding: 0 38px;
}

.result-name {
  display: none;
  margin: 0 0 10px;
  color: var(--text-strong);
  font-size: clamp(1.2rem, 2.2vw, 1.4rem);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.result-description {
  max-width: 980px;
  margin-top: 12px;
  color: var(--text-muted-2);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
}

.result-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.result-detail {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 0 30px 14px 0;
  border-bottom: 0;
  color: var(--text-muted-3);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.48;
}

.result-detail + .result-detail {
  padding-right: 0;
  padding-left: 30px;
  border-left: 1px solid var(--line);
}

.result-detail:only-child {
  grid-column: 1 / -1;
  padding-right: 0;
}

.detail-heading {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.result-detail strong {
  color: var(--text-detail-strong);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.detail-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: var(--neutral);
  background: var(--detail-icon-bg);
}

.detail-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-detail.alt strong {
  color: var(--green);
}

.result-item.vegan .result-detail.aliases .detail-icon {
  color: var(--green);
  background: var(--green-icon-bg);
}

.result-item.carnist .result-detail.aliases .detail-icon {
  color: var(--red);
  background: var(--red-icon-bg);
}

.result-item.itDepends .result-detail.aliases .detail-icon {
  color: var(--amber);
  background: var(--amber-icon-bg);
}

.result-detail.alt .detail-icon {
  color: var(--green);
  background: var(--green-icon-bg);
}

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.detail-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  max-width: 100%;
  padding: 0 16px;
  border: 1px solid var(--chip-border);
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--text-muted-2);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.alias-chips .detail-chip {
  border-color: var(--chip-alias-border);
}

.alternative-chips .detail-chip {
  border-color: var(--chip-alt-border);
}

.result-item.vegan .alias-chips .detail-chip {
  border-color: var(--state-border-veg);
}

.result-item.itDepends .alias-chips .detail-chip {
  border-color: var(--state-border-itd);
}

.result-item.carnist .detail-heading strong {
  color: var(--red);
}

.result-item.vegan .detail-heading strong {
  color: var(--green);
}

.result-item.itDepends .detail-heading strong {
  color: var(--amber);
}

.result-detail.alt .detail-heading strong {
  color: var(--green);
}

.result-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 0 -38px;
  padding: 16px 38px;
  border-top: 1px solid var(--line);
  background: var(--footer-bg);
}

.source-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.source-shield {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
}

.source-shield svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-sources {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.result-sources a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 160px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-faint);
  border-radius: var(--radius);
  background: var(--action-bg);
  color: var(--neutral);
  font-size: 0.78rem;
  font-weight: 400;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-sources a:hover {
  border-color: var(--border-faint-hover);
  background: var(--neutral-soft);
  color: var(--text-strong);
}

.source-icon {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.source-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 48px 18px;
  color: var(--text-empty);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state p {
  color: var(--text-empty-title);
  font-size: 1rem;
  font-weight: 400;
}

.empty-state span {
  color: var(--text-empty-sub);
  font-size: 0.9rem;
  font-weight: 400;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .page-shell {
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 18px;
  }

  .site-header {
    align-items: flex-start;
    gap: 10px;
  }

  .brand-mark {
    font-size: 1.28rem;
  }

  .brand-logo {
    width: 96px;
    max-height: 36px;
  }

  .nav-pill {
    min-height: 42px;
    padding: 0 12px;
  }

  .top-actions {
    gap: 8px;
  }

  .nav-pill span:not(.fav-count) {
    display: none;
  }

  .hero {
    min-height: calc(100svh - 78px);
    padding-top: 42px;
  }

  .hero.compact {
    padding-top: 22px;
  }

  .hero.compact .hero-copy {
    transform: none;
  }

  .search-box {
    min-height: 58px;
  }

  .search-icon {
    left: 17px;
    width: 22px;
    height: 22px;
  }

  .search-box input {
    padding: 15px 56px 15px 50px;
    font-size: 1rem;
  }

  .filter-row {
    gap: 8px;
  }

  .filter-btn {
    min-height: 38px;
    padding: 0 13px;
    font-size: 0.82rem;
  }

  .filters.visible {
    max-height: 340px;
  }

  .result-item {
    border-left-width: 3px;
  }

  .result-header {
    gap: 10px;
    padding: 12px 16px;
  }

  .header-code {
    font-size: 1.18rem;
  }

  .header-divider {
    height: 18px;
  }

  .header-dataset {
    font-size: 0.7rem;
    gap: 6px;
  }

  .header-dataset svg {
    width: 14px;
    height: 14px;
  }

  .header-dataset-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .header-state {
    width: 20px;
    height: 20px;
  }

  .header-state svg {
    width: 18px;
    height: 18px;
  }

  .result-actions {
    gap: 6px;
  }

  .share-btn,
  .save-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
  }

  .save-btn span {
    display: none;
  }

  .save-btn svg,
  .share-btn svg {
    width: 18px;
    height: 18px;
  }

  .result-body {
    padding: 14px 16px 0;
  }

  .result-name {
    margin-bottom: 8px;
    font-size: 1.08rem;
    line-height: 1.2;
  }

  .result-description {
    margin-top: 10px;
    color: var(--text-strong);
    font-size: 0.94rem;
    line-height: 1.58;
  }

  .result-details {
    grid-template-columns: 1fr;
    margin-top: 14px;
    padding-top: 14px;
  }

  .result-detail {
    gap: 10px;
    padding: 0 0 14px;
    font-size: 0.82rem;
  }

  .result-detail + .result-detail {
    padding: 14px 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .detail-heading {
    gap: 10px;
  }

  .detail-chip {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 0.82rem;
  }

  .detail-icon {
    width: 28px;
    height: 28px;
  }

  .result-footer {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 0 -16px;
    padding: 14px 16px;
  }

  .source-label {
    font-size: 0.74rem;
  }

  .result-sources {
    justify-content: flex-start;
    margin-top: 0;
  }
}

@media (max-width: 420px) {
  .hero-logo {
    width: min(100%, 286px);
  }

  .filter-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    width: 100%;
    gap: 5px;
  }

  .filters.visible {
    max-height: 340px;
  }

  .filter-btn {
    flex: 0 1 auto;
    min-height: 34px;
    gap: 5px;
    padding-inline: 7px;
    font-size: 0.72rem;
  }

  .filter-icon {
    width: 17px;
    height: 17px;
    font-size: 0.82rem;
  }

  .filter-icon svg {
    width: 13px;
    height: 13px;
  }

  .result-header {
    gap: 8px;
    padding: 11px 14px;
  }

  .header-code {
    font-size: 1.08rem;
  }

  .header-dataset {
    font-size: 0.66rem;
  }

  .header-state {
    width: 18px;
    height: 18px;
  }

  .header-state svg {
    width: 16px;
    height: 16px;
  }

  .share-btn,
  .save-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .result-body {
    padding: 12px 14px 0;
  }

  .result-name {
    font-size: 1rem;
  }

  .result-footer {
    margin: 0 -14px;
    padding: 13px 14px;
  }
}

body.compact-view .result-item {
  cursor: pointer;
}

.result-item {
  cursor: pointer;
}

.result-header {
  padding-block: 16px;
}

.result-expand {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 380ms cubic-bezier(0.4, 0, 0.2, 1), opacity 220ms ease, margin-top 220ms ease;
}

.result-item.expanded .result-expand {
  max-height: 2000px;
  opacity: 1;
}

.result-header::after {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-soft);
  border-bottom: 2px solid var(--text-soft);
  transform: rotate(45deg);
  transform-origin: 60% 60%;
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 4px;
  flex: 0 0 auto;
  opacity: 0.75;
}

.result-item.expanded .result-header::after {
  transform: rotate(-135deg);
  opacity: 0.95;
}

body.compact-view .result-item:hover {
  border-color: var(--line-strong);
  box-shadow: none;
}

.result-body {
  padding-top: 0;
}

.result-body > .result-name {
  display: none;
}

@media (max-width: 720px) {
  .result-header {
    padding-block: 12px;
  }

  .header-name {
    font-size: 0.95rem;
  }
}

@media (max-width: 420px) {
  .header-name {
    font-size: 0.88rem;
  }
}

.offline-chip {
  max-width: calc(100vw - 32px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber-tile-1);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.16);
  animation: chipIn 0.2s var(--ease);
}

.offline-chip[hidden] { display: none; }

.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 0 var(--amber);
  animation: offlinePulse 1.6s ease-in-out infinite;
}

@keyframes chipIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes offlinePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--amber-tile-1); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--surface-strong);
  color: var(--text-strong);
  border: 1px solid var(--border-faint);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 400;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
  z-index: 100;
  animation: toastIn 0.25s var(--ease);
}

.toast[hidden] { display: none; }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 640px) {
  .offline-chip {
    padding: 6px 10px;
    font-size: 0.72rem;
  }
  .toast {
    bottom: 12px;
    padding: 8px 14px;
    font-size: 0.8rem;
  }
}

/* =========================================================================
   INGESTA — profile form and nutrition dashboard
   ========================================================================= */

.top-divider {
  display: inline-block;
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: var(--line);
  flex: 0 0 auto;
}

.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--green-dark);
}

.tool-pill svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ingesta-section {
  width: min(100%, 1120px);
  margin: 0 auto;
}

.ingesta-form-card,
.ingesta-results-card {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  animation: fadeInUp 340ms var(--ease) forwards;
  opacity: 0;
  transform: translateY(10px);
}

.ingesta-form-card {
  max-width: 860px;
  margin: 0 auto;
  background:
    linear-gradient(180deg, var(--green-tint-1), transparent 34%),
    var(--surface);
}

.form-title {
  margin: 0 0 6px;
  color: var(--text-strong);
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0;
}

.form-kicker {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-title svg {
  display: none;
}

.form-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--text-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-step span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
}

.form-subtitle {
  margin: 0 0 22px;
  color: var(--text-muted-2);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.45;
}

.form-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 680px) {
  .form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .form-field-wide,
  .form-actions {
    grid-column: 1 / -1;
  }

  .form-field {
    grid-column: span 2;
  }

  .form-field:has(#ageInput),
  .form-field:has(#heightInput),
  .form-field:has(#weightInput) {
    grid-column: span 1;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.ingesta-section [hidden] {
  display: none !important;
}

.form-field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-strong);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.form-field-hint {
  color: var(--text-muted-3);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
}

.form-input {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-search);
  color: var(--text);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: border-color 160ms ease, background 160ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:hover {
  border-color: var(--border-faint-hover);
}

.form-input:focus,
.form-input:focus-visible {
  outline: none;
  border-color: var(--green);
  background: var(--surface-strong);
}

.form-input::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
}

.form-input[type="number"] {
  -moz-appearance: textfield;
}

.form-input[type="number"]::-webkit-outer-spin-button,
.form-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.radio-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-pill-group.activity {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
}

.radio-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-pill-mid);
  color: var(--text-pill);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease;
}

.radio-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.radio-pill:hover {
  border-color: var(--border-faint-hover);
  transform: translateY(-1px);
}

.radio-pill input:checked + span,
.radio-pill.is-checked {
  color: #fff;
}

.radio-pill-group.sex .radio-pill input:checked ~ span,
.radio-pill.sex input:checked ~ span,
.radio-pill-group.sex .radio-pill.is-checked {
  background: var(--green);
  border-color: var(--green);
}

.radio-pill-group[data-color="blue"] .radio-pill input:checked ~ span,
.radio-pill-group[data-color="blue"] .radio-pill.is-checked {
  background: var(--blue);
  border-color: var(--blue);
}

.radio-pill:has(input:checked) {
  color: #fff;
}

.radio-pill-group.sex .radio-pill:has(input:checked) {
  background: var(--green);
  border-color: var(--green);
}

.radio-pill-group.activity .radio-pill:has(input:checked) {
  background: var(--green);
  border-color: var(--green);
}

.radio-pill-group[data-color="blue"] .radio-pill:has(input:checked) {
  background: var(--blue);
  border-color: var(--blue);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 50px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-search);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.switch-row:hover {
  border-color: var(--border-faint-hover);
}

.switch-row:focus-within {
  border-color: var(--green);
  background: var(--surface-strong);
}

.switch-row-text {
  color: var(--text-strong);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.context-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 16px;
  align-items: stretch;
}

.context-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.context-card-label {
  color: var(--text-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.context-card .radio-pill-group.activity {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.context-card .switch-row {
  flex: 0 0 auto;
  min-height: 58px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--bg-clear);
  transition: background 200ms ease;
}

.switch-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.25);
  transition: transform 220ms var(--ease);
}

.switch input:checked ~ .switch-slider {
  background: var(--green);
}

.switch input:checked ~ .switch-slider::before {
  transform: translateX(18px);
}

.switch input:focus-visible ~ .switch-slider {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.btn-primary:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-pill-mid);
  color: var(--text-pill);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 150ms ease;
}

.btn-secondary:hover {
  border-color: var(--border-faint-hover);
  color: var(--text-strong);
  transform: translateY(-1px);
}

.btn-secondary svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-danger {
  color: var(--red);
}

.btn-danger:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.ingesta-results-card {
  padding: clamp(18px, 3vw, 28px);
  background: transparent;
  border: 0;
  animation: fadeInUp 340ms var(--ease) forwards;
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.results-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.results-header-text h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.profile-summary {
  margin: 0;
  color: var(--text-muted-2);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
}

.profile-summary strong {
  color: var(--text-strong);
  font-weight: 600;
}

.profile-summary .pill-inline {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-tile-1);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: 1px;
  margin: 0 2px;
}

.profile-summary .pill-inline.warn {
  background: var(--amber-tile-1);
  color: var(--amber);
}

.profile-summary .pill-inline.muted {
  background: var(--neutral-soft);
  color: var(--neutral);
}

.results-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nutrient-sections,
.intake-dashboard {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.intake-overview {
  display: grid;
  grid-template-columns: minmax(220px, 0.6fr) minmax(0, 1.4fr);
  gap: 14px;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--green-tint-1), transparent 48%),
    var(--surface);
}

.intake-kcal-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 170px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.intake-kcal-label,
.section-heading span,
.energy-tile span,
.profile-fact span {
  color: var(--text-muted-3);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intake-kcal-block strong {
  color: var(--text-strong);
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.intake-kcal-block > span:last-child {
  color: var(--green);
  font-size: 1rem;
  font-weight: 700;
}

.intake-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.profile-fact {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.profile-fact strong {
  color: var(--text-strong);
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.25;
}

.section-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.section-heading h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  color: var(--text-strong);
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0;
}

.section-heading p {
  margin: 0;
  max-width: 720px;
  color: var(--text-muted-2);
  font-size: 0.86rem;
  line-height: 1.45;
}

.help-tip {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  align-self: center;
  width: 17px;
  height: 17px;
  min-width: 17px;
  border: 0;
  border-radius: 999px;
  color: var(--text-muted-2);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 17px;
  text-transform: none;
  cursor: help;
  outline: none;
  vertical-align: middle;
  margin-top: 0;
}

.help-tip-icon {
  display: block;
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.help-tip::before {
  content: '';
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-bottom-color: #111827;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 91;
}

.help-tip::after {
  content: attr(aria-label);
  position: absolute;
  top: calc(100% + 11px);
  left: 50%;
  width: max-content;
  max-width: min(260px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 7px 10px;
  border-radius: 7px;
  background: #111827;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 90;
}

.help-tip:hover::before,
.help-tip:focus-visible::before,
.help-tip:hover::after,
.help-tip:focus-visible::after {
  opacity: 1;
}

[data-theme="dark"] .help-tip::before {
  border-bottom-color: #f1f3f5;
}

[data-theme="dark"] .help-tip::after {
  background: #f1f3f5;
  color: #11151a;
}

.energy-plan,
.macro-board,
.micro-section {
  padding: clamp(16px, 3vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.energy-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.energy-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.energy-tile:nth-child(2) {
  border-color: var(--green);
  background:
    linear-gradient(135deg, var(--green-tint-1), transparent 58%),
    var(--surface-strong);
}

.energy-tile strong {
  color: var(--text-strong);
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1;
}

.energy-tile small {
  color: var(--text-muted-2);
  font-size: 0.8rem;
  line-height: 1.35;
}

.macro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.macro-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.macro-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nutrient-glyph {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--green-icon-bg);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.macro-card h4 {
  margin: 0;
  color: var(--text-strong);
  font-size: 0.98rem;
  font-weight: 800;
}

.macro-card p {
  margin: 0;
  color: var(--text-muted-3);
  font-size: 0.76rem;
}

.macro-card > strong {
  color: var(--text-strong);
  font-size: 1.45rem;
  line-height: 1;
}

.macro-card > small {
  min-height: 34px;
  color: var(--text-muted-2);
  font-size: 0.78rem;
  line-height: 1.35;
}

.macro-track {
  height: 8px;
  border-radius: 999px;
  background: var(--green-tile-1);
  overflow: hidden;
}

.macro-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.supporting-macros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.compact-nutrient {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--neutral-soft);
  color: var(--text-muted-2);
  font-size: 0.86rem;
}

.compact-nutrient strong {
  color: var(--text-strong);
  white-space: nowrap;
}

.micro-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.nutrient-table {
  display: grid;
  gap: 6px;
}

.nutrient-table-head,
.nutrient-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) minmax(82px, 0.65fr) minmax(92px, 0.75fr);
  align-items: center;
  gap: 10px;
}

.nutrient-table-head {
  position: relative;
  z-index: 10;
  padding: 0 12px 6px;
  color: var(--text-muted-3);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nutrient-table-head span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-height: 20px;
  line-height: 1;
}

.nutrient-table-head span:first-child {
  justify-content: flex-start;
}

.nutrient-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.nutrient-row-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nutrient-row-name strong {
  display: block;
  color: var(--text-strong);
  font-size: 0.9rem;
  line-height: 1.2;
}

.nutrient-row-name small {
  display: block;
  color: var(--text-muted-3);
  font-size: 0.72rem;
}

.nutrient-row-value {
  color: var(--text-strong);
  font-size: 0.86rem;
  font-weight: 750;
  text-align: right;
}

.nutrient-row-value.muted {
  color: var(--text-muted-2);
}

.nutrient-adjustment {
  display: inline-flex;
  margin-left: 4px;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 800;
}

.nutrient-label-mobile {
  display: none;
}

.micro-legend {
  display: none;
  margin: 0 0 6px;
  color: var(--text-muted-3);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.4;
}

.results-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 42px 18px;
  color: var(--text-empty);
  text-align: center;
}

.results-empty p {
  color: var(--text-empty-title);
  font-size: 1rem;
  font-weight: 600;
}

.results-empty span {
  color: var(--text-empty-sub);
  font-size: 0.9rem;
  font-weight: 400;
  max-width: 360px;
  line-height: 1.5;
}

.results-empty svg {
  width: 42px;
  height: 42px;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.saved-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-strong);
  border: 1px solid var(--green);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.14);
  z-index: 100;
  animation: toastIn 0.25s var(--ease);
}

.saved-toast[hidden] {
  display: none;
}

.saved-toast svg {
  width: 16px;
  height: 16px;
  color: var(--green);
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 720px) {
  .ingesta-section {
    width: min(100%, 860px);
  }

  .top-divider {
    height: 20px;
  }

  .tool-pill {
    min-width: 0;
    padding: 0 12px;
  }

  .ingesta-form-card,
  .ingesta-results-card {
    padding-left: 18px;
    padding-right: 18px;
  }

  .form-title {
    font-size: 1.1rem;
  }

  .radio-pill {
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.84rem;
  }

  .intake-overview,
  .macro-grid,
  .energy-tiles,
  .supporting-macros,
  .context-grid,
  .micro-layout {
    grid-template-columns: 1fr;
  }

  .context-card .radio-pill-group.activity {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intake-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nutrient-table-head {
    display: none;
  }

.nutrient-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .nutrient-row-value {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    text-align: left;
  }

.nutrient-label-mobile {
    display: inline;
    color: var(--text-muted-3);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .micro-legend {
    display: block;
  }

  .results-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .results-header-text {
    gap: 6px;
  }

  .profile-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .results-actions {
    justify-content: flex-end;
  }
}

@media (max-width: 420px) {
  .intake-profile-grid {
    grid-template-columns: 1fr;
  }

  .energy-tile strong,
  .macro-card > strong {
    font-size: 1.2rem;
  }
}
