/*
 * Recipe Recordings - "Kitchen Notebook" Design System
 * A warm, editorial aesthetic with analog charm
 */

/* ========================================
   CSS Custom Properties (Design Tokens)
   ======================================== */
:root {
  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --text-caption: 0.75rem;
  --text-sm: 0.875rem;
  --text-body: 1rem;
  --text-body-lg: 1.125rem;
  --text-title-sm: 1.375rem;
  --text-title-md: 1.75rem;
  --text-title-lg: clamp(2rem, 1.7rem + 1vw, 2.5rem);
  --leading-tight: 1.12;
  --leading-snug: 1.32;
  --leading-body: 1.6;
  --tracking-tight: -0.02em;
  --tracking-label: 0.08em;

  /* Colors - Warm Kitchen Palette */
  --color-cream: #faf8f3;
  --color-cream-dark: #f3efe6;
  --color-paper: #fffdf9;
  --color-charcoal: #2c2c2c;
  --color-charcoal-light: #4a4a4a;
  --color-ink: #1a1a1a;
  --color-terracotta: #c45d3a;
  --color-terracotta-dark: #a84e30;
  --color-terracotta-light: #e8a995;
  --color-sage: #7d9a78;
  --color-sage-light: #c5d4c2;
  --color-sage-dark: #5c7858;
  --color-warm-gray: #9a9590;
  --color-border: #e5e0d8;
  --color-border-light: #f0ebe3;
  --color-white: var(--color-paper);
  --color-black: var(--color-ink);
  --color-ink-2: #1f1f1f;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(44, 44, 44, 0.04);
  --shadow-md: 0 4px 12px rgba(44, 44, 44, 0.08);
  --shadow-lg: 0 8px 24px rgba(44, 44, 44, 0.12);
  --shadow-lifted: 0 12px 32px rgba(44, 44, 44, 0.15);

  /* Spacing */
  --space-2xs: 2px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-sm-plus: 10px;
  --space-sm-md: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 7px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-round: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Semantic UI Tokens (aliases only; pass 1 no usage changes) */
  --ui-bg-page: var(--color-cream);
  --ui-bg-surface: var(--color-paper);
  --ui-bg-surface-muted: var(--color-cream);
  --ui-bg-surface-muted-strong: var(--color-cream-dark);
  --ui-bg-inverse: var(--color-ink);
  --ui-bg-inverse-muted: var(--color-ink-2);

  --ui-text: var(--color-charcoal);
  --ui-text-strong: var(--color-ink);
  --ui-text-muted: var(--color-charcoal-light);
  --ui-text-subtle: var(--color-warm-gray);
  --ui-text-inverse: var(--color-white);

  --ui-border: var(--color-border);
  --ui-border-subtle: var(--color-border-light);

  --ui-accent: var(--color-terracotta);
  --ui-accent-hover: var(--color-terracotta-dark);
  --ui-accent-soft: var(--color-terracotta-light);

  --ui-positive: var(--color-sage);
  --ui-positive-hover: var(--color-sage-dark);
  --ui-positive-soft: var(--color-sage-light);

  --ui-focus-ring: var(--color-sage-light);
  --ui-focus-outline: var(--color-terracotta-light);

  --ui-shadow-1: var(--shadow-sm);
  --ui-shadow-2: var(--shadow-md);
  --ui-shadow-3: var(--shadow-lg);
  --ui-shadow-4: var(--shadow-lifted);

  --ui-notification-surface: var(--ui-bg-surface);
  --ui-notification-border: var(--ui-border);
  --ui-notification-shadow: 0 4px 16px rgba(67, 48, 35, 0.1);
  --ui-notification-close-surface: var(--ui-bg-surface-muted);
  --ui-notification-close-border: color-mix(in srgb, var(--ui-border) 72%, var(--ui-text-subtle));
  --ui-notification-close-text: var(--ui-text-muted);
  --ui-notification-notice-border: color-mix(in srgb, var(--ui-positive) 30%, var(--ui-border));
  --ui-notification-alert-border: color-mix(in srgb, var(--ui-accent) 32%, var(--ui-border));
  --ui-notification-notice-accent: color-mix(in srgb, var(--ui-positive) 24%, var(--ui-bg-surface));
  --ui-notification-alert-accent: color-mix(in srgb, var(--ui-accent) 20%, var(--ui-bg-surface));

}

/* ========================================
   Base Styles & Reset
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-kerning: normal;
  color: var(--color-charcoal);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(125, 154, 120, 0.08) 0%, transparent 50%),
    var(--color-cream);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Subtle paper texture overlay - very faint for depth without hurting legibility */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  z-index: 1;
  mix-blend-mode: multiply;
}

body:not(.controller-prototype) :is(a, button, input, select, textarea):not(.recipe-index-search-input):focus-visible {
  outline: 2px solid var(--ui-focus-outline);
  outline-offset: 2px;
}

body:not(.controller-prototype) :is(.auth-title, .profile-header-copy h1, .queue-title-block h1, .video-hero-title, .recipe-title, .queue-plan-week-copy h2) {
  text-wrap: balance;
}

body:not(.controller-prototype) :is(.queue-count-number, .queue-date, .plan-day-meta, .tip-count, .section-count-heading) {
  font-variant-numeric: tabular-nums;
}

.text-measure {
  max-width: 65ch;
}

/* ========================================
   Main Container
   ======================================== */
.prototype-container {
  max-width: 420px;
  margin: 0 auto;
  background: var(--color-paper);
  min-height: 100vh;
  position: relative;
  box-shadow:
    -1px 0 0 var(--color-border),
    1px 0 0 var(--color-border),
    var(--shadow-lg);
}

/* ========================================
   Header
   ======================================== */
.header {
  background: linear-gradient(180deg, var(--ui-bg-surface) 0%, var(--ui-bg-surface-muted) 100%);
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--ui-border);
}

.header::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: var(--space-lg);
  right: var(--space-lg);
  height: 8px;
  background: linear-gradient(180deg, rgba(44, 44, 44, 0.04) 0%, transparent 100%);
  pointer-events: none;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-title-md);
  font-weight: 600;
  color: var(--ui-text-strong);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.header-accent {
  width: 32px;
  height: 32px;
  background: var(--ui-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-3deg);
  box-shadow: var(--ui-shadow-1);
}

.header-accent svg {
  width: 18px;
  height: 18px;
  color: var(--ui-text-inverse);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-search-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ui-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.header-search-toggle:hover {
  color: var(--ui-text-strong);
  background: color-mix(in srgb, var(--ui-accent-soft) 35%, transparent);
}

.header-search-toggle[aria-expanded="true"] {
  color: var(--ui-accent-hover);
  background: color-mix(in srgb, var(--ui-accent-soft) 50%, transparent);
}

.header-search-toggle svg {
  width: 20px;
  height: 20px;
}

.app-navbar-search-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--ui-border) 72%, rgba(196, 93, 58, 0.12));
  border-radius: 9999px;
  background: rgba(255, 253, 249, 0.72);
  color: color-mix(in srgb, var(--ui-text-subtle) 88%, var(--ui-accent) 12%);
  box-shadow: var(--ui-shadow-1);
}

.app-navbar-search-toggle:hover,
.app-navbar-search-toggle:focus-visible {
  outline: none;
  color: var(--ui-accent-hover);
  border-color: rgba(196, 93, 58, 0.24);
  background: rgba(196, 93, 58, 0.08);
  transform: translateY(-1px);
}

.app-navbar-search-toggle[aria-expanded="true"] {
  color: var(--ui-accent-hover);
  background: var(--ui-bg-surface);
  border-color: var(--ui-border);
  box-shadow: var(--ui-shadow-1);
}

body.recipe-search-modal-open {
  overflow: hidden;
}

.recipe-index-search-shell {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 5vh, 44px) 0;
  background: rgba(73, 52, 39, 0.2);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.recipe-index-search-shell.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.recipe-index-search-shell__inner {
  width: min(90vw, 1040px);
  max-width: 1040px;
  min-height: 0;
}

.recipe-index-search-shell__paper {
  display: grid;
  grid-template-rows: auto auto minmax(0, auto);
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--ui-border);
  background: var(--ui-bg-surface);
  box-shadow: var(--ui-shadow-4);
  transform: translateY(18px) scale(0.985);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.recipe-index-search-shell.is-open .recipe-index-search-shell__paper {
  transform: translateY(0) scale(1);
}

.recipe-index-search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 60px;
  padding: 0 clamp(18px, 2vw, 22px);
  border-bottom: 1px solid color-mix(in srgb, var(--ui-border) 60%, transparent);
  background: transparent;
}

.recipe-index-search-title {
  display: none;
}

.recipe-index-search-clear {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-round);
  background: transparent;
  color: var(--ui-text-muted);
  font-size: 24px;
  cursor: pointer;
}

.recipe-index-search-clear[hidden],
.recipe-index-search-reset[hidden] {
  display: none;
}

.recipe-index-search-input-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--ui-text-subtle);
  flex-shrink: 0;
}

.recipe-index-search-input-icon svg {
  width: 18px;
  height: 18px;
}

.recipe-index-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ui-text-strong);
  font-family: var(--font-body);
  font-size: 17px;
  padding: 18px 0;
}

.recipe-index-search-input::placeholder {
  color: color-mix(in srgb, var(--ui-text-subtle) 90%, white);
}

.recipe-index-search-input:focus,
.recipe-index-search-input:focus-visible {
  outline: none;
}

.recipe-index-search-kbd {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ui-text-subtle);
  padding: 3px 8px 4px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--ui-border) 70%, transparent);
  background: color-mix(in srgb, var(--ui-bg-surface) 70%, transparent);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--ui-border) 50%, transparent);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.recipe-index-search-kbd:hover {
  color: var(--ui-text-strong);
  border-color: color-mix(in srgb, var(--ui-accent) 40%, var(--ui-border));
}

.recipe-index-search-close {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ui-text-subtle);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.recipe-index-search-close:active {
  background: color-mix(in srgb, var(--ui-accent-soft) 40%, transparent);
  color: var(--ui-text-strong);
}

.recipe-index-search-close svg {
  width: 18px;
  height: 18px;
}

.recipe-index-search-status {
  min-height: 1.4em;
  padding: 6px clamp(18px, 2vw, 22px) 0;
  font-size: 0.88rem;
  color: var(--ui-text-subtle);
}

.recipe-index-search-status:empty {
  display: none;
}

.recipe-index-search-body {
  min-height: 0;
  display: grid;
  align-content: start;
  padding: 0 clamp(18px, 2vw, 24px) clamp(18px, 2vw, 24px);
}

.recipe-index-search-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: clamp(24px, 4vw, 40px) 4px;
  color: var(--ui-text-subtle);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.recipe-index-search-empty[hidden] {
  display: none;
}

.recipe-index-search-results {
  display: grid;
  gap: 8px;
  min-height: 0;
  max-height: calc(90dvh - 140px);
  overflow-y: auto;
  padding: 8px 4px 4px;
  scrollbar-gutter: stable;
}

.recipe-index-search-result-link {
  display: block;
  min-width: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  color: inherit;
  text-decoration: none;
  outline: 3px solid transparent;
  outline-offset: 0;
}

.recipe-index-search-result-link--active {
  outline-color: var(--ui-accent-hover);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-accent) 12%, transparent);
}

.recipe-index-search-result-link:is(:hover, :focus-visible) .recipe-preview {
  border-color: color-mix(in srgb, var(--ui-accent) 58%, var(--ui-border));
}

@media (max-width: 767px) {
  .recipe-index-search-shell {
    top: var(--search-viewport-top, 0px);
    bottom: auto;
    height: var(--search-viewport-height, 100dvh);
    padding: 0;
    background: var(--ui-bg-page);
  }

  .recipe-index-search-shell__inner {
    width: 100%;
    height: 100%;
  }

  .recipe-index-search-shell__paper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    border: 0;
    border-radius: 0;
    background: var(--ui-bg-page);
    box-shadow: none;
    transform: none;
  }

  .recipe-index-search-title {
    display: block;
    flex-shrink: 0;
    margin: 24px 16px 12px;
    font: 600 1.4rem/1.3 var(--font-display);
    color: var(--ui-text-strong);
  }

  .recipe-index-search-bar {
    flex-shrink: 0;
    min-height: 48px;
    margin: 0 16px;
    padding: 0;
  }

  .recipe-index-search-input {
    padding: 12px 0;
    font-size: 16px;
  }

  .recipe-index-search-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 16px 16px;
  }

  .recipe-index-search-status {
    flex-shrink: 0;
    padding: 12px 16px;
    color: var(--ui-text-muted);
  }

  .recipe-index-search-results {
    flex: 1;
    max-height: none;
    align-content: start;
    gap: 12px;
    padding: 2px;
    scrollbar-gutter: auto;
    overscroll-behavior: contain;
  }

  .recipe-index-search-results[hidden] {
    display: none;
  }

  .recipe-index-search-result-link--active {
    outline: 2px solid var(--ui-accent-hover);
    box-shadow: none;
  }

  .recipe-index-search-result-link .recipe-preview {
    min-height: 100px;
  }

  .recipe-index-search-result-link .recipe-preview__title {
    overflow-wrap: anywhere;
  }

  .recipe-index-search-result-link .recipe-preview__media img {
    position: absolute;
    inset: 0;
  }

  .recipe-index-search-result-link .recipe-preview__match {
    display: none;
  }

  .recipe-index-search-reset {
    align-self: center;
    margin-bottom: 16px;
  }

  .recipe-index-search-kbd {
    display: none;
  }

  .recipe-index-search-close {
    display: inline-flex;
    width: auto;
    min-width: 60px;
    min-height: 44px;
    color: var(--ui-accent-hover);
    font: 500 1rem/1.4 var(--font-body);
  }
}

.queue-nav-actions,
.detail-nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.profile-menu {
  position: relative;
  display: none;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-round);
  border: 1px solid var(--ui-border);
  background: var(--ui-bg-surface-muted);
  color: var(--ui-text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  transition: all var(--transition-fast);
  box-shadow: var(--ui-shadow-1);
}

.menu-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--ui-text);
  border-radius: 2px;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  outline: none;
  background: var(--ui-bg-surface);
  border-color: var(--ui-accent-soft);
  box-shadow: var(--ui-shadow-2);
}

.profile-avatar {
  list-style: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--ui-accent-soft), var(--ui-positive));
  border: 1px solid rgba(44, 44, 44, 0.12);
  box-shadow: var(--ui-shadow-1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.profile-avatar::-webkit-details-marker {
  display: none;
}

.profile-avatar::marker {
  content: '';
}

.profile-avatar::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  opacity: 0.9;
}

.profile-avatar:focus-visible {
  outline: 2px solid var(--ui-focus-outline);
  outline-offset: 3px;
}

.profile-menu[open] .profile-avatar {
  border-color: var(--ui-accent-soft);
  box-shadow: var(--ui-shadow-2);
  transform: translateY(-1px);
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  box-shadow: var(--ui-shadow-3);
  padding: var(--space-sm);
  min-width: 140px;
  z-index: 10;
}

.profile-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 16px;
  width: 12px;
  height: 12px;
  background: var(--ui-bg-surface);
  border-left: 1px solid var(--ui-border);
  border-top: 1px solid var(--ui-border);
  transform: rotate(45deg);
}

/* button_to wraps this button in a .button_to form */
.swipe-menu-inner .button_to {
  margin: 0;
  width: 100%;
}

.profile-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: var(--ui-bg-surface-muted);
  border: 1px solid var(--ui-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-text-subtle);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  font-family: inherit;
  line-height: 1.2;
  appearance: none;
}

.profile-logout:hover,
.profile-logout:focus-visible {
  background: rgba(196, 93, 58, 0.1);
  border-color: rgba(196, 93, 58, 0.3);
  color: var(--ui-accent-hover);
  outline: none;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top left, rgba(196, 93, 58, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(250, 248, 243, 0.98), rgba(250, 248, 243, 1));
}

.app-navbar-shell {
  --app-navbar-frost-opacity: 0.82;
  --app-navbar-frost-blur: 0px;
  --app-navbar-frost-saturate: 1;
  --app-navbar-frost-radius: 18px;
  --app-navbar-border-color: transparent;
  --app-navbar-shadow: none;
  position: sticky;
  top: 0;
  z-index: 430;
  padding: 0;
  background: transparent;
  isolation: isolate;
}

.app-navbar-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 -14px;
  border-radius: 0 0 var(--app-navbar-frost-radius) var(--app-navbar-frost-radius);
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.4), rgba(250, 248, 243, 0.2) 72%, rgba(250, 248, 243, 0) 100%),
    radial-gradient(circle at top left, rgba(196, 93, 58, 0.12), transparent 42%);
  opacity: var(--app-navbar-frost-opacity);
  -webkit-backdrop-filter: blur(var(--app-navbar-frost-blur)) saturate(var(--app-navbar-frost-saturate));
  backdrop-filter: blur(var(--app-navbar-frost-blur)) saturate(var(--app-navbar-frost-saturate));
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 76%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 76%, transparent 100%);
  pointer-events: none;
  transition: opacity var(--transition-base), -webkit-backdrop-filter var(--transition-base), backdrop-filter var(--transition-base);
}

.app-navbar-shell:has(.app-navbar--quiet-cream)::before {
  background: var(--color-cream);
  border-bottom: 1px solid color-mix(in oklch, var(--color-border) 72%, var(--color-cream));
  border-radius: 0;
  inset: 0;
  opacity: 1;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.app-navbar-shell.is-scrolled {
  --app-navbar-frost-opacity: 1;
  --app-navbar-frost-blur: 16px;
  --app-navbar-frost-saturate: 1.08;
  --app-navbar-border-color: color-mix(in srgb, var(--ui-border) 72%, rgba(191, 160, 122, 0.2));
  --app-navbar-shadow:
    0 10px 24px rgba(67, 48, 35, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.48);
}

.app-navbar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 8px 14px;
  border-style: solid;
  border-width: 0 0 1px;
  border-color: var(--app-navbar-border-color);
  border-radius: 0 0 16px 16px;
  background: transparent;
  box-shadow: var(--app-navbar-shadow);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-fast);
}

.app-navbar--quiet-cream {
  background: var(--color-cream);
  border-color: color-mix(in oklch, var(--color-border) 72%, var(--color-cream));
  border-radius: 0;
  box-shadow: none;
  padding-block: 8px;
}

.app-navbar--quiet-cream .app-navbar-brand-mark {
  opacity: 0.72;
}

.app-navbar-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.app-navbar-brand:hover,
.app-navbar-brand:focus-visible {
  outline: none;
  transform: translateY(-1px);
}

.app-navbar-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--ui-accent);
  font-size: 16px;
  text-shadow: none;
}

.app-navbar-brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.app-navbar-brand-title {
  font-family: var(--font-display);
  font-size: clamp(1.0625rem, 0.98rem + 0.38vw, 1.35rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: var(--tracking-tight);
  color: var(--ui-text-strong);
}

.app-navbar-brand-subtitle {
  font-size: 0.8125rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: color-mix(in srgb, var(--ui-text-subtle) 82%, var(--ui-positive) 18%);
  max-width: 34ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-navbar-links {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid color-mix(in srgb, var(--ui-border) 78%, rgba(191, 160, 122, 0.18));
  border-radius: 9999px;
  background: rgba(255, 251, 246, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.app-navbar-nav {
  min-width: 0;
}

.app-navbar-link-item {
  display: contents;
}

.app-navbar-links::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 0;
  height: 40px;
  border-radius: 9999px;
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border);
  box-shadow: var(--ui-shadow-1);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition:
    left 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    width 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    height 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 160ms ease;
}

.app-navbar-link--current {
  anchor-name: --nav-magnet;
}

.app-navbar-links:has(:where(.app-navbar-link:is(:hover, :focus-visible))) :where(.app-navbar-link--current) {
  anchor-name: none;
}

.app-navbar-link:is(:hover, :focus-visible) {
  anchor-name: --nav-magnet;
}

.app-navbar-links:has(.app-navbar-link--current)::before,
.app-navbar-links:has(.app-navbar-link:is(:hover, :focus-visible))::before {
  opacity: 1;
}

.app-navbar-links:has(.app-navbar-link:is(:hover, :focus-visible))::before {
  background: var(--ui-bg-surface-muted);
  border-color: var(--ui-border-subtle);
  box-shadow: none;
}

.app-navbar-links:not(:has(.app-navbar-link:is(:hover, :focus-visible)))::before {
  transition-delay: 120ms;
}

@supports (anchor-name: --x) {
  .app-navbar-links::before {
    position-anchor: --nav-magnet;
    left: anchor(left);
    top: anchor(top);
    width: anchor-size(width);
    height: anchor-size(height);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-navbar-links::before {
    transition: opacity 120ms ease;
  }
}

.app-navbar-link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 9999px;
  border: 1px solid transparent;
  color: color-mix(in srgb, var(--ui-text) 90%, var(--ui-accent) 10%);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color var(--transition-fast);
}

.app-navbar-link:hover,
.app-navbar-link:focus-visible {
  outline: none;
  color: var(--ui-accent-hover);
}

.app-navbar-link--current {
  font-weight: 700;
  color: var(--ui-accent-hover);
}

.app-navbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.app-navbar-profile {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  max-width: min(100%, 272px);
  padding: 3px 8px 3px 3px;
  border-radius: 9999px;
  border: 1px solid color-mix(in srgb, var(--ui-border) 68%, rgba(125, 154, 120, 0.26));
  background: var(--ui-bg-surface);
  box-shadow: var(--ui-shadow-1);
  color: inherit;
  text-decoration: none;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.app-navbar-profile:hover,
.app-navbar-profile:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: rgba(196, 93, 58, 0.28);
  box-shadow: var(--ui-shadow-2);
}

.app-navbar-profile--current {
  border-color: rgba(196, 93, 58, 0.32);
  background: var(--ui-bg-surface-muted);
  box-shadow: var(--ui-shadow-1);
}

.app-navbar-profile-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  flex: 0 0 34px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ui-text-inverse);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.34), transparent 48%),
    var(--profile-avatar-color, var(--ui-accent));
  border: 1px solid rgba(44, 44, 44, 0.12);
  box-shadow: var(--ui-shadow-1);
}

