/*
 * NourishScan — Design System
 */

/* ─── Webfonts, self-hosted ────────────────────────────────────
 * Not Google's CDN. A font fetch from fonts.gstatic.com hands Google every
 * visitor's IP with no Art. 6(1) basis (LG München I, 3 O 17493/20), and the
 * request carries a Referer -- the referer of a lab-report app discloses
 * health status by inference, which Art. 9 covers (CJEU C-184/20).
 *
 * Variable woff2, latin and latin-ext subsets, from Google Fonts under the SIL
 * Open Font License 1.1. Propshaft puts app/assets/fonts on the load path, so
 * a bare filename resolves and is fingerprinted with no configuration.
 * ───────────────────────────────────────────────────────────── */
@font-face {
  font-family: "DM Sans";
  src: url("/assets/dm-sans-latin-c2796eef.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  src: url("/assets/dm-sans-latin-ext-49348ecb.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Playfair Display";
  src: url("/assets/playfair-display-latin-92cdd45e.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Playfair Display";
  src: url("/assets/playfair-display-latin-ext-c7159dd9.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Playfair Display";
  src: url("/assets/playfair-display-italic-latin-bb807916.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Playfair Display";
  src: url("/assets/playfair-display-italic-latin-ext-bb9d93c2.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ─── CSS Custom Properties ────────────────────────────────── */
:root {
  /* Brand hues. Forest and sage sit at ~155 (deep evergreen) rather than
     the old ~117 (olive): it reads less dated, throws the amber accent into
     relief, and matches the brand mark. Cream stays saturated because it is
     only ever used as light-on-forest text -- never as a page fill. */
  --color-cream: #FFF1CA;
  --color-amber: #FFB823;
  --color-sage: #3A7159;
  --color-forest: #17382C;

  /* Surfaces. The page is a warm off-white and cards are pure white, so
     cards separate from the page by value alone rather than needing a
     shadow to do the work. --color-background doubles as the "sunken"
     fill for insets sitting on a card (table headers, quick actions). */
  --color-background: #FAF8F3;
  --color-surface: #FFFFFF;

  --color-primary: #FFB823;
  --color-primary-dark: #E0A000;
  --color-secondary: #3A7159;
  --color-secondary-dark: #2B5A49;

  /* Text is near-neutral with a green cast rather than full forest -- body
     copy set in a saturated hue is what read "old school" most. All of these
     sit on the same deep-evergreen hue (~155) as the header, rather than the
     old yellow-green (~117), so nothing clashes with the brand mark.
     All pass WCAG AA (4.5:1) on both white and the off-white page; the
     values this replaced failed -- muted at 2.9:1, sage links at 3.8:1. */
  --color-heading: #17382C;
  --color-text-primary: #1E2C26;
  --color-text-secondary: #4E5A54;
  --color-text-muted: #5F6B64;

  --color-border: rgba(58, 113, 89, 0.22);
  --color-border-strong: rgba(23, 56, 44, 0.32);
  --color-white: #FFFFFF;
  /* Soft tinted fills, for chips and callouts that sit on a surface. */
  --color-accent-soft: #E4F0EA;
  --color-warning-soft: #FFF4D6;
  --color-success: #4CAF6E;
  --color-error: #D65C4F;
  --color-info: #5B8DB8;

  /* Softened now that surfaces carry their own contrast. */
  --shadow-sm: 0 1px 2px rgba(23, 56, 44, 0.05);
  --shadow-md: 0 4px 12px rgba(23, 56, 44, 0.08);
  --shadow-lg: 0 8px 24px rgba(23, 56, 44, 0.11);
  --shadow-card: 0 1px 2px rgba(23, 56, 44, 0.06);

  /* Playfair is reserved for display type -- marketing hero copy and large
     page titles. Everything in the product UI (stat numbers, card titles,
     table headers, nav) uses the sans: a high-contrast Didone at 0.8rem
     is both harder to read and reads editorial rather than product. */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 9999px;
}

/* ─── Icons ──────────────────────────────────────────────────── */
/* Sized in em so icons drop into existing font-size-driven containers
   (.stat-card__icon etc.) at the same visual size emoji used to be. */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
/* Tells the browser both themes are supported, so form controls, scrollbars
   and the caret follow along instead of staying light on a dark page. */
html { font-size: 16px; scroll-behavior: smooth; color-scheme: light; }
body {
  font-family: var(--font-body);
  background-color: var(--color-background);
  color: var(--color-text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding-top: 64px;
  padding-bottom: 70px;
}
@media (min-width: 768px) {
  body { padding-bottom: 0; }
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -0.011em;
  color: var(--color-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
}
/* Opt back in to the serif for marketing/display copy. The landing page
   sets --font-display on its own .lp__* rules, so it is unaffected. */
.display-serif { font-family: var(--font-display); font-weight: 700; letter-spacing: normal; }
p { margin: 0 0 1em; }
a { color: var(--color-secondary); text-decoration: none; }
a:hover { color: var(--color-secondary-dark); }
ul, ol { padding-left: 1.5em; }
img { max-width: 100%; }

/* ─── Layout ─────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container--narrow { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; }

/* ─── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--color-forest);
  box-shadow: var(--shadow-md);
  height: 64px;
}
.navbar__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.navbar__logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; flex-shrink: 0; }
.navbar__logo-icon { font-size: 1.6rem; }
.navbar__logo-text { font-family: var(--font-body); font-size: 1.2rem; font-weight: 700; letter-spacing: -0.025em; color: var(--color-cream); }
.navbar__menu { display: flex; align-items: center; gap: 0.25rem; flex: 1; }
@media (max-width: 767px) {
  .navbar__menu {
    display: none; flex-direction: column;
    position: absolute; top: 64px; left: 0; right: 0;
    background: var(--color-forest);
    padding: 1rem;
    border-top: 1px solid rgba(255,241,202, 0.1);
    align-items: stretch;
  }
  .navbar__menu.is-open { display: flex; }
}
.navbar__link {
  color: rgba(255,241,202, 0.85);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
}
.navbar__link:hover, .navbar__link--active {
  color: var(--color-cream);
  background: rgba(255,241,202, 0.1);
}
.navbar__dropdown { position: relative; }
.navbar__dropdown-trigger { display: flex; align-items: center; gap: 0.25rem; }
.navbar__dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem); left: 0;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 200;
}
.navbar__dropdown-menu.is-open { display: block; }
.navbar__dropdown-item {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--color-text-primary);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s;
}
.navbar__dropdown-item:last-child { border-bottom: none; }
.navbar__dropdown-item:hover { background: var(--color-background); color: var(--color-forest); }
.navbar__arrow { font-size: 0.75rem; opacity: 0.7; }
.navbar__hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 0.5rem; margin-left: auto;
}
.navbar__hamburger span { display: block; width: 24px; height: 2px; background: var(--color-cream); border-radius: 2px; transition: all 0.3s; }
@media (max-width: 767px) { .navbar__hamburger { display: flex; } }

/* ─── Bottom Nav ────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 0.5rem 0;
  box-shadow: 0 -2px 12px rgba(23, 56, 44, 0.1);
}
@media (max-width: 767px) { .bottom-nav { display: flex; justify-content: space-around; } }
.bottom-nav__item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0.5rem; text-decoration: none; flex: 1;
  color: var(--color-text-muted); transition: color 0.15s;
}
.bottom-nav__item--active, .bottom-nav__item:hover { color: var(--color-forest); }
.bottom-nav__icon { font-size: 1.25rem; }
.bottom-nav__label { font-size: 0.65rem; font-weight: 500; }

/* ─── Flash ─────────────────────────────────────────────────── */
.flash {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.5rem; font-size: 0.9rem; font-weight: 500;
  position: relative; z-index: 101;
}
.flash--notice { background: rgba(76, 175, 110, 0.15); color: #2d7a50; border-bottom: 1px solid rgba(76, 175, 110, 0.3); }
.flash--alert { background: rgba(214, 92, 79, 0.12); color: #b54035; border-bottom: 1px solid rgba(214, 92, 79, 0.25); }
.flash__close { background: none; border: none; cursor: pointer; font-size: 1.25rem; opacity: 0.6; padding: 0 0.5rem; color: inherit; }
.flash__close:hover { opacity: 1; }

/* ─── Page Header ───────────────────────────────────────────── */
/* Page headers used to be a full-bleed dark gradient band on every page --
   the most dated element left once the palette was sorted. Now plain type on
   the page background, with hierarchy carried by size and colour. The markup
   is unchanged, so all 15 pages using .page-header move together. */
.page-header {
  padding: 2.25rem 0 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--color-border);
}
.page-header__back { display: inline-block; color: var(--color-secondary); font-size: 0.875rem; margin-bottom: 0.75rem; text-decoration: none; font-weight: 500; }
.page-header__back:hover { color: var(--color-secondary-dark); }
.page-header__title { font-family: var(--font-body); font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; color: var(--color-heading); margin-bottom: 0.25rem; }
@media (max-width: 767px) { .page-header__title { font-size: 1.5rem; } }
.page-header__subtitle { color: var(--color-text-muted); margin: 0; font-size: 0.95rem; }
.page-header__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-header__actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.main-content { min-height: calc(100vh - 64px - 70px); padding-bottom: 3rem; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: 2px solid transparent;
  text-decoration: none; transition: all 0.2s; white-space: nowrap;
}
.btn--primary { background: var(--color-primary); color: var(--color-forest); border-color: var(--color-primary); }
.btn--primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: var(--color-forest); }
.btn--secondary { background: transparent; color: var(--color-cream); border-color: rgba(255,241,202,0.4); }
.btn--secondary:hover { background: rgba(255,241,202,0.1); border-color: var(--color-cream); color: var(--color-cream); }
.btn--ghost { background: transparent; color: var(--color-secondary); border-color: var(--color-border); }
.btn--ghost:hover { background: var(--color-background); border-color: var(--color-secondary); color: var(--color-secondary-dark); }
.btn--sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
.btn[aria-disabled="true"] { cursor: default; opacity: 0.6; }
.btn[aria-disabled="true"]:hover { transform: none; box-shadow: none; }
.btn--lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn--full { width: 100%; }

/* Light-bg button overrides */
.recipe-card .btn--secondary, .card .btn--secondary, .form .btn--secondary,
.form__actions .btn--secondary, .card__footer .btn--secondary, .recipe-detail .btn--ghost,
.page-header .btn--secondary {
  color: var(--color-secondary);
  border-color: var(--color-border-strong);
}
.recipe-card .btn--secondary:hover, .card .btn--secondary:hover, .form .btn--secondary:hover,
.form__actions .btn--secondary:hover, .card__footer .btn--secondary:hover,
.page-header .btn--secondary:hover {
  background: rgba(58, 113, 89,0.08);
  color: var(--color-secondary-dark);
}
.page-header__actions .btn--ghost { color: var(--color-secondary); border-color: var(--color-border-strong); }
.page-header__actions .btn--ghost:hover { background: rgba(58, 113, 89, 0.08); color: var(--color-secondary-dark); }

/* ─── Cards ─────────────────────────────────────────────────── */
.card { background: var(--color-surface); border-radius: var(--radius-lg); border: 1px solid var(--color-border); overflow: hidden; }
.card__header { padding: 1.25rem 1.5rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card__title { font-size: 1.1rem; font-weight: 600; margin: 0; color: var(--color-heading); }
.card__link { font-size: 0.85rem; color: var(--color-secondary); }
.card__link:hover { color: var(--color-secondary-dark); }
.card__body { padding: 1.25rem 1.5rem; }
.card__footer { padding: 1rem 1.5rem 1.25rem; border-top: 1px solid var(--color-border); display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ─── Dashboard ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 0.875rem 0.75rem; gap: 0.625rem; }
  .stat-card__number { font-size: 1.4rem; }
  .stat-card__icon { font-size: 1.5rem; }
  .stat-card__label { font-size: 0.7rem; }
}
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; }
.stat-card__icon { font-size: 2rem; }
.stat-card__content { display: flex; flex-direction: column; }
.stat-card__number { font-family: var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-size: 1.75rem; font-weight: 600; color: var(--color-heading); line-height: 1; }
.stat-card__label { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }
.dashboard-grid__aside { display: flex; flex-direction: column; gap: 1rem; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1rem; background: var(--color-background);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  text-decoration: none; text-align: center; transition: all 0.15s;
  color: var(--color-text-primary);
}
.quick-action:hover { border-color: var(--color-primary); background: var(--color-surface); color: var(--color-heading); }
.quick-action__icon { font-size: 1.5rem; }
.quick-action__label { font-size: 0.8rem; font-weight: 500; }

/* ─── Health Tags ────────────────────────────────────────────── */
.health-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.health-tags__label { font-size: 0.8rem; font-weight: 600; color: var(--color-text-secondary); white-space: nowrap; }
.health-notes {
  font-size: 0.9rem; color: var(--color-text-secondary);
  background: var(--color-background);
  border-left: 3px solid var(--color-primary);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 0.75rem;
}

/* ─── Tags & Badges ──────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  padding: 0.25rem 0.625rem; border-radius: var(--radius-pill);
  font-size: 0.75rem; font-weight: 500;
  text-decoration: none; border: 1px solid transparent; white-space: nowrap;
}
.tag--warning { background: rgba(255,184,35,0.15); color: #8c5e00; border-color: rgba(255,184,35,0.3); }
.tag--error { background: rgba(214,92,79,0.1); color: #b54035; border-color: rgba(214,92,79,0.25); }
.tag--sage { background: rgba(58, 113, 89,0.12); color: var(--color-secondary-dark); border-color: rgba(58, 113, 89,0.3); }
.tag--info { background: rgba(91,141,184,0.12); color: #3a6a9a; border-color: rgba(91,141,184,0.3); }
.tag--filter { cursor: pointer; background: var(--color-surface); color: var(--color-text-secondary); border-color: var(--color-border); }
.tag--filter:hover, .tag--filter.tag--active { background: var(--color-forest); color: var(--color-cream); border-color: var(--color-forest); }
.tag--small { font-size: 0.7rem; padding: 0.2rem 0.5rem; }
.badge {
  display: inline-flex; align-items: center;
  padding: 0.25rem 0.625rem; border-radius: var(--radius-pill);
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badge--success { background: rgba(76,175,110,0.15); color: #2d7a50; }
.badge--warning { background: rgba(255,184,35,0.15); color: #8c5e00; }
.badge--error { background: rgba(214,92,79,0.12); color: #b54035; }
.badge--ai { background: linear-gradient(135deg, rgba(255,184,35,0.2), rgba(58, 113, 89,0.2)); color: var(--color-secondary-dark); border: 1px solid rgba(255,184,35,0.3); }

/* ─── Recipe Grid ────────────────────────────────────────────── */
.recipe-grid, .recipe-book-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem;
}
@media (max-width: 480px) { .recipe-grid, .recipe-book-grid { grid-template-columns: 1fr; } }
.recipe-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color 0.15s;
}
.recipe-card:hover { border-color: var(--color-border-strong); }
.recipe-card__emoji { font-size: 3rem; text-align: center; padding: 1.5rem 1rem 0.5rem; background: linear-gradient(180deg, rgba(255,184,35,0.08) 0%, transparent 100%); }
.recipe-card__body { padding: 1rem 1.25rem; flex: 1; }
.recipe-card__title { font-size: 1rem; font-weight: 600; margin-bottom: 0.375rem; font-family: var(--font-body); color: var(--color-heading); }
.recipe-card__description { font-size: 0.85rem; color: var(--color-text-secondary); line-height: 1.5; margin-bottom: 0.75rem; }
.recipe-card__meta { display: flex; gap: 0.75rem; font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 0.5rem; flex-wrap: wrap; }
.recipe-card__tags { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.recipe-card__footer { padding: 0.875rem 1.25rem; border-top: 1px solid var(--color-border); }

/* ─── Recipe List (sidebar) ──────────────────────────────────── */
.recipe-list { display: flex; flex-direction: column; gap: 0.75rem; }
.recipe-list__item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem; border-radius: var(--radius-md);
  text-decoration: none; color: var(--color-text-primary);
  transition: background 0.15s; border: 1px solid var(--color-border);
}
.recipe-list__item:hover { background: var(--color-background); }
.recipe-list__emoji { font-size: 1.5rem; }
.recipe-list__info { display: flex; flex-direction: column; gap: 0.125rem; flex: 1; min-width: 0; }
.recipe-list__title { font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recipe-list__meta { font-size: 0.75rem; color: var(--color-text-muted); }

/* ─── Recipe Detail ──────────────────────────────────────────── */
.recipe-meta-bar { display: flex; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.5rem; }
@media (max-width: 480px) { .recipe-meta-bar { display: grid; grid-template-columns: 1fr 1fr; } }
.recipe-meta-item { flex: 1; text-align: center; padding: 1rem; border-right: 1px solid var(--color-border); }
.recipe-meta-item:last-child { border-right: none; }
.recipe-meta-item__label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); font-weight: 600; margin-bottom: 0.25rem; }
.recipe-meta-item__value { display: block; font-family: var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-size: 1.1rem; font-weight: 600; color: var(--color-heading); }
.recipe-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.health-benefit-card {
  display: flex; gap: 1rem;
  background: rgba(76,175,110,0.08); border: 1px solid rgba(76,175,110,0.2);
  border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1.5rem;
}
.health-benefit-card__icon { font-size: 1.5rem; flex-shrink: 0; }
.health-benefit-card p { margin: 0.25rem 0 0; font-size: 0.9rem; color: var(--color-text-secondary); }
.health-benefit-card strong { font-size: 0.9rem; color: var(--color-text-primary); }
.recipe-columns { display: grid; grid-template-columns: 1fr 1.5fr; gap: 1.5rem; }
@media (max-width: 768px) { .recipe-columns { grid-template-columns: 1fr; } }
.recipe-section__title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--color-primary); }
.ingredient-list { list-style: none; padding: 0; margin: 0; }
.ingredient-list__item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.625rem 0; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
.ingredient-list__item:last-child { border-bottom: none; }
.ingredient-list__bullet { color: var(--color-primary); font-size: 0.5rem; margin-top: 0.4rem; flex-shrink: 0; }
.instruction-list { list-style: none; padding: 0; margin: 0; }
.instruction-list__item { display: flex; gap: 1rem; margin-bottom: 1rem; align-items: flex-start; }
.instruction-list__number {
  flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--color-primary); color: var(--color-forest);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem;
}
.instruction-list__text { font-size: 0.9rem; line-height: 1.6; padding-top: 0.25rem; }

/* ─── Analysis ───────────────────────────────────────────────── */
.analysis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.analysis-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.25rem; }
.analysis-card__title { font-size: 1rem; font-weight: 700; margin-bottom: 0.875rem; }
.analysis-card--warning { border-color: rgba(255,184,35,0.4); }
.analysis-card--error   { border-color: rgba(214,92,79,0.35); }
.analysis-card--success { border-color: rgba(76,175,110,0.35); }
.analysis-card--info    { border-color: rgba(91,141,184,0.3); }
.analysis-card--notes   { grid-column: 1 / -1; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ─── Active Profile — Finding Rows ──────────────────────────── */
.banner { display: flex; align-items: center; gap: 0.5rem; padding: 1rem 1.25rem; border-radius: var(--radius-lg); margin-bottom: 1.5rem; font-weight: 500; }
.banner--info { background: rgba(91,141,184,0.12); color: #3a6a9a; border: 1px solid rgba(91,141,184,0.3); }
.finding-list { display: flex; flex-direction: column; gap: 0.625rem; }
.finding-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.finding-row--ignored { opacity: 0.6; }
.finding-row__form { margin: 0; }
.finding-row__label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; min-height: 44px; }
.finding-row__checkbox { width: 20px; height: 20px; min-width: 20px; cursor: pointer; accent-color: var(--color-secondary); }
.finding-row__provenance { font-size: 0.75rem; color: var(--color-text-muted); margin: 0; }
@media (max-width: 480px) {
  .finding-row { flex-direction: column; align-items: flex-start; gap: 0.375rem; }
  .finding-row__provenance { padding-left: 1.75rem; }
}

/* ─── Document List ──────────────────────────────────────────── */
.document-list { display: flex; flex-direction: column; gap: 0.75rem; }
.document-card {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  transition: border-color 0.15s;
}
.document-card:hover { border-color: var(--color-border-strong); }
.document-card__link {
  display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 0;
  text-decoration: none; color: var(--color-text-primary); transition: transform 0.15s, color 0.15s;
}
.document-card__link:hover { transform: translateX(4px); color: var(--color-forest); }
.document-card__icon { font-size: 2rem; }
.document-card__info { flex: 1; min-width: 0; }
.document-card__name { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; font-family: var(--font-body); }
.document-card__meta { font-size: 0.8rem; color: var(--color-text-muted); margin: 0; }
.document-card__delete {
  display: flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; flex-shrink: 0;
  background: none; border: none; border-radius: var(--radius-md);
  color: var(--color-text-muted); font-size: 1.1rem; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.document-card__delete:hover { background: rgba(214,92,79,0.1); color: var(--color-error); }

/* ─── Upload Zone ────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem; text-align: center; cursor: pointer;
  transition: all 0.2s; position: relative;
  background: var(--color-surface); margin-bottom: 1.5rem;
}
.upload-zone:hover, .upload-zone.is-dragover { border-color: var(--color-primary); background: rgba(255,184,35,0.04); }
.upload-zone__icon { font-size: 3rem; margin-bottom: 0.75rem; }
.upload-zone__title { font-family: var(--font-body); font-weight: 600; font-size: 1.25rem; margin-bottom: 0.5rem; }
.upload-zone__text { color: var(--color-text-secondary); margin-bottom: 0.5rem; }
.upload-zone__hint { font-size: 0.8rem; color: var(--color-text-muted); margin: 0; }
.upload-zone__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-zone__preview { display: flex; align-items: center; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.upload-zone__file-icon { font-size: 2rem; }
.upload-zone__filename { font-weight: 500; }
.upload-zone__remove {
  background: none; border: 1px solid var(--color-border);
  border-radius: var(--radius-pill); padding: 0.25rem 0.75rem;
  cursor: pointer; font-size: 0.8rem; color: var(--color-error);
}
.upload-zone__remove:hover { background: rgba(214,92,79,0.08); }

/* ─── Forms ──────────────────────────────────────────────────── */
.form__group { margin-bottom: 1.25rem; }
.form__label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.5rem; color: var(--color-text-primary); }
.form__input {
  width: 100%; padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body); font-size: 0.9rem;
  background: var(--color-white); color: var(--color-text-primary);
  transition: border-color 0.15s;
}
.form__input:focus { outline: none; border-color: var(--color-secondary); box-shadow: 0 0 0 3px rgba(58, 113, 89,0.15); }
.form__textarea { resize: vertical; min-height: 80px; }
.form__textarea--sm { min-height: 60px; }
.form__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 480px) { .form__row { grid-template-columns: 1fr; } }
.form__dynamic-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.form__dynamic-row .form__input { flex: 1; }
.form__dynamic-row textarea { flex: 1; }
.form__actions { display: flex; gap: 0.75rem; margin-top: 2rem; flex-wrap: wrap; }
.form__hint { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.375rem; }
.form__privacy-note { font-size: 0.8rem; color: var(--color-text-muted); background: rgba(58, 113, 89,0.08); padding: 0.75rem 1rem; border-radius: var(--radius-md); margin-top: 0.5rem; }
.form__info { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.5rem; }
.form__info h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.form__info ul { font-size: 0.875rem; color: var(--color-text-secondary); padding-left: 0; list-style: none; }
.form__info li { padding: 0.25rem 0; }
.form__errors { background: rgba(214,92,79,0.08); border: 1px solid rgba(214,92,79,0.25); border-radius: var(--radius-md); padding: 1rem; margin-bottom: 1rem; }
.form__errors p { color: var(--color-error); font-size: 0.875rem; margin: 0.25rem 0; }

