:root {
  /* Variante A — Caldo Editoriale (tema chiaro) */
  --bg: #f5eee1;
  --bg-top: #fbf7f2;
  --bg-accent: #f3dcc9;
  --surface: #ffffff;
  --surface-alt: #f1e8d6;
  --text: #2b211b;
  --text-muted: #8a7460;
  --paprika: #a8380f;
  --paprika-dark: #7e2a0a;
  --paprika-tint: #f3dcc9;
  --sage: #6e7f4f;
  --sage-tint: #e4e9d6;
  --gold: #b5842b;
  --gold-tint: #f3e6c4;
  --heart: #d6455a;
  --line: #e7dcc7;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 10px 24px rgba(43, 33, 27, 0.14);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-editorial: "Lora", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --input-bg: #ffffff;
  --card-ink: #2b211b;

  /* Alias (CSS esistente) */
  --ink: var(--text);
  --muted: var(--text-muted);
  --brand: var(--paprika);
  --brand-dark: var(--paprika-dark);
  --card: var(--surface);
  --ok: var(--sage);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-top);
}

body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg-top);
  background-image:
    radial-gradient(ellipse at top left, var(--bg-accent), transparent 55%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
  background-attachment: fixed;
  line-height: 1.45;
}

/*
  iPhone PWA con status-bar black-translucent:
  lo sfondo crema arriva sotto orario/batteria (con “default” iOS forza il bianco).
  Il padding safe-area va sul contenuto, non sul body, altrimenti resta un buco.
*/
.app-frame,
body.is-auth {
  padding-top: env(safe-area-inset-top, 0px);
  box-sizing: border-box;
}

@media all and (display-mode: standalone) {
  html,
  body {
    background-color: var(--bg-top);
  }
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.app-shell {
  --shell-pad-x: 1rem;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem var(--shell-pad-x) 5.5rem;
}

.app-frame {
  min-height: 100dvh;
}

.app-sidebar {
  display: none;
}

.app-main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.brand {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--paprika-dark);
}

.font-mono,
.qty-mono,
.step-counter,
.timer-inline {
  font-family: var(--font-mono);
}

.font-editorial {
  font-family: var(--font-editorial);
}

.muted { color: var(--muted); font-size: 0.95rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem;
}

.stack { display: grid; gap: 0.9rem; }

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.auth-card {
  width: min(100%, 24rem);
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  font-size: 2rem;
  color: var(--brand);
  letter-spacing: -0.03em;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="email"],
input[type="search"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 35%, white);
  border-color: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.85rem;
  padding: 0.7rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.btn:hover { background: var(--brand-dark); }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  font-size: 0.95rem;
}
.alert-error {
  background: #fdeceb;
  color: var(--danger);
}
.alert-success {
  background: #e8f6ee;
  color: var(--ok);
}

.empty {
  text-align: center;
  padding: 2rem 1rem;
}

.empty h2 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--card) 92%, white);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  padding: 0.2rem 0.75rem calc(0.25rem + env(safe-area-inset-bottom));
  overflow: visible;
}

.bottom-nav-inner {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.2rem;
  align-items: end;
  overflow: visible;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  min-height: 2.85rem;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  text-align: center;
  padding: 0.2rem 0.15rem 0.15rem;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .ph-bold,
.nav-item .ph-fill {
  font-size: 1.25rem;
  line-height: 1;
}

.nav-item.active,
.nav-item:hover {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, white);
}

.nav-item-add {
  position: relative;
  background: transparent !important;
  color: inherit;
  min-height: 2.85rem;
  align-self: end;
  overflow: visible;
}

.nav-item-add:hover,
.nav-item-add.active {
  background: transparent !important;
}

.nav-add-circle {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.05rem;
  height: 3.05rem;
  margin-top: -1.15rem;
  border-radius: 50%;
  border: 2px solid var(--brand);
  background: #fff;
  color: var(--brand);
  font-size: 0;
  line-height: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nav-add-circle .nav-add-ic {
  font-size: 1.45rem;
  line-height: 1;
  color: var(--brand);
}

.nav-item-add.active .nav-add-circle,
.nav-item-add:hover .nav-add-circle {
  background: color-mix(in srgb, var(--brand) 8%, #fff);
  transform: scale(1.04);
}

.recipe-list {
  display: grid;
  gap: 0.75rem;
}

.recipe-item {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.85rem;
  align-items: center;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  position: relative;
}

.recipe-thumb {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 12px;
  object-fit: cover;
  background: #efe6dc;
}

.recipe-meta {
  display: grid;
  gap: 0.2rem;
}

.recipe-meta strong {
  font-size: 1.02rem;
}

.spinner {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
  margin: 0.35rem auto;
}

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

.detail-hero {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 0.85rem;
  background: #efe6dc;
}

.ing-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 80%, var(--bg-accent));
}

.mode-switch-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.mode-switch-3 .mode-switch-item {
  font-size: 0.88rem;
  min-height: 2.4rem;
  padding: 0 0.25rem;
}

.mode-switch-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
}

.mode-switch-item.active {
  background: var(--card);
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(31, 26, 23, 0.08);
}

.mode-switch-item:hover {
  color: var(--brand-dark);
}

.source-card {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding: 0.9rem 1rem;
}

.source-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.source-card-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.help-btn {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.help-btn:hover,
.help-btn:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
  outline: none;
}

.help-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  width: min(100% - 2rem, 24rem);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.help-dialog::backdrop {
  background: rgba(31, 26, 23, 0.45);
}

.help-dialog h2 {
  margin: 0;
  font-size: 1.15rem;
}

.help-dialog p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--muted);
}

.foto-actions {
  display: grid;
  gap: 0.45rem;
}

.foto-pick {
  display: grid;
  gap: 0.45rem;
}

.foto-pick-label {
  font-weight: 600;
  font-size: 0.92rem;
}

.ing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ing-title-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem 0.45rem;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

/* Più specifico di input[type=number] globale (width 100% + padding grande) */
.ing-title-line input.portion-inline[type="number"] {
  width: 3.1rem;
  max-width: 3.1rem;
  flex: 0 0 3.1rem;
  min-height: 2.15rem;
  padding: 0.25rem 0.35rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 750;
  font-family: inherit;
  border-radius: 10px;
  border: 1.5px solid var(--brand);
  background: var(--input-bg);
  color: var(--card-ink);
  -webkit-appearance: none;
  appearance: textfield;
  box-sizing: border-box;
  color-scheme: light;
}

.ing-title-line input.portion-inline[type="number"]::-webkit-outer-spin-button,
.ing-title-line input.portion-inline[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.portion-scaler {
  display: grid;
  gap: 0.2rem;
  margin: 0;
  font-weight: 600;
  min-width: 8.5rem;
}

.portion-scaler input[type="number"] {
  width: 5.5rem;
  min-height: 2.4rem;
  padding: 0.4rem 0.55rem;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--card-ink);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: textfield;
  box-sizing: border-box;
  color-scheme: light;
}

.portion-scaler input[type="number"]::-webkit-outer-spin-button,
.portion-scaler input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ing-note {
  font-size: 0.85rem;
}

.prose {
  white-space: normal;
  line-height: 1.55;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-weight: 650;
  font-size: 0.92rem;
}

.rich-editor {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--input-bg);
  overflow: hidden;
}

.rich-toolbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  padding: 0.45rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.rich-btn {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--card-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.rich-btn:active,
.rich-btn:focus-visible {
  border-color: var(--brand);
  outline: none;
}

.rich-surface {
  min-height: 11rem;
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--card-ink);
  -webkit-user-select: text;
  user-select: text;
}

.rich-surface:focus {
  outline: none;
}

.rich-surface p {
  margin: 0 0 0.65rem;
}

.rich-surface p:last-child {
  margin-bottom: 0;
}