.app-navbar-profile-meta {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.app-navbar-profile-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: color-mix(in srgb, var(--ui-text) 86%, var(--ui-text-subtle) 14%);
}

.app-navbar-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 9999px;
  border: 1px solid color-mix(in srgb, var(--ui-border) 74%, rgba(44, 44, 44, 0.12));
  background: rgba(255, 253, 249, 0.72);
  color: color-mix(in srgb, var(--ui-text-subtle) 88%, var(--ui-accent) 12%);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.app-navbar-logout-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  flex: 0 0 16px;
}

.app-navbar-logout-icon svg {
  width: 100%;
  height: 100%;
}

.app-navbar-logout:hover,
.app-navbar-logout:focus-visible {
  outline: none;
  color: var(--ui-accent-hover);
  border-color: rgba(196, 93, 58, 0.24);
  background: rgba(196, 93, 58, 0.08);
  transform: translateY(-1px);
}

.app-navbar-actions .button_to {
  margin: 0;
}

.app-navbar-brand:focus-visible,
.app-navbar-link:focus-visible,
.app-navbar-profile:focus-visible,
.app-navbar-logout:focus-visible {
  outline: 2px solid var(--ui-focus-outline);
  outline-offset: 2px;
}

.app-navbar-link:active,
.app-navbar-profile:active,
.app-navbar-logout:active,
.app-navbar-brand:active {
  transform: translateY(0);
}

.app-main {
  min-height: calc(100vh - 88px);
  padding: 8px 12px clamp(28px, 4vw, 40px);
}

.swipe-scroller {
  min-height: 100vh;
}

.swipe-menu {
  display: none;
}

.swipe-content {
  min-height: 100vh;
}

.swipe-content[inert] {
  pointer-events: none;
  user-select: none;
}

.swipe-menu[inert] {
  pointer-events: none;
  user-select: none;
}

.swipe-menu-inner {
  display: grid;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
}

/* Icon element inside sidebar links */
.swipe-menu-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.swipe-menu-icon svg {
  width: 100%;
  height: 100%;
}

.swipe-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(191, 160, 122, 0.24);
  background: linear-gradient(145deg, rgba(255, 251, 246, 0.96), rgba(197, 212, 194, 0.32));
  box-shadow: var(--ui-shadow-1);
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}

.swipe-profile:hover,
.swipe-profile:focus-visible {
  outline: none;
  transform: translateY(-1px);
  border-color: rgba(196, 93, 58, 0.3);
  background: linear-gradient(145deg, rgba(255, 251, 246, 0.98), rgba(232, 169, 149, 0.2));
  box-shadow: var(--ui-shadow-2);
}

.swipe-profile--current {
  border-color: rgba(196, 93, 58, 0.28);
  background: linear-gradient(145deg, rgba(255, 250, 245, 0.98), rgba(232, 169, 149, 0.22));
}

.swipe-profile:focus-visible {
  outline: 2px solid var(--ui-focus-outline);
  outline-offset: 2px;
}

.swipe-profile-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  flex: 0 0 40px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ui-text-inverse);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.34), transparent 48%),
    var(--profile-avatar-color, var(--ui-accent));
  border: 1px solid rgba(44, 44, 44, 0.12);
  box-shadow: var(--ui-shadow-1);
}

.swipe-profile-meta {
  display: grid;
  gap: 1px;
  min-width: 0;
  align-content: center;
}

.swipe-profile-name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ui-text-strong);
  overflow-wrap: anywhere;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swipe-profile-detail {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--ui-text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swipe-menu-nav {
  display: grid;
  gap: 6px;
}

.swipe-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-text);
  transition: all var(--transition-fast);
}

.swipe-menu-link:hover,
.swipe-menu-link:focus-visible {
  outline: none;
  background: var(--ui-bg-surface-muted-strong);
  border-color: var(--ui-border-subtle);
  color: var(--ui-accent-hover);
}

.swipe-menu-link--current {
  background: linear-gradient(135deg, rgba(196, 93, 58, 0.12), rgba(255, 253, 249, 0.92));
  border-color: rgba(196, 93, 58, 0.3);
  color: var(--ui-accent-hover);
}

.swipe-menu-link--current .swipe-menu-icon {
  color: var(--ui-accent);
}

.mobile-tabbar {
  display: none;
}

.mobile-tabbar-link {
  text-decoration: none;
}

@media (max-width: 767px) {
  .app-navbar-shell {
    --app-navbar-frost-opacity: 0.74;
    --app-navbar-frost-radius: 12px;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .app-navbar-shell::before {
    inset: 0 0 -10px;
    background: var(--color-cream);
  }

  .app-navbar-shell.is-scrolled {
    --app-navbar-frost-blur: 12px;
  }

  .app-navbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: stretch;
    column-gap: 8px;
    row-gap: 4px;
    padding: 5px 10px 6px;
    border-radius: 0 0 10px 10px;
    background: transparent;
  }

  .app-navbar-brand {
    gap: 8px;
    min-width: 0;
    min-height: 34px;
    padding-block: 0;
  }

  .app-navbar-brand-mark {
    width: 10px;
    height: 10px;
    font-size: 9px;
    text-shadow: 0 2px 8px oklch(64% 0.13 43 / 0.16);
  }

  .app-navbar-brand-title {
    font-size: 1rem;
    line-height: 1;
  }

  .app-navbar-brand-subtitle {
    display: none;
  }

  .app-navbar-nav {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
  }

  .app-navbar-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 2px;
    padding: 2px;
    border: 1px solid oklch(84% 0.026 68 / 0.5);
    border-radius: 9999px;
    background: oklch(98.6% 0.01 78 / 0.58);
    box-shadow: inset 0 1px 0 oklch(99% 0.006 78 / 0.74);
  }

  .app-navbar-links::before {
    display: none;
  }

  .app-navbar-link {
    width: 100%;
    min-height: 34px;
    padding: 5px 3px;
    color: color-mix(in srgb, var(--ui-text) 78%, var(--ui-text-subtle) 22%);
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
  }

  .app-navbar-link--admin {
    display: none;
  }

  .app-navbar-link--current {
    color: var(--ui-accent-hover);
    background: var(--ui-bg-surface);
    border-color: var(--ui-border);
    box-shadow: var(--ui-shadow-1);
  }

  .app-navbar-actions {
    width: auto;
    justify-content: flex-end;
    margin-left: 0;
    gap: 6px;
  }

  .app-navbar-search-toggle {
    width: 36px;
    height: 36px;
    box-shadow: none;
  }

  .app-navbar-search-toggle svg {
    width: 18px;
    height: 18px;
  }

  .app-navbar-profile {
    flex: 0 0 auto;
    min-width: 36px;
    min-height: 36px;
    padding: 3px;
    gap: 0;
    box-shadow: none;
  }

  .app-navbar-profile-meta {
    display: none;
  }

  .app-navbar-profile-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    flex-basis: 30px;
    font-size: 12px;
  }

  .app-navbar-logout {
    display: none;
  }

  .app-main {
    padding-left: 0;
    padding-right: 0;
  }

  .prototype-container {
    width: 100%;
    max-width: none;
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .plan-week-container .queue-header {
    position: relative;
    top: auto;
  }

  .swipe-scroller {
    min-height: 100vh;
    min-height: 100dvh;
    display: block;
  }

  .swipe-menu {
    display: none;
  }

  .swipe-content {
    min-height: 100vh;
    min-height: 100dvh;
  }

  body.is-authenticated .swipe-content {
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 420;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    border-radius: 14px;
    border: 1px solid rgba(44, 44, 44, 0.14);
    background: var(--ui-bg-surface);
    box-shadow: var(--ui-shadow-2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .mobile-tabbar-link {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: var(--ui-text-subtle);
    font-size: var(--text-caption);
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  }

  .mobile-tabbar-link:hover,
  .mobile-tabbar-link:focus-visible {
    background: rgba(44, 44, 44, 0.05);
    color: var(--ui-text-strong);
    border-color: rgba(44, 44, 44, 0.12);
    outline: none;
  }

  .mobile-tabbar-link:active {
    transform: translateY(1px);
  }

  .mobile-tabbar-link--current {
    background: rgba(44, 44, 44, 0.08);
    color: var(--ui-text-strong);
    border-color: rgba(44, 44, 44, 0.16);
  }

  .mobile-tabbar-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
  }

  .mobile-tabbar-icon svg {
    width: 100%;
    height: 100%;
  }
}

@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
  .mobile-tabbar {
    background: rgba(255, 253, 249, 0.97);
  }

  .app-navbar-shell::before {
    background:
      linear-gradient(180deg, rgba(255, 253, 249, 0.78), rgba(250, 248, 243, 0.44) 72%, rgba(250, 248, 243, 0) 100%),
      radial-gradient(circle at top left, rgba(196, 93, 58, 0.14), transparent 42%);
  }

  .app-navbar-shell.is-scrolled::before {
    background:
      linear-gradient(180deg, rgba(255, 253, 249, 0.94), rgba(250, 248, 243, 0.76) 72%, rgba(250, 248, 243, 0.08) 100%),
      radial-gradient(circle at top left, rgba(196, 93, 58, 0.18), transparent 42%);
  }
}

.notification-toaster {
  position: fixed;
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 480;
  width: min(300px, calc(100% - 48px));
  pointer-events: none;
}

body:has(.plan-week-bottom-search) .notification-toaster {
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

.notification-toaster--empty {
  width: 0;
}

.notification-toaster-stack {
  /* Paper-stack tokens. Each layer behind the front peels down by --step,
     scales down by --scale-step, and darkens its shadow. */
  --notification-stack-step: 8px;
  --notification-stack-scale-step: 0.035;
  --notification-stack-peek: 14px; /* sliver of back cards visible when collapsed */
  display: grid;
  align-items: start;
  /* Reserve room below the front card for peeking slivers + counter label. */
  padding-bottom: calc(
    (min(var(--notification-stack-count, 1), 3) - 1) * var(--notification-stack-peek)
  );
  transition: padding-bottom 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.notification-toaster.is-expanded .notification-toaster-stack {
  padding-bottom: 0;
  gap: 10px;
  grid-auto-flow: row;
}

.notification-card {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  position: relative;
  overflow: hidden;
  min-height: 52px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--ui-notification-border);
  background: var(--ui-notification-surface);
  box-shadow: var(--ui-notification-shadow);
  opacity: 0;
  /* Collapsed: depth 0 = front (full); 1,2 = peek slivers; 3+ = hidden behind. */
  z-index: calc(30 - var(--notification-stack-depth, 0));
  transform:
    translateY(calc(-6px + (var(--notification-stack-depth, 0) * var(--notification-stack-peek))))
    scale(calc(1 - (var(--notification-stack-depth, 0) * var(--notification-stack-scale-step))));
  transform-origin: top center;
  pointer-events: auto;
  transition:
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 200ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 280ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.notification-card.is-visible {
  opacity: 1;
  transform:
    translateY(calc(var(--notification-stack-depth, 0) * var(--notification-stack-peek)))
    scale(calc(1 - (var(--notification-stack-depth, 0) * var(--notification-stack-scale-step))));
}

/* Back cards feel quieter — slight desaturation and muted shadow. */
.notification-card:not(.is-front).is-visible {
  filter: saturate(0.92) brightness(0.985);
  box-shadow:
    0 2px 6px rgba(67, 48, 35, 0.06),
    0 1px 0 rgba(67, 48, 35, 0.04);
}

/* Cards deeper than the peek budget hide entirely. */
.notification-card.is-buried.is-visible {
  opacity: 0;
  pointer-events: none;
  transform:
    translateY(calc(3 * var(--notification-stack-peek)))
    scale(calc(1 - (3 * var(--notification-stack-scale-step))));
}

.notification-card.is-closing {
  opacity: 0;
  transform:
    translateY(calc(-4px + (var(--notification-stack-depth, 0) * var(--notification-stack-peek))))
    scale(calc(0.985 - (var(--notification-stack-depth, 0) * var(--notification-stack-scale-step))));
  pointer-events: none;
  transition-duration: 160ms;
}

/* Expanded: fan out, every card fully readable. */
.notification-toaster.is-expanded .notification-card.is-visible {
  transform: none;
  filter: none;
  box-shadow: var(--ui-notification-shadow);
  opacity: 1;
  grid-area: auto;
  pointer-events: auto;
}

/* When expanded, hidden (buried) cards reappear in the flow. */
.notification-toaster.is-expanded .notification-card.is-buried.is-visible {
  transform: none;
  opacity: 1;
}

/* Show the number of other notices while the stack is collapsed. */
.notification-toaster__counter {
  display: block;
  margin: 6px 0 0 auto;
  padding: 4px 10px;
  width: fit-content;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--ui-text-muted);
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-notification-border);
  border-radius: 999px;
  pointer-events: auto;
}

.notification-toaster__counter[hidden],
.notification-toaster.is-expanded .notification-toaster__counter {
  display: none;
}

.notification-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border-top: 1px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.notification-card__indicator {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  color: var(--color-paper);
  background: var(--color-sage-dark);
}

.notification-card__indicator svg {
  width: 18px;
  height: 18px;
}

.notification-card--alert {
  border-color: var(--ui-notification-alert-border);
}

.notification-card--alert .notification-card__indicator {
  background: var(--ui-accent-hover);
}

.notification-card--notice {
  background: color-mix(in srgb, var(--color-sage-light) 38%, var(--color-cream));
  border-color: var(--ui-notification-notice-border);
}

.notification-card__content {
  min-width: 0;
  display: grid;
  gap: 4px;
  align-self: center;
}

.notification-card__text {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ui-text-strong);
}

.notification-card--notice .notification-card__text {
  color: color-mix(in srgb, var(--ui-text-strong) 90%, var(--ui-positive-hover));
}

.notification-card--alert .notification-card__text {
  color: color-mix(in srgb, var(--ui-text-strong) 90%, var(--ui-accent-hover));
}

.notification-card:focus-visible {
  outline: 2px solid var(--ui-focus-outline);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .notification-toaster {
    left: calc(16px + env(safe-area-inset-left, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: auto;
  }

  .notification-toaster-stack {
    --notification-stack-peek: 12px;
  }

  .notification-card__content {
    gap: 3px;
  }

  .notification-card__text {
    font-size: 0.9375rem;
    max-width: none;
  }

  /* Touch screens show every notification without hover. */
  .notification-toaster-stack {
    padding-bottom: 0;
    gap: 8px;
    grid-auto-flow: row;
  }
  .notification-card.is-visible {
    grid-area: auto;
    transform: none;
    filter: none;
    box-shadow: var(--ui-notification-shadow);
  }
  .notification-card.is-buried.is-visible {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
  .notification-toaster__counter {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Reduced motion: always show every card, no stacked transforms. */
  .notification-toaster-stack {
    gap: 10px;
    padding-top: 0;
    padding-bottom: 0;
    grid-auto-flow: row;
  }

  .notification-card {
    grid-area: auto;
    transform: none;
    filter: none;
    transition: opacity 120ms linear;
  }

  .notification-card.is-visible {
    transform: none;
  }

  .notification-card.is-buried.is-visible {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .notification-card.is-closing {
    transform: none;
  }

  .notification-toaster__counter {
    display: none;
  }
}

@media (min-width: 640px) and (max-width: 767px) {
  :root {
    --mobile-tablet-edge-gutter: clamp(18px, 3.4vw, 28px);
  }

  .header,
  .detail-nav,
  .import-widget,
  .section-divider,
  .video-header,
  .detail-footer {
    padding-left: var(--mobile-tablet-edge-gutter);
    padding-right: var(--mobile-tablet-edge-gutter);
  }

  .header::after {
    left: var(--mobile-tablet-edge-gutter);
    right: var(--mobile-tablet-edge-gutter);
  }

  .recipes-container {
    margin-left: var(--mobile-tablet-edge-gutter);
    margin-right: var(--mobile-tablet-edge-gutter);
  }
}

/* ========================================
   Import Widget — V2b Soft Terra Chips
   ======================================== */
.import-widget {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  background: var(--ui-bg-surface-muted);
  border-bottom: 1px solid var(--ui-border);
  position: relative;
}

/* Tab row: chips left, hint right */
.import-tabs-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm-md);
}

.import-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.import-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-round);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-text-subtle);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 180ms ease,
    border-color 180ms ease;
}

.import-tab:hover:not(.import-tab--active) {
  background: color-mix(in srgb, var(--ui-bg-surface-muted-strong) 60%, transparent);
  color: var(--ui-text-muted);
}

.import-tab--active {
  background: color-mix(in srgb, var(--color-terracotta-light) 30%, var(--color-cream));
  color: color-mix(in srgb, var(--color-terracotta-dark) 90%, var(--color-ink));
  border-color: color-mix(in srgb, var(--color-terracotta-light) 50%, transparent);
  font-weight: 600;
}

.import-tab-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  transition: stroke 180ms ease;
}

.import-tab--soon {
  opacity: 0.72;
}

.import-tab-soon-badge {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ui-text-subtle);
  background: var(--ui-bg-surface-muted-strong);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-round);
  padding: 1px 5px;
  line-height: 1.4;
}

.import-hint {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--ui-text-subtle);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
}

@media (max-width: 640px) {
  .import-tabs-row--hint-below .import-tabs {
    width: 100%;
  }

  .import-tabs-row--hint-below .import-tab {
    flex: 1 1 0;
    justify-content: center;
  }

  .import-tabs-row--hint-below .import-hint {
    display: none;
  }
}

/* Panel morph animation on tab switch */
@keyframes import-panel-morph {
  0%   { opacity: 0; transform: translateY(4px); filter: blur(2px); }
  60%  { filter: blur(0); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.import-panel--morph {
  animation: import-panel-morph 220ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Input row: icon + field + submit button */
.import-input-row {
  margin: 0;
}

.import-input-field {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--ui-bg-surface);
  border: 1px solid transparent;
  border-bottom: 3px solid var(--ui-border);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 14px;
  height: 50px;
  transition: border-color 140ms ease;
}

.import-input-field:focus-within {
  border-bottom-color: var(--ui-accent);
}

.import-input-field--error {
  border-bottom-color: var(--ui-accent);
}

.import-input-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--ui-text-subtle);
  flex-shrink: 0;
}

.import-input-field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  font-family: var(--font-body);
  /* Keep iOS from auto-zooming focused text inputs (requires >=16px). */
  font-size: 16px;
  color: var(--ui-text);
  padding: 0;
}

body:not(.controller-prototype) .import-input-field input:focus,
body:not(.controller-prototype) .import-input-field input:focus-visible { outline: none; box-shadow: none; }

.import-input-field input::placeholder {
  color: var(--ui-text-subtle);
}

.import-input-field input[type="file"] {
  appearance: auto;
  -webkit-appearance: auto;
}

.import-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  background: var(--ui-accent);
  color: var(--ui-text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.16);
  transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.import-submit-btn svg {
  width: 12px;
  height: 12px;
}

.import-submit-btn:hover:not(:disabled) {
  background: var(--ui-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow-2);
}

.import-submit-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--ui-shadow-1);
}

.import-submit-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.youtube-search-results {
  margin-top: var(--space-md);
  color: var(--ui-text-muted);
}

.import-input-field--youtube {
  height: auto;
  min-height: 58px;
}

