/* ============================================================
   SAPORI — Component Library
   Premium Italian Recipe PWA
   ============================================================ */

/* ============================================================
   APP LAYOUT
   ============================================================ */

/* Main content area — accounts for fixed header & bottom nav */
#app-content {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: calc(72px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transition: padding var(--transition-normal);
}

body.search-open #app-content {
  padding-top: calc(138px + env(safe-area-inset-top, 0px));
}

.view {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-md);
  animation: fadeIn 0.35s ease both;
}

/* ============================================================
   HEADER (#app-header)
   ============================================================ */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  height: calc(64px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 0px) max(var(--space-md), env(safe-area-inset-right, 0px)) 0 max(var(--space-md), env(safe-area-inset-left, 0px));
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--glass-border);
  transition:
    background var(--transition-normal),
    border-color var(--transition-normal);
}

#app-header .header-logo {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
  user-select: none;
}

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

#app-header .header-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

#app-header .header-btn:hover {
  background: var(--bg-tertiary);
  color: var(--primary-ink);
  transform: scale(1.05);
}

#app-header .header-btn:active {
  transform: scale(0.92);
}

#app-header .header-btn svg,
#app-header .header-btn i {
  width: 22px;
  height: 22px;
  font-size: 22px;
}

/* ── Theme Toggle Icon Visibility ── */
#btn-theme-toggle .icon-moon {
  display: block;
}
#btn-theme-toggle .icon-sun {
  display: none;
}
[data-theme="dark"] #btn-theme-toggle .icon-moon {
  display: none;
}
[data-theme="dark"] #btn-theme-toggle .icon-sun {
  display: block;
}
#btn-theme-toggle svg {
  transition: transform var(--transition-normal);
}
#btn-theme-toggle:hover svg {
  transform: rotate(20deg);
}

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-top: 1px solid var(--glass-border);
  transition:
    background var(--transition-normal),
    border-color var(--transition-normal);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition:
    color var(--transition-fast),
    transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 40px;
  height: 3px;
  border-radius: 0 0 var(--radius-full) var(--radius-full);
  background: var(--gradient);
  transition: transform var(--transition-normal) cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-item.active {
  color: var(--primary-ink);
}

.nav-item.active::before {
  transform: translateX(-50%) scaleX(1);
}

.nav-item:active {
  transform: scale(0.88);
}

.nav-icon {
  width: 24px;
  height: 24px;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}

/* Active nav SVG fill effect */
.nav-item.active .nav-icon svg {
  filter: drop-shadow(0 0 3px var(--primary));
}

/* ============================================================
   SEARCH BAR
   ============================================================ */
.search-bar {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  z-index: calc(var(--z-header) - 1);
  width: 100%;
  padding: var(--space-sm) max(var(--space-md), env(safe-area-inset-right, 0px)) var(--space-sm) max(var(--space-md), env(safe-area-inset-left, 0px));
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  animation: slideDown 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.search-bar .search-icon {
  position: absolute;
  left: max(calc(var(--space-md) * 2), calc(env(safe-area-inset-left, 0px) + var(--space-md)));
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.search-bar input {
  width: 100%;
  height: 50px;
  padding: 0 64px 0 48px;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--shadow);
  background: var(--bg-secondary);
}

.search-bar input:focus ~ .search-icon {
  color: var(--primary-ink);
}

.search-bar .search-clear {
  position: absolute;
  right: max(calc(var(--space-md) + var(--space-sm)), calc(env(safe-area-inset-right, 0px) + var(--space-sm)));
  top: 50%;
  transform: translateY(-50%);
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.search-bar .search-clear:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============================================================
   FILTER BAR & CHIPS
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-md);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  min-height: 45px;
  max-width: min(80vw, 320px);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip:hover {
  border-color: var(--primary-light);
  color: var(--primary-ink);
  transform: translateY(-1px);
}

.filter-chip:active {
  transform: scale(0.95);
}

.filter-chip.active {
  background: var(--gradient);
  color: var(--on-primary);
  border-color: transparent;
  box-shadow: 0 4px 14px var(--shadow);
}

.filter-chip .chip-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ============================================================
   SORT SELECT
   ============================================================ */
.sort-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sort-select select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 45px;
  padding: 8px 36px 8px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.sort-select select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--shadow);
}

