/* ============================================================
   Forkato — Design System
   OKLCH dark mode, amber-tinted neutrals
   ============================================================ */

/* --- Reset ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; }

/* --- Tokens ------------------------------------------------ */
:root {
  /* Surface */
  --c-base:        oklch(0.13 0.008 70);
  --c-surface:     oklch(0.17 0.012 70);
  --c-surface-hi:  oklch(0.21 0.014 70);
  --c-surface-max: oklch(0.26 0.016 70);

  /* Accent — warm amber */
  --c-accent:       oklch(0.76 0.155 70);
  --c-accent-hover: oklch(0.83 0.12 70);
  --c-accent-subtle:oklch(0.24 0.04 70);
  --c-accent-fg:    oklch(0.16 0.02 70);

  /* Text */
  --c-text:   oklch(0.93 0.01 70);
  --c-text-2: oklch(0.68 0.01 70);
  --c-text-3: oklch(0.48 0.008 70);

  /* Borders */
  --c-border:    oklch(0.24 0.012 70);
  --c-border-hi: oklch(0.32 0.016 70);

  /* Semantic */
  --c-success: oklch(0.72 0.14 152);
  --c-error:   oklch(0.68 0.19 25);
  --c-warning: oklch(0.80 0.14 80);

  /* Spacing — 4pt */
  --s-2:  4px;   --s-4:  8px;   --s-6: 12px;
  --s-8: 16px;   --s-12: 24px;  --s-16: 32px;
  --s-24: 48px;  --s-32: 64px;  --s-48: 96px;

  /* Typography */
  --f-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --f-body:    'Figtree', system-ui, sans-serif;

  --t-xs:  0.75rem;
  --t-sm:  0.875rem;
  --t-base: 1rem;
  --t-lg:  1.25rem;
  --t-xl:  1.563rem;
  --t-2xl: 1.953rem;
  --t-3xl: 2.441rem;
  --t-4xl: 3.052rem;

  --lh-tight:  1.15;
  --lh-snug:   1.3;
  --lh-normal: 1.6;

  /* Radius */
  --r-sm:   6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* Motion */
  --ease-out:  cubic-bezier(0.25, 1, 0.5, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast:   120ms;
  --dur-normal: 220ms;
  --dur-slow:   400ms;

  /* Shadows (dark mode: mostly elevation via surface lightness) */
  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.5);
  --shadow-md: 0 4px 16px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.5);
}

/* --- Base -------------------------------------------------- */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--f-body);
  font-weight: 400;
  font-size: var(--t-base);
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-base);
  min-height: 100vh;
}

::selection {
  background: oklch(0.76 0.155 70 / 0.3);
  color: var(--c-text);
}

/* --- Typography -------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 650;
  line-height: var(--lh-tight);
  color: var(--c-text);
  letter-spacing: -0.02em;
}
h1 { font-size: var(--t-4xl); }
h2 { font-size: var(--t-2xl); }
h3 { font-size: var(--t-xl); }
h4 { font-size: var(--t-lg); }

.text-sm  { font-size: var(--t-sm); }
.text-xs  { font-size: var(--t-xs); }
.text-lg  { font-size: var(--t-lg); }
.text-muted { color: var(--c-text-3); }
.text-secondary { color: var(--c-text-2); }
.text-accent { color: var(--c-accent); }

/* --- Links ------------------------------------------------- */
a:not(.btn):not(.nav__brand):not(.recipe-card) {
  color: var(--c-accent);
  transition: color var(--dur-fast) var(--ease-out);
}
a:not(.btn):not(.nav__brand):not(.recipe-card):hover {
  color: var(--c-accent-hover);
}

/* --- Nav --------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: oklch(0.13 0.008 70 / 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-border);
  padding: var(--s-6) var(--s-12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-8);
}

.nav__brand {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.nav__brand-mark {
  width: 28px;
  height: 28px;
  background: var(--c-accent);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-accent-fg);
  font-weight: 800;
  font-size: var(--t-sm);
  font-family: var(--f-display);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-8);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--f-body);
  font-size: var(--t-sm);
  font-weight: 500;
  line-height: 1.4;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--c-accent);
  color: var(--c-accent-fg);
}
.btn--primary:hover {
  background: var(--c-accent-hover);
}
.btn--primary:active {
  background: oklch(0.70 0.16 70);
}

.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--ghost {
  background: transparent;
  color: var(--c-text-2);
  border-color: var(--c-border);
}
.btn--ghost:hover {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border-hi);
}
.btn--ghost:active {
  background: var(--c-surface-hi);
}

.btn--danger {
  background: transparent;
  color: var(--c-error);
  border-color: oklch(0.30 0.06 25);
}
.btn--danger:hover {
  background: oklch(0.18 0.05 25);
}
.btn--danger:active {
  background: oklch(0.22 0.07 25);
}

.btn--text {
  background: transparent;
  color: var(--c-text-2);
  padding: var(--s-2) var(--s-4);
  border: none;
}
.btn--text:hover { color: var(--c-text); }

.btn--sm {
  padding: var(--s-2) var(--s-4);
  font-size: var(--t-xs);
}

.btn--lg {
  padding: var(--s-6) var(--s-12);
  font-size: var(--t-base);
  border-radius: var(--r-lg);
}

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--r-md);
  font-size: var(--t-lg);
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* --- Inputs ------------------------------------------------ */
.input {
  width: 100%;
  padding: var(--s-6) var(--s-8);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-text);
  font-size: var(--t-base);
  line-height: 1.5;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.input::placeholder { color: var(--c-text-3); }