.rich-surface a {
  color: var(--brand);
  text-decoration: underline;
  word-break: break-word;
}

.step-item a {
  color: var(--brand);
  text-decoration: underline;
  word-break: break-word;
}

.step-item strong {
  font-weight: 750;
}

.step-item em {
  font-style: italic;
}

textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--card-ink);
}

input[type="file"] {
  width: 100%;
  font-size: 0.95rem;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: #8f1c14;
}

.topbar-compact {
  margin-bottom: 0.65rem;
}

.btn-compact {
  min-height: 2.2rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

.filters-compact {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
}

/* Figlio diretto di .app-shell: resta visibile anche mentre scorrono le ricette */
.home-filters-sticky {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 25;
  margin-left: calc(-1 * var(--shell-pad-x));
  margin-right: calc(-1 * var(--shell-pad-x));
  margin-bottom: 0.55rem;
  padding: 0.4rem var(--shell-pad-x) 0.5rem;
  background: var(--bg-top);
  box-shadow: 0 10px 14px -12px rgba(43, 33, 27, 0.2);
}

.filters-compact-search {
  display: flex;
  gap: 0;
  align-items: stretch;
  position: relative;
}

.filters-compact-search .search-ic {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1;
  pointer-events: none;
}

.filters-compact-search input[type="search"],
.filters-compact-search input[type="text"] {
  flex: 1;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.4rem 0.65rem 0.4rem 2.35rem;
  font-size: 16px; /* evita zoom automatico Safari iPhone */
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--card-ink);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.filters-compact-search input[type="search"]::-webkit-search-decoration,
.filters-compact-search input[type="search"]::-webkit-search-cancel-button,
.filters-compact-search input[type="search"]::-webkit-search-results-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.filters-compact-search input[type="search"]:focus,
.filters-compact-search input[type="text"]:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 35%, white);
  border-color: var(--brand);
}

.btn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  line-height: 1;
}

.btn-chip:hover {
  background: color-mix(in srgb, var(--brand) 10%, white);
}

.btn-chip.filters {
  color: var(--paprika-dark);
}

.btn-chip.filter-chip {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.filter-chip-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 2.25rem;
  padding: 0 0.7rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  cursor: pointer;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}

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

.filter-chip-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: 2rem;
  padding: 0 0.55rem 0 0.25rem;
  border-left: 1px solid color-mix(in srgb, var(--paprika) 28%, var(--line));
  color: var(--paprika-dark);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.filter-chip-clear:hover {
  background: color-mix(in srgb, var(--paprika) 12%, transparent);
  color: var(--paprika-dark);
}

.chip-count {
  background: var(--paprika);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.1rem 0.4rem;
  line-height: 1.2;
}

.home-filter-chips {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.1rem;
}

.home-filter-chips-main {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
}

.home-vista-chip {
  flex-shrink: 0;
  margin-left: auto;
}

.filters-compact-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.filters-compact-row select {
  flex: 1;
  min-width: 0;
  min-height: 2.25rem;
  padding: 0.4rem 0.5rem;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: var(--card);
  color: var(--card-ink);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b5e55' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 1.75rem;
}

.user-filter {
  position: relative;
  flex: 1;
  min-width: 0;
}

.user-filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.4rem 1.85rem 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b5e55' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  color: var(--card-ink);
  font: inherit;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

.user-filter-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-filter-count {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.9rem;
}

.user-filter-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 32;
  display: grid;
  padding: 0.3rem;
  max-height: min(50vh, 18rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.user-filter-menu[hidden] {
  display: none !important;
}

.user-filter-opt {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--card-ink);
  font: inherit;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}

.user-filter-opt:hover,
.user-filter-opt:focus-visible {
  background: color-mix(in srgb, var(--brand) 10%, var(--card));
}

.user-filter-opt.is-on {
  background: color-mix(in srgb, var(--brand) 14%, var(--card));
  font-weight: 700;
}

.user-filter-opt.is-on .user-filter-count {
  color: var(--paprika-dark);
}

.filters-reset {
  flex-shrink: 0;
  min-height: 2.1rem;
  display: inline-flex;
  align-items: center;
  padding: 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
}

.pantry-active {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

.pantry-active a {
  font-weight: 650;
}

.pantry-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  width: min(100% - 2rem, 24rem);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.pantry-dialog::backdrop {
  background: rgba(31, 26, 23, 0.45);
}

.pantry-dialog h2 {
  margin: 0;
  font-size: 1.15rem;
}

.pantry-dialog textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.pantry-dialog.filter-sheet {
  padding: 0;
  overflow: hidden;
  background: var(--surface);
}

.filter-sheet form {
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 36rem);
}

.filter-sheet-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.filter-sheet-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.filter-sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.filter-sheet-close:hover {
  background: color-mix(in srgb, var(--text) 6%, transparent);
}

.filter-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  background: var(--surface);
}

.filter-sheet-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.btn.btn-pill-sm {
  min-height: 2.35rem;
  height: 2.35rem;
  padding: 0 1.25rem;
  width: auto;
  border-radius: 999px;
  font-size: 0.92rem;
}

.pref-heart {
  color: var(--heart);
  margin-right: 0.15rem;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
}

.check-row input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--brand);
}

.pantry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.pantry-actions .btn {
  min-height: 2.85rem;
}

.badge-admin {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--brand-dark);
  background: var(--bg-accent);
  border-radius: 999px;
  vertical-align: middle;
}

.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.cat-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}
.cat-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.cat-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.btn-chip.is-active {
  background: color-mix(in srgb, var(--brand) 14%, white);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.2rem 0 0.15rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 18%, var(--bg-top));
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.cat-editor {
  display: grid;
  gap: 0.55rem;
}

.cat-editor-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-weight: 700;
}

.cat-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.35rem;
  padding: 0.25rem 0.25rem 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.cat-chip.is-on {
  border-color: color-mix(in srgb, var(--brand) 50%, var(--line));
  background: color-mix(in srgb, var(--brand) 12%, white);
  color: var(--brand);
  font-weight: 700;
}

.cat-chip-name {
  font-size: 0.92rem;
}

.cat-chip-menu {
  min-width: 2rem;
  min-height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.cat-chip-menu:hover {
  background: color-mix(in srgb, var(--ink) 6%, white);
  color: var(--ink);
}

.cat-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  width: min(100% - 2rem, 24rem);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.cat-dialog::backdrop {
  background: rgba(31, 26, 23, 0.45);
}

.cat-dialog h2 {
  margin: 0;
  font-size: 1.15rem;
}

.cat-filter-list {
  display: grid;
  gap: 0.55rem;
  max-height: min(50vh, 18rem);
  overflow: auto;
  padding-right: 0.15rem;
}

.cat-actions form { margin: 0; }
.link-danger {
  background: none;
  border: 0;
  color: var(--danger);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
}

.install-steps {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.55rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.install-steps li {
  padding-left: 0.15rem;
}

/* ——— Responsive shell + feature UI ——— */

@media (min-width: 640px) {
  .app-shell {
    --shell-pad-x: 1.35rem;
    max-width: 48rem;
    padding: 1.25rem var(--shell-pad-x) 5.5rem;
  }
  .bottom-nav-inner {
    max-width: 48rem;
  }
  .nav-item {
    font-size: 0.8rem;
  }
}

@media (min-width: 1024px) {
  body.is-app {
    background: var(--bg);
  }

  .app-frame {
    display: grid;
    grid-template-columns: 15.5rem 1fr;
    min-height: 100dvh;
  }

  .app-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    padding: 1.25rem 1rem;
    border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--card) 94%, white);
    overflow: auto;
  }

  .app-sidebar-brand {
    font-family: "Fraunces", Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 760;
    letter-spacing: -0.03em;
    color: var(--brand);
    padding: 0 0.35rem;
  }

  .app-sidebar-nav {
    display: grid;
    gap: 0.25rem;
  }

  .side-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 650;
    text-decoration: none;
  }

  .side-link-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    flex-shrink: 0;
    line-height: 1;
  }

  .side-link-ic .ph-bold,
  .side-link-ic .ph-fill {
    font-size: 1.2rem;
    line-height: 1;
  }

  .side-link.active,
  .side-link:hover {
    background: color-mix(in srgb, var(--brand) 12%, white);
    color: var(--brand);
  }

  .app-sidebar-cats {
    margin-top: 0.5rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 0.15rem;
  }

  .app-sidebar-cats-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding: 0 0.75rem 0.35rem;
  }

  .side-cat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    color: var(--ink);
    font-size: 0.9rem;
  }

  .side-cat:hover {
    background: color-mix(in srgb, var(--brand) 8%, white);
  }

  .app-main {
    min-width: 0;
  }

  .app-shell {
    --shell-pad-x: 1.75rem;
    max-width: 72rem;
    padding: 1.5rem var(--shell-pad-x) 2rem;
  }

  .bottom-nav {
    display: none;
  }
}