.youtube-search-options {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  flex-shrink: 0;
  gap: 2px;
  margin: 8px 12px 8px 8px;
  padding: 3px;
  border-radius: 999px;
  background: var(--ui-bg-subtle, #f3f0ea);
}

.youtube-search-options::before {
  content: "";
  position: absolute;
  inset: 3px auto 3px 3px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: #f6e3db;
  transform: translateX(0);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.youtube-search-options:has(input[value="viewCount"]:checked)::before {
  transform: translateX(calc(100% + 2px));
}

.youtube-search-options[hidden] { display: none; }

.youtube-sort-option {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.youtube-sort-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
}

.youtube-sort-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 180ms ease;
  gap: 5px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.youtube-sort-option svg { width: 14px; height: 14px; }

.youtube-sort-option input:checked + span {
  color: #a84e30;
}

@media (prefers-reduced-motion: reduce) {
  .youtube-search-options::before,
  .youtube-sort-option span { transition: none; }
}

.youtube-sort-option input:focus-visible + span {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .import-input-field--youtube:has(.youtube-search-options:not([hidden])) {
    display: grid;
    grid-template-columns: 15px minmax(0, 1fr) auto;
    padding: 10px;
  }

  .import-input-field--youtube:has(.youtube-search-options:not([hidden])) > input {
    grid-column: 2 / -1;
    min-height: 32px;
  }

  .youtube-search-options {
    grid-column: 1 / 3;
    justify-self: start;
    margin: 4px 0;
  }
}

.youtube-video-statistics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  color: var(--ui-text-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.youtube-video-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.youtube-video-stat svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.youtube-search-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.youtube-search-result {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--ui-border);
}

.youtube-search-preview {
  position: relative;
  display: block;
  flex-shrink: 0;
  border-radius: var(--radius-md);
}

.youtube-search-preview img { display: block; }

.youtube-search-preview:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 3px;
}

.youtube-search-result img {
  width: 120px;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.youtube-search-result-copy {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.youtube-search-result-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--ui-text-strong);
}

.youtube-search-result-copy p {
  margin: 4px 0 0;
  font-size: var(--text-sm);
}

.youtube-search-result .import-submit-btn {
  min-height: 44px;
  background: var(--ui-accent-hover);
}

@media (max-width: 640px) {
  .youtube-search-result {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: start;
  }
  .youtube-search-result img { width: 96px; }
  .youtube-search-result form { grid-column: 2; }
}

/* Error banner */
.import-error-banner {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: var(--space-sm);
  padding: 7px 11px;
  background: color-mix(in srgb, var(--color-terracotta-light) 22%, white);
  border: 1px solid color-mix(in srgb, var(--color-terracotta-light) 55%, white);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: color-mix(in srgb, var(--color-terracotta-dark) 88%, var(--color-ink));
  animation: fadeUp 160ms ease;
}

.import-error-banner[hidden] { display: none; }

.import-error-banner--visible { display: flex; }

.import-error-banner svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* Photo coming-soon panel */
.import-panel--soon .import-photo-dropzone {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  height: 66px;
  border-radius: var(--radius-lg);
  border: 1.5px dashed var(--ui-border);
  background: color-mix(in srgb, var(--ui-bg-surface-muted-strong) 40%, transparent);
  padding: 0 var(--space-md);
  opacity: 0.7;
  cursor: default;
}

.import-panel--soon .import-photo-dropzone svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--ui-text-subtle);
}

.import-photo-dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.import-photo-dropzone-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-text-muted);
}

.import-photo-dropzone-text span {
  font-size: var(--text-sm);
  color: var(--ui-text-subtle);
}

.import-soon-pill {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ui-text-subtle);
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-round);
  padding: 3px 9px;
  flex-shrink: 0;
}

/* ========================================
   Section Divider
   ======================================== */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl) var(--space-lg) var(--space-md);
  background: var(--color-paper);
}

.section-divider span {
  font-family: var(--font-display);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--color-warm-gray);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(229, 224, 216, 0.35) 0%, transparent 100%);
}

.section-divider::after {
  background: linear-gradient(90deg, transparent 0%, rgba(229, 224, 216, 0.35) 100%);
}

/* ========================================
   Recipe List
   ======================================== */
.recipe-list {
  padding: 0;
  list-style: none;
  margin: 0;
}

/* ========================================
   Video Group
   ======================================== */
.video-group {
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, var(--color-paper) 0%, rgba(250, 248, 243, 0.6) 100%);
}

.video-group:last-child {
  border-bottom: none;
}

.video-header {
  position: relative;
  padding: var(--space-md) var(--space-lg) var(--space-sm);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  cursor: default;
  transition: background var(--transition-fast);
}

.video-header--text {
  padding-top: var(--space-md);
}

.video-header:hover {
  background: rgba(250, 248, 243, 0.7);
}

.video-thumbnail {
  position: relative;
  flex-shrink: 0;
  width: 110px;
  height: 62px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  line-height: 0;
  transition: box-shadow var(--transition-base);
}

.video-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.video-header:hover .video-thumbnail img {
  transform: scale(1.02);
}

.video-header:hover .video-thumbnail {
  box-shadow: var(--shadow-lg);
}

.video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: all var(--transition-fast);
}

.video-header:hover .video-play-icon,
.youtube-search-preview:hover .video-play-icon,
.youtube-search-preview:focus-visible .video-play-icon {
  background: var(--color-terracotta);
  transform: translate(-50%, -50%) scale(1.1);
}

.video-play-icon svg {
  width: 12px;
  height: 12px;
  color: white;
  margin-left: 2px;
}

.prompt-glyph-tile {
  position: relative;
  flex-shrink: 0;
  width: 110px;
  height: 62px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--color-terracotta-light) 35%, var(--color-cream-dark));
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.85), transparent 55%),
    repeating-linear-gradient(
      0deg,
      transparent 0 10px,
      color-mix(in srgb, var(--color-terracotta-light) 20%, transparent) 10px 11px
    ),
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--color-paper) 92%, var(--color-terracotta-light)) 0%,
      color-mix(in srgb, var(--color-cream-dark) 70%, var(--color-paper)) 100%
    );
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-terracotta);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  overflow: hidden;
}

.prompt-glyph-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  background: linear-gradient(
    135deg,
    transparent 0 50%,
    color-mix(in srgb, var(--color-cream-dark) 80%, var(--color-terracotta-light)) 50% 100%
  );
  border-bottom-right-radius: var(--radius-sm);
  opacity: 0.75;
}

.prompt-glyph-tile__icon {
  width: 24px;
  height: 24px;
  opacity: 0.85;
}

.video-header:hover .prompt-glyph-tile {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.video-header-info {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.video-header--text .video-header-info {
  padding-top: 0;
}

.video-source-label {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-bottom: var(--space-xs);
  padding: 2px 9px;
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--color-paper) 80%, var(--color-cream-dark));
  color: var(--color-sage-dark);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.video-header-info h3 {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-ink);
  line-height: 1.28;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-header-info h3::after {
  content: none;
}

.video-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-warm-gray);
}

.channel-attribution {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm-plus);
  min-width: 0;
  max-width: 100%;
  border-radius: var(--radius-round);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.channel-attribution__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.channel-attribution__avatar::after {
  content: '';
  position: absolute;
  inset: var(--space-2xs);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.42);
  pointer-events: none;
}

.channel-attribution__avatar-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.channel-attribution__label {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-attribution--list {
  padding: var(--space-xs) var(--space-sm-md) var(--space-xs) var(--space-xs);
  background: color-mix(in srgb, var(--color-paper) 92%, var(--color-cream-dark));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-border) 82%, transparent);
  color: var(--color-charcoal-light);
}

.channel-attribution--list .channel-attribution__avatar {
  background: linear-gradient(135deg, color-mix(in srgb, var(--color-sage-light) 78%, var(--color-paper)) 0%, color-mix(in srgb, var(--color-cream-dark) 82%, var(--color-paper)) 100%);
}

.channel-attribution--list .channel-attribution__label {
  max-width: min(44vw, 30ch);
  font-size: 13px;
  font-weight: 600;
}

a.channel-attribution--list:hover,
.channel-attribution--list:focus-visible {
  background: color-mix(in srgb, var(--color-paper) 78%, var(--color-cream));
  color: var(--color-terracotta-dark);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-terracotta-light) 70%, var(--color-border));
  transform: translateY(-1px);
}

.video-pending-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.video-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.video-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-warm-gray);
  flex-shrink: 0;
}

.video-status--pending .video-status-dot {
  background: var(--color-terracotta);
  animation: breatheDots 1.6s ease-in-out infinite;
}

.video-status--failed .video-status-dot {
  background: var(--color-terracotta-dark);
}

.video-status--empty .video-status-dot {
  background: var(--color-warm-gray);
}

.video-status-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-charcoal-light);
}

.video-status--failed .video-status-label {
  color: var(--color-terracotta-dark);
}

.video-status-detail {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--color-warm-gray);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pending-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-terracotta);
  animation: breatheDots 1.6s ease-in-out infinite;
}

.pending-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-charcoal-light);
}

/* ========================================
   Recipe Items
   ======================================== */
.recipes-container {
  background: var(--color-cream);
  padding: var(--space-sm) var(--space-lg) var(--space-md);
  position: relative;
  margin-left: var(--space-md);
  margin-right: var(--space-xs);
}

.recipes-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-lg);
  right: var(--space-lg);
  height: 1px;
  background: linear-gradient(90deg, rgba(229, 224, 216, 0.6), transparent);
}

.recipe-item {
  background: var(--color-paper);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.recipes-container .recipe-item {
  margin-left: var(--space-sm);
}

.recipe-item:last-child {
  margin-bottom: 0;
}

.recipe-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--color-sage);
  transform: scaleY(0);
  transition: transform var(--transition-base);
}

.recipe-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-sage-light);
  transform: translateX(6px);
}

.recipe-item:hover::before {
  transform: scaleY(1);
}

.recipe-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding-right: 44px;
}

.recipe-item > .recipe-favorite-control {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 2;
}

.recipe-item > .recipe-favorite-control .recipe-favorite-button {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.recipe-item > .recipe-favorite-control .recipe-favorite-button svg {
  width: 16px;
  height: 16px;
}

.recipe-item > .recipe-favorite-control .recipe-favorite-button:hover,
.recipe-item > .recipe-favorite-control .recipe-favorite-button:focus-visible {
  background: color-mix(in srgb, var(--ui-accent) 8%, transparent);
  border-color: transparent;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 24%, transparent);
}

.recipe-item > .recipe-favorite-control .recipe-favorite-button.is-favorited {
  background: var(--ui-accent);
}

.recipe-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.recipe-item-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--color-ink);
  line-height: 1.28;
  letter-spacing: -0.01em;
}

.recipe-item-meta {
  display: flex;
  gap: var(--space-md);
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-charcoal-light);
}

.recipe-item-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Source color belongs to the video header, not recipe rows. */
.recipe-list--source-groups {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--ui-bg-page);
}

.video-group--source-preview {
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-xl);
  background: var(--ui-bg-surface);
  box-shadow: var(--ui-shadow-1);
}

.video-group--source-preview:last-child {
  border-bottom: 1px solid var(--ui-border);
}

.video-group--source-preview .video-header {
  --preview-tone: var(--ui-bg-surface-muted-strong);
  --preview-ink: var(--ui-text-strong);
  --preview-muted: var(--ui-text-muted);

  gap: var(--space-sm-md);
  align-items: center;
  padding: var(--space-sm-md);
  color: var(--preview-ink);
  background: var(--preview-tone);
}

.video-group--source-preview .video-header:hover {
  background: var(--preview-tone);
}

.video-group--source-preview .video-header:not(.video-header--text) {
  gap: 0;
  padding: 0;
}

.video-group--source-preview .video-thumbnail {
  order: 2;
  width: clamp(106px, 35.7%, 133px);
  height: auto;
  min-height: 74px;
  align-self: stretch;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.video-group--source-preview .video-header:hover .video-thumbnail {
  box-shadow: none;
}

.video-group--source-preview .video-thumbnail img {
  position: absolute;
  inset: 0;
}

.video-group--source-preview .video-thumbnail::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 16px;
  background: linear-gradient(90deg, var(--preview-tone), transparent);
  pointer-events: none;
}

.video-group--source-preview .video-header-info {
  padding: var(--space-sm-md) var(--space-sm) var(--space-sm-md) var(--space-md);
}

.video-group--source-preview .video-header:not(.video-header--text) .video-header-info {
  padding-right: var(--space-sm);
}

.video-group--source-preview .video-header--text .video-header-info {
  padding: 0;
}

.video-group--source-preview .video-header-info h3 {
  margin-bottom: 4px;
  color: var(--preview-ink);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.15;
}

.video-group--source-preview .video-meta,
.video-group--source-preview .channel-attribution--list {
  color: var(--preview-muted);
}

.video-group--source-preview .channel-attribution--list {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.video-group--source-preview .channel-attribution__label {
  font-size: 0.75rem;
  font-weight: 400;
}

.video-group--source-preview .video-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.video-extraction-dots {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--preview-ink);
}

.video-extraction-dots span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: extraction-dots-fade 1.4s ease-in-out infinite;
}

.video-extraction-dots span:nth-child(2) { animation-delay: -1.2s; }
.video-extraction-dots span:nth-child(3) { animation-delay: -1s; }

@keyframes extraction-dots-fade {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.video-group--source-preview .video-meta--extracting {
  flex-wrap: nowrap;
  gap: var(--space-sm);
}

.video-meta--extracting .video-status {
  gap: var(--space-xs);
  flex-shrink: 0;
  padding: 0;
  white-space: nowrap;
}

.video-meta--extracting .video-status-label {
  color: var(--preview-ink);
  font-size: var(--text-caption);
}

.video-meta--extracting .channel-attribution + .video-status::before {
  content: "·";
  color: var(--preview-ink);
}

@media (prefers-reduced-motion: reduce) {
  .video-extraction-dots span {
    animation: none;
  }
}

.video-group--source-preview :is(a.channel-attribution--list:hover, .channel-attribution--list:focus-visible) {
  color: var(--preview-ink);
  background: transparent;
  box-shadow: none;
}

.video-group--source-preview .channel-attribution__avatar::after {
  border-color: color-mix(in srgb, var(--preview-ink) 34%, transparent);
}




.video-group--source-preview .recipes-container {
  display: block;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: var(--ui-bg-surface);
}

.video-group--source-preview .recipes-container::before {
  content: none;
}

.video-group--source-preview .recipes-container .recipe-item {
  min-height: 76px;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: var(--ui-bg-surface);
  box-shadow: none;
  transition: background-color 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.video-group--source-preview .recipes-container .recipe-item + .recipe-item {
  border-top: 1px solid var(--ui-border-subtle);
}

.video-group--source-preview .recipes-container .recipe-item::before {
  content: none;
}

.video-group--source-preview .recipes-container .recipe-item:hover {
  border-color: transparent;
  background: color-mix(in srgb, var(--ui-bg-surface) 84%, var(--ui-bg-page));
  box-shadow: none;
  transform: none;
}

.video-group--source-preview .recipe-item-link {
  display: grid;
  min-height: 76px;
  align-content: start;
  padding: 17px 58px 17px var(--space-md);
}

.video-group--source-preview .recipe-item > .recipe-favorite-control {
  top: 27px;
  right: 7px;
  transform: translateY(-50%);
}

.video-group--source-preview .recipe-item > .recipe-favorite-control .recipe-favorite-button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  box-shadow: none;
  transition: none;
}

.video-group--source-preview .recipe-item > .recipe-favorite-control .recipe-favorite-button:hover {
  border: 0;
  color: var(--ui-accent);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.video-group--source-preview .recipe-item > .recipe-favorite-control .recipe-favorite-button:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: 2px solid color-mix(in srgb, var(--ui-accent) 42%, transparent);
  outline-offset: -8px;
  border-radius: var(--radius-sm);
}

.video-group--source-preview .recipe-item > .recipe-favorite-control .recipe-favorite-button.is-favorited {
  background: transparent;
  color: var(--ui-accent);
}

.video-group--source-preview .recipe-item > .recipe-favorite-control .recipe-favorite-button svg {
  width: 16px;
  height: 16px;
}

.video-group--source-preview .recipe-item > .recipe-favorite-control .recipe-favorite-button.is-favorited svg {
  fill: currentColor;
}

.video-group--source-preview .recipe-item-header {
  display: block;
  margin-bottom: 2px;
}

.video-group--source-preview .recipe-item-title {
  color: var(--ui-text-strong);
  font-size: 1rem;
  line-height: 1.26;
}

.video-group--source-preview .recipe-item-meta {
  color: var(--ui-text-muted);
  font-size: 0.8125rem;
}

.meta-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-sage);
}

.meta-icon svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
}

.empty-state-illustration {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--space-lg);
  background: var(--color-cream);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.empty-state-illustration::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--color-border);
  border-radius: 50%;
}

.empty-state-illustration svg {
  width: 48px;
  height: 48px;
  color: var(--color-warm-gray);
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: var(--text-title-sm);
  font-weight: 600;
  color: var(--color-ink);
  margin: 0 0 var(--space-sm);
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
}

.empty-state p {
  font-size: var(--text-body);
  color: var(--color-warm-gray);
  margin: 0;
  max-width: 34ch;
  margin-left: auto;
  margin-right: auto;
  line-height: var(--leading-body);
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

.header {
  animation: none;
}

.import-widget {
  animation: none;
}

.section-divider {
  animation: none;
}

.video-group {
  animation: none;
}

.video-group:nth-child(1) { animation-delay: 250ms; }
.video-group:nth-child(2) { animation-delay: 350ms; }
.video-group:nth-child(3) { animation-delay: 450ms; }

.recipe-item {
  animation: none;
}

.recipe-item:nth-child(1) { animation-delay: 100ms; }
.recipe-item:nth-child(2) { animation-delay: 150ms; }
.recipe-item:nth-child(3) { animation-delay: 200ms; }
.recipe-item:nth-child(4) { animation-delay: 250ms; }
.recipe-item:nth-child(5) { animation-delay: 300ms; }

.queue-container {
  background: var(--ui-bg-surface);
}

.queue-header {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  background: linear-gradient(180deg, var(--ui-bg-surface) 0%, var(--ui-bg-surface-muted) 100%);
  border-bottom: 1px solid var(--ui-border);
  animation: none;

  container-type: scroll-state;
  container-name: queue-hd;
  transition: background 200ms var(--transition-slow),
              box-shadow 200ms var(--transition-slow);
}

@container queue-hd scroll-state(stuck: top) {
  .queue-header {
    background: var(--ui-bg-surface);
    box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.18);
  }
}

.queue-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.queue-nav-actions {
  flex-shrink: 0;
}

.queue-nav .back-link {
  padding-left: 0;
}

.queue-date {
  font-size: var(--text-sm);
  line-height: 1.3;
  color: var(--ui-text-subtle);
  background: var(--ui-bg-surface-muted);
  padding: 4px 10px;
  border-radius: var(--radius-round);
  border: 1px solid var(--ui-border);
  font-weight: 500;
}

.queue-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.queue-title-block h1 {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-size: var(--text-title-md);
  font-weight: 600;
  color: var(--ui-text-strong);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.queue-subtitle {
  margin: 0;
  font-size: var(--text-body);
  color: var(--ui-text-muted);
  line-height: var(--leading-body);
  max-width: 34ch;
}

.queue-count-pill {
  background: var(--ui-accent);
  color: var(--ui-text-inverse);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  box-shadow: var(--ui-shadow-1);
  position: relative;
  overflow: hidden;
}

.queue-count-pill::after {
  content: none;
}

.queue-count-number {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.queue-count-label {
  display: block;
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.queue-empty-card {
  margin: 0 var(--space-lg) var(--space-2xl);
  background: var(--ui-bg-surface-muted);
  border-radius: var(--radius-xl);
  border: 1px dashed var(--ui-border);
  padding: var(--space-lg);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  animation: fadeInUp 500ms 320ms var(--transition-slow) backwards;
}

.queue-empty-illustration {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-text-subtle);
  flex-shrink: 0;
}

.queue-empty-illustration svg {
  width: 28px;
  height: 28px;
}

.queue-empty-content h2 {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-size: var(--text-body);
  color: var(--ui-text-strong);
}

.queue-empty-content p {
  margin: 0 0 var(--space-md);
  font-size: var(--text-sm);
  color: var(--ui-text-muted);
}

.queue-empty-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 12px;
  font-weight: 600;
  color: var(--ui-accent-hover);
  text-decoration: none;
  background: var(--ui-bg-surface);
  border: 1px solid rgba(196, 93, 58, 0.4);
  padding: 8px 13px;
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.queue-empty-action svg {
  width: 14px;
  height: 14px;
}

.queue-empty-action:hover {
  background: var(--ui-accent);
  color: var(--ui-text-inverse);
  border-color: var(--ui-accent);
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow-2);
}

.queue-empty-action:active {
  transform: translateY(1px) scale(0.99);
}

.queue-plan-week-cta {
  margin: var(--space-sm) var(--space-lg) 0;
  background:
    radial-gradient(circle at 88% 18%, rgba(196, 93, 58, 0.24), transparent 52%),
    radial-gradient(circle at 12% 100%, rgba(125, 154, 120, 0.2), transparent 58%),
    linear-gradient(138deg, rgba(255, 253, 249, 0.96), rgba(250, 248, 243, 0.9));
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 34px rgba(102, 78, 62, 0.13);
  padding: var(--space-lg);
  display: grid;
  gap: var(--space-md);
  position: relative;
  overflow: hidden;
}

.queue-plan-week-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.4), transparent 45%);
  pointer-events: none;
}