.sort-select::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}

/* ============================================================
   RECIPE GRID
   ============================================================ */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  padding: var(--space-sm) 0;
}

/* ============================================================
   RECIPE CARD
   ============================================================ */
.recipe-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--transition-normal) cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal);
  box-shadow: var(--shadow-sm);
  animation: scaleIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.recipe-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.recipe-card:active {
  transform: translateY(-2px) scale(0.99);
}

/* Image container */
.recipe-card__image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.recipe-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.recipe-card:hover .recipe-card__image img {
  transform: scale(1.08);
}

/* Gradient overlay on image */
.recipe-card__image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}

/* No-image placeholder */
.recipe-card__image--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  font-size: 3rem;
}

/* Placeholder realmente usato da recipeCardHTML() quando la ricetta non ha foto */
.recipe-card__placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Favorite heart button */
.recipe-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: inherit;
}

.recipe-card__link:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.recipe-card__favorite {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition:
    transform var(--transition-fast),
    color var(--transition-fast),
    background var(--transition-fast);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.recipe-card__favorite:hover {
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.95);
}

.recipe-card__favorite:active {
  transform: scale(0.85);
}

.recipe-card__favorite.is-favorite {
  color: var(--danger);
  animation: heartBeat 0.6s ease;
}

/* Card content */
.recipe-card__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  flex: 1;
}

.recipe-card__title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.recipe-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.recipe-card__meta svg,
.recipe-card__meta i {
  width: 14px;
  height: 14px;
  font-size: 14px;
}

.recipe-card__category {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-ink);
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ============================================================
   RECIPE DETAIL
   ============================================================ */
.recipe-detail {
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 0.4s ease both;
}

/* Hero image */
.recipe-detail__hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-lg);
  background: var(--bg-tertiary);
}

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

/* Placeholder usato da renderDetail() quando la ricetta non ha foto:
   stesse dimensioni/posizionamento di .recipe-detail__hero, altrimenti
   i pulsanti indietro/preferito (position:absolute) non hanno un
   genitore posizionato correttamente. */
.recipe-detail__hero-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.recipe-detail__hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0%,
    transparent 40%,
    transparent 50%,
    rgba(0, 0, 0, 0.5) 100%
  );
  pointer-events: none;
}

/* Back button overlay */
.recipe-detail__back {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 3;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.25rem;
  transition:
    transform var(--transition-fast),
    background var(--transition-fast),
    color var(--transition-fast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.recipe-detail__back:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.95);
}

.recipe-detail__back:active {
  transform: scale(0.9);
}

.recipe-detail__servings-control {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.recipe-detail__servings-button {
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 1.125rem;
  line-height: 1;
}

.recipe-detail__servings-value {
  min-width: 1.5ch;
  font-weight: 700;
  text-align: center;
}

/* Detail title */
.recipe-detail__title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

/* Description Section */
.recipe-detail__description-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-ink);
  margin-top: 0;
  margin-bottom: var(--space-xs);
}

.recipe-detail__description-section {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-line;
}

/* Notes Section */
.recipe-detail__notes-section {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.recipe-detail__notes-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-ink);
  margin-top: 0;
  margin-bottom: var(--space-xs);
}

.recipe-detail__notes-section p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-line;
}

/* Info bar with icons */
.recipe-detail__info,
.recipe-detail__info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.recipe-detail__info-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.recipe-detail__info-item svg,
.recipe-detail__info-item i {
  width: 20px;
  height: 20px;
  font-size: 20px;
  color: var(--primary-ink);
  flex-shrink: 0;
}

.recipe-detail__info-item strong {
  color: var(--text-primary);
}

/* Section headings */
.recipe-detail__section-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.recipe-detail__section-title .section-icon {
  font-size: 1.2rem;
}

/* Ingredient list with checkable items */
.recipe-detail__ingredients {
  list-style: none;
  margin-bottom: var(--space-xl);
}

.recipe-detail__ingredients li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  min-height: 44px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: opacity var(--transition-fast);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.recipe-detail__ingredients li:last-child {
  border-bottom: none;
}