/* Catalogo griglia */
.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin: 0.35rem 0 0.75rem;
}

.catalog-count {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.vista-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.vista-toggle .btn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  height: 1.75rem;
  padding: 0 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 8px;
}

.recipe-select-check {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, #1b1712 42%, transparent);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  pointer-events: none;
}

.recipe-item .recipe-select-check {
  top: 0.55rem;
  left: 0.55rem;
  width: 2.15rem;
  height: 2.15rem;
  font-size: 1.25rem;
}

.recipe-select-check .recipe-select-on {
  display: none;
}

body.is-selecting .recipe-select-check {
  display: flex;
}

body.is-selecting .fav-form {
  visibility: hidden;
  pointer-events: none;
}

body.is-selecting #btn-bulk-categorie,
body.is-selecting .bottom-nav,
body.is-selecting .pin-switcher {
  display: none !important;
}

body.is-selecting .app-shell {
  padding-bottom: 8.25rem;
}

.recipe-card.is-selected,
.recipe-item.is-selected {
  box-shadow: 0 0 0 2px var(--brand);
}

.recipe-card.is-selected .recipe-select-check,
.recipe-item.is-selected .recipe-select-check {
  background: var(--brand);
  color: #fff;
}

.recipe-card.is-selected .recipe-select-on,
.recipe-item.is-selected .recipe-select-on {
  display: inline-block;
}

.recipe-card.is-selected .recipe-select-off,
.recipe-item.is-selected .recipe-select-off {
  display: none;
}

.bulk-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: color-mix(in srgb, var(--card) 94%, white);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px rgba(43, 33, 27, 0.12);
}

.bulk-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
}

.bulk-bar-count {
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 0;
}

.bulk-bar-actions {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 0.55rem;
  width: 100%;
  max-width: 40rem;
  margin: 0.55rem auto 0;
}

.bulk-bar-actions .btn {
  min-height: 2.75rem;
  width: 100%;
}

.bulk-cat-footer {
  justify-content: space-between;
}

.bulk-cat-footer .btn-ghost {
  order: 1;
  min-height: 2.35rem;
}

.bulk-cat-footer .btn-pill-sm {
  order: 2;
}

.cat-filter-list .check-row {
  min-height: 2.6rem;
  align-items: center;
}

@media (min-width: 640px) {
  .bulk-bar-top,
  .bulk-bar-actions {
    max-width: 48rem;
  }
}

@media (min-width: 1024px) {
  body.is-selecting .app-shell {
    padding-bottom: 7.5rem;
  }
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .recipe-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
  }
}

@media (min-width: 1024px) {
  .recipe-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
  }
}

.recipe-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  position: relative;
}

.recipe-card-thumb {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: #efe6dc;
  display: block;
}

.recipe-card-thumb.is-empty,
.recipe-thumb.is-empty,
.detail-hero.is-empty,
.detail-summary-thumb.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Cerchio crema + piatto con posate (Phosphor) */
.recipe-card-thumb.is-empty::after,
.recipe-thumb.is-empty::after,
.detail-hero.is-empty::after,
.detail-summary-thumb.is-empty::after {
  display: none;
}

.cover-empty-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: #fffdf8;
  color: var(--paprika);
  font-size: 1.35rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  line-height: 1;
}

.cover-empty-ic .ph-bold,
.cover-empty-ic .ph-fill {
  font-size: inherit;
  line-height: 1;
}

.recipe-thumb.is-empty .cover-empty-ic,
.detail-summary-thumb.is-empty .cover-empty-ic {
  width: 2.15rem;
  height: 2.15rem;
  font-size: 1.05rem;
}

.detail-hero.is-empty .cover-empty-ic {
  width: 4.35rem;
  height: 4.35rem;
  font-size: 2.1rem;
}

.btn-chip .ph-bold,
.btn-chip .ph-fill,
.filter-chip-open .ph-bold,
.filter-chip-clear .ph-bold,
.pin-switcher-label .ph-bold,
.pin-switcher-label .ph-fill,
.detail-back .ph-bold,
.time-pill .ph-bold,
.help-btn .ph-bold,
.icon-btn .ph-bold,
.icon-btn .ph-fill {
  vertical-align: -0.12em;
  font-size: 1.05em;
  line-height: 1;
}

.help-btn .ph-bold {
  font-size: 1rem;
}

.notif-bell-btn .ph-bold {
  font-size: 1.2rem;
  line-height: 1;
}

.list-fav-ic {
  margin-right: 0.25rem;
  color: var(--heart);
  font-size: 0.95em;
  vertical-align: -0.1em;
}

.pref-heart {
  color: var(--heart);
  margin-right: 0.15rem;
}

.recipe-card-body {
  padding: 0.55rem 0.6rem 0.7rem;
  display: grid;
  gap: 0.25rem;
}

.recipe-card-body strong {
  font-size: 0.88rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fav-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 253, 248, 0.94);
  color: color-mix(in srgb, var(--text-muted) 85%, var(--text));
  cursor: pointer;
  line-height: 0;
  box-shadow: 0 2px 6px rgba(43, 33, 27, 0.18);
  -webkit-tap-highlight-color: transparent;
}

.fav-btn .ph-bold,
.fav-btn .ph-fill {
  font-size: 1.2rem;
  line-height: 1;
}

.fav-btn.is-on {
  color: var(--heart);
  background: rgba(255, 253, 248, 0.96);
}

.fav-btn:active {
  transform: scale(0.94);
}

.recipe-list.is-hidden,
.recipe-grid.is-hidden {
  display: none;
}

/* Dettaglio cucina */
.detail-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  align-items: start;
  margin-bottom: 0.85rem;
}

.detail-summary > div {
  min-width: 0;
  width: 100%;
}

.detail-title {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.25;
  word-break: normal;
  overflow-wrap: break-word;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
}

.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.detail-meta-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  opacity: 0.9;
}

.detail-meta-sep {
  opacity: 0.55;
}

.detail-summary-thumb {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 12px;
  object-fit: cover;
  background: #efe6dc;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.topbar-icon-form {
  margin: 0;
  display: inline-flex;
}

.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  line-height: 1;
}

.topbar-icon-btn .ph-bold,
.topbar-icon-btn .ph-fill {
  font-size: 1.15rem;
  line-height: 1;
}

.topbar-icon-btn.heart {
  color: var(--heart);
}

.topbar-icon-btn.heart.is-on {
  background: #fbe3e7;
  border-color: var(--heart);
  color: var(--heart);
}

.topbar-icon-btn.pin {
  color: var(--gold);
  background: var(--gold-tint);
  border-color: var(--gold);
}