.input:focus {
  outline: none;
  border-color: var(--c-accent);
  background: var(--c-surface-hi);
}
textarea.input { resize: vertical; min-height: 140px; }

.input--lg {
  padding: var(--s-8) var(--s-12);
  font-size: var(--t-lg);
  border-radius: var(--r-lg);
}

.label {
  display: block;
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--c-text-2);
  margin-bottom: var(--s-4);
}

.form-hint {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  margin-top: var(--s-2);
}

.field { margin-bottom: var(--s-12); }

/* --- Alert ------------------------------------------------- */
.alert {
  padding: var(--s-6) var(--s-8);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  line-height: 1.5;
}
.alert--error {
  background: oklch(0.18 0.05 25);
  color: oklch(0.85 0.12 25);
}
.alert--success {
  background: oklch(0.18 0.04 152);
  color: oklch(0.82 0.10 152);
}

/* --- Tags -------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--s-2) var(--s-6);
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 500;
  line-height: 1.4;
}

.tag--platform {
  background: var(--c-surface-hi);
  color: var(--c-text-2);
  text-transform: capitalize;
}

/* --- Dropdown ---------------------------------------------- */
.dropdown {
  position: relative;
}
.dropdown__trigger {
  cursor: pointer;
}
.dropdown__menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 160px;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-2);
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.dropdown--open .dropdown__menu { display: block; }

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  padding: var(--s-4) var(--s-6);
  border: none;
  background: none;
  color: var(--c-text-2);
  font-size: var(--t-sm);
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.dropdown__item:hover {
  background: var(--c-surface-max);
  color: var(--c-text);
}

/* --- Search Bar -------------------------------------------- */
.search-bar {
  position: relative;
}
.search-bar__icon {
  position: absolute;
  left: var(--s-8);
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-3);
  pointer-events: none;
  font-size: var(--t-lg);
}
.search-bar .input {
  padding-left: 44px;
}

/* --- Tabs -------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--s-2);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-12);
}
.tab {
  padding: var(--s-4) var(--s-8);
  border: none;
  background: transparent;
  color: var(--c-text-3);
  font-size: var(--t-sm);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--c-text-2); }
.tab--active {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}

/* --- View Toggle ------------------------------------------- */
.view-toggle {
  display: flex;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.view-toggle__btn {
  padding: var(--s-2) var(--s-4);
  border: none;
  background: transparent;
  color: var(--c-text-3);
  font-size: var(--t-sm);
  transition: all var(--dur-fast) var(--ease-out);
  display: flex;
  align-items: center;
}
.view-toggle__btn--active {
  background: var(--c-surface-hi);
  color: var(--c-text);
}
.view-toggle__btn:hover:not(.view-toggle__btn--active) {
  color: var(--c-text-2);
}

/* ============================================================
   RECIPE CARDS
   ============================================================ */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-12);
}

.recipe-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 2;
  background: var(--c-surface);
  transition: transform var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out);
}
.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.recipe-card:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.recipe-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-card__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    oklch(0.05 0.005 70 / 0.88) 0%,
    oklch(0.05 0.005 70 / 0.35) 45%,
    transparent 70%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--s-8);
  gap: var(--s-2);
}

.recipe-card__title {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 600;
  color: oklch(0.96 0.005 70);
  line-height: var(--lh-snug);
  letter-spacing: -0.01em;
}

.recipe-card__meta {
  font-size: var(--t-xs);
  color: oklch(0.72 0.01 70);
  display: flex;
  align-items: center;
  gap: var(--s-6);
}

.recipe-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.recipe-card__tags .tag {
  background: oklch(1 0 0 / 0.12);
  color: oklch(0.90 0.01 70);
  font-size: 0.65rem;
}

/* No-image card */
.recipe-card--noimg {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--s-12);
  background: linear-gradient(
    135deg,
    var(--c-surface) 0%,
    var(--c-surface-hi) 100%
  );
}

.recipe-card--noimg::before {
  content: '';
  position: absolute;
  top: var(--s-8);
  right: var(--s-8);
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  background: var(--c-accent-subtle);
  opacity: 0.5;
}

.recipe-card--noimg .recipe-card__title {
  color: var(--c-text);
}

.recipe-card--noimg .recipe-card__meta {
  color: var(--c-text-3);
}

.recipe-card--noimg .recipe-card__tags .tag {
  background: var(--c-accent-subtle);
  color: var(--c-accent);
}

/* List view variant */
.recipe-grid--list {
  grid-template-columns: 1fr;
  gap: var(--s-4);
}

.recipe-grid--list .recipe-card {
  aspect-ratio: unset;
  display: grid;
  grid-template-columns: 180px 1fr;
  height: 110px;
  border-radius: var(--r-md);
}