/* ─── Search Bar ────────────────────────────────────────────── */
.search-bar { margin-bottom: 1.5rem; }
.search-bar__input-wrap { display: flex; gap: 0.75rem; margin-bottom: 0.75rem; }
@media (max-width: 480px) { .search-bar__input-wrap { flex-direction: column; } }
.search-bar__input {
  flex: 1; padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border); border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: 0.9rem; background: var(--color-white);
}
.search-bar__input:focus { outline: none; border-color: var(--color-secondary); }
.tag-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ─── Empty States ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-state__icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state__title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.75rem; }
.empty-state__text { color: var(--color-text-secondary); max-width: 400px; margin: 0 auto 1.5rem; }
.empty-state__actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.empty-mini { text-align: center; padding: 1rem; color: var(--color-text-muted); font-size: 0.9rem; }
.empty-mini p { margin-bottom: 0.75rem; }

/* ─── CTA Section ────────────────────────────────────────────── */
.cta-section { text-align: center; background: linear-gradient(135deg, #17382C, #0F2A20); border-radius: var(--radius-xl); padding: 3rem 2rem; margin-top: 2rem; }
.cta-section h2 { color: var(--color-cream); font-size: 1.75rem; margin-bottom: 0.75rem; }
.cta-section p { color: rgba(255,241,202,0.8); margin-bottom: 1.5rem; }

/* ─── Subscription Plans ─────────────────────────────────────── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 260px));
  gap: 1.25rem;
  justify-content: center;
}
@media (max-width: 600px) {
  .plans-grid { grid-template-columns: minmax(0, 1fr); max-width: 320px; margin: 0 auto; }
}
.plan-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
/* Emphasis carried by a 2px accent border rather than a drop shadow. */
.plan-card--highlight { border-color: var(--color-primary); border-width: 2px; padding: calc(1.5rem - 1px); }
.plan-card__header { display: flex; flex-direction: column; gap: 0.375rem; }
.plan-card__title { font-size: 0.9rem; font-weight: 600; color: var(--color-text-secondary); }
.plan-card__price { font-family: var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; font-size: 1.75rem; font-weight: 600; color: var(--color-heading); }
.plan-card__period { font-family: var(--font-body); font-size: 0.9rem; font-weight: 500; color: var(--color-text-muted); margin-left: 0.125rem; }
.plan-card__details { font-size: 0.85rem; color: var(--color-text-secondary); }
.plan-card__details summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.375rem;
  color: var(--color-secondary); font-weight: 500; user-select: none;
}
.plan-card__details summary::-webkit-details-marker { display: none; }
.plan-card__chevron { transition: transform 0.15s; }
.plan-card__details[open] .plan-card__chevron { transform: rotate(180deg); }
.plan-card__details p { margin: 0.625rem 0 0; }
/* The German Widerrufsrecht wording on the CTA (§ 356(4) BGB) runs longer than
   the fixed 260px plan-card column at any width ≥ 601px (the single-column
   breakpoint is the only place it had room); wrap rather than pin a pixel
   budget to one string that must never be shortened. */
.plan-card__cta { width: 100%; margin-top: auto; white-space: normal; line-height: 1.3; }
/* The § 356(4) BGB acknowledgement sits directly above the paying button, so
   the consumer reads it before the obligation, not after. */
.plan-card__form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: auto; }
.plan-card__withdrawal {
  display: flex; gap: 0.625rem; align-items: flex-start; margin: 0;
  font-size: 0.8rem; line-height: 1.45; color: var(--color-text-secondary);
}
.plan-card__withdrawal input[type="checkbox"] {
  flex: 0 0 auto; width: 1.15rem; height: 1.15rem; margin: 0.1rem 0 0;
  accent-color: var(--color-secondary); cursor: pointer;
}
.plan-card__withdrawal label { cursor: pointer; }
.plan-card__legalnote { margin: 0; font-size: 0.75rem; line-height: 1.5; color: var(--color-text-muted); }
.plan-card__legalnote a { color: var(--color-secondary); }