.topbar-icon-btn.pin.is-on {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.detail-backbar {
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.detail-action-groups {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.15rem 0 0.85rem;
}

.detail-action-group {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.detail-action-form {
  margin: 0;
}

.detail-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  min-width: 2.6rem;
}

.detail-action-ic {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  box-sizing: border-box;
  line-height: 1;
}

.detail-action-ic .ph-bold,
.detail-action-ic .ph-fill {
  font-size: 1.15rem;
  line-height: 1;
}

.detail-action-lbl {
  font-size: 0.62rem;
  font-weight: 650;
  color: var(--text-muted);
  line-height: 1.1;
  text-align: center;
}

.detail-action.pin .detail-action-ic {
  background: var(--gold-tint);
  border-color: var(--gold);
  color: var(--gold);
}

.detail-action.pin.is-on .detail-action-ic {
  background: var(--gold);
  border-color: var(--gold);
  color: #fff;
}

.detail-action.heart .detail-action-ic {
  color: var(--heart);
}

.detail-action.heart.is-on .detail-action-ic {
  background: #fbe3e7;
  border-color: var(--heart);
  color: var(--heart);
}

.detail-action.more {
  position: relative;
}

.more-menu {
  position: relative;
}

.more-menu-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

.more-menu-btn::-webkit-details-marker {
  display: none;
}

.more-menu-btn .ph-bold {
  font-size: 1.2rem;
  line-height: 1;
}

.more-menu-top .more-menu-panel {
  right: 0;
  left: auto;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.45rem;
}

.time-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.detail-hero.is-empty,
.detail-summary-thumb.is-empty {
  min-height: 10rem;
}

.menu-share-icon {
  width: 1.05rem;
  height: 1.05rem;
  vertical-align: -0.15rem;
  margin-right: 0.35rem;
}

.more-menu-share {
  display: flex !important;
  align-items: center;
}

.pin-switcher {
  position: relative;
  z-index: 5;
  margin: 0.85rem 0 0;
  padding: 0.85rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

/* Sticky in basso: barra bianca fino al menù (niente gap beige). Il + può sporgere sul bordo. */
.pin-switcher:not([hidden]) {
  position: fixed;
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  margin: 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: none;
  padding: 0.65rem 0.85rem calc(3.75rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 16px rgba(43, 33, 27, 0.1);
  max-width: none;
  overflow: hidden;
}

body.has-pin-bar:not(.cook-fs) .app-shell {
  padding-bottom: calc(5.5rem + var(--pin-bar-offset, 4.75rem));
}

/* In modalità preparazione: resta fisso al fondo (barra nav nascosta) — non toccare */
body.cook-fs .pin-switcher:not([hidden]) {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 230;
  margin: 0;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: none;
  padding: 0.65rem 0.85rem max(0.75rem, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(43, 33, 27, 0.1);
}

body.cook-fs.has-pin-bar .prep-fs {
  padding-top: max(0.5rem, env(safe-area-inset-top));
  padding-bottom: var(--pin-bar-offset, 5.5rem);
}

@media (min-width: 900px) {
  .pin-switcher:not([hidden]) {
    bottom: 0;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  }

  body.has-pin-bar:not(.cook-fs) .app-shell {
    padding-bottom: calc(2rem + var(--pin-bar-offset, 4.75rem));
  }
}

.pin-switcher-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pin-switcher-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.pin-switcher-clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--paprika-dark);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  padding: 0.25rem 0.35rem;
  min-height: 2rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pin-switcher-list {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.1rem;
  scrollbar-width: thin;
  box-sizing: border-box;
}

.pin-chip {
  display: inline-flex;
  align-items: stretch;
  max-width: 12rem;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 7.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.pin-chip.is-current {
  border-color: var(--gold);
  background: var(--gold-tint);
}

.pin-chip-link {
  display: block;
  width: 100%;
  max-width: none;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  text-align: center;
  min-height: 2.35rem;
  line-height: 1.35;
  box-sizing: border-box;
}

.pin-chip.is-current .pin-chip-link {
  color: #7a5a1e;
}

.pin-chip-remove {
  display: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover,
.icon-btn.is-on {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}

.cook-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 2px solid var(--line);
  margin: 0.5rem 0 0.85rem;
}

.cook-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.7rem 0.5rem;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.cook-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.cook-panel[hidden] {
  display: none !important;
}

.cook-layout {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  max-width: 100%;
}

.cook-panel {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.cook-panel > * {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 900px) {
  .cook-tabs {
    display: none;
  }
  .cook-layout {
    grid-template-columns: 1fr 1.15fr;
    align-items: start;
  }
  .cook-panel[hidden] {
    display: grid !important;
  }
}

.ing-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.ing-hint a {
  color: var(--paprika-dark);
  font-weight: 700;
  text-decoration: none;
}

.ing-check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  min-width: 0;
  max-width: 100%;
}

.ing-check-list li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.2rem;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
}

.ing-check-list li + li {
  border-top: 1px solid var(--line);
}

.ing-check-list li.is-done {
  opacity: 0.55;
}

.ing-check-list li.is-done .ing-nome {
  text-decoration: line-through;
}

.ing-check-list input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--paprika);
  pointer-events: none;
}

.ing-check-list .ing-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.ing-check-list .ing-nome {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--card-ink);
  overflow-wrap: anywhere;
}

.ing-check-list .ing-qty-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.1rem;
  flex: 0 0 auto;
  flex-shrink: 0;
  max-width: 46%;
  text-align: right;
  overflow: visible;
}

.ing-check-list .ing-qty {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--paprika-dark);
  white-space: nowrap;
  line-height: 1.2;
}

.ing-check-list .ing-qty:empty {
  display: none;
}

.ing-check-list .ing-qty-orig {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.15;
  text-decoration: line-through;
}

.prep-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.prep-fs {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: var(--bg-top);
  padding:
    max(0.5rem, env(safe-area-inset-top))
    max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom))
    max(0.75rem, env(safe-area-inset-left));
}

.prep-fs[hidden] {
  display: none !important;
}

.prep-fs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.35rem 0 0.65rem;
}

.prep-fs-title {
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--ink);
}

.prep-fs-hint {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.prep-fs-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.prep-fs .step-list {
  gap: 0.75rem;
  padding-bottom: 1.5rem;
}

.prep-fs .step-item {
  font-size: 1.28rem;
  line-height: 1.55;
  padding: 1.15rem 1.05rem;
  border-radius: 16px;
}

.prep-fs .cook-timer-chip {
  font-size: 1em;
  padding: 0.4rem 0.85rem;
  min-height: 2.5rem;
}

body.cook-fs {
  overflow: hidden;
}

body.cook-fs .bottom-nav {
  visibility: hidden;
  pointer-events: none;
}

.step-list {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  max-width: 100%;
}

.step-item {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.step-num {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--text-muted);
}

.step-body {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.step-item.is-done {
  background: var(--sage-tint);
  border-color: transparent;
  color: #5c6a44;
  opacity: 1;
}

.step-item.is-done .step-num {
  background: var(--sage);
  color: #fff;
}

.step-item.is-current,
.step-item.is-active {
  background: var(--paprika-tint);
  border: 1.5px solid var(--paprika);
  font-weight: 600;
  outline: none;
  box-shadow: none;
}

.step-item.is-current .step-num,
.step-item.is-active .step-num {
  background: var(--paprika);
  color: #fff;
}

.kitchen-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: var(--paprika);
  color: #fff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.kitchen-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.kitchen-toggle-title {
  font-size: 0.9rem;
  font-weight: 700;
}

.kitchen-toggle-sub {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.88;
}

.kitchen-toggle-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.kitchen-switch {
  position: relative;
  flex-shrink: 0;
  width: 2.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  transition: background 0.15s ease;
}

.kitchen-switch::after {
  content: "";
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  background: #fff;
  transition: transform 0.15s ease;
}

.kitchen-toggle-input:checked + .kitchen-switch {
  background: rgba(255, 255, 255, 0.55);
}

.kitchen-toggle-input:checked + .kitchen-switch::after {
  transform: translateX(1rem);
}

.kitchen-toggle-input:not(:checked) + .kitchen-switch::after {
  transform: translateX(0);
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.15rem 0 0.25rem;
  min-width: 0;
  max-width: 100%;
}

.progress-mid {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: center;
  overflow: hidden;
}

.step-dial {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--paprika) var(--deg, 40deg), var(--surface-alt) 0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-dial::after {
  content: "";
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--surface);
}