.recipe-grid--list .recipe-card__scrim {
  position: static;
  background: none;
  padding: var(--s-6) var(--s-8);
  justify-content: center;
}

.recipe-grid--list .recipe-card__title {
  color: var(--c-text);
  font-size: var(--t-base);
}

.recipe-grid--list .recipe-card__meta {
  color: var(--c-text-3);
}

.recipe-grid--list .recipe-card__tags .tag {
  background: var(--c-accent-subtle);
  color: var(--c-accent);
}

.recipe-grid--list .recipe-card--noimg {
  grid-template-columns: 1fr;
  padding: var(--s-6) var(--s-8);
  height: auto;
  min-height: 80px;
}

.recipe-grid--list .recipe-card--noimg::before { display: none; }

/* ============================================================
   RECIPE DETAIL
   ============================================================ */
.recipe-detail { max-width: 960px; }

.recipe-detail__hero {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  border-radius: var(--r-xl);
  margin-bottom: var(--s-16);
}

.recipe-detail__header {
  margin-bottom: var(--s-12);
}

.recipe-detail__title {
  font-size: var(--t-3xl);
  margin-bottom: var(--s-4);
}

.recipe-detail__desc {
  color: var(--c-text-2);
  font-size: var(--t-lg);
  line-height: var(--lh-normal);
  max-width: 65ch;
}

.recipe-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
  margin-bottom: var(--s-12);
}

.recipe-detail__meta-item {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  font-size: var(--t-sm);
  color: var(--c-text-2);
}

.recipe-detail__meta-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-sm);
}

.recipe-detail__source {
  display: inline-flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-12);
}

.recipe-detail__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-bottom: var(--s-16);
}

.recipe-detail__body {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--s-16);
  align-items: start;
}

@media (max-width: 768px) {
  .recipe-detail__body {
    grid-template-columns: 1fr;
    gap: var(--s-12);
  }
}

/* Ingredients */
.ingredients {
  position: sticky;
  top: 80px;
}

.ingredients__title,
.steps__title {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  margin-bottom: var(--s-8);
}

.ingredients__list li {
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-base);
  line-height: var(--lh-snug);
  color: var(--c-text);
}
.ingredients__list li:last-child { border-bottom: none; }

.ingredients__amount {
  color: var(--c-accent);
  font-weight: 500;
}

/* Steps */
.steps__list { counter-reset: step; }

.steps__list li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--s-8);
  padding: var(--s-8) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-lg);
  line-height: var(--lh-normal);
  color: var(--c-text);
}
.steps__list li:last-child { border-bottom: none; }

.steps__list li::before {
  content: counter(step);
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--t-base);
  flex-shrink: 0;
}

/* ============================================================
   IMPORT PAGE
   ============================================================ */
.import-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--s-24) var(--s-12);
}

.import-page__title {
  font-size: var(--t-2xl);
  margin-bottom: var(--s-4);
}

.import-page__subtitle {
  color: var(--c-text-2);
  margin-bottom: var(--s-16);
  max-width: 50ch;
}

.import-page .tab-content {
  display: none;
}
.import-page .tab-content--active {
  display: block;
}

.import-progress {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-8);
  background: var(--c-surface);
  border-radius: var(--r-md);
  color: var(--c-text-2);
  font-size: var(--t-sm);
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s-32) var(--s-12);
}

.empty-state__icon {
  font-size: 4rem;
  color: var(--c-text-3);
  opacity: 0.3;
  margin-bottom: var(--s-12);
}

.empty-state__title {
  font-family: var(--f-display);
  font-size: var(--t-xl);
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: var(--s-4);
}

.empty-state__desc {
  color: var(--c-text-3);
  margin-bottom: var(--s-12);
  max-width: 36ch;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--s-12);
}

.login-form {
  width: 100%;
  max-width: 380px;
}

.login-brand {
  margin-bottom: var(--s-24);
}

.login-brand__mark {
  width: 44px;
  height: 44px;
  background: var(--c-accent);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-accent-fg);
  font-weight: 800;
  font-size: var(--t-lg);
  font-family: var(--f-display);
  margin-bottom: var(--s-12);
}

.login-brand__title {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--s-4);
}

.login-brand__subtitle {
  color: var(--c-text-3);
  font-size: var(--t-sm);
}

.pw-strength {
  height: 4px;
  background: var(--c-border);
  border-radius: var(--r-full);
  margin-top: var(--s-4);
  overflow: hidden;
}
.pw-strength__bar {
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  transition: width 0.2s, background 0.2s;
}

/* ============================================================
   ADMIN
   ============================================================ */
.admin-layout {
  padding: var(--s-12);
  max-width: 1280px;
  margin: 0 auto;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-6);
  margin-bottom: var(--s-16);
}

.stat-block {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: var(--s-12);
}