/* The Art. 9(2)(a) consent sits between the upload zone and the button that
   starts the processing, so it is read before the decision. */
.form__consent {
  display: flex; gap: 0.75rem; align-items: flex-start;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 1rem 1.125rem; margin-bottom: 1.25rem;
  font-size: 0.875rem; line-height: 1.55; color: var(--color-text-secondary);
}
.form__consent input[type="checkbox"] {
  flex: 0 0 auto; width: 1.15rem; height: 1.15rem; margin: 0.15rem 0 0;
  accent-color: var(--color-secondary); cursor: pointer;
}
.form__consent label { cursor: pointer; }

/* ─── Auth Pages ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem 1.5rem;
  background: linear-gradient(160deg, #17382C 0%, #0D2419 60%, #0F2A20 100%);
}
.auth-page__hero { text-align: center; margin-bottom: 2rem; }
.auth-page__logo {
  display: inline-flex; align-items: center; gap: 0.625rem;
  text-decoration: none; margin-bottom: 0.75rem;
}
.auth-page__logo-icon { font-size: 2rem; }
.auth-page__logo-text {
  font-family: var(--font-body); font-size: 1.6rem; font-weight: 700;
  letter-spacing: -0.025em; color: var(--color-cream);
}
.auth-page__tagline { color: rgba(255,241,202,0.7); font-size: 0.95rem; margin: 0; }
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 440px;
}
.auth-card__title {
  font-size: 1.75rem; font-weight: 700;
  color: var(--color-forest); margin-bottom: 0.375rem;
}
.auth-card__subtitle { color: var(--color-text-muted); margin-bottom: 1.75rem; font-size: 0.95rem; }
.auth-card__privacy {
  font-size: 0.8rem; color: var(--color-text-muted);
  background: rgba(58, 113, 89,0.08); border-radius: var(--radius-md);
  padding: 0.75rem 1rem; margin-top: 1.25rem; text-align: center;
}
.form__actions--stacked { flex-direction: column; }
.form__group--inline { display: flex; align-items: center; gap: 0.5rem; }
.form__checkbox { width: 1rem; height: 1rem; accent-color: var(--color-forest); flex-shrink: 0; }
.form__label--inline { margin-bottom: 0; font-weight: 400; }
.auth-links { margin-top: 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.625rem; }
.auth-links__link { font-size: 0.875rem; color: var(--color-secondary); text-decoration: none; }
.auth-links__link:hover { color: var(--color-forest); }
.auth-links__link--muted { color: var(--color-text-muted); font-size: 0.8rem; }
.auth-links__link--muted:hover { color: var(--color-text-secondary); }

/* Auth page overrides: forms on auth page need light-bg btn styles */
.auth-card .btn--ghost { color: var(--color-secondary); border-color: var(--color-border-strong); }
.auth-card .btn--ghost:hover { background: rgba(58, 113, 89,0.08); }