.recipe-detail__ingredients li .ingredient-check {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  flex-shrink: 0;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.recipe-detail__ingredients li.checked .ingredient-check {
  background: var(--gradient);
  border-color: transparent;
  color: var(--on-primary);
}

.recipe-detail__ingredients li.checked {
  opacity: 0.5;
  text-decoration: line-through;
}

/* Numbered step list */
.recipe-detail__steps {
  list-style: none;
  margin-bottom: var(--space-xl);
  counter-reset: step-counter;
}

.recipe-detail__steps li {
  position: relative;
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  counter-increment: step-counter;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.recipe-detail__steps li:last-child {
  border-bottom: none;
}

.recipe-detail__steps li::before {
  content: counter(step-counter);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--gradient);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Action buttons */
.recipe-detail__actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

/* Body layout for desktop/print side-by-side */
.recipe-detail__body-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  .recipe-detail__body-layout {
    display: grid;
    grid-template-columns: 1fr 1.8fr;
    gap: var(--space-xl);
    align-items: start;
  }
}

/* Ingredient list (custom) */
.ingredient-list {
  list-style: none;
  margin-bottom: var(--space-lg);
}

.ingredient-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.ingredient-item:last-child {
  border-bottom: none;
}

.ingredient-bullet {
  color: var(--primary-ink);
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Contenuto: nome + quantità + note in colonna */
.ingredient-item__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.ingredient-item__main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  word-break: break-word;
}

.ingredient-item__name {
  font-weight: 500;
  color: var(--text-primary);
}

.ingredient-item__qty {
  font-size: 0.88rem;
  color: var(--primary-ink);
  font-weight: 600;
  white-space: nowrap;
}

.ingredient-item__notes {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}


/* Step list (custom) */
.step-list {
  list-style: none;
  margin-bottom: var(--space-lg);
}

.step-item {
  position: relative;
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-secondary);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-item__notes {
  display: block;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 4px;
}

.step-item:last-child {
  border-bottom: none;
}

.step-item p {
  margin: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--gradient);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 44px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.95);
}

/* Ripple effect container */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10%);
  background-repeat: no-repeat;
  background-position: center;
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.6s;
}

.btn:active::after {
  transform: scale(0);
  opacity: 1;
  transition: 0s;
}

/* Primary */
.btn--primary {
  color: var(--on-primary);
  background: var(--gradient);
  box-shadow: 0 4px 16px var(--shadow);
}

.btn--primary:hover {
  box-shadow: 0 6px 24px var(--shadow);
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(0) scale(0.97);
  filter: brightness(0.95);
}

/* Secondary */
.btn--secondary {
  color: var(--primary-ink);
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
}

.btn--secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Danger */
.btn--danger {
  color: var(--on-danger);
  background: var(--danger);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn--danger:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

/* Ghost */
.btn--ghost {
  color: var(--text-secondary);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--primary-ink);
  background: var(--bg-tertiary);
}

/* Icon button */
.btn--icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  font-size: 1.2rem;
}

/* Variante compatta, usata su bottoni pillola (Annulla/Installa, azioni
   secondarie) e in combinazione con .btn--icon (rimuovi ingrediente/passaggio,
   chiudi anteprima stampa, ecc.) */
.btn--small {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.btn--icon.btn--small {
  width: 44px;
  height: 44px;
  font-size: 0.95rem;
}

/* FAB - Floating Action Button */
.btn--fab {
  position: fixed;
  bottom: 88px;
  right: var(--space-md);
  z-index: 50;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: var(--radius-full);
  color: var(--on-primary);
  background: var(--gradient);
  box-shadow: 0 6px 24px var(--shadow);
  font-size: 1.6rem;
  animation: pulse 2.5s ease-in-out infinite;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.btn--fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 8px 32px var(--shadow);
}

.btn--fab:active {
  transform: scale(0.92);
  animation: none;
}

.btn svg,
.btn i {
  width: 18px;
  height: 18px;
  font-size: 18px;
  flex-shrink: 0;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  position: relative;
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  transition: color var(--transition-fast);
}

.form-group:focus-within .form-label {
  color: var(--primary-ink);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--shadow);
  background: var(--bg-secondary);
  outline: none;
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* Custom Category Selector Grid */
.category-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.category-select-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-sm);
  min-width: 0;
  min-height: 44px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.category-select-btn:hover {
  border-color: var(--primary-light);
  background: var(--bg-tertiary);
  transform: translateY(-2px);
}