.progress-txt {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.progress-txt b {
  color: var(--text);
  font-family: var(--font-mono);
}

.cook-timer-chip {
  display: inline-flex;
  align-items: center;
  vertical-align: baseline;
  margin: 0 0.15rem;
  padding: 0.28rem 0.7rem;
  max-width: 100%;
  border: 1.5px solid color-mix(in srgb, var(--brand) 55%, var(--line));
  border-radius: 999px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 14%, white), color-mix(in srgb, var(--brand) 6%, white));
  color: var(--brand-dark);
  font: inherit;
  font-weight: 750;
  font-size: 0.95em;
  line-height: 1.25;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 18%, transparent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-sizing: border-box;
}

.cook-timer-chip:active {
  transform: scale(0.97);
}

.cook-timer-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  vertical-align: middle;
  margin: 0.15rem 0.2rem;
  padding: 0.45rem 0.55rem 0.45rem 0.75rem;
  border: 2px solid var(--brand);
  border-radius: 16px;
  background:
    radial-gradient(ellipse at top left, color-mix(in srgb, var(--brand) 22%, white), transparent 55%),
    linear-gradient(165deg, #fffdf9 0%, color-mix(in srgb, var(--brand) 8%, white) 100%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent),
    0 8px 20px rgba(31, 26, 23, 0.1);
  animation: cook-timer-in 0.28s ease;
}

