/* Recipe Grabber */

:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-muted: #f4ede4;
  --text: #2b2320;
  --text-muted: #6f625a;
  --border: #e8ddd1;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: #fde8dc;
  --success: #3f7d4e;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(43 35 32 / 0.06), 0 8px 24px rgb(43 35 32 / 0.06);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --theme-icon-moon: block;
  --theme-icon-sun: none;
  color-scheme: light;
}

/* Dark tokens apply on screen only, so printing always uses the light ones.
   data-theme on <html> is the visitor's saved choice; without it the system
   preference decides. Keep the two blocks below in sync. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1715;
    --surface: #26201d;
    --surface-muted: #2f2824;
    --text: #f3ebe4;
    --text-muted: #b5a79c;
    --border: #3d3430;
    --accent: #f97316;
    --accent-hover: #fb923c;
    --accent-soft: #3b2418;
    --success: #6fbf82;
    --danger: #f87171;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    --theme-icon-moon: none;
    --theme-icon-sun: block;
    color-scheme: dark;
  }
}

@media screen {
  :root[data-theme="dark"] {
    --bg: #1c1715;
    --surface: #26201d;
    --surface-muted: #2f2824;
    --text: #f3ebe4;
    --text-muted: #b5a79c;
    --border: #3d3430;
    --accent: #f97316;
    --accent-hover: #fb923c;
    --accent-soft: #3b2418;
    --success: #6fbf82;
    --danger: #f87171;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    --theme-icon-moon: none;
    --theme-icon-sun: block;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* Header & footer */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header__inner { display: flex; align-items: center; height: 64px; }