.category-select-btn.active {
  border-color: var(--primary);
  background: var(--bg-secondary);
  box-shadow: 0 4px 12px var(--shadow);
  transform: scale(1.02);
}

.category-select-btn__icon {
  font-size: 1.8rem;
  line-height: 1;
  transition: transform var(--transition-fast);
}

.category-select-btn:hover .category-select-btn__icon {
  transform: scale(1.15);
}

.category-select-btn__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Error state */
.form-group.has-error .form-input,
.form-group.has-error .form-textarea,
.form-group.has-error .form-select {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
  animation: shake 0.5s ease;
}

.form-group.has-error .category-select-btn {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.02);
  animation: shake 0.5s ease;
}

.form-group.has-error .form-label {
  color: var(--danger);
}

.form-error {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--danger);
  margin-top: 6px;
  padding-left: 2px;
  animation: slideUp 0.25s ease both;
}

/* File input as drop zone */
.form-group .file-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-md);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  cursor: pointer;
  text-align: center;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast);
}

.form-group .file-drop-zone:hover,
.form-group .file-drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--bg-secondary);
}

.form-group .file-drop-zone .drop-icon {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.form-group .file-drop-zone .drop-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-group .file-drop-zone .drop-text strong {
  color: var(--primary-ink);
}

.form-group .file-drop-zone input[type="file"] {
  display: none;
}

/* Area upload foto (form crea/modifica ricetta): nomi reali usati da views.js/app.js */
.image-upload {
  margin-top: var(--space-sm);
}

.image-upload[aria-busy="true"] {
  opacity: 0.65;
  pointer-events: none;
  cursor: progress;
}

.image-upload__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: 180px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    color var(--transition-fast);
}

.image-upload__placeholder:hover {
  border-color: var(--primary);
  background: var(--bg-secondary);
  color: var(--primary-ink);
}

.image-upload__placeholder span {
  font-size: 0.875rem;
  font-weight: 500;
}

.image-upload__preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-tertiary);
}

.image-upload__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-upload__change {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

.image-upload__change:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: -4px;
}

.image-upload__remove {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: #FFFFFF;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.image-upload__remove:hover {
  background: var(--danger);
  color: var(--on-danger);
  transform: scale(1.1);
}

/* ============================================================
   DYNAMIC LISTS (ingredients & steps)
   ============================================================ */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.dynamic-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: slideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.dynamic-list__item:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--shadow);
}

.dynamic-list__item .item-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  color: var(--text-muted);
  cursor: grab;
  font-size: 1rem;
}

.dynamic-list__item .item-handle:active {
  cursor: grabbing;
}

.dynamic-list__item .item-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--gradient);
  border-radius: var(--radius-full);
}

.dynamic-list__item input,
.dynamic-list__item textarea {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
}

.dynamic-list__item input::placeholder,
.dynamic-list__item textarea::placeholder {
  color: var(--text-muted);
}

.dynamic-list__item .item-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    color var(--transition-fast),
    background var(--transition-fast);
}

.dynamic-list__item .item-remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.dynamic-list__add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary-ink);
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    border-color var(--transition-fast),
    color var(--transition-fast),
    background var(--transition-fast);
}

.dynamic-list__add:hover {
  border-color: var(--primary);
  background: var(--bg-tertiary);
}

.dynamic-list__add:active {
  transform: scale(0.98);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  overflow-y: auto;
  animation: fadeIn 0.25s ease both;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-normal),
    visibility var(--transition-normal);
}

.modal-overlay.is-open,
.modal-overlay:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.modal__header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal__header .modal-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.modal__header .modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: rotate(90deg);
}

.modal__body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--border);
}

@media (max-width: 400px) {
  .modal__footer--import {
    flex-direction: column;
    align-items: stretch;
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .modal__footer--import .btn {
    width: 100%;
    min-width: 0;
  }
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  max-width: 420px;
  padding: 0 var(--space-md);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 14px var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: hidden;
  position: relative;
}

.toast.is-exiting {
  animation: toastSlideOut 0.3s ease both;
}

/* Colored left border */
.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.toast--success::before {
  background: var(--success);
}

.toast--error::before {
  background: var(--danger);
}

.toast--info::before {
  background: var(--primary);
}

.toast--warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: var(--bg-secondary);
}