.stat-block__label {
  font-size: var(--t-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
  margin-bottom: var(--s-4);
}

.stat-block__value {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

.stat-block--accent .stat-block__value,
.stat-block__value.stat-block--accent {
  color: var(--c-accent);
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

.data-table th {
  text-align: left;
  padding: var(--s-6) var(--s-8);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-3);
  border-bottom: 1px solid var(--c-border);
}

.data-table td {
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-2);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td {
  background: var(--c-surface);
}

.data-table .text-right { text-align: right; }
.data-table .text-nowrap { white-space: nowrap; }

.data-panel {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--s-12);
}

.data-panel__header {
  padding: var(--s-8) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-text-2);
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--s-12);
  align-items: start;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--s-4);
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 500;
  line-height: 1.4;
}
.badge--success { background: oklch(0.22 0.04 152); color: var(--c-success); }
.badge--error   { background: oklch(0.20 0.05 25);  color: var(--c-error); }
.badge--warning { background: oklch(0.22 0.04 80);  color: var(--c-warning); }
.badge--info    { background: oklch(0.20 0.03 240);  color: var(--c-text-2); }
.badge--neutral { background: var(--c-surface-hi);  color: var(--c-text-3); }

/* Cost breakdown */
.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4) 0;
}
.cost-row + .cost-row { border-top: 1px solid var(--c-border); }

.cost-row__name {
  font-weight: 500;
  color: var(--c-text);
}
.cost-row__detail {
  font-size: var(--t-xs);
  color: var(--c-text-3);
}
.cost-row__amount {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--c-accent);
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page {
  padding: var(--s-12);
  max-width: 1200px;
  margin: 0 auto;
}

.page__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-12);
  gap: var(--s-8);
}

.page__header h2 {
  font-size: var(--t-xl);
}

/* ============================================================
   STAGGER ANIMATION
   ============================================================ */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger-in {
  animation: fade-up var(--dur-slow) var(--ease-expo) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@media (prefers-reduced-motion: reduce) {
  .stagger-in {
    animation: none;
    opacity: 1;
  }
  .spinner { animation: none; }
  .skeleton-shimmer,
  .skeleton-line::after { animation: none; }
  .toast { transition: none; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.hidden { display: none !important; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  :root {
    --t-3xl: 2rem;
    --t-4xl: 2.5rem;
  }

  .nav {
    padding: var(--s-4);
    gap: var(--s-4);
  }
  .nav__brand { font-size: var(--t-base); }
  .nav__actions { gap: var(--s-2); }
  .nav__actions .btn { padding: var(--s-2) var(--s-4); font-size: var(--t-xs); }
  .btn .btn-label-hide-mobile { display: none; }
  .hide-mobile { display: none !important; }

  .page { padding: var(--s-8); }
  .page__header h2 { font-size: var(--t-lg); }

  .recipe-grid {
    grid-template-columns: 1fr;
    gap: var(--s-8);
  }

  .recipe-card { aspect-ratio: 4 / 3; }

  .recipe-detail__title { font-size: var(--t-2xl); }
  .recipe-detail__body { grid-template-columns: 1fr; }
  .ingredients { position: static; }
  .recipe-detail__meta { gap: var(--s-4); }

  .recipe-detail__hero {
    aspect-ratio: 16 / 9;
    border-radius: var(--r-lg);
  }

  .steps__list li {
    font-size: var(--t-base);
    grid-template-columns: 32px 1fr;
    gap: var(--s-6);
  }

  .steps__list li::before {
    width: 32px;
    height: 32px;
    font-size: var(--t-sm);
  }

  .import-page { padding: var(--s-12) var(--s-8); }

  .stats-row { grid-template-columns: 1fr 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-layout { padding: var(--s-8); }

  .filter-bar { flex-wrap: wrap; }
  .filter-select { min-width: 0; flex: 1 1 120px; }

  .planner-grid { overflow-x: auto; }
  .planner-header, .planner-row { min-width: 700px; }

  .recipe-detail__actions { flex-wrap: wrap; }
  .recipe-detail__actions .btn { font-size: var(--t-xs); padding: var(--s-2) var(--s-4); }

  .nutrition-label { max-width: 100%; }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--s-12);
  right: var(--s-12);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  pointer-events: none;
}

.toast {
  padding: var(--s-6) var(--s-12);
  border-radius: var(--r-md);
  font-size: var(--t-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  opacity: 0;
  transition: all var(--dur-normal) var(--ease-out);
  pointer-events: auto;
}
.toast--visible {
  transform: translateY(0);
  opacity: 1;
}
.toast--success {
  background: oklch(0.22 0.06 152);
  color: oklch(0.88 0.10 152);
  border: 1px solid oklch(0.30 0.06 152);
}
.toast--error {
  background: oklch(0.20 0.06 25);
  color: oklch(0.88 0.12 25);
  border: 1px solid oklch(0.30 0.06 25);
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  gap: var(--s-4);
  margin-bottom: var(--s-12);
  flex-wrap: wrap;
}

.filter-select {
  padding: var(--s-4) var(--s-8) var(--s-4) var(--s-6);
  font-size: var(--t-xs);
  font-family: var(--f-body);
  border-radius: var(--r-md);
  min-width: 120px;
  flex: 0 1 auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.filter-select:focus {
  outline: none;
  border-color: var(--c-accent);
  background-color: var(--c-surface-hi);
}
.filter-select:hover {
  border-color: var(--c-border-hi);
}
.filter-select option {
  background: var(--c-surface-hi);
  color: var(--c-text);
}

/* ============================================================
   LOADING SKELETON
   ============================================================ */
.recipe-card--skeleton {
  background: var(--c-surface);
  aspect-ratio: 3 / 2;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
}

.skeleton-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    oklch(0.22 0.01 70 / 0.4) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.skeleton-line {
  height: 44px;
  background: var(--c-surface);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}
.skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, oklch(0.22 0.01 70 / 0.4) 50%, transparent 100%);
  animation: shimmer 1.5s infinite;
}

/* ============================================================
   SERVING ADJUSTER
   ============================================================ */
.serving-adjuster {
  display: flex;
  align-items: center;
  gap: var(--s-6);
}

.serving-adjuster .serving-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: var(--t-xl);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface-hi);
  border-color: var(--c-border);
  color: var(--c-text);
}
.serving-adjuster .serving-btn:hover {
  background: var(--c-accent-subtle);
  color: var(--c-accent);
  border-color: var(--c-accent);
}
.serving-adjuster .serving-btn:active {
  background: var(--c-accent);
  color: var(--c-accent-fg);
}

.serving-count {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: var(--t-xl);
  color: var(--c-accent);
  min-width: 2.5ch;
  text-align: center;
}

/* ============================================================
   INGREDIENT CHECKLIST
   ============================================================ */
.ingredient-item {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  cursor: pointer;
  padding: var(--s-6) var(--s-4);
  border-bottom: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  transition: opacity var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  user-select: none;
  min-height: 44px;
}
.ingredient-item:last-child { border-bottom: none; }
.ingredient-item:hover { background: oklch(0.15 0.01 70); }
.ingredient-item:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
}