.site-header__brand { display: flex; gap: 8px; align-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--text); text-decoration: none; }
.site-header__brand:hover { color: var(--accent); }
.site-header__logo { display: block; width: 52px; height: 52px; margin: -4px 0; flex: none; transition: transform 0.2s; }
.site-header__brand:hover .site-header__logo { transform: rotate(-8deg) scale(1.05); }
.theme-toggle { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--text-muted); cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.theme-toggle:hover { color: var(--accent); border-color: var(--border); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle__icon--moon { display: var(--theme-icon-moon); }
.theme-toggle__icon--sun { display: var(--theme-icon-sun); }
.site-footer { color: var(--text-muted); font-size: 0.85rem; padding-top: 48px; padding-bottom: 32px; text-align: center; }
.site-footer__links { margin-top: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }

.flash { margin: 20px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  font: 600 0.95rem var(--font-body); text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.button:hover { border-color: var(--accent); color: var(--accent); }
.button--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.button--quiet { border-color: transparent; background: transparent; color: var(--text-muted); }
.button:disabled { opacity: 0.7; cursor: progress; }

/* Home */
.hero { text-align: center; padding: 56px 0 32px; max-width: 720px; margin: 0 auto; }
.hero__title { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.01em; }
/* The headline's rotating platform name ("YouTube", "TikTok"). */
/* Every word shares one grid cell, so the slot is as wide as the longest
   word and the rest of the headline stays put as they change. */
.word-rotator { display: inline-grid; color: var(--accent); }
.word-rotator__word { grid-area: 1 / 1; visibility: hidden; }
.word-rotator__word--active { visibility: visible; animation: word-rotator-in 0.4s ease-out; }
@keyframes word-rotator-in { from { opacity: 0; transform: translateY(0.4em); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .word-rotator__word--active { animation: none; } }
.hero__lede { color: var(--text-muted); font-size: 1.1rem; margin: 16px auto 32px; max-width: 560px; }

.url-form { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.url-form__label { display: block; font-weight: 600; margin-bottom: 10px; }
.url-form__row { display: flex; gap: 10px; flex-wrap: wrap; }
.url-form__input {
  flex: 1 1 280px; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); color: var(--text); font: inherit;
}
.url-form__input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.url-form__row .button { min-height: 48px; }
.url-form__hint { color: var(--text-muted); font-size: 0.85rem; margin: 10px 0 0; }
.url-form__quota { margin-top: 4px; }
.url-form__error { color: var(--danger); font-size: 0.9rem; margin: 10px 0 0; font-weight: 500; }

.section-heading { font-size: 1.5rem; margin: 32px 0 16px; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }

.recipe-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform 0.15s; }
.recipe-card:hover { transform: translateY(-2px); color: var(--text); }
/* YouTube's hqdefault thumbnails are 4:3 with black bars around a 16:9 picture.
   Covering a 16:9 box crops exactly those bars; overflow: hidden stops the
   taller image from stretching the box past its aspect ratio. */
.recipe-card__image { aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-muted); }
.recipe-card__image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.recipe-card__body { padding: 14px 16px 16px; }
.recipe-card__title { font-size: 1.05rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-card__channel { color: var(--text-muted); font-size: 0.85rem; margin: 4px 0 0; }
.recipe-card__meta { font-size: 0.85rem; margin: 8px 0 0; color: var(--text-muted); }
.recipe-card--failed .recipe-card__meta { color: var(--danger); }
.recipe-card--pending .recipe-card__meta, .recipe-card--fetching .recipe-card__meta, .recipe-card--extracting .recipe-card__meta { color: var(--accent); }
/* The last tile on the signed-out home page: a sign-up pitch instead of a recipe. */
.recipe-card--cta { justify-content: center; align-items: center; gap: 10px; padding: 28px 22px; text-align: center; background: var(--surface-muted); border-style: dashed; border-width: 2px; border-color: var(--accent); box-shadow: none; }
.recipe-card--cta:hover .button--primary { background: var(--accent-hover); border-color: var(--accent-hover); }
.recipe-card-cta__icon { font-size: 2.4rem; line-height: 1; }
.recipe-card-cta__title { font-size: 1.3rem; margin: 0; }
.recipe-card-cta__text { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 6px; }

/* Recipe page */
.recipe-page { max-width: 820px; margin: 0 auto; padding-top: 40px; }
.recipe-header__eyebrow { color: var(--text-muted); margin: 0 0 8px; font-size: 0.95rem; }
.recipe-header__channel { color: inherit; }
.recipe-header__channel:hover { color: var(--accent); }
.recipe-header__title { font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -0.01em; }
.recipe-header__summary { font-size: 1.1rem; color: var(--text-muted); margin: 16px 0 0; }
.recipe-header__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.recipe-video { margin: 32px 0; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.recipe-video--vertical { aspect-ratio: 9 / 16; max-width: 340px; margin-inline: auto; }
.recipe-video iframe { width: 100%; height: 100%; border: 0; display: block; }

.recipe-card-full { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; scroll-margin-top: 16px; }

.recipe-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin: 0 0 28px; padding: 0 0 24px; border-bottom: 1px solid var(--border); }
.recipe-meta__item { background: var(--surface-muted); border-radius: 10px; padding: 12px 14px; }
.recipe-meta dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.recipe-meta dd { margin: 2px 0 0; font-weight: 600; }

.recipe-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 40px; }
.recipe-section__title { font-size: 1.5rem; margin-bottom: 12px; }
.recipe-section__subtitle { font-family: var(--font-body); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin: 20px 0 8px; }

.ingredient-list, .step-list { list-style: none; margin: 0; padding: 0; }
.ingredient { border-bottom: 1px dashed var(--border); }
.ingredient label { display: block; padding: 10px 0 10px 32px; position: relative; cursor: pointer; }
.ingredient__check, .step__check { position: absolute; opacity: 0; pointer-events: none; }
.ingredient label::before { content: ""; position: absolute; left: 0; top: 13px; width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 6px; background: var(--surface); }
.ingredient__check:checked + label::before { background: var(--success); border-color: var(--success); }
.ingredient__check:checked + label::after { content: ""; position: absolute; left: 7px; top: 16px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ingredient__check:checked + label { color: var(--text-muted); text-decoration: line-through; }
.ingredient__check:focus-visible + label::before, .step__check:focus-visible + label .step__number { outline: 2px solid var(--accent); outline-offset: 2px; }
.ingredient__amount { font-weight: 600; margin-right: 4px; }
.ingredient__note { color: var(--text-muted); }

.step label { display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding: 12px 0; cursor: pointer; }
.step__number { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.95rem; }
.step__check:checked + label { color: var(--text-muted); }
.step__check:checked + label .step__number { background: var(--success); color: #fff; }

.recipe-notes { margin-top: 32px; padding: 20px 24px; background: var(--surface-muted); border-radius: 10px; }
.recipe-notes ul { margin: 0; padding-left: 20px; }
.recipe-notes li + li { margin-top: 6px; }
.recipe-sources { margin: 24px 0 0; font-size: 0.85rem; color: var(--text-muted); }

.recipe-page__footer { display: flex; justify-content: flex-end; gap: 4px; margin-top: 16px; }

/* Status */
.status-panel { margin-top: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 28px; text-align: center; box-shadow: var(--shadow); }
.status-panel h2 { font-size: 1.4rem; margin-bottom: 12px; }
.status-panel--failed { border-color: var(--danger); text-align: left; }
.status-panel--failed p { color: var(--text-muted); }
.status-panel__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.status-panel__actions form { margin: 0; }
.status-steps { list-style: none; padding: 0; margin: 16px auto 0; display: inline-block; text-align: left; }
.status-steps__item { padding: 4px 0 4px 28px; position: relative; color: var(--text-muted); }
.status-steps__item::before { content: "○"; position: absolute; left: 4px; }
.status-steps__item--active { color: var(--text); font-weight: 600; }
.status-steps__item--active::before { content: "●"; color: var(--accent); }
.status-steps__item--done::before { content: "✓"; color: var(--success); }
.spinner { width: 40px; height: 40px; margin: 0 auto 16px; border: 4px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Accounts */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav form { display: contents; }
.site-nav .theme-toggle { margin-left: 4px; }
.site-header__brand, .site-nav__link, .site-nav__cta { white-space: nowrap; }
.site-nav__link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--text); font: 500 0.95rem var(--font-body); text-decoration: none; cursor: pointer; border-radius: 999px; }
.site-nav__link:hover { color: var(--accent); }
.site-nav__cta { min-height: 38px; padding: 0 16px; margin-left: 4px; }
.flash--alert { background: color-mix(in srgb, var(--danger) 14%, transparent); }

.hero__signup { color: var(--text-muted); margin: 16px 0 0; font-size: 0.95rem; }
.section-heading-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-heading-row a { font-weight: 600; }

.auth-card { max-width: 420px; margin: 48px auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.auth-card__title { font-size: 1.9rem; }
.auth-card__lede { color: var(--text-muted); margin: 8px 0 20px; }
.auth-card__links { margin: 20px 0 0; font-size: 0.9rem; color: var(--text-muted); }
.auth-card__fine-print { margin: 16px 0 0; font-size: 0.85rem; color: var(--text-muted); }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-weight: 600; font-size: 0.9rem; margin-top: 8px; }
.auth-form__input { min-height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.auth-form__input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-form__submit { margin-top: 16px; }
.auth-form__errors { margin: 0 0 8px; padding: 12px 16px 12px 32px; border-radius: 10px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); font-size: 0.9rem; }

.save-controls { display: contents; }
.save-controls__form { display: contents; }
.share-button--done { border-color: var(--success); color: var(--success); }
.button--saved { border-color: var(--success); color: var(--success); }
.favorite-toggle--on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.recipe-card__image { position: relative; }
.recipe-card__favorite { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* Cards still being grabbed: a shimmer sweeps over the image */
.recipe-card--busy .recipe-card__image, .recipe-card--skeleton .recipe-card__image, .skeleton-line {
  background: linear-gradient(100deg, var(--surface-muted) 30%, color-mix(in srgb, var(--surface-muted) 55%, var(--surface)) 50%, var(--surface-muted) 70%) var(--surface-muted);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.recipe-card--busy .recipe-card__image img { opacity: 0.55; filter: saturate(0.6); }

/* The bubbling pot over a card that's still being grabbed */
.cooking-loader { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: color-mix(in srgb, var(--surface) 35%, transparent); }
.cooking-loader__caption { height: 1.6em; overflow: hidden; padding: 0 10px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 0.8rem; font-weight: 600; line-height: 1.6em; color: var(--text); }
.cooking-loader__captions { list-style: none; margin: 0; padding: 0; text-align: center; }
.cooking-loader__captions--cycle { animation: captions 8s steps(1) infinite; }
@keyframes captions { 0% { transform: translateY(0); } 25% { transform: translateY(-1.6em); } 50% { transform: translateY(-3.2em); } 75% { transform: translateY(-4.8em); } }
.cooking-loader__pot { width: 64px; height: 64px; color: var(--text-muted); filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.18)); overflow: visible; }
.cooking-loader__steam path { opacity: 0; }
.cooking-loader__lid { transform-box: fill-box; transform-origin: 50% 100%; }
.cooking-loader--cooking .cooking-loader__steam path { animation: steam 1.8s ease-out infinite; }
.cooking-loader--cooking .cooking-loader__steam path:nth-child(2) { animation-delay: 0.6s; }
.cooking-loader--cooking .cooking-loader__steam path:nth-child(3) { animation-delay: 1.2s; }
.cooking-loader--cooking .cooking-loader__lid { animation: rattle 0.9s ease-in-out infinite; }
.recipe-card--pending .cooking-loader__pot { animation: simmer 2.4s ease-in-out infinite; }
@keyframes steam { 0% { opacity: 0; transform: translateY(6px); } 30% { opacity: 0.9; } 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes rattle { 0%, 60%, 100% { transform: translateY(0) rotate(0); } 70% { transform: translateY(-3px) rotate(-6deg); } 80% { transform: translateY(-2px) rotate(5deg); } 90% { transform: translateY(-1px) rotate(-3deg); } }
@keyframes simmer { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.recipe-card--skeleton { pointer-events: none; }
.skeleton-line { display: block; height: 14px; border-radius: 6px; margin: 4px 0 10px; }
.skeleton-line--short { width: 55%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .recipe-card--busy .recipe-card__image, .recipe-card--skeleton .recipe-card__image, .skeleton-line { animation: none; }
  .cooking-loader__pot, .cooking-loader__lid, .cooking-loader__steam path, .cooking-loader__captions { animation: none !important; }
  .cooking-loader--cooking .cooking-loader__steam path { opacity: 0.7; }
  .site-header__brand:hover .site-header__logo { transform: none; }
}

/* Playlist page */
.playlist-page { padding-top: 40px; }
.playlist-header { margin-bottom: 28px; }
.playlist-progress { margin-top: 20px; }
.playlist-progress__bar { height: 10px; border-radius: 999px; background: var(--surface-muted); border: 1px solid var(--border); overflow: hidden; }
.playlist-progress__bar span { display: block; height: 100%; background: var(--accent); transition: width 0.4s ease; }
.playlist-progress__summary { margin: 12px 0 0; font-weight: 600; }
.playlist-progress__hint { margin: 4px 0 0; color: var(--text-muted); font-size: 0.95rem; }
.playlist-list { list-style: none; padding: 0; margin: 0 0 32px; display: grid; gap: 8px; }
.playlist-list a { font-weight: 600; }
.playlist-list span { color: var(--text-muted); }
.pricing { max-width: 820px; margin: 0 auto; }
.legal { max-width: 720px; margin: 0 auto; padding: 40px 0 16px; line-height: 1.65; }
.legal h1 { font-size: 2rem; margin-bottom: 4px; }
.legal h2 { font-size: 1.25rem; margin: 32px 0 8px; }
.legal p, .legal ul { margin: 0 0 12px; }
.legal li { margin-bottom: 6px; }
.legal__updated { color: var(--text-muted); font-size: 0.9rem; }
.pricing__plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.plan-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.plan-card--featured { border-color: var(--accent); }
.plan-card__name { font-size: 1.4rem; }
.plan-card__price { margin: 8px 0 0; font-size: 2.2rem; font-weight: 700; }
.plan-card__price small { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.plan-card__alt { margin: 2px 0 0; color: var(--text-muted); font-size: 0.9rem; min-height: 1.4em; }
.plan-card__features { list-style: none; padding: 0; margin: 20px 0 24px; display: grid; gap: 10px; flex: 1; }
.plan-card__features li { position: relative; padding-left: 24px; }
.plan-card__features li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.plan-card .button { justify-content: center; text-align: center; }
.plan-card .button[aria-disabled="true"] { cursor: default; color: var(--text-muted); border-color: var(--border); }
.pricing__faq { margin-top: 40px; }
.pricing__faq h3 { font-size: 1.05rem; margin: 20px 0 4px; font-family: var(--font-body); }
.pricing__faq p { margin: 0; color: var(--text-muted); }
.account__details { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; }
.account__details dt { color: var(--text-muted); }
.account__details dd { margin: 0; font-weight: 600; }
.account__heading { font-size: 1.2rem; margin: 24px 0 12px; }
.account__usage { margin: 12px 0 0; }
.account__hint { margin: 4px 0 0; color: var(--text-muted); font-size: 0.9rem; }
.account__grabs { margin: 16px 0 0; }
.account__sign-out { margin-top: 24px; }
.account__manage { margin-top: 16px; }
.account__referral { display: flex; gap: 8px; margin-top: 12px; }
.account__referral .auth-form__input { flex: 1; min-width: 0; }
.plan-card__actions { display: grid; gap: 10px; }
.plan-card__actions form, .plan-card__actions .button { width: 100%; }
.pricing__trial { margin: 0 0 24px; padding: 14px 18px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.trial-form { margin-top: 16px; }
.trial-form__label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.9rem; }
.trial-form__row { display: flex; gap: 8px; }
.trial-form__input { flex: 1; min-width: 0; min-height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; text-transform: uppercase; }
.trial-form__input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.library { padding-top: 40px; }
.library__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.library__title { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.filter-tabs { display: inline-flex; padding: 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.filter-tabs__tab { padding: 8px 16px; border-radius: 999px; color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.filter-tabs__tab:hover { color: var(--accent); }
.filter-tabs__tab[aria-current="page"] { background: var(--accent); color: #fff; }
.recipe-search { margin-bottom: 24px; }
.recipe-search__input {
  width: 100%; min-height: 48px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit;
}
.recipe-search__input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.empty-state { color: var(--text-muted); text-align: center; padding: 48px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

@media (max-width: 720px) {
  .site-header__brand { font-size: 1.1rem; gap: 6px; }
  .site-header__logo { width: 44px; height: 44px; }
  .site-nav { gap: 0; }
  .site-nav__link { padding: 0 8px; font-size: 0.875rem; }
  .site-nav__cta { padding: 0 12px; font-size: 0.875rem; }
  .recipe-body { grid-template-columns: 1fr; gap: 28px; }
  .recipe-card-full { padding: 20px 16px; }
  .recipe-page { padding-top: 24px; }
}

@media (max-width: 420px) {
  .site-header__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .site-header__logo { width: 46px; height: 46px; }
}

@media print {
  .site-header, .site-footer, .recipe-header__actions, .recipe-video, .recipe-page__footer, .flash { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .recipe-card-full { box-shadow: none; border: 0; padding: 0; }
  .recipe-body { grid-template-columns: 1fr 2fr; }
  .ingredient label::before { border-color: #999; }
}

.auth-google__form { margin: 0; }
.auth-google { width: 100%; justify-content: center; gap: 10px; min-height: 46px; }
.auth-google__logo { width: 18px; height: 18px; flex: none; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--text-muted); font-size: 0.85rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.confirm-email { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 14px 18px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.confirm-email p { margin: 0; }

/* Admin costs page */
.costs { max-width: 720px; margin: 40px auto 0; }
.costs__title { font-size: 2rem; }
.costs__lede { color: var(--text-muted); margin: 8px 0 24px; }
.costs__lede strong { color: var(--text); }
.costs__table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.costs__table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.costs__table th, .costs__table td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.costs__table th[scope="row"] { text-align: left; font-weight: 500; white-space: normal; }
.costs__table th[scope="row"] span { display: block; color: var(--text-muted); font-size: 0.8rem; }
.costs__table thead th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.costs__table tr:last-child > * { border-bottom: 0; }
.costs__revenue td { color: var(--success); font-weight: 600; }
.costs__total > * { font-weight: 600; border-top: 2px solid var(--border); }
.costs__profit > * { font-weight: 700; font-size: 1.1rem; background: var(--surface-muted); }
.costs__table .costs__loss { color: var(--danger); }
.costs__missing { color: var(--text-muted); font-style: italic; font-weight: 400; }
.costs__note { color: var(--text-muted); font-size: 0.85rem; margin: 12px 0 0; }
.costs__heading { font-size: 1.3rem; margin: 32px 0 12px; }
.costs__fixed { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 4px; }
.costs__fixed li { display: flex; align-items: center; gap: 12px; }
.costs__fixed li span:first-child { flex: 1; font-weight: 600; }
.costs__fixed form { margin: 0; }
.costs__form { display: flex; flex-wrap: wrap; gap: 8px; }
.costs__form input[type="text"] { flex: 2 1 180px; }
.costs__form input[type="number"] { flex: 1 1 100px; }
@media (max-width: 520px) {
  .costs__table th, .costs__table td { padding: 10px 8px; }
  .costs__table th[scope="row"] { padding-left: 12px; }
  .costs__table td:last-child, .costs__table thead th:last-child { padding-right: 12px; }
}

/* Admin stats page. Series colors are the first five slots of a categorical
   palette checked for color-blind separation; dark mode has its own steps. */
.stats {
  max-width: 960px; margin: 40px auto 0;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4;
}
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stats { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; }
}
@media screen {
  :root[data-theme="dark"] .stats { --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; }
}
.stats__filters { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 20px; }
.stats__filter-group { display: inline-flex; flex-wrap: wrap; background: var(--surface-muted); border-radius: 999px; padding: 3px; }
.stats__filter { padding: 5px 12px; border-radius: 999px; color: var(--text-muted); text-decoration: none; font-size: 0.85rem; font-weight: 500; }
.stats__filter:hover { color: var(--text); }
.stats__filter--active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.stats__tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stats__tile, .stats__panel, .chart { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stats__tile { padding: 14px 16px; display: grid; gap: 4px; }
.stats__tile span { color: var(--text-muted); font-size: 0.8rem; }
.stats__tile strong { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats__panel { padding: 16px; }
.stats__panel-lede { margin: 0 0 12px; color: var(--text-muted); }
.stats__panel-lede strong { color: var(--text); }
.stats__split { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.stats__split span { min-width: 4px; }
.stats__split-legend strong { font-variant-numeric: tabular-nums; margin-left: 2px; }
.stats__charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 16px; margin-top: 16px; }
.stats__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 24px; margin: 0; }
.stats__facts div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.stats__facts dt { color: var(--text-muted); }
.stats__facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats__lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 0 32px; }
.stats__ranked { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.stats__ranked li { padding-left: 4px; }
.stats__ranked li > span { display: inline-flex; width: calc(100% - 3em); overflow-wrap: anywhere; }
.stats__ranked strong { float: right; font-variant-numeric: tabular-nums; }
.stats__codes { margin-top: 16px; }
.stats__codes thead th:first-child { text-align: left; }
.stats__code--done > * { color: var(--text-muted); }

.chart { margin: 0; padding: 16px; min-width: 0; }
.chart__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.chart__title { font-weight: 600; }
.chart__total { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart__legend { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.8rem; color: var(--text-muted); }
.chart__legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart__swatch { width: 10px; height: 10px; border-radius: 3px; }
.chart__plot { position: relative; height: 160px; margin: 16px 0 0 40px; }
.chart__gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.chart__gridline--base { border-top-style: solid; }
.chart__gridline span { position: absolute; right: calc(100% + 6px); transform: translateY(-50%); font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart__bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.chart__col { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; border-radius: 4px 4px 0 0; outline: none; }
.chart__col--active { background: var(--surface-muted); }
.chart__stack { width: 100%; max-width: 32px; margin: 0 auto; display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 4px 4px 0 0; overflow: hidden; }
.chart__seg { min-height: 2px; flex-basis: 0; }
.chart__tooltip { position: absolute; bottom: calc(100% + 4px); transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 0.75rem; padding: 6px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 1; }
.chart__axis { display: flex; justify-content: space-between; margin: 6px 0 0 40px; font-size: 0.7rem; color: var(--text-muted); }
.chart__data { margin-top: 10px; font-size: 0.8rem; color: var(--text-muted); }
.chart__data summary { cursor: pointer; }
.chart__table-wrap { max-height: 220px; overflow: auto; margin-top: 8px; }
.chart__data table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart__data th, .chart__data td { padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--border); }
.chart__data th[scope="row"] { text-align: left; font-weight: 400; }