@keyframes cook-timer-in {
  from { opacity: 0.4; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.cook-timer-inline-time {
  font-size: 1.55rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1;
  min-width: 4.2ch;
  text-align: center;
}

.cook-timer-inline-stop {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cook-timer-inline.is-done {
  border-color: var(--ok);
  background:
    radial-gradient(ellipse at top left, color-mix(in srgb, var(--ok) 24%, white), transparent 55%),
    linear-gradient(165deg, #fffdf9 0%, color-mix(in srgb, var(--ok) 10%, white) 100%);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent),
    0 8px 20px rgba(31, 26, 23, 0.08);
  animation: cook-timer-pulse 0.9s ease 2;
}

.cook-timer-inline.is-done .cook-timer-inline-time {
  color: var(--ok);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  min-width: auto;
}

@keyframes cook-timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.timer-sound-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.wake-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.wake-row input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--brand);
}

/* Spesa */
.spesa-add {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.spesa-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.spesa-item.is-done {
  opacity: 0.5;
}

.spesa-item.is-done .spesa-text {
  text-decoration: line-through;
}

.spesa-text strong {
  display: block;
}

.spesa-qty {
  font-size: 0.85rem;
  color: var(--muted);
}

.share-dialog {
  padding: 0;
}

.amico-codice {
  font-size: 1.75rem;
  font-weight: 780;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 0.75rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand) 10%, #fff);
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.amico-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.amico-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.amico-row-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.amico-row-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.amico-thumb,
.amico-thumb-empty {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #efe6dc;
  display: block;
}

/* Pasti */
.pasti-subnav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin: -0.35rem 0 0.9rem;
}

.pasti-subnav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.pasti-subnav-link.is-active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.menu-list {
  display: grid;
  gap: 0.55rem;
}

.menu-list-item {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-decoration: none;
  color: inherit;
  min-height: 3.25rem;
}

.menu-list-name {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
}

.menu-list-meta {
  font-size: 0.85rem;
}

.menu-voce {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

.menu-voce:last-of-type {
  border-bottom: 0;
}

.menu-voce-thumb,
.menu-voce-thumb-empty {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  background: #efe6dc;
}

.menu-voce-title {
  font-weight: 650;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.3;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.week-nav strong {
  font-size: 0.95rem;
  text-align: center;
}

.day-block {
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
}

.day-block.is-today .day-head {
  color: var(--brand);
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: color-mix(in srgb, var(--bg) 70%, white);
  font-weight: 700;
  font-size: 0.92rem;
}

.day-meals {
  padding: 0.35rem 0.65rem 0.65rem;
  display: grid;
  gap: 0.35rem;
}

.meal-row {
  display: grid;
  grid-template-columns: auto 2.75rem 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0.35rem;
  cursor: grab;
  touch-action: pan-y;
  border-radius: 10px;
}

.meal-row:active {
  cursor: grabbing;
}

.meal-row.is-dragging {
  opacity: 0.45;
}

.meal-row-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.92;
  background: var(--card);
  border: 1px solid var(--brand);
  box-shadow: var(--shadow);
  padding: 0.35rem;
  max-width: min(90vw, 28rem);
}

.day-block.is-drop-target {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--brand) 6%, white);
}

.meal-thumb-link {
  display: block;
  flex-shrink: 0;
}

.meal-thumb {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  object-fit: cover;
  background: #efe6dc;
  display: block;
}

.meal-thumb-empty {
  background: #efe6dc;
}

.meal-row .meal-title {
  color: inherit;
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-tipo {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 4.2rem;
  font-weight: 650;
}

/* Pasti - layout dedicato (mobile first) */
.pasti-page .topbar {
  margin-bottom: 0.85rem;
}

.pasti-page .brand {
  font-size: 1.95rem;
  color: var(--text);
}

.pasti-menu-btn {
  min-height: 1.85rem;
  padding: 0.15rem 0.7rem;
  font-size: 0.7rem;
  border-radius: 999px;
}

.pasti-page .week-nav {
  margin-bottom: 0.9rem;
}

.pasti-page .week-nav strong {
  font-size: 0.9rem;
  font-weight: 700;
}

.pasti-page .week-nav .icon-btn {
  min-width: 1.8rem;
  min-height: 1.8rem;
  border-radius: 8px;
  padding: 0.2rem;
}

.pasti-empty-week {
  text-align: center;
}

.pasti-empty-week h2 {
  font-size: 2rem;
  margin-bottom: 0.45rem;
}

.pasti-empty-week p {
  max-width: 26rem;
  margin-left: auto;
  margin-right: auto;
}

.pasti-empty-week .btn {
  min-height: 2.35rem;
  padding: 0.55rem 1.05rem;
}

.pasti-week-list {
  display: grid;
  gap: 0.65rem;
}

.pasti-page .day-block {
  margin-bottom: 0;
}

.pasti-page .day-head {
  font-size: 0.84rem;
  text-transform: lowercase;
}

.pasti-page .day-head .icon-btn {
  min-width: 1.6rem;
  min-height: 1.6rem;
  border: 0;
  background: transparent;
}

.pasti-page .meal-empty {
  margin: 0.2rem 0.35rem;
  font-size: 0.82rem;
}

.detail-hero-desktop {
  display: none;
}

@media (min-width: 900px) {
  .detail-summary {
    grid-template-columns: 4.5rem 1fr;
  }

  .detail-hero-mobile {
    display: none;
  }
  .detail-hero-desktop {
    display: block;
  }
}


/* ===== Redesign Variante A: import / revisione / home / cucina ===== */
.btn-outline {
  background: transparent;
  color: var(--paprika);
  border: 1.5px solid var(--paprika);
}
.btn-outline:hover { background: var(--paprika-tint); color: var(--paprika-dark); }
.btn-row-2 { display: flex; gap: 0.5rem; }
.btn-row-2 .btn { flex: 1; font-size: 0.85rem; padding: 0.7rem 0.4rem; }

.source-card-primary { border-top: 3px solid var(--paprika); }
.source-platforms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  margin: 0.1rem 0 0.15rem;
}
.source-platform {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 3.6rem;
  padding: 0.45rem 0.2rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.source-platform:active {
  transform: scale(0.97);
}
.source-platform-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  color: #fff;
}
.source-platform[data-platform="instagram"] .source-platform-icon {
  background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af);
}
.source-platform[data-platform="tiktok"] .source-platform-icon {
  background: #111;
}
.source-platform[data-platform="facebook"] .source-platform-icon {
  background: #1877f2;
}
.source-platform[data-platform="youtube"] .source-platform-icon {
  background: #ff0000;
}
.source-platform[data-platform="pinterest"] .source-platform-icon {
  background: #e60023;
}
.source-platform[data-platform="threads"] .source-platform-icon {
  background: #000;
}
.source-platform[data-platform="x"] .source-platform-icon {
  background: #000;
}
.source-platform[data-platform="giallozafferano"] .source-platform-icon {
  background: #f5c518;
  color: #1a1208;
}
.source-platform-name {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  color: var(--text-muted);
}
.platform-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.8rem; font-weight: 600; color: #8a3a16;
  background: var(--paprika-tint); padding: 0.3rem 0.65rem; border-radius: 999px; margin-bottom: 0.35rem;
}
.platform-chip.is-warn { background: #f3e6c4; color: #7a5a1e; }
.helper-text { font-size: 0.8rem; margin: 0 0 0.65rem; line-height: 1.4; }

.proc-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1rem 0 0.5rem; }
.proc-dial {
  position: relative;
  width: 4.5rem; height: 4.5rem;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
/* Solo l’anello gira; l’icona al centro resta ferma */
.proc-dial::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--paprika) 250deg, var(--surface-alt) 0);
  animation: proc-spin 1.2s linear infinite;
}
.proc-dial::after {
  content: "";
  position: relative; z-index: 1;
  width: 3.25rem; height: 3.25rem; border-radius: 50%;
  background-color: var(--surface);
}
.proc-dial .proc-dial-ic {
  position: absolute;
  z-index: 2;
  font-size: 1.45rem;
  color: var(--paprika);
  line-height: 1;
}
@keyframes proc-spin { to { transform: rotate(360deg); } }
.proc-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; margin: 0 0 0.35rem; }
.proc-sub { margin: 0 0 1.1rem; font-size: 0.88rem; }
.proc-list { list-style: none; padding: 0; margin: 0; width: 100%; text-align: left; }
.proc-item { display: flex; align-items: center; gap: 0.65rem; font-size: 0.9rem; padding: 0.55rem 0.2rem; }
.proc-num {
  width: 1.25rem; height: 1.25rem; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700;
}
.proc-item.done .proc-num { background: var(--sage); color: #fff; }
.proc-item.done .proc-num::after {
  content: "";
  width: 0.28rem; height: 0.5rem;
  margin-bottom: 0.12rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.proc-item.done { color: #5c6a44; }
.proc-item.current { font-weight: 700; }
.proc-item.current .proc-num { background: var(--paprika); color: #fff; }
.proc-item.current .proc-num::after { content: ""; width: 0.35rem; height: 0.35rem; border-radius: 50%; background: #fff; }
.proc-item.todo { color: var(--text-muted); }
.proc-item.todo .proc-num { background: var(--surface-alt); }
.link-cancel { background: none; border: 0; color: var(--text-muted); text-decoration: underline; font-size: 0.9rem; cursor: pointer; padding: 0.5rem; }

.review-shell { padding-bottom: 6rem; }
.review-form .cat-chip {
  padding-right: 0.75rem;
}
.review-form .cat-editor {
  margin-bottom: 0.35rem;
}
.section-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin: 0.85rem 0 0.45rem;
}
.cover-row { display: flex; gap: 0.65rem; overflow-x: auto; padding-bottom: 0.25rem; }
.cover-opt {
  position: relative; width: 4.6rem; height: 4.6rem; border-radius: 12px; overflow: hidden;
  border: 2px solid transparent; flex-shrink: 0; cursor: pointer; display: block;
}
.cover-opt.selected { border-color: var(--gold); }
.cover-opt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-opt .tag {
  position: absolute; top: -0.35rem; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: #fff; font-size: 0.6rem; font-weight: 700;
  padding: 0.15rem 0.4rem; border-radius: 8px; white-space: nowrap;
}
.field-box { margin: 0.35rem 0; }
.meta-edit-row { display: flex; gap: 0.5rem; margin: 0.5rem 0; }
.meta-edit {
  display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); background: var(--surface); border: 1px solid var(--line);
  padding: 0.35rem 0.65rem; border-radius: 999px; flex: 1;
}
.meta-edit input { border: 0; background: transparent; width: 100%; padding: 0.25rem 0; font-size: 0.9rem; }
.ing-box { background: var(--surface); border-radius: 14px; border: 1px solid var(--line); padding: 0.25rem 0.65rem; }
.ing-edit-row { display: flex; gap: 0.4rem; align-items: center; padding: 0.45rem 0; border-top: 1px solid var(--line); }
.ing-edit-row:first-child { border-top: 0; }
.ing-edit-row input { border: 0; background: transparent; padding: 0.35rem 0; font-size: 0.92rem; }
.ing-edit-row input:first-child { flex: 1; min-width: 0; }
.ing-edit-row .qty-mono { width: 4.5rem; color: var(--paprika-dark); font-weight: 600; text-align: right; }
.ing-remove { border: 0; background: transparent; color: var(--text-muted); font-size: 1.25rem; cursor: pointer; padding: 0.25rem 0.4rem; }
.add-ing-btn {
  display: block; width: 100%; border: 0; background: transparent; color: var(--paprika);
  font-weight: 700; font-size: 0.9rem; text-align: left; padding: 0.65rem 0.25rem; cursor: pointer;
}
.save-bar {
  position: sticky; bottom: 4.5rem; left: 0; right: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px);
  padding: 0.65rem 0 0.35rem; margin-top: 1rem;
}

.chip-dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%; display: inline-block;
  flex-shrink: 0; background: var(--paprika);
}
.btn-chip.incasa {
  background: var(--sage-tint); border-color: var(--sage); color: #4c5b33;
}

.tag-with-dot { display: inline-flex; align-items: center; gap: 0.35rem; }

.more-menu { position: relative; }
.more-menu summary { list-style: none; cursor: pointer; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu-panel {
  position: absolute; right: 0; top: calc(100% + 0.25rem); z-index: 30; min-width: 12.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 0.25rem; overflow: hidden;
}
.more-menu-panel button, .more-menu-panel a {
  display: flex; width: 100%; align-items: center; text-align: left; border: 0; background: transparent;
  padding: 0.75rem 0.85rem; border-radius: 10px; font-size: 0.9rem; font-weight: 600; color: var(--text); cursor: pointer;
  text-decoration: none; font-family: inherit;
}
.more-menu-panel button:hover, .more-menu-panel a:hover {
  background: color-mix(in srgb, var(--text) 5%, transparent);
}
.more-menu-panel .danger { color: var(--heart); }
.more-menu-panel form { margin: 0; }

.ing-check-list li { cursor: pointer; }
.step-nav { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.step-counter { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.prep-fs { padding-top: env(safe-area-inset-top); }
.prep-fs-bar { padding-top: max(0.5rem, env(safe-area-inset-top)); }

.auth-card h1 { font-family: var(--font-display); color: var(--paprika-dark); }
.auth-wrap { background:
  radial-gradient(ellipse at top left, var(--paprika-tint), transparent 55%),
  linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%); }
.empty-state h2 { font-family: var(--font-display); font-weight: 600; }
.empty-state p { color: var(--text-muted); }

.color-dots { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.color-dot-pick {
  width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
}
.color-dot-pick.is-on { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }

/* —— Notifiche (campanella) —— */
.notif-menu {
  position: relative;
}
.notif-menu > summary {
  list-style: none;
  cursor: pointer;
}
.notif-menu > summary::-webkit-details-marker {
  display: none;
}
.notif-bell-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1.05rem;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.notif-menu-action .detail-action-ic.notif-ic {
  position: relative;
}
.notif-badge {
  position: absolute;
  top: -0.2rem;
  right: -0.25rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--heart);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--surface);
}
.notif-bell-btn .notif-badge {
  top: 0.05rem;
  right: 0.05rem;
}
.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 60;
  width: min(18.5rem, calc(100vw - 1.5rem));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.notif-panel-head {
  padding: 0.7rem 0.85rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.notif-empty {
  margin: 0;
  padding: 0.5rem 0.85rem 0.85rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 60vh;
  overflow-y: auto;
}
.notif-item {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.5rem;
}
.notif-item-main {
  display: grid;
  gap: 0.15rem;
  color: inherit;
  text-decoration: none;
}
.notif-item-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--paprika-dark);
}
.notif-item-text {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.notif-item-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.notif-item-actions .btn {
  min-height: 2.1rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}
.notif-footer-link {
  display: block;
  padding: 0.7rem 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--paprika-dark);
  text-decoration: none;
  text-align: center;
}
.notif-footer-link:hover {
  background: color-mix(in srgb, var(--paprika) 8%, transparent);
}

/* —— Theme toggle (sole / luna) —— */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  line-height: 1;
}
.theme-toggle:hover {
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
  color: var(--paprika-dark);
}
.theme-toggle .theme-ic {
  display: none;
  line-height: 1;
}
.theme-toggle .theme-ic .ph-bold {
  font-size: 1.15rem;
  line-height: 1;
}
html:not([data-theme="dark"]) .theme-toggle .theme-ic-moon { display: inline-flex; }
html[data-theme="dark"] .theme-toggle .theme-ic-sun { display: inline-flex; }