.toast--warning::before {
  background: var(--warning);
}

.toast .toast-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: var(--radius-full);
}

.toast--success .toast-icon {
  color: var(--success);
}

.toast--error .toast-icon {
  color: var(--danger);
}

.toast--info .toast-icon {
  color: var(--primary-ink);
}

.toast--warning .toast-icon {
  color: var(--warning);
}

.toast .toast-message {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.toast .toast-dismiss {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.toast .toast-dismiss:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--on-primary);
  background: var(--gradient);
  border-radius: var(--radius-full);
  line-height: 1.6;
}

.badge--success {
  background: var(--success);
  color: var(--on-success);
}

.modal__body p {
  margin: 0;
}

.badge--warning {
  background: var(--warning);
  color: var(--on-warning);
}

.badge--danger {
  background: var(--danger);
  color: var(--on-danger);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary-ink);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.tag:hover {
  background: var(--bg-secondary);
  color: var(--primary-ink);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  min-height: 50vh;
  animation: fadeIn 0.5s ease both;
}

.empty-state__icon {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--primary-ink);
  margin-bottom: var(--space-xl);
  position: relative;
}

.empty-state__icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px dashed var(--border);
  opacity: 0.5;
}

.empty-state__title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.empty-state__description {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: var(--space-lg);
}

.empty-state .btn {
  margin-top: var(--space-sm);
}

/* View Header */
.view-header {
  margin-bottom: var(--space-lg);
}

.view-header__title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.view-header__subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-section {
  margin-bottom: var(--space-xl);
}

.settings-section .section-title {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  padding-left: var(--space-xs);
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);
}

.settings-item:hover {
  border-color: var(--primary-light);
}

.settings-item--column {
  flex-direction: column;
  align-items: flex-start;
}

.settings-item .settings-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-item .settings-item__label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-item .settings-item__description {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Theme selector */
.theme-selector {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-md) 0;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.theme-option:hover {
  transform: scale(1.08);
}

.theme-option:active {
  transform: scale(0.95);
}

.theme-option .theme-circle {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  position: relative;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
  overflow: hidden;
}

.theme-option .theme-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: capitalize;
}

.theme-option.active .theme-circle {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--shadow), var(--shadow-md);
}

.theme-option.active .theme-name {
  color: var(--primary-ink);
  font-weight: 700;
}

/* ============================================================
   SETTINGS CARD SYSTEM
   ============================================================ */
.settings-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  overflow: hidden;
  transition:
    background var(--transition-normal),
    border-color var(--transition-normal);
}

.settings-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-lg) var(--space-sm);
}

.settings-card__icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--primary-ink);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.settings-card__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.settings-card__body {
  padding: var(--space-sm) var(--space-lg) var(--space-lg);
}

.settings-card__body .settings-item {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  padding: var(--space-md) 0;
  background: transparent;
}

.settings-card__body .settings-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.settings-card__body .settings-item:hover {
  border-color: var(--border);
}

/* Settings Actions Row */
.settings-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  padding: var(--space-sm) 0;
}

.settings-actions .btn {
  flex: 1;
  min-width: 120px;
}

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

/* Settings Footer */
.settings-footer {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-md);
}

.settings-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--border);
  border-radius: var(--radius-full);
  transition:
    background var(--transition-normal),
    box-shadow var(--transition-normal);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #FFFFFF;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-normal) cubic-bezier(0.22, 1, 0.36, 1);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--gradient);
  box-shadow: 0 2px 8px var(--shadow);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.toggle-switch input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px var(--shadow);
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ≥ 480px — Large phones */
@media (min-width: 480px) {
  .view {
    padding: var(--space-lg);
  }

  .recipe-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .modal {
    max-width: 420px;
  }
}