.queue-plan-week-copy h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 21px;
  color: var(--ui-text-strong);
  letter-spacing: -0.02em;
}

.queue-plan-week-copy p {
  margin: 0;
  max-width: 44ch;
  font-size: 13px;
  color: var(--ui-text-subtle);
  line-height: 1.6;
}

.queue-plan-week-cta .queue-empty-action {
  justify-self: start;
}

@media (min-width: 640px) {
  .queue-plan-week-cta {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: var(--space-lg);
  }

  .queue-plan-week-cta .queue-empty-action {
    justify-self: end;
  }
}

.plan-week-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.plan-history-controls {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-history-form {
  margin: 0;
}

.plan-history-button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-round);
  background: var(--ui-bg-surface);
  color: var(--ui-text-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.plan-history-button .size-6 {
  width: 15px;
  height: 15px;
}

.plan-history-button:hover {
  border-color: rgba(196, 93, 58, 0.45);
  color: var(--ui-accent-hover);
  background: rgba(196, 93, 58, 0.08);
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow-1);
}

.plan-history-button:active {
  transform: translateY(1px) scale(0.98);
}

.plan-history-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   Utility Classes
   ======================================== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   Recipe Detail Page - "Cooking Studio" Design
   ======================================== */

/* Detail Container */
.detail-container {
  max-width: 420px;
  margin: 0 auto;
  background: var(--ui-bg-surface);
  min-height: 100vh;
  position: relative;
  box-shadow:
    -1px 0 0 var(--ui-border),
    1px 0 0 var(--ui-border),
    var(--ui-shadow-3);
}

@media (max-width: 767px) {
  .detail-container {
    width: 100%;
    max-width: none;
    margin: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ========================================
   Detail Navigation
   ======================================== */
.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(180deg, var(--ui-bg-surface) 0%, rgba(255, 253, 249, 0.95) 100%);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ui-border-subtle);
  animation: fadeInUp 400ms var(--transition-slow) backwards;
}

.detail-nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.back-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 500;
  padding: var(--space-xs) var(--space-sm);
  margin: calc(var(--space-xs) * -1) calc(var(--space-sm) * -1);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.back-link:hover {
  background: var(--ui-bg-surface-muted);
  color: var(--ui-accent);
}

.back-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-icon svg {
  width: 18px;
  height: 18px;
}

.save-button {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--ui-bg-surface-muted);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-round);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-text);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.save-button svg {
  width: 16px;
  height: 16px;
  color: var(--ui-accent);
}

.save-button:hover {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: var(--ui-text-inverse);
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow-2);
}

.save-button:hover svg {
  color: var(--ui-text-inverse);
}

.recipe-favorite-control {
  margin: 0;
}

.recipe-favorite-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-round);
  background: var(--ui-bg-surface-muted);
  color: var(--ui-accent);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.recipe-favorite-button svg {
  width: 19px;
  height: 19px;
}

.recipe-favorite-button:hover,
.recipe-favorite-button:focus-visible {
  border-color: var(--ui-accent);
  background: var(--ui-bg-surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 24%, transparent);
  outline: 0;
}

.recipe-favorite-button.is-favorited {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: var(--ui-text-inverse);
}

.recipe-favorite-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.recipe-detail-plan-open {
  border-color: var(--ui-accent-hover);
  background: var(--ui-accent);
  color: var(--ui-text-inverse);
  box-shadow: none;
}

.recipe-detail-plan-open svg {
  color: var(--ui-text-inverse);
}

.recipe-detail-plan-open:hover {
  background: var(--ui-accent-hover);
  border-color: var(--ui-accent-hover);
  box-shadow: none;
}

body.recipe-detail-plan-modal-open {
  overflow: hidden;
}

.recipe-detail-plan {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.recipe-detail-plan.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.recipe-detail-plan-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background:
    linear-gradient(180deg, rgba(51, 39, 31, 0.28), rgba(51, 39, 31, 0.46)),
    radial-gradient(circle at 50% 8%, rgba(250, 248, 243, 0.18), transparent 46%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.recipe-detail-plan-panel {
  position: relative;
  width: 100%;
  max-height: min(82vh, 720px);
  max-height: min(82dvh, 720px);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow: hidden;
  padding: var(--space-sm) var(--space-lg) calc(var(--space-lg) + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  border: 1px solid color-mix(in srgb, var(--ui-border) 74%, var(--ui-accent) 26%);
  border-bottom: 0;
  background:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--ui-accent-soft) 14%, transparent), transparent 38%),
    linear-gradient(180deg, rgba(255, 253, 249, 0.99), rgba(250, 248, 243, 0.98));
  box-shadow: 0 -24px 64px rgba(61, 44, 31, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.74);
  transform: translateY(24px);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.recipe-detail-plan.is-open .recipe-detail-plan-panel {
  transform: translateY(0);
}

.recipe-detail-plan-handle {
  flex: 0 0 auto;
  width: 72px;
  height: 6px;
  margin: 0 auto var(--space-xs);
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--ui-text-subtle) 34%, transparent);
}

.recipe-detail-plan-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-md);
  text-align: center;
}

.recipe-detail-plan-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.45rem + 1.35vw, 2.25rem);
  line-height: var(--leading-tight);
  color: var(--ui-text-strong);
  letter-spacing: var(--tracking-tight);
}

.recipe-detail-plan-header p {
  margin: var(--space-xs) 0 0;
  color: var(--ui-text-subtle);
  font-size: var(--text-body);
  line-height: var(--leading-snug);
}

.recipe-detail-plan-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-round);
  background: transparent;
  color: var(--ui-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

.recipe-detail-plan-close:hover,
.recipe-detail-plan-close:focus-visible {
  color: var(--ui-text-strong);
  background: color-mix(in srgb, var(--ui-accent-soft) 30%, transparent);
  transform: translateY(-1px);
}

.recipe-detail-plan-close svg {
  width: 20px;
  height: 20px;
}

.recipe-detail-plan-days {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(7, minmax(76px, 1fr));
  gap: var(--space-sm);
  overflow-x: auto;
  overflow-y: hidden;
  padding: var(--space-xs) 0 var(--space-sm);
  scrollbar-width: none;
}

.recipe-detail-plan-days::-webkit-scrollbar {
  display: none;
}

.recipe-detail-plan-day {
  min-height: 92px;
  min-width: 76px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--ui-bg-surface) 92%, white 8%);
  color: var(--ui-text);
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: var(--ui-shadow-1);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.recipe-detail-plan-day:hover,
.recipe-detail-plan-day:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--ui-accent) 42%, var(--ui-border));
  box-shadow: var(--ui-shadow-2);
}

.recipe-detail-plan-day.is-selected {
  border-color: var(--ui-accent-hover);
  background: linear-gradient(180deg, var(--ui-accent) 0%, var(--ui-accent-hover) 100%);
  color: var(--ui-text-inverse);
  box-shadow: 0 14px 28px rgba(168, 78, 48, 0.2);
}

.recipe-detail-plan-day-name,
.recipe-detail-plan-day-month {
  font-size: var(--text-sm);
  line-height: 1.1;
}

.recipe-detail-plan-day-name--mobile {
  display: none;
}

.recipe-detail-plan-day-number {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.recipe-detail-plan-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: var(--space-xs);
  display: grid;
  align-content: start;
  gap: var(--space-md);
}

.recipe-detail-plan-list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
}

.recipe-detail-plan-list-heading h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-title-sm);
  color: var(--ui-text-strong);
}

.recipe-detail-plan-list-heading span {
  color: var(--ui-accent-hover);
  font-size: var(--text-body);
  font-variant-numeric: tabular-nums;
}

.recipe-detail-plan-assignments {
  display: grid;
  gap: var(--space-sm);
}

.recipe-detail-plan-assignment {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: var(--space-sm-md);
  align-items: center;
  padding: var(--space-sm-md);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--ui-bg-surface) 94%, white 6%);
  box-shadow: var(--ui-shadow-1);
}

.recipe-detail-plan-assignment.is-selected-day {
  border-color: color-mix(in srgb, var(--ui-accent) 36%, var(--ui-border));
  background: color-mix(in srgb, var(--ui-accent) 7%, var(--ui-bg-surface));
}

.recipe-detail-plan-assignment-date {
  display: none;
}

.recipe-detail-plan-assignment-preview {
  width: 74px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--ui-bg-surface-muted-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-border) 72%, transparent);
}

.recipe-detail-plan-assignment-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-detail-plan-assignment-preview--text {
  display: grid;
  place-items: center;
  padding: var(--space-xs);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--ui-positive-soft) 44%, var(--ui-bg-surface)) 0%, var(--ui-bg-surface) 100%);
  color: var(--ui-positive-hover);
  text-align: center;
}

.recipe-detail-plan-text-preview-label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.recipe-detail-plan-text-preview-mark {
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1;
}

.recipe-detail-plan-assignment-main {
  min-width: 0;
}

.recipe-detail-plan-assignment-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
}

.recipe-detail-plan-assignment h4 {
  margin: 0;
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--text-body-lg);
  line-height: var(--leading-snug);
  color: var(--ui-text-strong);
}

.recipe-detail-plan-assignment p {
  margin: var(--space-xs) 0 0;
  color: var(--ui-text-muted);
  font-size: var(--text-sm);
  line-height: 1.3;
}

.recipe-detail-plan-assignment-badge {
  justify-self: end;
  flex-shrink: 0;
  padding: 5px var(--space-sm);
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--ui-accent) 18%, transparent);
  background: color-mix(in srgb, var(--ui-accent) 13%, var(--ui-bg-surface));
  color: var(--ui-accent-hover);
  font-size: var(--text-caption);
  font-weight: 700;
}

.recipe-detail-plan-remove-form {
  position: absolute;
  right: var(--space-sm);
  bottom: var(--space-sm);
  margin: 0;
}

.recipe-detail-plan-remove {
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--ui-border) 76%, transparent);
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--ui-bg-surface) 84%, transparent);
  color: color-mix(in srgb, var(--ui-text-muted) 76%, transparent);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0.64;
  transition: transform var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast), opacity var(--transition-fast);
}

.recipe-detail-plan-remove:hover,
.recipe-detail-plan-remove:focus-visible {
  opacity: 1;
  border-color: color-mix(in srgb, var(--ui-accent) 42%, var(--ui-border));
  color: var(--ui-accent-hover);
  background: color-mix(in srgb, var(--ui-accent) 8%, var(--ui-bg-surface));
  transform: translateY(-1px);
}

@media (hover: hover) and (pointer: fine) {
  .recipe-detail-plan-remove {
    opacity: 0;
  }

  .recipe-detail-plan-assignment:hover .recipe-detail-plan-remove,
  .recipe-detail-plan-assignment:focus-within .recipe-detail-plan-remove {
    opacity: 0.88;
  }
}

.recipe-detail-plan-empty {
  margin: 0;
  padding: var(--space-lg);
  border: 1px dashed var(--ui-border);
  border-radius: var(--radius-lg);
  color: var(--ui-text-muted);
  text-align: center;
}

.recipe-detail-plan-actions {
  flex: 0 0 auto;
  display: grid;
  gap: var(--space-sm-md);
}

.recipe-detail-plan-add-form {
  margin: 0;
}

.recipe-detail-plan-submit,
.recipe-detail-plan-cancel {
  width: 100%;
  min-height: 54px;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.recipe-detail-plan-submit {
  border: 1px solid var(--ui-accent-hover);
  background: linear-gradient(180deg, var(--ui-accent) 0%, var(--ui-accent-hover) 100%);
  color: var(--ui-text-inverse);
  box-shadow: 0 14px 28px rgba(168, 78, 48, 0.18);
}

.recipe-detail-plan-submit:hover:not(:disabled),
.recipe-detail-plan-submit:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(180deg, var(--ui-accent-hover) 0%, #8f4228 100%);
}

.recipe-detail-plan-submit:disabled,
.recipe-detail-plan-submit.is-disabled {
  cursor: not-allowed;
  border-color: var(--ui-border);
  background: color-mix(in srgb, var(--ui-bg-surface-muted-strong) 86%, var(--ui-text-subtle) 14%);
  color: var(--ui-text-muted);
  box-shadow: none;
}

.recipe-detail-plan-cancel {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-accent-hover);
}

.recipe-detail-plan-cancel:hover,
.recipe-detail-plan-cancel:focus-visible {
  background: color-mix(in srgb, var(--ui-accent) 8%, transparent);
}

@media (max-width: 767px) {
  body.controller-entries.action-show .app-navbar-shell {
    display: none;
  }

  body.controller-entries.action-show .app-main {
    padding-top: 0;
  }

  .detail-nav {
    position: relative;
    top: auto;
    padding: 16px clamp(14px, 4vw, 22px);
    gap: 8px;
    background: color-mix(in srgb, var(--ui-bg-surface) 96%, white 4%);
    backdrop-filter: none;
    border-bottom-color: color-mix(in srgb, var(--ui-border) 86%, transparent);
  }

  .detail-nav .back-link {
    flex: 0 0 auto;
    gap: 7px;
    padding: 0;
    margin: 0;
    font-size: clamp(0.9rem, 3.5vw, 1rem);
    line-height: 1.15;
    white-space: nowrap;
  }

  .detail-nav-actions {
    flex: 0 0 auto;
    gap: 8px;
  }

  .detail-nav .save-button {
    min-height: 42px;
    padding: 0 10px;
    gap: 5px;
    font-size: 0.84rem;
    line-height: 1;
    white-space: nowrap;
  }

  .detail-nav .save-button svg {
    width: 15px;
    height: 15px;
  }

  .recipe-detail-plan-panel {
    height: auto;
    max-height: min(78vh, 720px);
    max-height: min(78dvh, 720px);
    gap: 14px;
    padding: 10px clamp(18px, 5vw, 36px) calc(16px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
  }

  .recipe-detail-plan-header {
    align-items: center;
    text-align: center;
  }

  .recipe-detail-plan-header h2 {
    font-size: var(--text-title-sm);
  }

  .recipe-detail-plan-header p {
    font-size: var(--text-sm);
  }

  .recipe-detail-plan-close {
    width: 36px;
    height: 36px;
    margin-right: -8px;
  }

  .recipe-detail-plan-days {
    grid-template-columns: repeat(7, minmax(48px, 1fr));
    gap: 6px;
    overflow-x: auto;
    padding: 2px 0 4px;
  }

  .recipe-detail-plan-day {
    min-width: 48px;
    min-height: 70px;
    gap: 1px;
    padding: 6px 4px;
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(61, 44, 31, 0.06);
  }

  .recipe-detail-plan-day-name--desktop {
    display: none;
  }

  .recipe-detail-plan-day-name--mobile {
    display: inline;
  }

  .recipe-detail-plan-day-name,
  .recipe-detail-plan-day-month {
    font-size: 0.74rem;
    letter-spacing: 0.01em;
  }

  .recipe-detail-plan-day-number {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 5vw, 1.55rem);
    font-weight: 400;
  }

  .recipe-detail-plan-body {
    flex: 0 1 auto;
    margin-right: calc(clamp(18px, 5vw, 36px) * -1);
    padding-right: clamp(18px, 5vw, 36px);
    gap: 12px;
  }

  .recipe-detail-plan-list-heading h3 {
    font-family: var(--font-body);
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: -0.02em;
  }

  .recipe-detail-plan-list-heading span {
    font-size: 0.92rem;
  }

  .recipe-detail-plan-assignments {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0 0 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .recipe-detail-plan-assignments::-webkit-scrollbar {
    display: none;
  }

  .recipe-detail-plan-assignment {
    flex: 0 0 clamp(140px, 38vw, 158px);
    min-width: 140px;
    scroll-snap-align: start;
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 8px;
    padding: 9px;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(61, 44, 31, 0.06);
  }

  .recipe-detail-plan-assignment-date {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 4px;
    padding-right: 48px;
    color: var(--ui-text);
    line-height: 1.05;
  }

  .recipe-detail-plan-assignment-date strong {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
  }

  .recipe-detail-plan-assignment-date span {
    font-size: 0.74rem;
    color: var(--ui-text-muted);
  }

  .recipe-detail-plan-assignment-date span:first-child {
    flex-basis: 100%;
    font-size: 0.78rem;
    color: var(--ui-text);
    font-weight: 500;
  }

  .recipe-detail-plan-assignment-preview {
    width: 100%;
    aspect-ratio: 5 / 4;
    border-radius: 10px;
  }

  .recipe-detail-plan-assignment-main {
    display: grid;
    gap: 2px;
  }

  .recipe-detail-plan-assignment-title-row {
    display: block;
  }

  .recipe-detail-plan-assignment h4 {
    font-family: var(--font-body);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .recipe-detail-plan-assignment p {
    display: none;
  }

  .recipe-detail-plan-assignment-badge {
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 3px 7px;
    border-radius: 7px;
    font-size: 0.66rem;
    font-weight: 700;
  }

  .recipe-detail-plan-remove-form {
    position: absolute;
    right: 6px;
    bottom: 6px;
  }

  .recipe-detail-plan-remove {
    width: 26px;
    height: 26px;
    min-height: 26px;
    background: color-mix(in srgb, var(--ui-bg-surface) 76%, transparent);
    font-size: 14px;
    opacity: 0;
  }

  .recipe-detail-plan-assignment:hover .recipe-detail-plan-remove,
  .recipe-detail-plan-assignment:focus-within .recipe-detail-plan-remove {
    opacity: 0.9;
  }

  .recipe-detail-plan-actions {
    gap: 6px;
    margin-top: 4px;
  }

  .recipe-detail-plan-submit {
    min-height: 50px;
    border-radius: 14px;
    font-size: 1.02rem;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(168, 78, 48, 0.16);
  }

  .recipe-detail-plan-cancel {
    min-height: 38px;
    font-size: 0.96rem;
    font-weight: 500;
  }
}

@media (max-width: 479px) {
  .detail-nav-actions {
    gap: 4px;
  }

  .detail-nav .save-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
    justify-content: center;
  }

  .detail-nav .save-button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (min-width: 768px) {
  .recipe-detail-plan {
    align-items: center;
    padding: var(--space-lg);
  }

  .recipe-detail-plan-panel {
    width: min(560px, calc(100vw - 48px));
    height: min(86vh, 760px);
    height: min(86dvh, 760px);
    max-height: min(86vh, 760px);
    max-height: min(86dvh, 760px);
    padding: var(--space-lg);
    border-radius: var(--radius-xl);
    border-bottom: 1px solid color-mix(in srgb, var(--ui-border) 74%, var(--ui-accent) 26%);
    transform: translateY(16px) scale(0.985);
    box-shadow: 0 32px 90px rgba(61, 44, 31, 0.22), 0 8px 24px rgba(61, 44, 31, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.74);
  }

  .recipe-detail-plan.is-open .recipe-detail-plan-panel {
    transform: translateY(0) scale(1);
  }

  .recipe-detail-plan-handle {
    display: none;
  }

  .recipe-detail-plan-header {
    text-align: left;
  }

  .recipe-detail-plan-header h2 {
    font-size: var(--text-title-sm);
  }

  .recipe-detail-plan-header p {
    font-size: var(--text-sm);
  }

  .recipe-detail-plan-days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
  }

  .recipe-detail-plan-day {
    min-height: 86px;
    min-width: 0;
  }

  .recipe-detail-plan-day-number {
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 700;
  }

  .recipe-detail-plan-day-month {
    color: inherit;
  }

  .recipe-detail-plan-actions {
    min-height: 100px;
  }

  .recipe-detail-plan-submit,
  .recipe-detail-plan-cancel {
    min-height: 44px;
    border-radius: var(--radius-md);
    font-size: var(--text-body);
  }
}

@media (prefers-reduced-motion: reduce) {
  .recipe-detail-plan,
  .recipe-detail-plan-panel {
    transition-duration: 1ms;
  }
}

/* ========================================
   Video Hero Section
   ======================================== */
.video-hero {
  background: var(--ui-bg-inverse);
  position: relative;
  animation: fadeInUp 500ms 100ms var(--transition-slow) backwards;
}

.recipe-detail-frame {
  display: contents;
}

.video-player-wrapper {
  position: relative;
}

.video-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  background: var(--color-black);
}