.theme-toggle-auth {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 50;
}

/* —— Dark mode — palette Primary #D48265 / Secondary #3D362F / Neutral #1B1712 —— */
html[data-theme="dark"] {
  --bg: #1b1712;
  --bg-top: #1b1712;
  --bg-accent: #3d362f;
  --surface: #3d362f;
  --surface-alt: #2a251f;
  --text: #f0e6d8;
  --text-muted: #a89880;
  --paprika: #d48265;
  --paprika-dark: #e09a7d;
  --paprika-tint: #4a3530;
  --sage: #9caf6e;
  --sage-tint: #2a3020;
  --gold: #c9a227;
  --gold-tint: #3d362f;
  --heart: #e85d75;
  --line: #5e5449;
  --danger: #e85d75;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  --font: "Hanken Grotesk", "Inter", system-ui, sans-serif;
  --font-display: "Hanken Grotesk", "Inter", system-ui, sans-serif;
  --input-bg: #2a251f;
  --card: #3d362f;
  --card-ink: #f0e6d8;
  color-scheme: dark;
}

html[data-theme="dark"] body {
  font-family: var(--font);
  background-image:
    radial-gradient(ellipse at top left, rgba(212, 130, 101, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
}

html[data-theme="dark"] .btn {
  background: var(--paprika);
  color: #1b1712;
}

html[data-theme="dark"] .btn:hover {
  background: var(--paprika-dark);
  color: #1b1712;
}

html[data-theme="dark"] .btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--line);
}

html[data-theme="dark"] .btn-danger {
  background: var(--danger);
  color: #fff;
}

/* Card scure + testo chiaro (tutte le pagine) */
html[data-theme="dark"] .card,
html[data-theme="dark"] .recipe-card,
html[data-theme="dark"] .recipe-item,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .pantry-dialog,
html[data-theme="dark"] .more-menu-panel,
html[data-theme="dark"] .notif-panel,
html[data-theme="dark"] .ing-box,
html[data-theme="dark"] .cook-panel,
html[data-theme="dark"] .spesa-item,
html[data-theme="dark"] .menu-day-card,
html[data-theme="dark"] .job-card {
  background: var(--card);
  color: var(--card-ink);
  border-color: var(--line);
}

html[data-theme="dark"] .card .muted,
html[data-theme="dark"] .recipe-card .muted,
html[data-theme="dark"] .recipe-item .muted,
html[data-theme="dark"] .auth-card .muted,
html[data-theme="dark"] .pantry-dialog .muted,
html[data-theme="dark"] .ing-hint,
html[data-theme="dark"] .portion-hint {
  color: var(--text-muted);
}

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .filters-compact-search input,
html[data-theme="dark"] .filters-compact-row select,
html[data-theme="dark"] .user-filter-toggle,
html[data-theme="dark"] .ing-title-line input.portion-inline[type="number"],
html[data-theme="dark"] .portion-scaler input[type="number"] {
  color: var(--text);
  background-color: var(--input-bg);
  border-color: var(--line);
  color-scheme: dark;
}

html[data-theme="dark"] select option {
  color: var(--text);
  background-color: var(--card);
}

html[data-theme="dark"] .ing-check-list .ing-nome,
html[data-theme="dark"] .prose,
html[data-theme="dark"] .recipe-meta strong,
html[data-theme="dark"] .recipe-card-body strong,
html[data-theme="dark"] .spesa-text,
html[data-theme="dark"] .spesa-text strong,
html[data-theme="dark"] .detail-title {
  color: var(--card-ink);
}

html[data-theme="dark"] .ing-check-list .ing-qty {
  color: var(--paprika);
}

html[data-theme="dark"] .ing-check-list .ing-qty-orig {
  color: var(--text-muted);
}

html[data-theme="dark"] .ing-check-list li + li {
  border-top-color: var(--line);
}

html[data-theme="dark"] .ing-hint a {
  color: var(--paprika-dark);
}