/* ≥ 768px — Tablets */
@media (min-width: 768px) {
  #app-content {
    padding-top: calc(80px + env(safe-area-inset-top, 0px));
  }

  body.search-open #app-content {
    padding-top: calc(146px + env(safe-area-inset-top, 0px));
  }

  #app-header {
    height: calc(72px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) max(var(--space-lg), env(safe-area-inset-right, 0px)) 0 max(var(--space-lg), env(safe-area-inset-left, 0px));
  }

  .search-bar {
    top: calc(72px + env(safe-area-inset-top, 0px));
  }

  #app-header .header-logo {
    font-size: 1.8rem;
  }

  .view {
    padding: var(--space-xl);
  }

  .recipe-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-xl);
  }

  .recipe-card__content {
    padding: var(--space-lg);
  }

  .recipe-detail__hero {
    aspect-ratio: 2.2 / 1;
    border-radius: var(--radius-lg);
  }

  .recipe-detail__info {
    padding: var(--space-lg);
  }

  .modal {
    max-width: 500px;
  }

  .toast-container {
    max-width: 440px;
  }

  .empty-state {
    padding: var(--space-3xl) var(--space-xl);
  }

  .filter-bar {
    gap: var(--space-md);
  }

  .filter-chip {
    padding: 10px 22px;
    font-size: 0.875rem;
  }
}

/* ≥ 1024px — Desktop */
@media (min-width: 1024px) {
  .view {
    padding: var(--space-xl) var(--space-2xl);
    max-width: 1280px;
  }

  .recipe-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-xl);
  }

  .recipe-detail {
    max-width: 860px;
  }

  .recipe-detail__info {
    gap: var(--space-xl);
  }

  .recipe-detail__hero {
    aspect-ratio: 2.5 / 1;
  }

  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
  }

  .btn--fab {
    bottom: 96px;
    right: var(--space-xl);
    width: 64px;
    height: 64px;
    font-size: 1.7rem;
  }

  .modal {
    max-width: 540px;
  }

  .settings-section {
    max-width: 640px;
  }

  .form-group {
    max-width: 640px;
  }

  .empty-state__icon {
    width: 112px;
    height: 112px;
  }

  .empty-state__title {
    font-size: 1.75rem;
  }
}

/* ≥ 1280px — Large desktop */
@media (min-width: 1280px) {
  .recipe-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Install Prompt Banner */
.install-prompt {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px) + var(--space-md));
  left: max(var(--space-md), env(safe-area-inset-left, 0px));
  right: max(var(--space-md), env(safe-area-inset-right, 0px));
  max-width: 500px;
  margin: 0 auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  z-index: var(--z-modal);
  box-shadow: var(--shadow-lg);
  animation: installPromptIn 0.4s ease both;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.install-prompt.hidden {
  display: none !important;
}

.install-prompt__content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.install-prompt__icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.install-prompt__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.install-prompt__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.install-prompt__title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.install-prompt__description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.install-prompt__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.install-prompt__actions .btn {
  padding: 8px 16px;
  font-size: 0.8rem;
}

@media (min-width: 1024px) {
  .install-prompt {
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
  }
}

/* ============================================================
   MULTI-STEP FORM
   ============================================================ */
.form-steps-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding: 0 var(--space-sm);
  position: relative;
}

.form-steps-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1;
}

.form-steps-btn .step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  transition: all var(--transition-fast) ease;
}

.form-steps-btn .step-lbl {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition-fast) ease;
}

.form-steps-btn.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 0 10px rgba(232, 93, 58, 0.3);
}

.form-steps-btn.active .step-lbl {
  color: var(--primary-ink);
  font-weight: 700;
}

.form-steps-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 var(--space-sm);
  margin-bottom: 22px; /* Aligns with step circles */
}

/* Form Tabs */
.form-tab {
  display: none;
  flex-direction: column;
  gap: var(--space-md);
}

.form-tab.active {
  display: flex;
  animation: fadeIn var(--transition-normal) ease both;
}

.form-tab-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* Ingredient Inputs Grid Layout */
.ingredient-row-container,
.step-inputs {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: var(--space-sm);
}

@keyframes installPromptIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dynamic-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.dynamic-field:focus-within {
  border-color: var(--primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--shadow);
}

.dynamic-field__label {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  line-height: 1.2;
  text-transform: uppercase;
}

.dynamic-field .form-input,
.dynamic-field .form-textarea,
.dynamic-field .form-select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 3px 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
}

.dynamic-field .form-select {
  padding-right: 28px;
  background-position: right 6px center;
}

.dynamic-field .form-textarea {
  min-height: 74px;
  resize: vertical;
}

.ingredient-inputs {
  display: grid;
  grid-template-columns: 2.2fr 0.8fr 1fr auto;
  gap: var(--space-xs);
  width: 100%;
  align-items: end;
}