.ingredient-check {
  width: 18px;
  height: 18px;
  border-radius: var(--r-sm);
  border: 2px solid var(--c-border-hi);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
}

.ingredient-item--checked .ingredient-check {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.ingredient-item--checked .ingredient-check::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid var(--c-accent-fg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.ingredient-item--checked {
  opacity: 0.4;
  text-decoration: line-through;
}

/* ============================================================
   STEP PROGRESS TRACKER
   ============================================================ */
.step-item {
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  user-select: none;
  border-radius: var(--r-md);
}
.step-item:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: -2px;
}

.step-item--active {
  background: oklch(0.22 0.04 70);
  border-radius: var(--r-md);
  padding-left: var(--s-4) !important;
  padding-right: var(--s-4) !important;
  margin-left: calc(-1 * var(--s-4));
  margin-right: calc(-1 * var(--s-4));
}
.step-item--active::before {
  background: var(--c-accent) !important;
  color: var(--c-accent-fg) !important;
}

.step-item--done {
  opacity: 0.35;
}
.step-item--done::before {
  background: var(--c-success) !important;
  color: oklch(0.16 0.02 152) !important;
  content: '\2713' !important;
}
.step-item--done .step-text {
  text-decoration: line-through;
}

/* ============================================================
   RECIPE DETAIL CONTROLS
   ============================================================ */
.recipe-detail__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
  margin-bottom: var(--s-12);
}

.recipe-detail__actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.measurement-toggle {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   NUTRITION LABEL
   ============================================================ */
.nutrition-label {
  max-width: 320px;
  background: var(--c-surface);
  border: 2px solid var(--c-text);
  border-radius: var(--r-md);
  padding: var(--s-6) var(--s-8);
  margin-top: var(--s-16);
  font-size: var(--t-sm);
}

.nutrition-label__header {
  margin-bottom: var(--s-2);
}

.nutrition-label__title {
  font-family: var(--f-display);
  font-size: var(--t-2xl);
  font-weight: 800;
  line-height: 1;
  color: var(--c-text);
  margin-bottom: var(--s-2);
  text-transform: none;
  letter-spacing: -0.02em;
}

.nutrition-label__servings {
  font-size: var(--t-sm);
  color: var(--c-text-2);
}

.nutrition-label__subtitle {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: var(--s-2);
}

.nutrition-label__divider {
  height: 1px;
  background: var(--c-border-hi);
  margin: var(--s-2) 0;
}
.nutrition-label__divider--thick {
  height: 8px;
  background: var(--c-text);
  margin: var(--s-4) 0;
}
.nutrition-label__divider--medium {
  height: 3px;
  background: var(--c-text);
  margin: var(--s-2) 0;
}

.nutrition-label__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1px 0;
}

.nutrition-label__row--calories {
  font-size: var(--t-xl);
  font-weight: 700;
}

.nutrition-label__row--sub {
  padding-left: var(--s-8);
}

.nutrition-label__name {
  color: var(--c-text);
}

.nutrition-label__value {
  color: var(--c-text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.nutrition-label__footer {
  margin-top: var(--s-4);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-12);
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-out);
}
.modal-overlay--visible { opacity: 1; }

.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal--sm { max-width: 400px; }

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--c-border);
}
.modal__header h3 { margin: 0; }

.modal__body {
  padding: var(--s-12);
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-4);
  padding: var(--s-8) var(--s-12);
  border-top: 1px solid var(--c-border);
}