.video-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.video-placeholder {
  position: absolute;
  inset: 0;
}

.video-placeholder img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-player-glow {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
}

.video-info {
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(180deg, var(--ui-bg-inverse) 0%, var(--ui-bg-inverse-muted) 100%);
}

.video-hero-recipe {
  display: none;
}

.video-hero-recipe--always-visible {
  display: block;
  margin-bottom: var(--space-lg);
}

.video-hero-kicker {
  display: inline-block;
  margin-bottom: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.video-hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-title-lg);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--ui-text-inverse);
}

.video-hero-description {
  margin: var(--space-sm) 0 0;
  font-size: var(--text-body);
  line-height: 1.68;
  color: rgba(255, 255, 255, 0.78);
}

.video-source {
  display: flex;
  align-items: center;
  min-width: 0;
}

.video-source-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.video-source-kind {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--color-paper) 84%, var(--color-cream-dark));
  color: var(--color-sage-dark);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.channel-attribution--detail {
  align-self: flex-start;
  color: var(--ui-text-inverse);
}

.channel-attribution--detail .channel-attribution__avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--ui-accent) 0%, var(--ui-accent-hover) 100%);
}

.channel-attribution--detail .channel-attribution__avatar::after {
  inset: var(--space-2xs);
  border-color: rgba(255, 255, 255, 0.2);
}

.channel-attribution--detail .channel-attribution__label {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

a.channel-attribution--detail:hover,
.channel-attribution--detail:focus-visible {
  color: var(--ui-accent-soft);
}

.video-title-small {
  display: block;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: rgba(255,255,255,0.62);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-source--text .video-title-small {
  color: var(--color-warm-gray);
}

/* ========================================
   Recipe Selector Tabs
   ======================================== */
.recipe-selector {
  padding: var(--space-md) var(--space-lg);
  background: var(--ui-bg-surface-muted);
  border-bottom: 1px solid var(--ui-border);
  animation: fadeInUp 500ms 150ms var(--transition-slow) backwards;
}

.recipe-selector-label {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--ui-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-sm);
}

.recipe-tabs {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  margin: 0 calc(var(--space-lg) * -1);
  padding: 0 var(--space-lg);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.recipe-tabs::-webkit-scrollbar {
  display: none;
}

.recipe-tab {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-round);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ui-text);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.recipe-tab:hover {
  border-color: var(--ui-positive-soft);
  box-shadow: var(--ui-shadow-1);
  text-decoration: none;
}

.recipe-tab.active {
  background: var(--ui-positive);
  border-color: var(--ui-positive);
  color: var(--ui-text-inverse);
  box-shadow: var(--ui-shadow-1);
}

.tab-number {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.1);
  border-radius: 50%;
  font-size: var(--text-caption);
  font-weight: 700;
}

.recipe-tab.active .tab-number {
  background: rgba(255,255,255,0.25);
}

.tab-name {
  font-weight: 500;
}

/* ========================================
   Recipe Content
   ======================================== */
.recipe-content {
  padding: 0 0 var(--space-xl);
}

.video-hero .recipe-content,
.video-hero .detail-footer {
  background: var(--ui-bg-surface);
}

.video-hero .detail-footer {
  margin-top: 0;
}

/* Recipe Header */
.recipe-header {
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  text-align: center;
  display: grid;
  justify-items: center;
  row-gap: var(--space-md);
  animation: none;
}

.recipe-badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  background: var(--ui-accent);
  color: var(--ui-text-inverse);
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border-radius: var(--radius-sm);
  position: relative;
}

.recipe-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  border-radius: inherit;
}

.recipe-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-title-md);
  font-weight: 600;
  color: var(--ui-text-strong);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.recipe-description {
  margin: 0;
  font-size: var(--text-body);
  color: var(--ui-text-muted);
  line-height: var(--leading-body);
  max-width: 44ch;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
  justify-self: stretch;
}

/* Meta Bar */
.recipe-meta-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--ui-bg-surface-muted);
  border-radius: var(--radius-lg);
  border: 1px solid var(--ui-border-subtle);
}

.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.meta-item .meta-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-accent);
  margin-bottom: var(--space-xs);
}

.meta-item .meta-icon svg {
  width: 20px;
  height: 20px;
}

.meta-value {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--ui-text-strong);
}

.meta-label {
  font-size: 11px;
  color: var(--ui-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-divider {
  width: 1px;
  height: 40px;
  background: var(--ui-border);
}

/* ========================================
   Ingredients Section
   ======================================== */
.ingredients-section {
  padding: var(--space-lg);
  animation: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ui-text-strong);
}

.section-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ui-positive-soft);
  border-radius: var(--radius-sm);
  color: var(--ui-positive-hover);
}

.section-icon svg {
  width: 16px;
  height: 16px;
}

.section-icon.prep-ahead-icon {
  width: 31px;
  height: 31px;
  background: transparent;
  color: var(--ui-text-strong);
}

.section-icon.prep-ahead-icon svg {
  width: 29px;
  height: 31px;
}

.section-icon.ingredients-icon,
.section-icon.steps-icon {
  width: 31px;
  height: 31px;
  background: transparent;
  color: var(--ui-text-strong);
}

.section-icon.ingredients-icon svg,
.section-icon.steps-icon svg {
  width: 21px;
  height: 21px;
}

.section-icon.tips-heading-icon {
  width: 31px;
  height: 31px;
  background: transparent;
  color: var(--ui-text-strong);
}

.section-icon.tips-heading-icon svg {
  width: 20px;
  height: 31px;
}

.ingredients-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ingredient-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
  animation: none;
}

.ingredient-item:nth-child(1) { animation-delay: 280ms; }
.ingredient-item:nth-child(2) { animation-delay: 320ms; }
.ingredient-item:nth-child(3) { animation-delay: 360ms; }
.ingredient-item:nth-child(4) { animation-delay: 400ms; }
.ingredient-item:nth-child(5) { animation-delay: 440ms; }
.ingredient-item:nth-child(6) { animation-delay: 480ms; }

.ingredient-item:last-child {
  margin-bottom: 0;
}

.ingredient-item:hover {
  border-color: var(--ui-positive-soft);
  box-shadow: var(--ui-shadow-1);
}

/* Ingredient sprite */
.ingredient-sprite-slot {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ingredient-sprite-image {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  filter: drop-shadow(0 4px 8px rgba(68, 51, 38, 0.12));
}

.ingredient-normalization-indicator,
.ingredient-sprite-placeholder {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-round);
  background: var(--ui-bg-surface-muted);
  border: 1px solid var(--ui-border-subtle);
}

.ingredient-normalization-indicator {
  position: relative;
  border-color: rgba(196, 93, 58, 0.28);
}

.ingredient-normalization-indicator::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: var(--radius-round);
  border: 2px solid rgba(196, 93, 58, 0.24);
  border-top-color: var(--ui-accent);
  animation: ingredientNormalizationSpin 900ms linear infinite;
}

@keyframes ingredientNormalizationSpin {
  to { transform: rotate(360deg); }
}

.ingredient-amount {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--ui-text-subtle);
  min-width: 52px;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.ingredient-main {
  flex: 1;
  min-width: 0;
}

.ingredient-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--ui-text-strong);
  line-height: 1.45;
}


/* ========================================
   Steps Section
   ======================================== */
.steps-section {
  padding: 0 var(--space-lg) var(--space-lg);
  animation: none;
}

.steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

/* Connecting line */
.steps-list::before {
  content: '';
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 15px;
  width: 2px;
  background: var(--ui-border);
  border-radius: 1px;
}

.step-item {
  display: flex;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  position: relative;
  animation: none;
}

.step-item:nth-child(1) { animation-delay: 380ms; }
.step-item:nth-child(2) { animation-delay: 430ms; }
.step-item:nth-child(3) { animation-delay: 480ms; }
.step-item:nth-child(4) { animation-delay: 530ms; }
.step-item:nth-child(5) { animation-delay: 580ms; }
.step-item:nth-child(6) { animation-delay: 630ms; }

.step-item:last-child {
  padding-bottom: 0;
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--ui-positive);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ui-text-inverse);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  box-shadow: var(--ui-shadow-1);
}

.step-content {
  flex: 1;
  padding-top: 4px;
}

.step-text {
  margin: 0 0 var(--space-sm);
  font-size: 15px;
  color: var(--ui-text);
  line-height: 1.6;
}

.prep-ahead-section {
  padding: 0 var(--space-lg) var(--space-lg);
  animation: none;
}

.prep-analysis-status {
  font-size: var(--text-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-round);
  border: 1px solid var(--ui-border-subtle);
  background: var(--ui-bg-surface);
  color: var(--ui-text);
}

.prep-analysis-status--succeeded {
  background: var(--ui-positive-soft);
  border-color: color-mix(in srgb, var(--ui-positive) 28%, var(--ui-border-subtle));
  color: var(--ui-text);
}

.prep-analysis-status--failed {
  background: color-mix(in srgb, var(--ui-accent-soft) 55%, var(--ui-bg-surface));
  border-color: color-mix(in srgb, var(--ui-accent) 28%, var(--ui-border-subtle));
  color: var(--ui-text);
}

.prep-analysis-status--running,
.prep-analysis-status--queued {
  background: var(--ui-bg-surface-muted-strong);
  color: var(--ui-text);
}

.prep-analysis-error,
.prep-analysis-note {
  margin: 0 0 var(--space-md);
  color: var(--ui-text-muted);
}

.prep-task-list {
  display: grid;
  gap: var(--space-md);
}

.prep-task-card {
  padding: var(--space-md);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  background: var(--ui-bg-surface);
  box-shadow: var(--ui-shadow-1);
}

.prep-task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.prep-task-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ui-text-strong);
}

.prep-task-timing {
  flex-shrink: 0;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-round);
  border: 1px solid color-mix(in srgb, var(--ui-positive) 28%, var(--ui-border-subtle));
  background: var(--ui-positive-soft);
  color: var(--ui-text);
  font-size: var(--text-sm);
  font-weight: 600;
}

.prep-task-instruction {
  margin: 0 0 var(--space-md);
  color: var(--ui-text);
}

.prep-task-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  list-style: none;
  margin: 0;
  padding: 0;
}

.prep-task-ingredients li {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-round);
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border);
  color: var(--ui-text-muted);
  font-size: var(--text-sm);
}

/* ========================================
   Tips Section
   ======================================== */
/* ========================================
   Weekly Prep Page
   ======================================== */
.prep-page-container .queue-header {
  padding-bottom: 0;
  border-bottom: 0;
  background: var(--ui-bg-surface);
}

.prep-page-container .queue-nav {
  margin-bottom: 0;
}

.prep-page-content {
  padding: var(--space-sm-md) var(--space-lg) var(--space-2xl);
  display: grid;
  gap: var(--space-xl);
}

.prep-date-group {
  display: grid;
  gap: var(--space-sm-md);
}

.prep-date-group h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-body-lg);
  font-weight: 400;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--ui-text-strong);
}

.prep-recipe-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: var(--space-sm-md);
  align-items: start;
}

.prep-recipe-card {
  position: relative;
  padding: var(--space-sm-md) var(--space-md) var(--space-md);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  background: var(--ui-bg-surface);
  box-shadow: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.prep-recipe-card:hover,
.prep-recipe-card:focus-within {
  border-color: color-mix(in srgb, var(--ui-positive) 34%, var(--ui-border));
  box-shadow: var(--ui-shadow-1);
}

.prep-recipe-title-row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-inline-end: clamp(116px, 34%, 150px);
}

.prep-recipe-link {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: 1.18;
  color: var(--ui-text-strong);
  text-decoration: none;
}

.prep-recipe-link:hover,
.prep-recipe-link:focus-visible {
  color: var(--ui-accent-hover);
}

.prep-ingredient-disclosure {
  margin: 0;
  interpolate-size: allow-keywords;
}

.prep-ingredient-disclosure::details-content {
  height: 0;
  overflow: clip;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    height 220ms cubic-bezier(0.25, 1, 0.5, 1),
    content-visibility 220ms allow-discrete,
    opacity 160ms cubic-bezier(0.25, 1, 0.5, 1),
    transform 220ms cubic-bezier(0.25, 1, 0.5, 1);
}

.prep-ingredient-disclosure[open]::details-content {
  height: auto;
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .prep-ingredient-disclosure::details-content,
  .prep-ingredient-disclosure summary svg {
    transition-duration: 0.01ms !important;
  }
}

.prep-ingredient-disclosure summary {
  position: absolute;
  top: 12px;
  right: var(--space-md);
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-xs);
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  color: var(--ui-positive-hover);
  font-size: var(--text-sm);
  font-weight: 400;
  white-space: nowrap;
}

.prep-ingredient-disclosure summary::-webkit-details-marker {
  display: none;
}

.prep-ingredient-disclosure summary:hover,
.prep-ingredient-disclosure summary:focus-visible {
  color: var(--ui-accent-hover);
}

.prep-ingredient-disclosure summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--ui-positive) 55%, transparent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.prep-ingredient-disclosure summary svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.prep-ingredient-disclosure[open] summary svg {
  transform: rotate(180deg);
}

.prep-ingredients {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--ui-border-subtle);
}

.prep-ingredients h3,
.prep-steps h3 {
  margin: 0 0 var(--space-sm);
  color: var(--ui-positive-hover);
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.prep-ingredients ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--ui-border-subtle);
}

.prep-ingredient-line {
  min-width: 0;
  padding: 10px var(--space-xs);
  border-bottom: 1px solid var(--ui-border-subtle);
  color: var(--ui-text);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.prep-ingredient-line:nth-child(odd) {
  padding-right: var(--space-sm);
  border-right: 1px solid var(--ui-border-subtle);
}

.prep-ingredient-line:nth-child(even) {
  padding-left: var(--space-lg);
}

.prep-ingredients p,
.prep-step-empty {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: var(--text-sm);
  font-style: italic;
}

.prep-steps {
  margin-top: var(--space-xs);
}

.prep-step-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: prep-step;
  border-top: 1px solid var(--ui-border-subtle);
}

.prep-step-list li {
  counter-increment: prep-step;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--space-sm);
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--ui-border-subtle);
  color: var(--ui-text);
  font-size: var(--text-sm);
  line-height: 1.35;
}

.prep-step-list li::before {
  content: counter(prep-step);
  color: var(--ui-positive-hover);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.prep-empty-card {
  margin: 0;
}

@media (max-width: 719px) {
  .prep-page-content {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .prep-page-container .queue-header {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }
}

.tips-section {
  padding: 0 var(--space-lg);
  animation: fadeInUp 500ms 500ms var(--transition-slow) backwards;
}

.tips-section .section-header {
  margin-bottom: var(--space-md);
}

.tip-count {
  font-size: 12px;
  color: var(--ui-text-muted);
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border-subtle);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-round);
}

.tips-list {
  display: grid;
  gap: var(--space-md);
}

.tips-card {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: linear-gradient(135deg, rgba(250, 248, 243, 0.9) 0%, rgba(243, 239, 230, 0.9) 100%);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  box-shadow: var(--ui-shadow-1);
}

.tips-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--ui-accent);
}

.tips-card:nth-child(2)::before {
  background: var(--ui-positive);
}

.tips-card:nth-child(3)::before {
  background: var(--ui-accent-hover);
}

.tips-icon {
  width: 36px;
  height: 36px;
  background: var(--ui-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--ui-shadow-1);
}

.tips-card:nth-child(2) .tips-icon {
  background: var(--ui-positive);
}

.tips-card:nth-child(3) .tips-icon {
  background: var(--ui-accent-hover);
}

.tips-icon svg {
  width: 18px;
  height: 18px;
  color: var(--ui-text-inverse);
}

.tips-content {
  flex: 1;
}

.tips-content h3 {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--ui-text-strong);
}

.tips-content p {
  margin: 0;
  font-size: 13px;
  color: var(--ui-text-muted);
  line-height: 1.6;
}

/* ========================================
   Detail Footer
   ======================================== */
.detail-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--ui-border);
  margin-top: var(--space-lg);
  animation: fadeInUp 500ms 550ms var(--transition-slow) backwards;
}

.source-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--ui-bg-surface-muted);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-text);
  transition: all var(--transition-fast);
}

.source-link svg {
  width: 16px;
  height: 16px;
  color: var(--ui-accent);
}

.source-link:hover {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: var(--ui-text-inverse);
}

.source-link:hover svg {
  color: var(--ui-text-inverse);
}

/* ========================================
   Detail Page Responsive
   ======================================== */
@media (min-width: 768px) {
  .detail-container {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-xl);
    border-radius: var(--radius-xl);
    min-height: calc(100vh - var(--space-xl) * 2);
    overflow: hidden;
  }
  
  .video-player {
    border-radius: 0;
  }
}

/* ========================================
   Prompt Lab
   ======================================== */
.prompt-lab-shell {
  max-width: 1120px;
  margin: var(--space-xl) auto;
  padding: 0 var(--space-lg) var(--space-2xl);
  position: relative;
  z-index: 2;
  display: grid;
  gap: var(--space-md);
}

.prompt-lab-header {
  display: grid;
  gap: var(--space-xs);
  max-width: 72ch;
}

.prompt-lab-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--ui-text-strong);
  letter-spacing: -0.02em;
}

.prompt-lab-header p {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: 14px;
}

.prompt-lab-kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ui-accent-hover);
}

.prompt-lab-flashes {
  display: grid;
  gap: var(--space-sm);
}

.prompt-lab-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-md);
}

.prompt-lab-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

.prompt-lab-grid {
  display: grid;
  gap: var(--space-md);
  align-items: start;
}

.prompt-lab-history-grid {
  display: grid;
  gap: var(--space-md);
  align-items: start;
}

.prompt-lab-card {
  background: var(--ui-bg-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--ui-shadow-1);
  padding: var(--space-md);
  display: grid;
  gap: var(--space-sm);
}

.prompt-lab-card h2,
.prompt-lab-card h3 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--ui-text-strong);
}

.prompt-lab-card h2 {
  font-size: 22px;
}

.prompt-lab-card h3 {
  font-size: 16px;
}

.prompt-lab-preview {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--ui-border-subtle);
  background: var(--ui-bg-surface-muted);
  padding: var(--space-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.prompt-lab-form {
  display: grid;
  gap: var(--space-sm);
}

.prompt-lab-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--ui-text-subtle);
}

.prompt-lab-input,
.prompt-lab-select,
.prompt-lab-textarea {
  width: 100%;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  background: var(--ui-bg-surface-muted);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ui-text-strong);
  padding: 10px 12px;
}

.prompt-lab-input:focus,
.prompt-lab-select:focus,
.prompt-lab-textarea:focus {
  outline: none;
  border-color: var(--ui-positive);
  box-shadow: 0 0 0 3px var(--ui-focus-ring);
  background: var(--ui-bg-surface);
}

.prompt-lab-textarea {
  min-height: 100px;
  resize: vertical;
}

.prompt-lab-field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.prompt-lab-actions {
  display: flex;
  justify-content: flex-end;
}

.prompt-lab-actions--start {
  justify-content: flex-start;
}

.prompt-lab-run-panel {
  border-top: 1px solid var(--ui-border-subtle);
  padding-top: var(--space-sm);
  display: grid;
  gap: var(--space-sm);
}

.prompt-lab-run-form {
  display: grid;
  gap: var(--space-sm);
}

.prompt-lab-run-hint {
  margin: 0;
  font-size: 12px;
  color: var(--ui-text-subtle);
}

.prompt-lab-button {
  border: none;
  border-radius: var(--radius-round);
  padding: 10px 16px;
  background: var(--ui-accent);
  color: var(--ui-text-inverse);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.prompt-lab-button:hover {
  background: var(--ui-accent-hover);
  transform: translateY(-1px);
}

.prompt-lab-button:disabled {
  cursor: not-allowed;
  background: var(--ui-bg-surface-muted-strong);
  color: var(--ui-text-subtle);
  transform: none;
}

.prompt-lab-button--subtle {
  background: var(--ui-bg-surface-muted);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
}

.prompt-lab-button--subtle:hover {
  background: var(--ui-bg-surface);
}

.prompt-lab-version-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-xs);
}

.prompt-lab-run-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-xs);
}

.prompt-lab-run-list li {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs);
  border: 1px solid var(--ui-border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--ui-bg-surface-muted);
}

.prompt-lab-version-list li {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs);
  border: 1px solid var(--ui-border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--ui-bg-surface-muted);
}

.prompt-lab-version-list p {
  margin: 0;
}

.prompt-lab-version-meta,
.prompt-lab-source-note,
.prompt-lab-empty {
  color: var(--ui-text-subtle);
  font-size: 12px;
}

.prompt-lab-version-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.prompt-lab-version-actions form {
  margin: 0;
}