.ingredient-notes-container {
  width: 100%;
}

.dynamic-list__item.step-item {
  align-items: flex-start;
}

.dynamic-list__item.step-item > .step-number {
  margin-top: 24px;
}

.dynamic-list__item.step-item > [data-action="remove-step"] {
  margin-top: 22px;
}

@media (max-width: 480px) {
  .ingredient-inputs {
    grid-template-columns: 1fr 1fr auto;
    grid-template-areas:
      "name name name"
      "qty unit remove";
    gap: var(--space-sm) var(--space-xs);
  }
  
  .ingredient-field--name {
    grid-area: name;
  }
  
  .ingredient-field--quantity {
    grid-area: qty;
  }
  
  .ingredient-field--unit {
    grid-area: unit;
  }
  
  .ingredient-inputs [data-action="remove-ingredient"] {
    grid-area: remove;
    justify-self: end;
    margin-bottom: 9px;
  }

  .form-tab-actions--submit {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-tab-actions--submit .btn {
    width: 100%;
    min-width: 0;
  }

  .form-tab-actions--submit .btn--grow {
    grid-column: 1 / -1;
  }

}

/* ============================================================
   RESPONSIVE LAYOUT POLISH
   ============================================================ */

/* Full-screen routes (create, detail and pantry) do not reserve space for
   navigation that is intentionally hidden. */
body.app-chrome-hidden #app-content {
  padding-top: max(var(--space-md), env(safe-area-inset-top, 0px));
  padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom, 0px));
}

.home-toolbar {
  margin-bottom: var(--space-md);
}

.home-toolbar .filter-bar {
  margin-bottom: var(--space-sm);
}

.filter-chip--pantry {
  color: var(--on-primary);
  background: var(--gradient);
  border-color: transparent;
  font-weight: 700;
}

.filter-chip--pantry:hover {
  color: var(--on-primary);
  border-color: transparent;
  filter: brightness(1.06);
}