/* Edit form rows */
.edit-ingredient-row, .edit-step-row {
  display: flex;
  gap: var(--s-4);
  align-items: center;
  margin-bottom: var(--s-4);
}
.edit-step-row {
  align-items: flex-start;
}
.edit-step-row textarea {
  min-height: 40px;
  flex: 1;
}

.input--sm {
  padding: var(--s-2) var(--s-4);
  font-size: var(--t-sm);
}

/* ============================================================
   SHOPPING LIST
   ============================================================ */
.add-item-form {
  display: flex;
  gap: var(--s-4);
}
.add-item-form .input {
  flex: 1;
}

.shopping-category {
  margin-bottom: var(--s-12);
}

.shopping-category__title {
  font-family: var(--f-display);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-accent);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-border);
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: var(--s-4) var(--s-4);
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) var(--ease-out);
}
.shopping-item:hover {
  background: var(--c-surface);
}

.shopping-item__check {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}
.shopping-item__check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--c-accent);
  cursor: pointer;
  border-radius: var(--r-sm);
}

.shopping-item__text {
  flex: 1;
  font-size: var(--t-base);
  color: var(--c-text);
  transition: opacity var(--dur-fast);
}

.shopping-item__amount {
  color: var(--c-accent);
  font-weight: 500;
}

.shopping-item__recipe {
  flex-shrink: 0;
}

.shopping-item__delete {
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.shopping-item:hover .shopping-item__delete {
  opacity: 1;
}

.shopping-item--checked .shopping-item__text {
  opacity: 0.4;
  text-decoration: line-through;
}

/* ============================================================
   MEAL PLANNER
   ============================================================ */
.planner-grid {
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--c-surface);
}

.planner-header {
  display: grid;
  grid-template-columns: 90px repeat(7, 1fr);
  border-bottom: 2px solid var(--c-border);
}

.planner-row {
  display: grid;
  grid-template-columns: 90px repeat(7, 1fr);
  border-bottom: 1px solid var(--c-border);
}
.planner-row:last-child { border-bottom: none; }

.planner-cell {
  padding: var(--s-4);
  min-height: 90px;
  border-right: 1px solid var(--c-border);
}
.planner-cell:last-child { border-right: none; }

.planner-cell--day-header {
  text-align: center;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: var(--t-sm);
  color: var(--c-text-2);
  min-height: auto;
  padding: var(--s-4);
}

.planner-cell--label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-size: var(--t-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-text-3);
  min-height: auto;
  background: oklch(0.15 0.01 70);
}

.planner-cell--slot {
  cursor: pointer;
  transition: background var(--dur-fast);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  position: relative;
}
.planner-cell--slot:hover {
  background: var(--c-surface-hi);
}

.planner-cell__add {
  position: absolute;
  bottom: var(--s-2);
  right: var(--s-2);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-sm);
  color: var(--c-text-3);
  border-radius: var(--r-full);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.planner-cell--slot:hover .planner-cell__add {
  opacity: 1;
}

.planner-item {
  background: var(--c-accent-subtle);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-4);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 28px;
  max-height: 44px;
  overflow: hidden;
}

.planner-item__title {
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--c-accent);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

.planner-item__remove {
  background: none;
  border: none;
  color: var(--c-text-3);
  cursor: pointer;
  font-size: var(--t-sm);
  padding: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.planner-item:hover .planner-item__remove {
  opacity: 1;
}

@keyframes pill-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.planner-item--new {
  animation: pill-in var(--dur-normal) var(--ease-expo);
}

/* ============================================================
   ADMIN: TEST OUTPUT
   ============================================================ */
.test-output {
  background: var(--c-base);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: var(--s-6);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: var(--t-xs);
  color: var(--c-text-2);
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================
   PHOTO UPLOAD ZONE
   ============================================================ */
.photo-upload-zone {
  border: 2px dashed var(--c-border-hi);
  border-radius: var(--r-lg);
  padding: var(--s-16);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.photo-upload-zone:hover,
.photo-upload-zone--active {
  border-color: var(--c-accent);
  background: var(--c-accent-subtle);
}

/* ============================================================
   RECIPE CARD PLACEHOLDER
   ============================================================ */
.recipe-card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recipe-card__placeholder-icon {
  font-size: 3.5rem;
  opacity: 0.35;
  filter: saturate(0.7);
}

/* ============================================================
   AI BADGE
   ============================================================ */
.badge--ai {
  background: oklch(0.24 0.06 70);
  color: var(--c-accent);
  font-size: 0.6rem;
  padding: 2px var(--s-4);
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
  cursor: help;
}

.badge--ai-partial {
  background: oklch(0.22 0.03 70);
  color: var(--c-text-2);
  font-size: 0.6rem;
  padding: 2px var(--s-4);
  border-radius: var(--r-full);
  cursor: help;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-6);
  background: oklch(0.22 0.05 70);
  border: 1px solid oklch(0.30 0.06 70);
  border-radius: var(--r-md);
  font-size: var(--t-xs);
  color: var(--c-accent);
  margin-top: var(--s-4);
  cursor: help;
}

.ai-badge--partial {
  background: oklch(0.20 0.02 70);
  border-color: var(--c-border);
  color: var(--c-text-2);
}

.ai-badge__icon {
  font-size: var(--t-sm);
}

/* ============================================================
   CONTEXT SWITCHER
   ============================================================ */
.context-switcher {
  position: relative;
}
.context-switcher__btn {
  font-size: var(--t-xs);
  padding: var(--s-2) var(--s-6);
  border-radius: var(--r-full);
  background: var(--c-accent-subtle);
  border-color: transparent;
  color: var(--c-accent);
}
.context-switcher__menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--s-2);
  z-index: 300;
  box-shadow: var(--shadow-lg);
}
.context-switcher__menu--open { display: block; }