.prompt-lab-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs);
}

@media (min-width: 960px) {
  .prompt-lab-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  }

  .prompt-lab-history-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }

  .prompt-lab-field-row {
    grid-template-columns: 2fr 1fr;
  }

  .prompt-lab-version-list li {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .prompt-lab-run-list li {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .prompt-lab-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ========================================
   User Ingress
   ======================================== */
.auth-shell {
  --auth-visual-height: 225px;
  --auth-tear-mobile-angle: 1.35deg;
  --auth-tear-desktop-angle: -0.4deg;
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: var(--auth-visual-height) minmax(0, 1fr);
  overflow: hidden;
  background: var(--ui-bg-surface);
}

.auth-shell--registration {
  --auth-visual-height: 169px;
  --auth-tear-mobile-angle: 2.05deg;
  --auth-tear-desktop-angle: -0.65deg;
}

.auth-shell--password {
  --auth-visual-height: 240px;
  --auth-tear-mobile-angle: 1.7deg;
  --auth-tear-desktop-angle: -0.5deg;
}

.auth-visual {
  min-width: 0;
  min-height: var(--auth-visual-height);
  background:
    linear-gradient(180deg, rgba(44, 44, 44, 0.02), rgba(44, 44, 44, 0.12)),
    url("/assets/auth-ingress-kitchen-d42cd315.webp") center / 170% auto no-repeat;
}

.auth-shell--session .auth-visual {
  background-position: 12% center;
}

.auth-shell--registration .auth-visual {
  background-position: 50% center;
}

.auth-shell--password .auth-visual {
  background-position: 88% center;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: -22px;
  padding: 18px 40px max(28px, env(safe-area-inset-bottom));
  border-radius: 0;
  background:
    url("/assets/paper-grain-6dcb78b5.svg") 0 0 / 180px 180px repeat,
    radial-gradient(circle at 95% 0%, color-mix(in oklch, var(--ui-positive-soft) 25%, transparent), transparent 34%),
    var(--ui-bg-surface);
  box-shadow: 0 -12px 30px rgba(67, 48, 35, 0.12);
}

.auth-card::before {
  content: "";
  position: absolute;
  top: -19px;
  left: -24px;
  width: calc(100% + 48px);
  height: 30px;
  pointer-events: none;
  background: url("/assets/paper-tear-horizontal-af5fed04.svg") center / 100% 100% no-repeat;
  filter: drop-shadow(0 -2px 2px rgba(67, 48, 35, 0.12));
  transform: rotate(var(--auth-tear-mobile-angle));
  transform-origin: center;
}

.auth-brand {
  display: block;
  margin: 0 0 21px;
  color: var(--ui-accent-hover);
  font: 600 1.05rem/1.3 var(--font-display);
  letter-spacing: -0.01em;
}

.auth-header {
  margin: 0 0 34px;
}

.auth-title {
  margin: 0 0 8px;
  color: var(--ui-text-strong);
  font: 600 2.35rem/1.05 var(--font-display);
  letter-spacing: -0.035em;
}

.auth-subtitle {
  max-width: 38ch;
  margin: 0;
  color: var(--ui-text-muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-label {
  color: var(--ui-text-strong);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
}

.auth-input {
  appearance: none;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid color-mix(in oklch, var(--ui-border) 78%, var(--ui-text-subtle));
  border-radius: 10px;
  background: color-mix(in oklch, var(--ui-bg-surface) 68%, var(--ui-bg-surface-muted));
  box-shadow: inset 0 1px 2px rgba(67, 48, 35, 0.04);
  color: var(--ui-text-strong);
  font: 400 1rem/1.45 var(--font-body);
  transition: border-color 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms cubic-bezier(0.22, 1, 0.36, 1), background-color 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-input::placeholder {
  color: color-mix(in oklch, var(--ui-text-subtle) 78%, var(--ui-bg-surface));
  opacity: 1;
}

.auth-input:hover {
  border-color: color-mix(in oklch, var(--ui-accent) 28%, var(--ui-border));
}

.auth-input:focus {
  border-color: var(--ui-positive);
  outline: 3px solid color-mix(in oklch, var(--ui-positive-soft) 55%, transparent);
  outline-offset: 1px;
  background: var(--ui-bg-surface);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--ui-positive) 18%, transparent);
}

.auth-input[aria-invalid="true"] {
  border-color: var(--ui-accent);
  background: color-mix(in oklch, var(--ui-accent-soft) 16%, var(--ui-bg-surface));
}

.auth-meta {
  margin-top: -3px;
}

.auth-link {
  color: var(--ui-accent-hover);
  font-weight: 500;
  text-decoration-color: color-mix(in oklch, var(--ui-accent) 50%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 150ms cubic-bezier(0.22, 1, 0.36, 1), text-decoration-color 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-link:hover {
  color: var(--ui-accent);
  text-decoration-color: currentColor;
}

.auth-button {
  width: 100%;
  min-height: 56px;
  margin-top: 2px;
  padding: 13px 18px;
  border: 1px solid var(--ui-accent-hover);
  border-radius: 10px;
  background: var(--ui-accent);
  box-shadow: 0 8px 18px rgba(168, 78, 48, 0.18);
  color: var(--ui-text-inverse);
  cursor: pointer;
  font: 600 1rem/1.35 var(--font-body);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1), background-color 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-button:hover {
  transform: translateY(-1px);
  background: var(--ui-accent-hover);
  box-shadow: 0 12px 24px rgba(168, 78, 48, 0.22);
}

.auth-button:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(168, 78, 48, 0.16);
}

.auth-button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 18px;
  color: var(--ui-text-muted);
  font-size: 0.94rem;
  line-height: 1.5;
  text-align: center;
}

.auth-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--ui-positive-hover);
  font-size: 0.8rem;
  line-height: 1.35;
}

.auth-hint::before {
  content: "✓";
  display: inline-grid;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  place-items: center;
  border-radius: 50%;
  background: var(--ui-positive);
  color: var(--ui-text-inverse);
  font-size: 0.68rem;
  font-weight: 700;
}

@media (max-width: 899px) {
  .auth-shell--session .auth-field + .auth-field {
    margin-top: 14px;
  }

  .auth-shell--session .auth-button {
    margin-top: 20px;
  }

  .auth-shell--session .auth-footer {
    margin-top: 34px;
  }

  .auth-shell--registration .auth-footer {
    margin-top: 32px;
  }

  .auth-shell--password .auth-title {
    font-size: 2.25rem;
  }

  .auth-shell--password .auth-header {
    margin-bottom: 18px;
  }

  .auth-shell--password .auth-footer {
    margin-top: 36px;
  }
}

.auth-flash {
  padding: 11px 13px;
  border: 1px solid color-mix(in oklch, var(--ui-accent) 34%, var(--ui-border));
  border-radius: 10px;
  background: color-mix(in oklch, var(--ui-accent-soft) 18%, var(--ui-bg-surface));
  color: var(--ui-accent-hover);
  font-size: 0.875rem;
  line-height: 1.45;
}

@media (min-width: 900px) {
  .auth-shell {
    grid-template: minmax(100vh, auto) / minmax(0, 0.92fr) minmax(560px, 1.08fr);
    min-height: 100vh;
    min-height: 100dvh;
  }

  .auth-visual {
    min-height: 100vh;
    min-height: 100dvh;
    background-size: cover;
  }

  .auth-shell--session .auth-visual {
    background-position: 14% center;
  }

  .auth-shell--registration .auth-visual {
    background-position: 50% center;
  }

  .auth-shell--password .auth-visual {
    background-position: 86% center;
  }

  .auth-card {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: clamp(48px, 7vh, 76px) clamp(56px, 7vw, 110px);
    border-radius: 0;
    box-shadow: -18px 0 48px rgba(67, 48, 35, 0.09);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .auth-card::before {
    top: -20px;
    left: -22px;
    width: 38px;
    height: calc(100% + 40px);
    background-image: url("/assets/paper-tear-vertical-977b0474.svg");
    filter: drop-shadow(-2px 0 2px rgba(67, 48, 35, 0.12));
    transform: rotate(var(--auth-tear-desktop-angle));
  }

  .auth-card > * {
    width: min(480px, 100%);
  }

  .auth-brand {
    margin-bottom: 24px;
    font-size: 1.15rem;
  }

  .auth-header {
    margin-bottom: 28px;
  }

  .auth-title {
    margin-bottom: 10px;
    font-size: 3rem;
  }

  .auth-subtitle {
    font-size: 1.03rem;
  }

  .auth-form {
    gap: 16px;
  }

  .auth-footer {
    margin-top: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-input,
  .auth-link,
  .auth-button {
    transition-duration: 0.01ms;
  }
}

/* ========================================
   Desktop Expansion - Kitchen Notebook
   ======================================== */
@media (min-width: 768px) {
  .app-navbar-shell {
    padding: 0;
    --app-navbar-frost-opacity: 0.78;
    --app-navbar-frost-radius: 16px;
  }

  .app-navbar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1fr);
    align-items: center;
    gap: 16px;
    padding: 6px clamp(14px, 2vw, 24px);
    border-color: var(--app-navbar-border-color);
    border-radius: 0 0 10px 10px;
    box-shadow: var(--app-navbar-shadow);
  }

  .app-navbar-brand {
    max-width: 300px;
  }

  .app-navbar-links {
    gap: 8px;
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .app-navbar-nav {
    justify-self: center;
  }

  .app-navbar-link {
    min-height: 40px;
    padding: 8px 12px;
    background: transparent;
    border-color: transparent;
  }

  .app-navbar-link:hover,
  .app-navbar-link:focus-visible {
    background: rgba(196, 93, 58, 0.06);
    border-color: rgba(196, 93, 58, 0.1);
    box-shadow: 0 1px 2px rgba(67, 48, 35, 0.03);
  }

  .app-navbar-link--current {
    color: var(--ui-text-strong);
    background: var(--ui-bg-surface);
    border-color: var(--ui-border);
    box-shadow: var(--ui-shadow-1);
  }

  .app-navbar-actions {
    justify-self: end;
    min-width: 0;
    position: relative;
    padding-left: 0;
  }

  .app-navbar-actions::before {
    content: none;
  }

  .app-navbar-profile {
    gap: 10px;
    padding: 3px 8px 3px 3px;
    border-color: rgba(191, 160, 122, 0.18);
    background: rgba(255, 253, 249, 0.76);
    box-shadow: 0 1px 2px rgba(67, 48, 35, 0.04);
  }

  .app-navbar-profile-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    flex-basis: 32px;
    font-size: 13px;
  }

  .app-navbar-profile:hover,
  .app-navbar-profile:focus-visible {
    border-color: rgba(196, 93, 58, 0.2);
    background: rgba(255, 252, 248, 0.94);
    box-shadow: 0 8px 18px rgba(67, 48, 35, 0.06);
  }

  .app-navbar-profile--current {
    border-color: rgba(196, 93, 58, 0.2);
    background: linear-gradient(145deg, rgba(255, 251, 247, 0.98), rgba(232, 169, 149, 0.12));
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.62),
      0 8px 18px rgba(196, 93, 58, 0.07);
  }

  .app-navbar-profile--current .app-navbar-profile-name {
    color: var(--ui-text-strong);
  }

  .app-main {
    padding-top: 2px;
    padding-left: clamp(20px, 4vw, 44px);
    padding-right: clamp(20px, 4vw, 44px);
  }

  /* --- Icon rail: 64px sidebar at 768-1023px --- */
  .swipe-scroller {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    overflow: visible;
    scroll-snap-type: none;
  }

  .swipe-menu {
    display: block;
    min-height: 100vh;
    background:
      linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(250, 248, 243, 0.98)),
      radial-gradient(circle at 18% 10%, rgba(196, 93, 58, 0.1), transparent 48%);
    border-right: 1px solid var(--ui-border);
  }

  .swipe-menu-inner {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
    align-content: start;
    padding: var(--space-lg) 0 var(--space-2xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }

  .swipe-menu-inner::-webkit-scrollbar {
    display: none;
  }

  /* Icon rail: profile collapses to avatar only */
  .swipe-profile {
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    box-shadow: none;
    justify-content: center;
    margin-bottom: var(--space-xs);
  }

  .swipe-profile:hover,
  .swipe-profile:focus-visible,
  .swipe-profile--current {
    transform: none;
    box-shadow: none;
    background: rgba(196, 93, 58, 0.1);
    border-color: transparent;
  }

  .swipe-profile-meta {
    display: none;
  }

  .swipe-profile-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    flex: 0 0 38px;
    font-size: 16px;
  }

  /* Icon rail: nav is centered column of icons */
  .swipe-menu-nav {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  /* Icon rail: links show icon only */
  .swipe-menu-link {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-md);
    border-color: transparent;
    position: relative;
  }

  .swipe-menu-label {
    display: none;
  }

  .swipe-menu-icon {
    width: 20px;
    height: 20px;
  }

  .swipe-menu-link:focus-visible {
    outline: 2px solid var(--ui-focus-outline);
    outline-offset: 2px;
  }

  .swipe-menu-link--current {
    background: rgba(196, 93, 58, 0.1);
    border-color: rgba(196, 93, 58, 0.25);
  }

  /* Icon rail: logout is icon only too */
  .swipe-menu-inner .button_to {
    margin-top: auto;
    display: flex;
    justify-content: center;
  }

  .profile-logout {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-md);
  }

  .profile-logout:focus-visible {
    outline: 2px solid var(--ui-focus-outline);
    outline-offset: 2px;
  }

  .profile-logout .swipe-menu-label {
    display: none;
  }

  .swipe-scroller > .swipe-content {
    min-height: 100vh;
    padding: 0 clamp(20px, 4vw, 44px) clamp(28px, 4vw, 48px);
  }

  .prototype-container,
  .detail-container {
    max-width: min(1120px, 100%);
    margin: clamp(20px, 3vw, 36px) auto 0;
    border-radius: var(--radius-lg);
    min-height: auto;
    overflow: hidden;
    border: 1px solid var(--ui-border);
    box-shadow: var(--ui-shadow-4);
  }

  .header {
    padding-left: clamp(22px, 3vw, 34px);
    padding-right: clamp(22px, 3vw, 34px);
  }

  .header::after {
    left: clamp(22px, 3vw, 34px);
    right: clamp(22px, 3vw, 34px);
  }

  .import-widget {
    padding: var(--space-md) clamp(22px, 3vw, 34px);
  }


  .section-divider {
    padding-left: clamp(22px, 3vw, 34px);
    padding-right: clamp(22px, 3vw, 34px);
  }

  .video-header {
    padding-left: clamp(22px, 3vw, 34px);
    padding-right: clamp(22px, 3vw, 34px);
    gap: var(--space-lg);
    align-items: center;
  }

  .video-thumbnail,
  .prompt-glyph-tile {
    width: 168px;
    height: 94px;
    border-radius: var(--radius-md);
  }

  .prompt-glyph-tile__icon {
    width: 30px;
    height: 30px;
  }

  .video-header-info h3 {
    font-size: 18px;
  }

  .video-meta {
    font-size: 13px;
  }

  .recipes-container {
    margin-left: clamp(22px, 3vw, 34px);
    margin-right: clamp(22px, 3vw, 34px);
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-sm);
  }

  .recipes-container::before {
    display: none;
  }

  .recipes-container .recipe-item {
    margin: 0;
    height: 100%;
  }

  .recipes-container .recipe-item:hover {
    transform: translateY(-2px);
  }

  .prototype-container.queue-container {
    max-width: min(1160px, 100%);
  }

  .queue-header {
    padding: var(--space-lg) clamp(22px, 3vw, 34px) 12px;
  }

  .queue-nav {
    margin-bottom: 10px;
  }

  .queue-title-block h1 {
    margin-bottom: 6px;
  }

  .queue-subtitle {
    max-width: 420px;
  }

  .queue-container .section-divider {
    padding-top: 14px;
    padding-bottom: 10px;
  }

  .queue-empty-card {
    margin: 0 clamp(22px, 3vw, 34px) var(--space-2xl);
    align-items: center;
  }

  .queue-plan-week-cta {
    margin-left: clamp(22px, 3vw, 34px);
    margin-right: clamp(22px, 3vw, 34px);
  }

  .detail-nav {
    padding-left: clamp(22px, 3vw, 34px);
    padding-right: clamp(22px, 3vw, 34px);
  }

  .recipe-selector {
    padding: var(--space-lg) clamp(22px, 3vw, 34px) var(--space-md);
  }

  .recipe-tabs {
    margin: 0;
    padding: 0;
  }

  .recipe-content {
    padding: 0 clamp(22px, 3vw, 34px) var(--space-xl);
  }

  .recipe-header {
    text-align: left;
    justify-items: flex-start;
    padding: var(--space-xl) 0 var(--space-lg);
  }

  .recipe-description {
    max-width: 62ch;
    margin-left: 0;
    margin-right: 0;
  }

  .ingredients-section,
  .steps-section,
  .prep-ahead-section,
  .tips-section {
    padding-left: 0;
    padding-right: 0;
  }

  .steps-section,
  .tips-section {
    margin-top: var(--space-lg);
  }

  .detail-footer {
    padding-left: clamp(22px, 3vw, 34px);
    padding-right: clamp(22px, 3vw, 34px);
    margin-top: var(--space-xl);
  }

  .prompt-lab-shell {
    max-width: min(1200px, 100%);
    margin: clamp(20px, 3vw, 40px) auto;
    padding-bottom: var(--space-2xl);
    gap: var(--space-lg);
  }

  .prompt-lab-controls {
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(250, 248, 243, 0.8), rgba(255, 253, 249, 0.95));
    box-shadow: var(--ui-shadow-1);
  }

  .prompt-lab-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--ui-shadow-2);
  }
}

@media (min-width: 768px) and (max-width: 1099px) {
  .app-navbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .app-navbar-brand {
    max-width: 240px;
  }

  .app-navbar-brand-subtitle {
    display: none;
  }
}

@media (min-width: 1024px) {
  /* --- Narrow expanded sidebar at 1024px+ --- */
  .swipe-scroller {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .swipe-menu-inner {
    padding: var(--space-lg) var(--space-md) var(--space-2xl);
    align-items: stretch;
    gap: var(--space-md);
  }

  .swipe-menu-inner::-webkit-scrollbar {
    display: block;
    width: 6px;
  }

  .swipe-menu-inner::-webkit-scrollbar-track {
    background: transparent;
  }

  .swipe-menu-inner::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: var(--radius-round);
  }

  .swipe-menu-inner:hover::-webkit-scrollbar-thumb,
  .swipe-menu-inner:focus-within::-webkit-scrollbar-thumb {
    background: rgba(44, 44, 44, 0.24);
  }

  /* Show profile meta again */
  .swipe-profile {
    width: auto;
    height: auto;
    padding: 12px;
    border: 1px solid rgba(191, 160, 122, 0.24);
    background: linear-gradient(145deg, rgba(255, 251, 246, 0.96), rgba(197, 212, 194, 0.32));
    box-shadow: var(--ui-shadow-1);
    justify-content: flex-start;
    margin-bottom: 0;
  }

  .swipe-profile:hover,
  .swipe-profile:focus-visible,
  .swipe-profile--current {
    border-color: rgba(196, 93, 58, 0.3);
  }

  .swipe-profile-meta {
    display: grid;
  }

  .swipe-profile-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    flex: 0 0 40px;
    font-size: 16px;
  }

  /* Show labels again in nav */
  .swipe-menu-nav {
    align-items: stretch;
  }

  .swipe-menu-link {
    width: auto;
    height: auto;
    padding: 9px 12px;
    justify-content: flex-start;
    gap: 10px;
  }

  .swipe-menu-label {
    display: inline;
  }

  .swipe-menu-link--current {
    background: linear-gradient(135deg, rgba(196, 93, 58, 0.12), rgba(255, 253, 249, 0.92));
    border-color: rgba(196, 93, 58, 0.3);
  }

  /* Show logout label again */
  .swipe-menu-inner .button_to {
    display: block;
    width: 100%;
    margin-top: auto;
  }

  .profile-logout {
    margin-top: auto;
    width: auto;
    height: auto;
    padding: 9px 12px;
    justify-content: flex-start;
  }

  .profile-logout .swipe-menu-label {
    display: inline;
  }

  .prototype-container,
  .detail-container {
    max-width: min(1180px, 100%);
  }

  .video-header {
    gap: var(--space-xl);
  }

  .recipe-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: clamp(18px, 2.4vw, 32px);
    row-gap: var(--space-lg);
    align-items: start;
  }

  .ingredients-section {
    grid-column: 1;
    margin-top: var(--space-lg);
    padding-top: 0;
  }

  .steps-section {
    grid-column: 2;
    margin-top: var(--space-lg);
    padding-top: 0;
  }

  .prep-ahead-section,
  .tips-section {
    grid-column: 1 / -1;
    grid-row: auto;
    margin-top: 0;
    position: static;
    align-self: auto;
  }

  .prep-task-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tips-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .detail-footer {
    margin-top: var(--space-lg);
  }

  .plan-week-container--panel-open [data-plan-week-picker-target='background'] {
    opacity: 0.82;
    transition: opacity var(--transition-base);
  }

  /* Desktop panel header */

  /* Desktop compact day nav in header */

  .prompt-lab-grid {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  }

  .prompt-lab-history-grid {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  }

  .prompt-lab-card {
    padding: var(--space-lg);
  }
}