.view-header--back {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.view-header--back .view-header__title {
  margin: 0;
  min-width: 0;
}

.view-back-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  color: var(--text-primary);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.view-back-button:hover {
  color: var(--primary-ink);
  border-color: var(--primary-light);
  background: var(--bg-secondary);
}

.form-view {
  max-width: 960px;
}

.form-view > .view-header,
.recipe-editor {
  width: 100%;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

.recipe-editor .form-group {
  max-width: none;
}

.btn--grow {
  flex: 1;
}

.settings-view {
  max-width: 1160px;
}

.settings-grid {
  display: grid;
  gap: var(--space-lg);
}

.settings-grid .settings-card {
  margin-bottom: 0;
}

.custom-categories-list,
.pantry-suggestions__list,
.pantry-selected__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  width: 100%;
}

.custom-categories-list {
  margin: var(--space-sm) 0;
}

.settings-empty-copy {
  margin: var(--space-xs) 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.custom-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  max-width: 100%;
  padding: 4px 8px 4px 12px;
  border: 1px solid;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.custom-cat-chip > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.btn-delete-cat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: 2px;
  border-radius: var(--radius-full);
  color: inherit;
  opacity: 0.8;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.btn-delete-cat:hover {
  opacity: 1;
  background: rgba(127, 127, 127, 0.14);
}

.add-category-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: var(--space-sm);
  width: 100%;
  margin-top: var(--space-xs);
}

.add-category-form .form-input,
.add-category-form .form-select {
  min-width: 0;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.add-category-form__icon {
  text-align: center;
}

.add-category-form__submit {
  width: 100%;
  min-height: 46px;
}

.settings-warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.09);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.settings-warning-banner__icon {
  flex-shrink: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.settings-warning-banner strong {
  color: var(--text-primary);
  font-weight: 700;
}

.settings-warning-banner p {
  margin-top: var(--space-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.pantry-view {
  max-width: 1040px;
  padding-bottom: var(--space-xl);
}

.pantry-header {
  align-items: flex-start;
  margin-bottom: var(--space-lg);
}

.pantry-header__copy {
  min-width: 0;
}

.pantry-header .view-header__subtitle {
  max-width: 620px;
  line-height: 1.5;
}

.pantry-card {
  padding: clamp(var(--space-md), 4vw, var(--space-lg));
  margin-bottom: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
}

.pantry-input-row {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.pantry-input-row .form-input {
  flex: 1;
  min-width: 0;
}

.pantry-input-row .btn {
  flex-shrink: 0;
}

.pantry-suggestions {
  margin-bottom: var(--space-md);
}

.pantry-section-label {
  display: block;
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pantry-quick-btn {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.pantry-quick-btn:hover {
  color: var(--primary-ink);
  border-color: var(--primary-light);
  background: var(--bg-tertiary);
}

.pantry-selected__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 700;
}

.pantry-clear-btn {
  color: var(--danger);
}

.pantry-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 8px 6px 12px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.85rem;
  font-weight: 600;
}

.pantry-chip button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  color: inherit;
}

.pantry-chip button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.pantry-empty-copy {
  padding: var(--space-md) 0 var(--space-xs);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.pantry-view .empty-state {
  min-height: 34vh;
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

#warning-modal .modal__actions {
  flex-wrap: wrap;
  padding: 0 var(--space-lg) var(--space-lg);
  padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom, 0px));
}

@media (max-width: 359px) {
  .nav-label {
    font-size: 0.75rem;
    letter-spacing: 0;
  }

  .form-steps-btn .step-lbl {
    max-width: 74px;
    font-size: 0.67rem;
    letter-spacing: -0.015em;
  }

  .form-steps-nav {
    padding-left: 0;
    padding-right: 0;
  }

  .form-steps-line {
    margin-left: var(--space-xs);
    margin-right: var(--space-xs);
  }

  .form-tab-actions--submit {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .form-tab-actions--submit .btn--grow {
    grid-column: 1 / -1;
  }

  .add-category-form {
    grid-template-columns: 1fr;
  }

  .pantry-input-row {
    flex-direction: column;
  }

  .pantry-input-row .btn {
    width: 100%;
  }
}

@media (min-width: 600px) {
  .home-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
  }

  .home-toolbar .filter-bar {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
  }

  .home-toolbar .sort-select {
    flex-shrink: 0;
  }

  .add-category-form {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

@media (min-width: 768px) {
  body.app-chrome-hidden #app-content {
    padding-top: max(var(--space-lg), env(safe-area-inset-top, 0px));
    padding-bottom: max(var(--space-xl), env(safe-area-inset-bottom, 0px));
  }

  .recipe-editor {
    padding: var(--space-xl);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
  }

  .category-selector-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #tab-cook.form-tab.active {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-lg);
  }

  #tab-cook .form-tab-actions {
    grid-column: 1 / -1;
  }

  .empty-state__description {
    max-width: 440px;
  }
}

@media (min-width: 960px) {
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xl);
  }

  .settings-card--appearance,
  .settings-card--categories {
    grid-column: 1 / -1;
  }

  .settings-card--appearance .settings-card__body {
    display: grid;
    grid-template-columns: minmax(260px, 0.75fr) minmax(420px, 1.25fr);
    gap: var(--space-xl);
    align-items: stretch;
  }

  .settings-card--appearance .settings-item {
    border-bottom: none !important;
  }

  .settings-card--appearance .settings-item + .settings-item {
    padding-left: var(--space-xl);
    border-left: 1px solid var(--border);
  }
}

@media (min-width: 1024px) {
  #app-header {
    padding-left: max(var(--space-2xl), calc((100vw - 1280px) / 2 + var(--space-2xl)));
    padding-right: max(var(--space-2xl), calc((100vw - 1280px) / 2 + var(--space-2xl)));
  }

  #app-content {
    padding-bottom: var(--space-xl);
  }

  .bottom-nav {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    bottom: auto;
    height: 56px;
    max-width: 520px;
    border: none;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav-item {
    flex: 0 1 auto;
    flex-direction: row;
    gap: 6px;
    min-width: 108px;
    padding: 0 14px;
    border-radius: var(--radius-full);
  }

  .nav-item:hover {
    background: var(--bg-tertiary);
  }

  .nav-item::before {
    top: auto;
    bottom: 4px;
    width: 28px;
    height: 2px;
    border-radius: var(--radius-full);
  }

  .nav-icon {
    width: 20px;
    height: 20px;
  }

  .nav-label {
    font-size: 0.75rem;
  }

  .home-toolbar .filter-bar {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}