/* ─── Utilities ──────────────────────────────────────────────── */
.text-muted { color: var(--color-text-muted); font-size: 0.875rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }

/* ─── Brand mark ─────────────────────────────────────────────── */
/* Sized in em like .icon so it scales with its wrapper's font-size. */
.brand-mark {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.145em;
  flex-shrink: 0;
}

/* ─── Dark mode ──────────────────────────────────────────────── */
/* Keyed on data-theme, which the inline script in the layout head resolves
   before first paint from the stored choice, falling back to the OS setting.
   One block rather than a media query plus a duplicate: this app already
   needs JS for the navbar, dropdowns, uploads and the meal planner.

   The base is a warm charcoal rather than a dark green. Green reads as a wash
   when it covers every surface, and a warm base suits the amber and cream
   accents better than a cool or green one does. Green is kept where it carries
   meaning: the navbar, links, and the accent tints. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --color-background: #242220;
  --color-surface: #2E2B28;

  --color-heading: #F2EFEB;
  --color-text-primary: #E5E1DC;
  --color-text-secondary: #BDB6AE;
  --color-text-muted: #A79F97;

  /* Links invert rather than darken -- sage at its light value disappears
     into a dark surface. */
  --color-secondary: #86C9A2;
  --color-secondary-dark: #9FD9B6;
  --color-sage: #86C9A2;

  --color-border: rgba(214, 205, 196, 0.15);
  --color-border-strong: rgba(214, 205, 196, 0.29);

  --color-accent-soft: rgba(134, 201, 162, 0.14);
  --color-warning-soft: rgba(255, 184, 35, 0.13);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* The navbar keeps real brand green so the app still reads as itself, but a
   long way off the light-mode forest, which was overbearing on a dark page. */