@media (min-width: 768px) and (max-width: 959px) {
  .video-info {
    padding: clamp(20px, 3vw, 30px);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
  }

  .video-hero-recipe {
    display: block;
  }

  .video-hero .recipe-content .recipe-header {
    display: none;
  }
}

@media (min-width: 960px) {
  .video-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    align-items: stretch;
  }

  .video-player-wrapper {
    height: 100%;
  }

  .video-player {
    height: auto;
    min-height: 0;
    padding-bottom: 56.25%;
  }

  .video-info {
    padding: clamp(20px, 3vw, 30px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-lg);
  }

  .video-hero-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .video-hero-recipe {
    display: block;
  }

  .video-hero .recipe-content .recipe-header {
    display: none;
  }

  .video-hero .video-player-wrapper {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
  }

  .video-hero .video-info {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .video-hero .recipe-selector,
  .video-hero .recipe-content,
  .video-hero .detail-footer {
    grid-column: 1 / -1;
  }

  .video-hero .recipe-content {
    grid-row: 3;
  }

  .video-hero .recipe-selector {
    grid-row: 2;
  }

  .video-hero .detail-footer {
    grid-row: 4;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
}

@media (min-width: 1120px) {
}

@media (min-width: 1280px) {
  .swipe-scroller {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .swipe-menu-inner {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }

  .prompt-lab-shell {
    max-width: min(1240px, 100%);
  }

  .prompt-lab-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }

  .prompt-lab-history-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ========================================
   Ingredient sprite review page
   ======================================== */
.sprites-page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 0;
}

.sprites-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.sprites-kicker {
  margin: 0 0 var(--space-sm);
  color: var(--color-terracotta-dark);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sprites-hero h1 {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.4rem + 2vw, 3.25rem);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: 1.04;
}

.sprites-intro {
  max-width: 58ch;
  margin: var(--space-md) 0 0;
  color: var(--color-charcoal-light);
  font-size: var(--text-body-lg);
  line-height: 1.55;
}

.sprites-count {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 128px;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid color-mix(in srgb, var(--color-sage-light) 70%, var(--color-border));
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--color-paper) 88%, var(--color-sage-light));
  color: var(--color-sage-dark);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-sm);
  font-weight: 700;
}

.sprites-count span {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
}

.sprites-table-shell {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(250, 248, 243, 0.72));
  box-shadow: var(--shadow-lg);
}

.sprites-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.sprites-table th,
.sprites-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
  text-align: left;
}

.sprites-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--color-cream) 88%, var(--color-paper));
  color: var(--color-warm-gray);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.sprites-table tbody tr {
  background: rgba(255, 253, 249, 0.68);
  transition: background-color var(--transition-fast);
}

.sprites-table tbody tr:hover {
  background: color-mix(in srgb, var(--color-paper) 78%, var(--color-cream-dark));
}

.sprites-table tbody tr:last-child td {
  border-bottom: 0;
}

.sprites-recipe-cell,
.sprites-ingredient-cell {
  max-width: 220px;
}

.sprites-recipe-link {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}

.sprites-recipe-link:hover {
  color: var(--color-terracotta-dark);
}

.sprites-ingredient-cell {
  color: var(--color-charcoal);
  font-weight: 600;
  line-height: 1.45;
}

.sprites-normalized-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--color-sage-light) 45%, var(--color-paper));
  color: var(--color-sage-dark);
  font-size: var(--text-sm);
  font-weight: 800;
}

.sprites-prompt-cell {
  max-width: 420px;
  color: var(--color-charcoal-light);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.sprites-muted {
  color: var(--color-warm-gray);
  font-size: var(--text-sm);
  font-style: italic;
}

.sprites-action-cell form {
  margin: 0;
}

.sprites-generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 15px;
  border: 0;
  border-radius: var(--radius-round);
  background: var(--color-terracotta);
  color: var(--color-paper);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 800;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.sprites-generate-button:hover {
  background: var(--color-terracotta-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.sprites-generate-button--secondary {
  border: 1px solid color-mix(in srgb, var(--color-sage) 42%, var(--color-border));
  background: color-mix(in srgb, var(--color-paper) 78%, var(--color-sage-light));
  color: var(--color-sage-dark);
}

.sprites-generate-button--secondary:hover {
  background: color-mix(in srgb, var(--color-paper) 60%, var(--color-sage-light));
  color: var(--color-sage-dark);
}

.sprites-generate-button--disabled,
.sprites-generate-button:disabled {
  background: var(--color-cream-dark);
  color: var(--color-warm-gray);
  box-shadow: none;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .sprites-hero {
    align-items: start;
    flex-direction: column;
  }

  .sprites-count {
    justify-items: start;
  }
}

.sprites-normalized-stack {
  display: flex;
  align-items: center;
  gap: var(--space-sm-md);
}

.sprites-thumbnail {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid color-mix(in srgb, var(--color-sage-light) 64%, var(--color-border));
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 253, 249, 0.92), rgba(243, 239, 230, 0.72)),
    var(--color-paper);
  box-shadow: var(--shadow-sm);
  object-fit: contain;
}

.sprites-recipe-owner {
  display: block;
  margin-top: 6px;
  color: var(--color-warm-gray);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.sprites-row-note {
  display: block;
  margin-top: 6px;
  color: var(--color-terracotta-dark);
  font-size: 0.78rem;
  font-weight: 800;
}
.plan-week-container {
  --planning-preferences-trigger-size: 28px;
  --planning-preferences-trigger-gap: 8px;
  position: relative;
}

.plan-week-container .queue-nav-actions {
  padding-right: calc(var(--planning-preferences-trigger-size) + var(--planning-preferences-trigger-gap));
}

.planning-preferences {
  position: absolute;
  z-index: 45;
  top: var(--space-lg);
  right: var(--space-lg);
  color: var(--ui-text);
}

.planning-preferences > summary {
  width: var(--planning-preferences-trigger-size);
  height: var(--planning-preferences-trigger-size);
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  background: var(--ui-bg-surface);
  color: var(--ui-text-muted);
  box-shadow: var(--ui-shadow-1);
  cursor: pointer;
  display: grid;
  place-items: center;
  list-style: none;
  transition: transform var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.planning-preferences > summary::-webkit-details-marker {
  display: none;
}

.planning-preferences > summary:hover {
  border-color: color-mix(in srgb, var(--ui-accent) 42%, var(--ui-border));
  color: var(--ui-accent-hover);
  box-shadow: var(--ui-shadow-2);
  transform: translateY(-1px);
}

.planning-preferences > summary:focus-visible {
  outline: none;
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-focus-outline) 44%, transparent), var(--ui-shadow-2);
}

.planning-preferences[open] > summary {
  border-color: color-mix(in srgb, var(--ui-positive) 48%, var(--ui-border));
  background: color-mix(in srgb, var(--ui-bg-surface) 86%, var(--ui-positive) 14%);
  color: var(--ui-positive-hover);
}

.planning-preferences > summary svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.planning-preferences form {
  position: absolute;
  top: calc(100% + var(--planning-preferences-trigger-gap));
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-xl);
  background: var(--ui-bg-surface);
  box-shadow: var(--ui-shadow-4);
  display: grid;
  gap: var(--space-md);
}

.planning-preferences fieldset {
  margin: 0;
  padding: var(--space-md) 0 0;
  border: 0;
  border-top: 1px solid var(--ui-border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.planning-preferences fieldset:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.planning-preferences legend {
  width: 100%;
  margin-bottom: var(--space-sm);
  color: var(--ui-text-strong);
  font-size: var(--text-caption);
  font-weight: 700;
}

.planning-preferences label {
  min-height: 36px;
  padding: 0 var(--space-sm-plus);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-round);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-caption);
}

.planning-preferences input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-sm-md);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  background: var(--ui-bg-page);
  color: var(--ui-text-strong);
  font: 400 16px/1.4 var(--font-body);
}

.planning-preferences input[type="submit"] {
  min-height: 44px;
  padding: 0 var(--space-md);
  border: 0;
  border-radius: var(--radius-round);
  background: var(--ui-accent);
  color: var(--ui-bg-surface);
  font: 700 var(--text-sm)/1 var(--font-body);
}

/* Quiet date-level recipe picker */
.plan-week-picker {
  min-height: calc(100dvh - var(--app-header-height, 72px));
  padding: clamp(24px, 5vw, 64px) 16px max(56px, env(safe-area-inset-bottom));
  color: var(--ui-text, #302923);
  background:
    radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--ui-accent) 7%, transparent), transparent 30rem),
    var(--ui-bg-page, #faf8f3);
}

.plan-week-picker [hidden] {
  display: none !important;
}

.plan-week-picker-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  max-width: 760px;
  margin: 0 -16px 24px;
  border-block: 1px solid var(--ui-border-subtle);
}

.plan-week-picker-day {
  position: relative;
  min-width: 0;
  min-height: 64px;
  padding: 8px 2px;
  border: 0;
  border-right: 1px solid var(--ui-border-subtle);
  color: var(--ui-text-muted);
  background: transparent;
  cursor: pointer;
  transition: color 140ms cubic-bezier(0.25, 1, 0.5, 1), background 140ms cubic-bezier(0.25, 1, 0.5, 1), transform 140ms cubic-bezier(0.25, 1, 0.5, 1);
}

.plan-week-picker-day:last-child {
  border-right: 0;
}

.plan-week-picker-day span,
.plan-week-picker-day strong {
  display: block;
}

.plan-week-picker-day span {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-week-picker-day strong {
  margin-top: 4px;
  font: 600 var(--text-body-lg)/1 var(--font-display);
}

.plan-week-picker-day i {
  position: absolute;
  top: 4px;
  right: 2px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding-inline: 4px;
  border-radius: 999px;
  color: var(--ui-positive-text, #5c7858);
  background: var(--ui-positive-soft);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.plan-week-picker-day.is-selected {
  color: var(--ui-accent);
  background: color-mix(in srgb, var(--ui-accent) 7%, transparent);
  box-shadow: inset 0 -3px var(--ui-accent);
}

.plan-week-picker-notebook {
  max-width: 760px;
  margin-inline: auto;
}

.plan-week-picker-search-shell {
  position: relative;
  margin-bottom: 16px;
}

.plan-week-picker-search-shell > input {
  width: 100%;
  min-height: 52px;
  padding: 0 142px 0 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-md);
  color: var(--ui-text);
  background: var(--ui-bg-surface);
  box-shadow: var(--ui-shadow-1);
  font: 600 1rem/1.4 var(--font-body);
}

.plan-week-picker-search-shell > input::placeholder {
  color: var(--ui-text-muted);
  font-weight: 500;
}

.plan-week-picker-preferences {
  position: absolute;
  z-index: 4;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

.plan-week-picker-preferences summary {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 4px 10px;
  border: 0;
  border-radius: 12px;
  color: var(--ui-text-muted);
  background: var(--ui-bg-surface-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
}

.plan-week-picker-preferences summary::-webkit-details-marker {
  display: none;
}

.plan-week-picker-preferences-form {
  position: absolute;
  right: 0;
  display: grid;
  gap: 10px;
  width: min(300px, calc(100vw - 32px));
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--ui-border-subtle);
  border-radius: var(--radius-md);
  background: var(--ui-bg-surface);
  box-shadow: var(--ui-shadow-3);
}

.plan-week-picker-preferences-form label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  font-size: var(--text-sm);
}

.plan-week-picker-preferences-form label:has(input[type="text"]) {
  display: grid;
  gap: 4px;
}

.plan-week-picker-preferences-form input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding-inline: 10px;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-sm);
  background: var(--ui-bg-page);
}

.plan-week-picker-preferences-form input[type="submit"] {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ui-bg-surface);
  background: var(--ui-accent);
  font-weight: 750;
  cursor: pointer;
}

.plan-week-picker-recent {
  min-height: 44px;
  margin-top: 16px;
  padding: 0;
  border: 0;
  color: var(--ui-text-muted);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.plan-week-picker-empty {
  width: 100%;
  margin: 12px 0;
  color: var(--ui-text-muted);
}

.plan-week-picker-planned {
  margin: 28px 0 24px;
}

.plan-week-picker-planned-day[hidden] {
  display: none;
}

.plan-week-picker-planned-day h2 {
  margin: 0 0 16px;
  color: var(--ui-text);
  font: 400 1rem/1.3 var(--font-body);
}

.plan-week-picker-planned-list {
  display: grid;
  gap: 10px;
  padding-left: 10px;
}

.plan-week-picker-planned-card {
  position: relative;
  min-width: 0;
}

.recipe-preview {
  --preview-tone: color-mix(in srgb, var(--ui-bg-surface) 82%, var(--ui-bg-page));
  --preview-ink: var(--ui-text-strong);
  --preview-muted: var(--ui-text-muted);

  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-height: 112px;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  color: var(--preview-ink);
  background: var(--preview-tone);
  box-shadow: var(--ui-shadow-1);
}

.recipe-preview.has-preview {
  grid-template-columns: minmax(0, 1fr) clamp(106px, 35.7%, 133px);
}

.plan-week-picker-planned-card .recipe-preview {
  min-height: 88px;
}

.plan-week-picker-planned-card .recipe-preview__media img {
  position: absolute;
  inset: 0;
}

.recipe-preview:not(.has-preview) .recipe-preview__media {
  display: none;
}

.recipe-preview__media {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--preview-tone) 88%, var(--ui-bg-surface));
}

.recipe-preview__media::before {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  width: clamp(28px, 22%, 56px);
  background: linear-gradient(90deg, var(--preview-tone), transparent);
  content: "";
  pointer-events: none;
}

.recipe-preview__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
}

.recipe-preview[data-thumbnail-tint-state="loading"] .recipe-preview__media img {
  opacity: 0;
}

.recipe-preview__copy {
  z-index: 2;
  display: grid;
  position: relative;
  min-width: 0;
  align-content: center;
  justify-items: start;
  padding: 12px 12px 12px 16px;
}

.recipe-preview__title {
  margin: 0;
  overflow: hidden;
  color: var(--preview-ink);
  font: 600 clamp(1.05rem, 3vw, 1.35rem)/1.15 var(--font-display);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.recipe-preview__ingredients {
  display: flex;
  gap: 12px;
  overflow: hidden;
  width: 100%;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.recipe-preview__ingredients li {
  min-width: 0;
  overflow: hidden;
  color: var(--preview-muted);
  font: 400 var(--text-caption)/1.4 var(--font-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-preview--compact {
  min-height: 80px;
}

.recipe-preview--compact.has-preview {
  grid-template-columns: minmax(0, 1fr) 116px;
}

.recipe-preview--compact .recipe-preview__copy {
  padding: 12px;
}

.recipe-preview--compact .recipe-preview__title {
  font-size: 0.98rem;
}

.recipe-preview--compact .recipe-preview__ingredients {
  display: block;
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-preview--compact .recipe-preview__ingredients li {
  display: inline;
  font-weight: 500;
}

.recipe-preview--compact .recipe-preview__ingredients li + li::before {
  content: " · ";
}

.plan-week-picker-planned-check {
  display: grid;
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: var(--ui-bg-surface);
  background: var(--ui-text-strong);
  box-shadow: 0 0 0 2px var(--ui-bg-page);
  transform: translate(-30%, -30%);
}

.plan-week-picker-planned-check svg {
  width: 14px;
  height: 14px;
}

.plan-week-picker-updating {
  display: grid;
  place-items: center;
  min-height: 50dvh;
  margin: 0;
  color: var(--ui-text-muted);
  font: 600 clamp(1.15rem, 3vw, 1.45rem)/1.3 var(--font-display);
  text-align: center;
}

.plan-week-picker :is(button, input, summary):focus-visible {
  outline: 3px solid var(--ui-focus-outline);
  outline-offset: 3px;
}

@media (hover: hover) {
  .plan-week-picker-day:hover,
  .plan-week-search-choice:hover {
    transform: translateY(-1px);
  }
}

@media (min-width: 640px) {
  .recipe-preview__copy {
    padding: 12px 16px 12px 24px;
  }

  .plan-week-picker {
    padding-inline: clamp(16px, 5vw, 72px);
  }

  .plan-week-picker-days {
    margin-inline: auto;
  }

  .plan-week-picker-day {
    min-height: 72px;
  }


  .plan-week-picker-day span {
    font-size: var(--text-caption);
    letter-spacing: 0.08em;
  }

  .plan-week-picker-day i {
    right: 4px;
  }
}

/* Plan My Week: compact search, selection, and review. */
body:has(.plan-week-search[open]) { overflow: hidden; }
.plan-week-picker { padding-bottom: 112px; }
.plan-week-picker-planned { margin-top: 0; }
.plan-week-bottom-search { position: fixed; inset: auto 0 0; z-index: 440; padding: 8px 16px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--ui-border-subtle); background: var(--ui-bg-page); }
.plan-week-bottom-search .plan-week-picker-search-shell { max-width: 760px; margin: auto; }
.plan-week-search-launch { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 152px 8px 16px; border: 1px solid var(--ui-border); border-radius: var(--radius-md); color: var(--ui-text-muted); background: var(--ui-bg-surface); box-shadow: var(--ui-shadow-1); text-align: left; cursor: pointer; font: inherit; }
.plan-week-search-launch svg { flex: none; width: 20px; height: 20px; }
.plan-week-bottom-preferences { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); min-height: 36px; padding: 2px 10px; border: 0; border-radius: 12px; background: var(--ui-bg-surface-muted); color: var(--ui-text-muted); font: 700 14px var(--font-body); cursor: pointer; }
.plan-week-search { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; color: var(--ui-text); background: var(--ui-bg-page); }
.plan-week-search[open] { display: flex; flex-direction: column; animation: plan-week-search-open 180ms ease-out; }
.plan-week-search-inner { width: 100%; max-width: 760px; margin: auto; }
.plan-week-search-top { flex-shrink: 0; padding: 16px 16px 0; border-bottom: 1px solid var(--ui-border-subtle); }
.plan-week-search-heading, .plan-week-review-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.plan-week-search-heading h2, .plan-week-review-heading h2 { flex: 1; margin: 0; font: 600 1.5rem/1.2 var(--font-display); }
.plan-week-search-back { display: grid; flex: none; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--ui-border); border-radius: 50%; color: var(--ui-text); background: var(--ui-bg-surface); cursor: pointer; }
.plan-week-search-back svg { width: 20px; height: 20px; }
.plan-week-search-date { color: var(--ui-text-muted); font-size: 13px; }
.plan-week-search .plan-week-picker-search-shell { margin-bottom: 8px; }
.plan-week-search .plan-week-picker-search-shell > input { min-height: 44px; font-weight: 400; }
.plan-week-search .plan-week-picker-preferences summary { min-height: 36px; padding-block: 2px; }
/* Keep the compact surface while retaining a 44px touch target. */
.plan-week-search .plan-week-picker-preferences summary { position: relative; }
.plan-week-bottom-preferences::after, .plan-week-search .plan-week-picker-preferences summary::after { content: ""; position: absolute; inset: -4px 0; }
.plan-week-search .plan-week-picker-preferences-form { max-height: calc(100dvh - 170px); overflow-y: auto; }
.plan-week-search-caption { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; font-size: 14px; }
.plan-week-search-caption p { margin: 0; }
.plan-week-search-caption .plan-week-picker-recent { margin: 0; text-decoration: none; font-weight: 600; }
.plan-week-search-results { flex: 1; min-height: 0; padding: 24px 16px 32px; overflow-y: auto; overscroll-behavior: contain; }
.plan-week-search-list { display: grid; gap: 22px; max-width: 760px; margin: auto; padding-left: 8px; }
.plan-week-search-result { position: relative; min-width: 0; }
.plan-week-search-choice { display: block; width: 100%; padding: 0; border: 0; border-radius: var(--radius-lg); background: transparent; text-align: left; cursor: pointer; }
.plan-week-search-result .recipe-preview { min-height: 80px; }
.plan-week-search-result .recipe-preview.has-preview { grid-template-columns: minmax(0, 1fr) 128px; }
.plan-week-search-result .recipe-preview__copy { padding: 16px 16px 10px; }
.plan-week-search-result .recipe-preview__title { font-size: 1.1rem; -webkit-line-clamp: 2; }
.plan-week-search-result .recipe-preview__media img, .plan-week-review-item .recipe-preview__media img { position: absolute; inset: 0; }
.plan-week-search-choice[aria-pressed="true"] { outline: 3px solid var(--ui-accent); outline-offset: 3px; }
.plan-week-search-choice .plan-week-picker-planned-check { width: 28px; height: 28px; border: 1px solid var(--ui-text-muted); color: transparent; background: var(--ui-bg-surface); }
.plan-week-search-choice[aria-pressed="true"] .plan-week-picker-planned-check { border-color: var(--ui-accent); color: var(--ui-bg-surface); background: var(--ui-accent); }
.plan-week-search-note { position: absolute; z-index: 3; top: -10px; left: 32px; padding: 3px 16px 4px 10px; color: var(--ui-text); background: var(--color-cream-dark); font: 600 11px/1.2 var(--font-body); clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%); transform: rotate(-1deg); pointer-events: none; }
.plan-week-search-note--scenario { color: #354c32; background: var(--color-sage-light); }
.plan-week-search-footer { flex-shrink: 0; padding: 6px 16px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--ui-border); background: var(--ui-bg-surface); }
.plan-week-search-footer .plan-week-search-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-week-search-footer span { font-size: clamp(16px, 2.5vw, 17px); white-space: nowrap; }
.plan-week-primary { min-height: 44px; padding: 8px 16px; border: 0; border-radius: 999px; color: var(--ui-bg-surface); background: var(--ui-accent); font: 600 1rem/1.4 var(--font-body); white-space: nowrap; cursor: pointer; }
.plan-week-primary:hover { background: var(--color-terracotta-dark); }
.plan-week-primary:disabled { opacity: .5; cursor: default; }
.plan-week-quiet { min-width: 44px; min-height: 44px; padding: 4px 8px; border: 0; color: var(--ui-text-muted); background: none; font: 600 14px var(--font-body); cursor: pointer; }
.plan-week-review { width: calc(100% - 32px); max-width: 600px; max-height: 90dvh; padding: 24px; overflow-y: auto; border: 1px solid var(--ui-border); border-radius: var(--radius-xl); color: var(--ui-text); background: var(--ui-bg-page); }
.plan-week-review::backdrop { background: rgb(44 36 29 / 35%); }
.plan-week-review .plan-week-picker-days { width: 100%; margin: 20px 0; }
.plan-week-review > p { color: var(--ui-text-muted); font-size: 14px; }
.plan-week-review-list { display: grid; gap: 10px; margin: 20px 0; }
.plan-week-review-item { display: flex; align-items: center; gap: 8px; }
.plan-week-review-item .recipe-preview { flex: 1; min-height: 82px; }
.plan-week-review-item .recipe-preview__title { font-size: 1rem; }
.plan-week-review > .plan-week-primary { width: 100%; }
.plan-week-review .plan-week-error { color: var(--color-terracotta-dark); }
.plan-week-toast { position: fixed; z-index: 445; bottom: 78px; left: 50%; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100% - 32px); padding: 8px 16px; transform: translateX(-50%); border: 1px solid var(--ui-border); border-radius: 12px; background: var(--ui-bg-surface); box-shadow: var(--ui-shadow-2); font-size: 14px; }
@keyframes plan-week-search-open { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .plan-week-search[open] { animation: none; } }
@media (max-width: 420px) {
  .plan-week-search-launch { padding-right: 134px; font-size: 14px; }
  .plan-week-search-launch svg { display: none; }
  .plan-week-bottom-preferences, .plan-week-search .plan-week-picker-preferences summary { font-size: 12px; }
  .plan-week-search-heading h2 { font-size: 1.3rem; }
  .plan-week-search .plan-week-picker-search-shell > input { padding-right: 136px; font-size: 16px; }
  .plan-week-search-result .recipe-preview.has-preview { grid-template-columns: minmax(0, 1fr) 100px; }
  .plan-week-search-result .recipe-preview__copy { padding-inline: 12px; }
  .plan-week-search-caption { font-size: 13px; }
  .plan-week-review { padding: 16px; }
}
@media (max-width: 359px) {
  .plan-week-search-footer { padding-inline: 8px; }
  .plan-week-search-footer span { font-size: 15px; }
  .plan-week-search-footer .plan-week-primary { padding-inline: 10px; }
}