/* ============================================================
   NAV ICON BUTTON
   ============================================================ */
.btn--icon-nav {
  padding: var(--s-4);
  border-color: transparent;
  position: relative;
}

/* ============================================================
   NOTIFICATION BELL & DROPDOWN
   ============================================================ */
.notification-bell {
  position: relative;
}
.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  background: var(--c-error);
  color: oklch(0.98 0 0);
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 400px;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notification-dropdown__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-sm);
}

.notification-dropdown__list {
  overflow-y: auto;
  flex: 1;
}

.notification-item {
  display: block;
  padding: var(--s-6) var(--s-8);
  border-bottom: 1px solid var(--c-border);
  transition: background var(--dur-fast);
}
.notification-item:hover { background: var(--c-surface-max); }
.notification-item:last-child { border-bottom: none; }

.notification-item--unread {
  background: oklch(0.19 0.02 70);
}

.notification-item__msg {
  display: block;
  font-size: var(--t-sm);
  color: var(--c-text);
  line-height: var(--lh-snug);
}

.notification-item__time {
  display: block;
  margin-top: var(--s-2);
}

/* ============================================================
   INVITE BANNER
   ============================================================ */
.invite-banner {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  padding: var(--s-6) var(--s-12);
  background: var(--c-accent-subtle);
  border-bottom: 1px solid oklch(0.30 0.06 70);
  font-size: var(--t-sm);
  color: var(--c-accent);
}

/* ============================================================
   ONBOARDING
   ============================================================ */
.onboarding {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-12);
  background: var(--c-base);
}

.onboarding__container {
  width: 100%;
  max-width: 520px;
}

.onboarding__brand {
  margin-bottom: var(--s-16);
}

.onboarding__title {
  font-size: var(--t-2xl);
  margin-bottom: var(--s-4);
}

.onboarding__desc {
  color: var(--c-text-2);
  margin-bottom: var(--s-16);
  line-height: var(--lh-normal);
  max-width: 50ch;
}

.onboarding__features {
  display: flex;
  flex-direction: column;
  gap: var(--s-8);
  margin-bottom: var(--s-16);
}

.onboarding__feature {
  display: flex;
  gap: var(--s-8);
  align-items: flex-start;
}

.onboarding__feature-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--c-surface);
  border-radius: var(--r-md);
}

.onboarding__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-8);
  margin-bottom: var(--s-8);
}

@media (max-width: 640px) {
  .onboarding__options { grid-template-columns: 1fr; }
}

.onboarding__progress {
  display: flex;
  justify-content: center;
  gap: var(--s-4);
  margin-top: var(--s-16);
}

.onboarding__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--c-border);
  transition: background var(--dur-normal);
}

.onboarding__dot--active {
  background: var(--c-accent);
}

/* ============================================================
   SEARCH ENHANCEMENTS
   ============================================================ */
.search-highlight {
  background: oklch(0.76 0.155 70 / 0.25);
  color: var(--c-accent);
  border-radius: 2px;
  padding: 0 2px;
}

.recent-searches {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  margin-top: 4px;
  z-index: 50;
  box-shadow: var(--shadow-md);
  padding: var(--s-4);
}
.recent-searches__label {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  padding: var(--s-2) var(--s-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.recent-searches__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s-4) var(--s-6);
  border: none;
  background: none;
  color: var(--c-text-2);
  font-size: var(--t-sm);
  cursor: pointer;
  border-radius: var(--r-sm);
}
.recent-searches__item:hover { background: var(--c-surface-max); color: var(--c-text); }

/* ============================================================
   STEP TIMER
   ============================================================ */
.step-timer-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: 4px;
  background: var(--c-accent-subtle);
  border: 1px solid var(--c-accent);
  border-radius: var(--r-full);
  color: var(--c-accent);
  font-size: var(--t-xs);
  cursor: pointer;
  vertical-align: middle;
  transition: background var(--dur-fast);
  font-family: var(--f-display);
}
.step-timer-btn:hover { background: var(--c-accent); color: var(--c-accent-fg); }
.step-timer-btn--active {
  background: var(--c-accent);
  color: var(--c-accent-fg);
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.step-timer-btn--done { background: oklch(0.22 0.06 152); border-color: var(--c-success); color: var(--c-success); }

/* ============================================================
   SCALING NOTES
   ============================================================ */
.scaling-notes {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-8);
  padding: var(--s-6) var(--s-8);
  background: var(--c-accent-subtle);
  border-radius: var(--r-md);
}
.scaling-note {
  font-size: var(--t-xs);
  color: var(--c-accent);
  font-style: italic;
}