[data-theme="dark"] .navbar,
[data-theme="dark"] .admin-nav {
  background: #2A312C;
  border-bottom: 1px solid rgba(214, 205, 196, 0.13);
}
[data-theme="dark"] .navbar__menu { background: #2A312C; }

/* The primary button is amber in both themes; its label stays deep green. */
[data-theme="dark"] .btn--primary { color: #10231B; }

/* Tag and badge tints were mixed against a white surface. */
[data-theme="dark"] .tag--warning { background: rgba(255,184,35,0.16); color: #F0C56A; border-color: rgba(255,184,35,0.3); }
[data-theme="dark"] .tag--error   { background: rgba(214,92,79,0.18); color: #F0A295; border-color: rgba(214,92,79,0.32); }
[data-theme="dark"] .tag--sage    { background: rgba(134,201,162,0.15); color: #9FD9B6; border-color: rgba(134,201,162,0.3); }
[data-theme="dark"] .tag--info    { background: rgba(91,141,184,0.18); color: #9EC6E8; border-color: rgba(91,141,184,0.32); }
[data-theme="dark"] .badge--success { background: rgba(76,175,110,0.18); color: #7FD5A0; }
[data-theme="dark"] .badge--warning { background: rgba(255,184,35,0.16); color: #F0C56A; }
[data-theme="dark"] .badge--error   { background: rgba(214,92,79,0.16); color: #F0A295; }

/* ─── Theme toggle ───────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0;
  background: none; border: none; cursor: pointer; border-radius: var(--radius-sm);
  color: rgba(255,241,202,0.75); font-size: 1rem; flex-shrink: 0;
}
.theme-toggle:hover { color: var(--color-cream); background: rgba(255,241,202,0.1); }
.theme-toggle__moon { display: none; }
[data-theme="dark"] .theme-toggle__moon { display: inline-block; }
[data-theme="dark"] .theme-toggle__sun { display: none; }