/* Passi preparazione */
html[data-theme="dark"] .step-item {
  background: var(--surface-alt);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .step-item .step-body {
  color: var(--text);
}

html[data-theme="dark"] .step-item.is-done {
  background: #252820;
  border-color: transparent;
  color: #b8c49a;
}

html[data-theme="dark"] .step-item.is-done .step-num {
  background: var(--sage);
  color: #1b1712;
}

html[data-theme="dark"] .step-item.is-current,
html[data-theme="dark"] .step-item.is-active {
  background: var(--paprika-tint);
  border-color: var(--paprika);
  color: var(--text);
}

html[data-theme="dark"] .step-item.is-current .step-num,
html[data-theme="dark"] .step-item.is-active .step-num {
  background: var(--paprika);
  color: #1b1712;
}

html[data-theme="dark"] .step-num {
  background: #2a251f;
  color: var(--text-muted);
}

html[data-theme="dark"] .step-item a {
  color: var(--paprika-dark);
}

html[data-theme="dark"] .progress-txt {
  color: var(--text-muted);
}

html[data-theme="dark"] .progress-txt b {
  color: var(--text);
}

html[data-theme="dark"] .step-dial {
  background: conic-gradient(var(--paprika) var(--deg, 40deg), var(--surface-alt) 0);
}

html[data-theme="dark"] .step-dial::after {
  background: var(--card);
}

html[data-theme="dark"] .cook-panel .btn-ghost {
  color: var(--text-muted);
  border-color: var(--line);
}

html[data-theme="dark"] .cook-timer-chip {
  background: var(--paprika-tint);
  border-color: var(--paprika);
  color: var(--text);
}

html[data-theme="dark"] .recipe-card-body strong,
html[data-theme="dark"] .detail-title,
html[data-theme="dark"] .empty-state h2,
html[data-theme="dark"] .pantry-dialog h2 {
  font-family: var(--font-display);
  font-weight: 700;
}

html[data-theme="dark"] .brand,
html[data-theme="dark"] .auth-card h1,
html[data-theme="dark"] .app-sidebar-brand {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-weight: 700;
  color: var(--paprika);
}

html[data-theme="dark"] .more-menu-panel button,
html[data-theme="dark"] .more-menu-panel a {
  color: var(--text);
}

html[data-theme="dark"] .more-menu-panel .danger {
  color: var(--heart);
}

html[data-theme="dark"] .notif-panel-head,
html[data-theme="dark"] .notif-empty,
html[data-theme="dark"] .notif-item-text {
  color: var(--text-muted);
}

html[data-theme="dark"] .notif-item-title,
html[data-theme="dark"] .notif-footer-link {
  color: var(--paprika-dark);
}

html[data-theme="dark"] .bottom-nav {
  background: color-mix(in srgb, #1b1712 88%, #3d362f);
  border-top-color: var(--line);
}

html[data-theme="dark"] .nav-item.active,
html[data-theme="dark"] .nav-item:hover {
  color: var(--paprika);
  background: color-mix(in srgb, var(--paprika) 14%, transparent);
}

html[data-theme="dark"] .nav-add-circle {
  background: var(--card);
  border-color: var(--paprika);
  color: var(--paprika);
}

html[data-theme="dark"] .btn-chip {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] .btn-chip:hover {
  background: color-mix(in srgb, var(--paprika) 18%, var(--surface));
}

html[data-theme="dark"] .btn-chip.filters,
html[data-theme="dark"] .btn-chip.incasa {
  color: var(--paprika-dark);
}

html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .more-menu-btn,
html[data-theme="dark"] .notif-bell-btn,
html[data-theme="dark"] .topbar-icon-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="dark"] .topbar-icon-btn.heart {
  color: var(--heart);
}

html[data-theme="dark"] .topbar-icon-btn.heart.is-on {
  background: #3a2418;
  border-color: var(--heart);
  color: var(--heart);
}

html[data-theme="dark"] .topbar-icon-btn.pin {
  color: var(--gold);
  background: var(--surface);
  border-color: var(--gold);
}

html[data-theme="dark"] .topbar-icon-btn.pin.is-on {
  background: var(--gold);
  border-color: var(--gold);
  color: #1b1712;
}

html[data-theme="dark"] .cover-empty-ic {
  background: #1b1712;
  color: var(--text);
  box-shadow: none;
}

html[data-theme="dark"] .recipe-card-thumb.is-empty,
html[data-theme="dark"] .recipe-thumb.is-empty,
html[data-theme="dark"] .detail-hero.is-empty,
html[data-theme="dark"] .detail-summary-thumb.is-empty {
  border-bottom: 3px solid var(--paprika);
}

html[data-theme="dark"] .alert-error {
  background: #3a2418;
  color: #f3c4bc;
}

html[data-theme="dark"] .alert-success {
  background: #24301c;
  color: #c5d9a8;
}

html[data-theme="dark"] .auth-wrap {
  background:
    radial-gradient(ellipse at top left, rgba(212, 130, 101, 0.18), transparent 55%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
}

html[data-theme="dark"] .side-link.active,
html[data-theme="dark"] .side-link:hover {
  background: color-mix(in srgb, var(--paprika) 16%, transparent);
  color: var(--paprika);
}

html[data-theme="dark"] .rich-editor {
  background: var(--input-bg);
  border-color: var(--line);
}

html[data-theme="dark"] .rich-toolbar {
  background: var(--surface);
  border-bottom-color: var(--line);
}

html[data-theme="dark"] .rich-btn {
  background: var(--card);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .rich-btn:active,
html[data-theme="dark"] .rich-btn:focus-visible {
  border-color: var(--paprika);
  color: var(--paprika-dark);
}

html[data-theme="dark"] .rich-surface {
  color: var(--text);
  background: var(--input-bg);
}

html[data-theme="dark"] .rich-surface a {
  color: var(--paprika-dark);
}

html[data-theme="dark"] .cook-tab {
  color: var(--text-muted);
}

html[data-theme="dark"] .cook-tab.active {
  color: var(--paprika);
}

html[data-theme="dark"] .tag {
  background: color-mix(in srgb, var(--surface) 84%, #4a4338);
  color: var(--paprika-dark);
}

html[data-theme="dark"] .time-pill {
  color: var(--text-muted);
}

html[data-theme="dark"] .pasti-page .brand {
  color: #f0e6d8;
}

html[data-theme="dark"] .pasti-page .day-block {
  background: #3d362f;
  border-color: #5e5449;
}

html[data-theme="dark"] .pasti-page .day-head {
  background: #453e36;
  color: #f0e6d8;
}

html[data-theme="dark"] .pasti-page .day-head .icon-btn {
  color: #f0e6d8;
}

html[data-theme="dark"] .pasti-page .week-nav strong {
  color: #f0e6d8;
}

html[data-theme="dark"] .pasti-page .meal-empty {
  color: #d7c8b4;
}

html[data-theme="dark"] .bulk-bar {
  background: color-mix(in srgb, var(--card) 94%, #1b1712);
  border-top-color: var(--line);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .home-filters-sticky {
  background: var(--bg-top);
  box-shadow: 0 10px 16px -12px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .user-filter-menu {
  background: var(--card);
  border-color: var(--line);
}

html[data-theme="dark"] .user-filter-opt {
  color: var(--card-ink);
}

html[data-theme="dark"] .user-filter-opt:hover,
html[data-theme="dark"] .user-filter-opt:focus-visible,
html[data-theme="dark"] .user-filter-opt.is-on {
  background: color-mix(in srgb, var(--paprika) 18%, var(--card));
}

html[data-theme="dark"] .user-filter-count {
  color: var(--text-muted);
}

html[data-theme="dark"] .recipe-card.is-selected,
html[data-theme="dark"] .recipe-item.is-selected {
  box-shadow: 0 0 0 2px var(--paprika);
}

/* Catalogo alimenti + tabella nutrizione */
.food-thumb {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.55rem;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-alt, var(--bg-accent));
}
.food-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 1.1rem;
}
.ing-check-list .food-thumb {
  width: 2.45rem;
  height: 2.45rem;
}
.food-admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.food-admin-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.food-admin-list li:last-child {
  border-bottom: 0;
}
.food-admin-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.food-admin-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.food-admin-meta strong {
  font-size: 1rem;
}
.food-num-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 0.65rem;
}
.food-form-preview {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 0.7rem;
  object-fit: cover;
}
.nutri-box {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.nutri-heading {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}
.nutri-per {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  line-height: 1.4;
}
.nutri-coverage {
  margin: 0 0 0.7rem;
  font-size: 0.82rem;
}
.nutri-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.35rem;
  padding: 0 0.35rem 0.35rem;
}
.nutri-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 0.8rem;
}
.nutri-table th,
.nutri-table td {
  padding: 0.5rem 0.55rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.nutri-table thead th {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
}
.nutri-table .nutri-sticky {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: var(--card);
  min-width: 8.2rem;
  max-width: 11rem;
  white-space: normal;
}
.nutri-table tbody .nutri-sticky,
.nutri-table tfoot .nutri-sticky {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 650;
}
.nutri-table .nutri-sticky .food-thumb {
  width: 1.85rem;
  height: 1.85rem;
}
.nutri-caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 0 0.45rem;
}
.nutri-total th,
.nutri-total td {
  font-weight: 800;
  border-bottom: 0;
  padding-top: 0.7rem;
}
html[data-theme="dark"] .nutri-table .nutri-sticky {
  background: var(--card);
}
html[data-theme="dark"] .nutri-box {
  border-top-color: var(--line);
}

@media (min-width: 900px) {
  html[data-theme="dark"] .app-sidebar {
    background: color-mix(in srgb, #1b1712 88%, #3d362f);
    border-right-color: var(--line);
  }
}