/* ============================================================
   RELATED RECIPES
   ============================================================ */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--s-8);
}
.related-card {
  cursor: pointer;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-surface);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.related-card__img {
  width: 100%;
  height: 100px;
  object-fit: cover;
}
.related-card__title {
  padding: var(--s-4) var(--s-6);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--c-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   IMPORT PREVIEW
   ============================================================ */
.import-preview__card {
  display: flex;
  gap: var(--s-8);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.import-preview__img {
  width: 160px;
  min-height: 140px;
  object-fit: cover;
  flex-shrink: 0;
}

.import-preview__info {
  padding: var(--s-8);
  flex: 1;
  min-width: 0;
}

.import-preview__title {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--s-2);
}

.import-preview__desc {
  font-size: var(--t-sm);
  color: var(--c-text-2);
  line-height: 1.4;
  margin-bottom: var(--s-4);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.import-preview__meta {
  font-size: var(--t-xs);
  color: var(--c-text-3);
  margin-bottom: var(--s-4);
}

.import-preview__stats {
  font-size: var(--t-xs);
  color: var(--c-accent);
  font-weight: 500;
  margin-bottom: var(--s-4);
}

.import-preview__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

@media (max-width: 640px) {
  .import-preview__card { flex-direction: column; }
  .import-preview__img { width: 100%; height: 160px; }
}

/* ============================================================
   QUICK MEAL PLAN ADD
   ============================================================ */
.recipe-card__quick-add {
  position: absolute;
  top: var(--s-4);
  right: var(--s-4);
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: oklch(0.13 0.01 70 / 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid oklch(1 0 0 / 0.15);
  color: var(--c-text);
  font-size: var(--t-lg);
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--dur-fast), background var(--dur-fast);
  z-index: 5;
  line-height: 1;
}
.recipe-card:hover .recipe-card__quick-add { opacity: 1; }
.recipe-card__quick-add:hover { background: var(--c-accent); color: var(--c-accent-fg); }

.quick-meal-pop {
  position: absolute;
  z-index: 500;
  background: var(--c-surface-hi);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-lg);
  width: 240px;
}

.qm-header {
  font-family: var(--f-display);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c-text-2);
  margin-bottom: var(--s-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.qm-day {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}

.qm-day__label {
  width: 32px;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--c-text-3);
}

.qm-slot {
  flex: 1;
  padding: var(--s-2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-text-3);
  font-size: var(--t-xs);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
  text-align: center;
}
.qm-slot:hover { background: var(--c-accent-subtle); color: var(--c-accent); border-color: var(--c-accent); }
.qm-slot--done { background: var(--c-accent); color: var(--c-accent-fg); border-color: var(--c-accent); }

/* ============================================================
   COOK MODE
   ============================================================ */
.cook-mode {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--c-base);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cook-mode__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-8) var(--s-12);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.cook-mode__progress {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--c-accent);
  letter-spacing: 0.04em;
}

.cook-mode__exit {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
  color: var(--c-text-2);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.cook-mode__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-16) var(--s-12);
  text-align: center;
  overflow-y: auto;
}

.cook-mode__step-num {
  font-family: var(--f-display);
  font-size: var(--t-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-accent);
  margin-bottom: var(--s-8);
}

.cook-mode__instruction {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 400;
  line-height: 1.5;
  color: var(--c-text);
  max-width: 36ch;
}

.cook-mode__nav {
  display: flex;
  gap: var(--s-6);
  padding: var(--s-8) var(--s-12);
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}

.cook-mode__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-8);
  min-height: 64px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: var(--t-lg);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.cook-mode__btn:hover { background: var(--c-surface-hi); border-color: var(--c-border-hi); }
.cook-mode__btn:disabled { opacity: 0.3; cursor: not-allowed; }
.cook-mode__btn--next { background: var(--c-accent); color: var(--c-accent-fg); border-color: transparent; }
.cook-mode__btn--next:hover { background: var(--c-accent-hover); }
.cook-mode__btn--ing { flex: 0 0 auto; padding: var(--s-8) var(--s-12); font-size: var(--t-sm); color: var(--c-text-2); }

/* Ingredient slide-up panel */
.cook-mode__ingredients {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 60vh;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  overflow-y: auto;
  padding: var(--s-8) var(--s-12) var(--s-16);
  z-index: 10;
  box-shadow: 0 -8px 40px oklch(0 0 0 / 0.5);
}

.cook-mode__ingredients-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-8);
  font-family: var(--f-display);
  font-size: var(--t-base);
  color: var(--c-text);
}

.cook-mode__ing-list {
  list-style: none;
}

.cook-ing {
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--t-base);
  color: var(--c-text);
}
.cook-ing:last-child { border-bottom: none; }

.cook-ing__amt {
  color: var(--c-accent);
  font-weight: 500;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .nav, .recipe-detail__actions, .recipe-detail__controls,
  .serving-adjuster, .btn, .filter-bar, .search-bar,
  .nutrition-label__footer, .toast-container {
    display: none !important;
  }
  body { background: white; color: black; }
  .recipe-detail { max-width: 100%; }
}