/* Profile: stacked settings on phones, account sidebar and aligned desktop form. */
.app-shell:has(.profile-shell) {
  background: #faf9f6;
  --ui-text: #101827;
  --ui-text-strong: #101827;
  --ui-text-muted: #5f6570;
}

.profile-shell {
  --ui-focus-outline: var(--ui-positive-hover);
  --profile-control-border: #8d887e;
  color: var(--ui-text);
  display: grid;
  gap: 28px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 32px;
}

.profile-shell :is(h1, h2, p, form) {
  margin: 0;
}
.profile-shell :is(section, fieldset, .profile-summary-copy, .profile-secondary) {
  min-width: 0;
}

.profile-header { order: 0; }
.profile-account { display: contents; }
.profile-summary { order: 1; position: relative; }
.profile-layout { order: 2; }
.profile-footer { order: 3; }
.profile-footer--desktop { display: none; }

.profile-header h1 {
  margin-bottom: 8px;
  font: 600 var(--text-title-lg)/var(--leading-tight) var(--font-display);
  letter-spacing: var(--tracking-tight);
}

.profile-header-copy > p,
.profile-pane-head > p {
  color: var(--ui-text-muted);
  line-height: 1.5;
}

.profile-summary {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.profile-summary-avatar {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #c1cfbd;
  color: var(--ui-text-strong);
  font: 600 28px/1 var(--font-display);
}

.profile-summary-avatar .profile-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-summary-name {
  font: 600 24px/1.25 var(--font-display);
  overflow-wrap: anywhere;
}

.profile-summary-email {
  overflow-wrap: anywhere;
}
.profile-shell .profile-summary-meta {
  margin-top: 4px;
}
.profile-summary-email,
.profile-summary-meta,
.profile-hint {
  color: var(--ui-text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.profile-layout,
.profile-secondary {
  display: grid;
  gap: 28px;
  align-items: start;
}
.profile-pane {
  scroll-margin-top: 110px;
}
.profile-pane-head {
  margin-bottom: 16px;
}
.profile-pane-head h2 {
  font: 600 1.25rem/1.35 var(--font-body);
  margin-bottom: 4px;
}
.profile-pane-head p {
  font-size: 0.9375rem;
}

.profile-card {
  padding: 16px;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-xl);
  background: var(--ui-bg-surface);
}

.profile-planning-form,
.profile-form,
.profile-avatar-form {
  display: grid;
  gap: 16px;
}

.profile-shell .auth-input {
  min-width: 0;
  min-height: 48px;
  border-color: var(--profile-control-border);
  background-color: var(--ui-bg-surface);
  box-shadow: none;
}

.profile-shell .auth-input::placeholder {
  color: var(--ui-text-muted);
}
.profile-shell .profile-select {
    appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23101827' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
  }

.profile-planning-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.profile-field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}
.profile-field-copy > .profile-hint { margin-top: 4px; }
.profile-exclusion-fields { min-width: 0; margin-top: 8px; }
.profile-planning-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.profile-planning-options--effort {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-planning-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f6f5f2;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.3;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.profile-planning-option input { margin: 0; accent-color: var(--ui-positive-hover); appearance: none; width: 21px; height: 21px; flex: 0 0 21px; background: #fff; border: 1.5px solid #192332; border-radius: 3px; box-shadow: inset 0 1px 2px rgb(0 0 0 / 8%); }

.profile-planning-option:hover {
  background: var(--ui-bg-surface-muted);
}
.profile-planning-option:has(:checked) {
  background: #edf2e9;
  border-color: var(--ui-positive-hover);
}
.profile-planning-option:has(:focus-visible) {
  outline: 2px solid var(--ui-positive-hover);
  outline-offset: 2px;
}
.profile-planning-exclusion {
  margin-top: 8px;
}

.profile-button {
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--ui-accent-hover);
  border-radius: var(--radius-lg);
  background: var(--ui-accent-hover);
  color: var(--ui-text-inverse);
  cursor: pointer;
  font: 600 1rem/1.4 var(--font-body);
}

.profile-button:hover {
  filter: brightness(0.94);
}
.profile-button:active {
  transform: translateY(1px);
}
.profile-button--secondary {
  background: var(--ui-bg-surface);
  color: var(--ui-text);
  border-color: var(--profile-control-border);
}

.profile-text-action,
.profile-photo summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--ui-positive-hover);
  font: 500 0.875rem/1.4 var(--font-body);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.profile-text-action:hover,
.profile-photo summary:hover {
  color: var(--ui-text-strong);
}
.profile-language-save {
  justify-self: end;
}
.profile-photo summary {
  list-style: none;
}
.profile-photo summary::-webkit-details-marker {
  display: none;
}
.profile-shell summary:focus-visible {
  outline: 2px solid var(--ui-positive-hover);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}
.profile-photo-badge {
  position: absolute;
  top: 48px;
  left: 40px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  background: var(--ui-bg-surface);
  color: var(--ui-text);
}
.profile-photo summary:focus-visible .profile-photo-badge {
  outline: 2px solid var(--ui-positive-hover);
  outline-offset: 2px;
}
.profile-photo-controls {
  padding: 8px 0 12px;
}
.profile-avatar-input {
  max-width: 100%;
}
.profile-avatar-input::file-selector-button {
  font: inherit;
}

.profile-calendar-card {
  padding-top: 4px;
}
.profile-calendar-action {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 0;
  color: var(--ui-text);
  text-decoration: none;
  font-size: 0.875rem;
}

.profile-calendar-action span {
  flex: 1;
}
.profile-shell svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}
.profile-calendar-action:hover {
  color: var(--ui-positive-hover);
}
.profile-calendar-help {
  border-block: 1px solid var(--ui-border-subtle);
}
.profile-calendar-help summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  cursor: pointer;
  font-size: 0.875rem;
  list-style: none;
}
.profile-calendar-help summary::-webkit-details-marker {
  display: none;
}
.profile-calendar-help summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-top: 1.5px solid;
  border-right: 1.5px solid;
  transform: rotate(45deg);
  margin-right: 4px;
}
.profile-calendar-help[open] summary::after {
  transform: rotate(135deg);
}
.profile-calendar-help p {
  padding-bottom: 12px;
  font-size: 0.875rem;
  color: var(--ui-text-muted);
}
.calendar-subscribe-field {
  padding-top: 16px;
}
.calendar-subscribe-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.calendar-subscribe-input {
  flex: 1;
  text-overflow: ellipsis;
}
.calendar-subscribe-copy {
  flex-shrink: 0;
  padding-inline: 4px;
  color: var(--ui-text);
}
.calendar-subscribe-feedback {
  min-height: 20px;
  padding-top: 4px;
  visibility: hidden;
}
.calendar-subscribe-feedback.is-visible {
  visibility: visible;
}
.profile-calendar-card .calendar-subscribe-rotate {
  padding-top: 0;
  padding-bottom: 0;
}

.profile-footer {
  margin-top: 28px;
  border-top: 1px solid var(--ui-border);
  padding-top: 8px;
}
.profile-signout {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 0;
  background: none;
  border: 0;
  color: var(--ui-text);
  font: 500 0.9375rem/1.4 var(--font-body);
  cursor: pointer;
}
.profile-signout:hover {
  color: var(--ui-accent-hover);
}

@media (max-width: 359px) {
  .profile-photo-badge { top: 32px; left: 20px; }
  .profile-planning-options:not(.profile-planning-options--effort) { grid-template-columns: minmax(0, 1fr); }
  .profile-summary {
    gap: 12px;
  }
  .profile-summary-avatar {
    flex-basis: 56px;
    width: 56px;
    height: 56px;
  }
  .profile-planning-options--effort .profile-planning-option {
    flex-direction: column;
    justify-content: center;
    padding-inline: 4px;
  }
}

@media (min-width: 640px) {
  .profile-shell {
    max-width: 720px;
    padding-block: 40px;
  }
  .profile-card {
    padding: 24px;
  }
}

/* The calendar uses native disclosure, including keyboard and screen-reader support. */
.profile-calendar-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  cursor: pointer;
  list-style: none;
}
.profile-calendar-disclosure > summary::-webkit-details-marker { display: none; }
.profile-calendar-disclosure .profile-pane-head { flex: 1; margin: 0; }
.profile-calendar-description { display: block; margin-top: 4px; color: var(--ui-text-muted); font-size: 0.875rem; }
.profile-calendar-setup { color: var(--ui-positive-hover); text-decoration: underline; text-underline-offset: 3px; }
.profile-calendar-chevron { width: 8px; height: 8px; border-top: 1.5px solid; border-right: 1.5px solid; transform: rotate(45deg); margin-right: 8px; }
.profile-calendar-disclosure[open] > summary .profile-calendar-chevron { transform: rotate(135deg); }

body:has(.profile-shell)::before { display: none; }

.profile-planning-option input:checked { appearance: auto; }

.profile-pane--language .profile-card { padding: 0; border: 0; background: none; border-radius: 0; gap: 0; }

.profile-language-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.profile-pane--calendar { border-top: 1px solid #e5e1da; padding-top: 14px; }

.profile-planning-form {
  background: #fffdfa;
  border: 1px solid #f0ece5;
  border-radius: 18px;
  box-shadow: 0 3px 12px rgb(58 43 25 / 4%);
  gap: 24px;
}
.profile-planning-form > .profile-pane-head { margin-bottom: 0; }
.profile-planning-submit {
  min-height: 54px;
  background: linear-gradient(135deg, #b85936, #a85032);
  border-color: #ad5030;
  border-radius: 10px;
}
.profile-pane--language .profile-pane-head h2 { font-size: 18px; }
.profile-shell .auth-input { border-radius: 10px; background-color: #fff; font-size: 16px; }

.app-shell:has(.profile-shell) .app-navbar-profile { padding: 0; border: 0; background: none; box-shadow: none; }
.app-shell:has(.profile-shell) .app-navbar-brand-mark { font-size: 0; background: #b45838; border-radius: 50%; margin: 0; }
.app-shell:has(.profile-shell) .app-navbar-profile-avatar {
  background: #c1cfbd;
  color: #101827;
  border: 0;
  box-shadow: none;
}
@media (max-width: 1023px) {
  .app-shell:has(.profile-shell) .app-navbar-links {
    background: none;
    border-color: transparent;
    box-shadow: none;
  }
  .app-shell:has(.profile-shell) .app-navbar-profile-avatar,
  .app-shell:has(.profile-shell) .app-navbar-search-toggle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-basis: 44px;
  }
  .app-shell:has(.profile-shell) .app-navbar-search-toggle {
    border: 1px solid #c5c8c9;
    background: #fffdfa;
    color: #101827;
    box-shadow: none;
  }
  .profile-header h1 { font-size: 36px; }
  .profile-pane--language .profile-card { gap: 4px; }
  .profile-language-save { font-size: 16px; font-weight: 400; }
}

@media (min-width: 1024px) {
  .app-shell:has(.profile-shell) .app-main { padding: 0 32px; min-height: calc(100dvh - 72px); }
  .app-shell:has(.profile-shell) .app-navbar-shell { border-bottom: 1px solid #e5e1da; }
  .app-shell:has(.profile-shell) .app-navbar {
    max-width: 1317px;
    min-height: 71px;
    margin: 0 auto;
    padding: 9px 0;
    border: 0;
    border-radius: 0;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .app-shell:has(.profile-shell) .app-navbar-brand-subtitle,
  .app-shell:has(.profile-shell) .app-navbar-profile-meta { display: none; }
  .app-shell:has(.profile-shell) .app-navbar-brand { gap: 18px; max-width: none; }
  .app-shell:has(.profile-shell) .app-navbar-brand-title { font-size: 26px; letter-spacing: -0.6px; }
  .app-shell:has(.profile-shell) .app-navbar-link { font-size: 18px; font-weight: 400; padding-inline: 18px; }
  .app-shell:has(.profile-shell) .app-navbar-actions { gap: 24px; padding-right: 12px; }
  .app-shell:has(.profile-shell) .app-navbar-search-toggle { width: 50px; height: 50px; border: 1px solid #c5c8c9; background: #fffdfa; color: #101827; box-shadow: none; }
  .app-shell:has(.profile-shell) .app-navbar-profile-avatar { width: 50px; height: 50px; min-width: 50px; flex-basis: 50px; font-size: 24px; }
  .profile-shell {
    max-width: 1297px;
    padding: 40px 0 36px;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 24px 62px;
  }
  .profile-header { grid-column: 2; grid-row: 1; }
  .profile-header h1 { font-size: 48px; line-height: 1.1; margin-bottom: 4px; }
  .profile-header-copy > p { font-size: 20px; line-height: 30px; }
  .profile-account { display: block; grid-column: 1; grid-row: 1 / span 2; min-width: 0; padding: 14px 0 0 37px; }
  .profile-summary { display: block; }
  .profile-summary-avatar { width: 120px; height: 120px; font-size: 48px; }
  .profile-summary-copy { margin-top: 12px; }
  .profile-summary-name { font-size: 36px; line-height: 44px; }
  .profile-summary-email, .profile-summary-meta { font-size: 16px; line-height: 26px; }
  .profile-shell .profile-summary-meta { margin-top: 0; white-space: nowrap; }
  .profile-photo { margin-top: 20px; }
  .profile-photo summary { font-size: 18px; font-weight: 400; padding-block: 8px; }
  .profile-photo-badge { top: 74px; left: 86px; width: 46px; height: 46px; }
  .profile-photo-hint-break { display: none; }
  #profile-photo-hint > span:last-child { display: block; }
  #profile-photo-hint { font-size: 14px; line-height: 22px; }
  .profile-footer--desktop { display: block; }
  .profile-footer--mobile { display: none; }
  .profile-footer { margin-top: 36px; padding: 0; border: 0; }
  .profile-signout { gap: 20px; font-size: 18px; font-weight: 400; }
  .profile-signout svg { width: 24px; height: 24px; flex-basis: 24px; }
  .profile-layout { grid-column: 2; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .profile-secondary { gap: 18px; }
  .profile-card { padding: 28px 30px; }
  .profile-planning-form {
    gap: 23px;
  }
  .profile-pane-head { margin: 0; }
  .profile-pane-head h2 { font-size: 26px; line-height: 32px; margin-bottom: 0; letter-spacing: -0.5px; }
  .profile-pane-head p { font-size: 18px; line-height: 28px; }
  .profile-time-zone,
  .profile-planning-fieldset,
  .profile-pane--language { display: grid; grid-template-columns: minmax(0, 0.515fr) minmax(0, 1fr); gap: 12px; align-items: start; }
  .profile-time-zone .auth-label,
  .profile-field-copy { padding-top: 10px; }
  .profile-field-label, .profile-time-zone .auth-label { font-size: 18px; line-height: 26px; font-weight: 600; }
  .profile-hint { font-size: 16px; line-height: 24px; }
  .profile-field-copy > .profile-hint { margin-top: 2px; }
  .profile-shell .auth-input { height: 50px; min-height: 50px; font-size: 18px; line-height: 26px; padding: 10px 18px; }
  .profile-time-zone .auth-input, .profile-pane--language .auth-input { width: min(100%, 496px); }
  .profile-planning-options { margin: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
  .profile-planning-option { min-height: 52px; padding: 12px 16px; gap: 14px; font-size: 16px; }
  .profile-exclusion-fields { margin: 0; }
  .profile-planning-submit { justify-self: end; width: 328px; font-size: 18px; margin-top: -4px; }
  .profile-pane--language { grid-template-columns: minmax(0, 0.537fr) minmax(0, 1fr); }
  .profile-pane--language .profile-pane-head { padding-top: 3px; }
  .profile-pane--language .profile-pane-head h2 { font-size: 18px; line-height: 28px; letter-spacing: 0; }
  .profile-pane--language .profile-pane-head p { font-size: 16px; line-height: 25px; }
  .profile-language-save { font-size: 18px; font-weight: 400; }
  .profile-calendar-disclosure > summary { min-height: 64px; gap: 28px; }
  .profile-calendar-description { font-size: 16px; line-height: 24px; }
  .profile-calendar-setup { font-size: 18px; }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .profile-shell { grid-template-columns: 190px minmax(0, 1fr); gap: 28px 32px; }
  .profile-account { padding-left: 0; }
  .profile-planning-options:not(.profile-planning-options--effort) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-planning-option { padding-inline: 8px; gap: 8px; font-size: 14px; }
  .profile-time-zone, .profile-planning-fieldset, .profile-pane--language { grid-template-columns: 155px minmax(0, 1fr); }
  .app-shell:has(.profile-shell) .app-navbar-brand-title { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .profile-shell * {
    transition: none;
  }
  .profile-button:active {
    transform: none;
  }
}
