/* =========================================================
   Gelato Lab — Apple HIG inspired styles
   ========================================================= */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", "Helvetica", "Arial", system-ui, sans-serif;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  /* Light system colors — paleta refinada off-white quente */
  /* Light system colors — paleta warm earthy (coolors EDEDE9/D6CCC2/F5EBE0/E3D5CA/D5BDAF) */
  --bg: #ededeb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5ebe0;
  --bg-grouped: #ededeb;
  --bg-grouped-secondary: #ffffff;
  --sidebar-bg: rgba(255, 255, 255, 0.85);
  --sidebar-border: rgba(80, 60, 45, 0.08);
  --separator: rgba(80, 60, 45, 0.08);
  --separator-strong: rgba(80, 60, 45, 0.18);
  --label: #2d241b;
  --label-secondary: rgba(45, 36, 27, 0.72);
  --label-tertiary: rgba(45, 36, 27, 0.50);
  --label-quaternary: rgba(45, 36, 27, 0.28);
  --fill: rgba(80, 60, 45, 0.06);
  --fill-secondary: rgba(80, 60, 45, 0.10);
  --fill-tertiary: rgba(80, 60, 45, 0.16);
  --tint: #4a3d31;
  --tint-soft: rgba(74, 61, 49, 0.10);
  --tint-fg: #ffffff;
  --tint-2: #6b584c;
  --tint-3: #3a2e23;
  --success: #6a8a4e;
  --warning: #c97a2b;
  --danger: #c0463b;

  --shadow-1: 0 1px 2px rgba(80, 60, 45, 0.05), 0 4px 16px rgba(80, 60, 45, 0.06);
  --shadow-2: 0 4px 14px rgba(80, 60, 45, 0.10), 0 12px 40px rgba(80, 60, 45, 0.08);

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --sidebar-w: 280px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #16110d;
    --bg-secondary: #251e18;
    --bg-tertiary: #2e2620;
    --bg-grouped: #16110d;
    --bg-grouped-secondary: #251e18;
    --sidebar-bg: rgba(37, 30, 24, 0.82);
    --sidebar-border: rgba(245, 235, 224, 0.08);
    --separator: rgba(245, 235, 224, 0.08);
    --separator-strong: rgba(245, 235, 224, 0.18);
    --label: #f5ebe0;
    --label-secondary: rgba(245, 235, 224, 0.72);
    --label-tertiary: rgba(245, 235, 224, 0.50);
    --label-quaternary: rgba(245, 235, 224, 0.28);
    --fill: rgba(245, 235, 224, 0.06);
    --fill-secondary: rgba(245, 235, 224, 0.10);
    --fill-tertiary: rgba(245, 235, 224, 0.16);
    --tint: #f5ebe0;
    --tint-soft: rgba(245, 235, 224, 0.10);
    --tint-fg: #2d241b;
    --success: #b8d49a;
    --warning: #e5b07a;
    --danger: #e69089;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 6px 22px rgba(0, 0, 0, 0.45), 0 16px 48px rgba(0, 0, 0, 0.35);
  }
}

/* Forçado pelo usuário: tema escuro (data-theme="dark") */
:root[data-theme="dark"] {
  --bg: #16110d;
  --bg-secondary: #251e18;
  --bg-tertiary: #2e2620;
  --bg-grouped: #16110d;
  --bg-grouped-secondary: #251e18;
  --sidebar-bg: rgba(37, 30, 24, 0.82);
  --sidebar-border: rgba(245, 235, 224, 0.08);
  --separator: rgba(245, 235, 224, 0.08);
  --separator-strong: rgba(245, 235, 224, 0.18);
  --label: #f5ebe0;
  --label-secondary: rgba(245, 235, 224, 0.72);
  --label-tertiary: rgba(245, 235, 224, 0.50);
  --label-quaternary: rgba(245, 235, 224, 0.28);
  --fill: rgba(245, 235, 224, 0.06);
  --fill-secondary: rgba(245, 235, 224, 0.10);
  --fill-tertiary: rgba(245, 235, 224, 0.16);
  --tint: #f5ebe0;
  --tint-soft: rgba(245, 235, 224, 0.10);
  --tint-fg: #2d241b;
  --success: #b8d49a;
  --warning: #e5b07a;
  --danger: #e69089;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 6px 22px rgba(0, 0, 0, 0.45), 0 16px 48px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  /* iPad/iPhone full-bleed; respect safe areas inside layout */
  min-height: 100dvh;
}

button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}

/* =========================================================
   App layout — sidebar + detail
   ========================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  width: 100%;
}

.app[data-sidebar="hidden"] { grid-template-columns: 0 1fr; }

.sidebar {
  position: relative;
  background: var(--sidebar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--sidebar-border);
  padding: calc(var(--safe-top) + 8px) 0 calc(var(--safe-bottom) + 8px) 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.app[data-sidebar="hidden"] .sidebar { transform: translateX(-100%); pointer-events: none; }

.sidebar-header {
  padding: 18px 20px 10px 20px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6b584c, #3a2e23);
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(245, 235, 224, 0.10),
    0 1px 2px rgba(80, 60, 45, 0.18);
}
.brand-mark::after {
  content: "";
  position: absolute;
  top: 6px; left: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #f5ebe0;
  box-shadow: 0 0 10px rgba(245, 235, 224, 0.5);
}
.brand-text { line-height: 1.2; }
.brand-title {
  font-family: var(--font-rounded);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.015em;
}
.brand-sub {
  font-size: 12px;
  color: var(--label-tertiary);
  margin-top: 1px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  flex: 1;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--label-secondary);
  text-align: left;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: var(--fill); color: var(--label); }
.nav-item:active { background: var(--fill-secondary); }
.nav-item[aria-current="page"] {
  background: var(--fill-secondary);
  color: var(--label);
  font-weight: 600;
}
.nav-item[aria-current="page"] .nav-icon svg { color: var(--label); }
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  color: var(--label-tertiary);
}
.nav-icon svg { width: 20px; height: 20px; display: block; }
.nav-item:hover .nav-icon { color: var(--label-secondary); }
.nav-item[aria-current="page"] .nav-icon { color: var(--label); }
.nav-label { flex: 1; }

.sidebar-footer {
  padding: 8px 16px 4px;
  border-top: 1px solid var(--separator);
}
.install-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--fill);
  font-size: 13px;
  color: var(--label-secondary);
  cursor: pointer;
}

/* =========================================================
   Detail / main area
   ========================================================= */
.detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.toolbar {
  position: sticky;
  top: 0; z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-top) + 12px) max(20px, var(--safe-right)) 12px max(20px, var(--safe-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--separator);
  min-height: 56px;
}
.toolbar-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  flex: 1;
  font-family: var(--font-rounded);
}
.toolbar-actions {
  display: flex; gap: 6px;
}

.toolbar-btn {
  appearance: none;
  border: none;
  background: var(--fill);
  color: var(--label);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.06s ease, color 0.15s ease;
}
.toolbar-btn:hover { background: var(--fill-secondary); }
.toolbar-btn:active { transform: scale(0.96); }
.toolbar-btn.primary {
  background: var(--tint);
  color: var(--tint-fg);
}
.toolbar-btn.primary:hover { filter: brightness(0.92); background: var(--tint); }
.toolbar-btn.ghost { background: transparent; color: var(--label-secondary); }
.toolbar-btn.ghost:hover { background: var(--fill); color: var(--label); }
.toolbar-btn.icon-only { padding: 8px; }
.toolbar-btn.round {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toolbar-btn .nav-icon { width: 22px; height: 22px; color: inherit; }
.toolbar-btn .nav-icon svg { width: 22px; height: 22px; }
.toolbar-btn.danger { color: var(--danger); }
.toolbar-btn.danger:hover { background: rgba(229, 74, 63, 0.10); }

/* Menu de ações ("more") — popover ancorado no botão */
.action-menu {
  position: fixed;
  z-index: 60;
  min-width: 240px;
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--separator);
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: action-menu-in 0.12s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes action-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.action-menu button {
  appearance: none;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--label);
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease;
}
.action-menu button:hover { background: var(--fill); }
.action-menu button.danger { color: var(--danger); }
.action-menu button.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.action-menu button .nav-icon { width: 18px; height: 18px; color: var(--label-tertiary); flex-shrink: 0; }
.action-menu button .nav-icon svg { width: 18px; height: 18px; }
.action-menu button.danger .nav-icon { color: var(--danger); }

.page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px max(24px, var(--safe-right)) max(28px, var(--safe-bottom)) max(24px, var(--safe-left));
}

/* =========================================================
   Generic UI atoms
   ========================================================= */
.section-header {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-tertiary);
  padding: 18px 4px 8px;
}

.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.card.padded { padding: 18px; }

.row-list {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-top: 1px solid var(--separator);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease;
}
.row:first-child { border-top: none; }
.row:hover { background: var(--fill); }
.row-title { font-size: 15.5px; font-weight: 500; letter-spacing: -0.005em; }
.row-sub { font-size: 12.5px; color: var(--label-tertiary); margin-top: 3px; }
.row-trailing { color: var(--label-tertiary); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.row-trailing .chev { color: var(--label-quaternary); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 24px;
  color: var(--label-secondary);
}
.empty-state .nav-icon { width: 56px; height: 56px; margin-bottom: 12px; color: var(--label-quaternary); }
.empty-state .nav-icon svg { width: 56px; height: 56px; }
.empty-state h2 { font-size: 22px; font-weight: 700; margin: 0 0 6px; color: var(--label); letter-spacing: -0.02em; }
.empty-state p { margin: 0 0 16px; max-width: 340px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 12px;
  color: var(--label-tertiary);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.input,
.select,
textarea.input {
  appearance: none;
  border: 1px solid var(--separator);
  background: var(--bg-secondary);
  color: var(--label);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 15px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--label);
  box-shadow: 0 0 0 4px var(--tint-soft);
}
textarea.input { resize: vertical; min-height: 80px; line-height: 1.45; }

.search-bar {
  position: relative;
  margin-bottom: 14px;
}
.search-bar .input {
  padding-left: 40px;
  border-radius: 12px;
  background: var(--fill);
  border-color: transparent;
  font-size: 15px;
}
.search-bar .input:focus {
  background: var(--bg-secondary);
  border-color: var(--separator);
}
.search-bar .nav-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--label-tertiary);
  pointer-events: none;
}

.segmented {
  display: inline-flex;
  background: var(--fill);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}
.segmented button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--label-secondary);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.segmented button[aria-pressed="true"] {
  background: var(--bg-secondary);
  color: var(--label);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--fill);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--label-secondary);
}
.tag.tint { background: var(--label); color: var(--tint-fg); }

/* Buttons (general) */
.btn {
  appearance: none;
  border: none;
  background: var(--fill);
  color: var(--label);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.06s ease, color 0.15s ease;
}
.btn:hover { background: var(--fill-secondary); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--tint); color: var(--tint-fg); font-weight: 600; }
.btn.primary:hover { filter: brightness(0.92); background: var(--tint); }
.btn.danger  { color: var(--danger); }
.btn.danger:hover { background: rgba(229, 74, 63, 0.10); }
.btn.full { width: 100%; justify-content: center; }
.btn.compact { padding: 7px 11px; font-size: 13px; border-radius: 7px; }
.btn.icon-only { padding: 8px; }
.btn .nav-icon { color: inherit; width: 18px; height: 18px; }
.btn .nav-icon svg { width: 18px; height: 18px; }

/* =========================================================
   Recipe list / detail
   ========================================================= */

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.recipe-card {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.recipe-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.recipe-card:active { transform: scale(0.99); }

.recipe-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.recipe-card > .type-badge {
  align-self: flex-start;
}
.recipe-card-foot > .recipe-title {
  flex: 1 1 auto;
  min-width: 0;
}
.recipe-card-foot > .card-action-btn {
  flex: 0 0 auto;
}

.recipe-card .recipe-title {
  font-family: var(--font-rounded);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Botão de ação (produção) — inline, ao lado do badge do tipo */
.card-action-btn {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-secondary);
  color: var(--label);
  border: 1px solid var(--separator);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(80, 60, 45, 0.06);
  transition: transform 0.12s ease, background-color 0.15s ease;
}
.card-action-btn:hover { background: var(--fill); transform: scale(1.05); }
.card-action-btn:active { transform: scale(0.94); }
.card-action-btn .nav-icon { width: 13px; height: 13px; color: inherit; }
.card-action-btn .nav-icon svg { width: 13px; height: 13px; }

/* Modal de produção: escolhas de lote e tabela escalada */
.batch-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.batch-btn {
  appearance: none;
  border: 1px solid var(--separator);
  background: var(--bg-secondary);
  color: var(--label);
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.batch-btn:hover { background: var(--fill); }
.batch-btn.active {
  background: var(--label);
  color: var(--tint-fg);
  border-color: var(--label);
}
.prod-list {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--separator);
  padding-top: 8px;
}
.prod-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 2px;
  font-size: 14px;
  border-bottom: 1px solid var(--separator);
}
.prod-row:last-child { border-bottom: none; }
.prod-row .prod-qty {
  font-family: var(--font-rounded);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  font-size: 14px;
}
.prod-row .prod-cost {
  font-family: var(--font-rounded);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--label-tertiary);
}
.prod-row.prod-total .prod-cost {
  color: var(--label);
}
.prod-row.prod-total {
  border-top: 2px solid var(--separator-strong);
  border-bottom: none;
  margin-top: 4px;
  padding-top: 10px;
  font-weight: 700;
  font-size: 15px;
}
.recipe-card .preview .type-badge {
  position: absolute;
  top: 8px; right: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cabeçalho do card: título + badge na mesma linha */
.recipe-card .recipe-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  /* Reserva espaço pro botão de ação absoluto no canto inferior direito */
  padding-bottom: 28px;
}
.recipe-card .recipe-content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.recipe-card .recipe-content-head .recipe-title {
  flex: 1 1 auto;
  min-width: 0;
}
.recipe-card .recipe-content-head .type-badge {
  flex: 0 0 auto;
}
.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--tone-color, var(--fill));
  color: color-mix(in srgb, var(--tone-color, var(--label-secondary)) 30%, #2d241b);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Dark mode — badge semitransparente com texto mais claro */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .type-badge {
    background: color-mix(in srgb, var(--tone-color, var(--label-tertiary)) 30%, transparent);
    color: color-mix(in srgb, var(--tone-color, var(--label)) 70%, #f5ebe0);
  }
}
:root[data-theme="dark"] .type-badge {
  background: color-mix(in srgb, var(--tone-color, var(--label-tertiary)) 30%, transparent);
  color: color-mix(in srgb, var(--tone-color, var(--label)) 70%, #f5ebe0);
}

/* Paleta curada de 8 tons — coordenada com o tema warm earthy.
   Gelato fica em sage; demais tipos espalham-se sem conflito visual. */
.tone-0 { --tone-color: #ccd5ae; }  /* sage     — Gelato */
.tone-1 { --tone-color: #e9edc9; }  /* amarelo-verde pálido — Sorbet */
.tone-2 { --tone-color: #d6ccc2; }  /* taupe    — Sorvete padrão */
.tone-3 { --tone-color: #d5bdaf; }  /* rosa-poeira — Sorvete premium */
.tone-4 { --tone-color: #e3d5ca; }  /* bege claro */
.tone-5 { --tone-color: #faedcd; }  /* manteiga */
.tone-6 { --tone-color: #b7e4c7; }  /* menta */
.tone-7 { --tone-color: #fde2e4; }  /* blush */

/* Chips de filtro por tipo na lista de receitas */
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-chip {
  appearance: none;
  border: 1px solid var(--separator);
  background: var(--bg-secondary);
  color: var(--label);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.filter-chip:hover { background: var(--fill); }
.filter-chip.active {
  background: var(--label);
  color: var(--bg-secondary);
  border-color: var(--label);
}
.filter-chip.colored {
  border-color: hsla(var(--badge-hue, 0), 60%, 50%, 0.24);
  background: hsla(var(--badge-hue, 0), 70%, 50%, 0.08);
  color: hsl(var(--badge-hue, 0), 60%, 38%);
}
.filter-chip.colored.active {
  background: hsl(var(--badge-hue, 0), 60%, 45%);
  border-color: hsl(var(--badge-hue, 0), 60%, 45%);
  color: white;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .filter-chip.colored {
    color: hsl(var(--badge-hue, 0), 75%, 78%);
    background: hsla(var(--badge-hue, 0), 60%, 60%, 0.14);
  }
}
:root[data-theme="dark"] .filter-chip.colored {
  color: hsl(var(--badge-hue, 0), 75%, 78%);
  background: hsla(var(--badge-hue, 0), 60%, 60%, 0.14);
}
.recipe-card .recipe-title {
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-rounded);
  line-height: 1.2;
}
.recipe-card .recipe-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-top: 1px solid var(--separator);
  padding-top: 10px;
}
.recipe-card .info-item { display: flex; flex-direction: column; gap: 2px; }
.recipe-card .info-label {
  font-size: 10px;
  color: var(--label-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.recipe-card .info-value {
  font-family: var(--font-rounded);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

/* Recipe editor layout: bloco superior (dados da receita) + editor-cols
   (ingredientes à esquerda, metas + análise à direita). No iPhone empilha. */
.editor {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.editor-cols {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  align-items: start;
}
.editor-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
@media (max-width: 980px) {
  .editor-cols { grid-template-columns: 1fr; }
}

.editor-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: 18px;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.editor-section h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 4px 4px 4px;
  font-family: var(--font-rounded);
}
.editor-section .sub { color: var(--label-tertiary); font-size: 13px; margin: -8px 4px 4px 4px; }

/* Ingredient line in editor */
.ing-list {
  display: flex; flex-direction: column;
  gap: 6px;
}
.ing-line {
  display: grid;
  grid-template-columns: 22px 1fr 72px auto 28px;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 2px;
  background: var(--fill);
  border-radius: 11px;
  border: 1px solid var(--separator);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.ing-line:hover { background: var(--fill-secondary); }
.ing-line.dragging { opacity: 0.5; }
.ing-line.drop-target { border-color: var(--label); background: var(--tint-soft); }
.ing-handle {
  cursor: grab;
  color: var(--label-quaternary);
  display: inline-flex; align-items: center; justify-content: center;
}
.ing-handle:hover { color: var(--label-secondary); }
.ing-name {
  font-weight: 500; font-size: 14.5px;
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.ing-name .ing-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ing-name .swatch {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--label-quaternary);
  flex-shrink: 0;
}
.ing-qty {
  text-align: right;
  background: var(--bg-secondary);
  border: 1px solid var(--separator);
  border-radius: 9px;
  padding: 7px 10px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 14.5px;
  font-weight: 500;
}
.ing-qty:focus { border-color: var(--label); box-shadow: 0 0 0 3px var(--tint-soft); outline: none; }
.ing-unit {
  font-size: 12px;
  color: var(--label-tertiary);
  text-align: left;
  padding: 0;
  background: transparent;
  border-radius: 0;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin-left: -4px;
}
.ing-remove {
  appearance: none; border: none; background: transparent; color: var(--label-tertiary);
  cursor: pointer; padding: 6px; border-radius: 7px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.ing-remove:hover { background: rgba(229, 74, 63, 0.10); color: var(--danger); }

/* Add-ingredient combobox */
.combobox {
  position: relative;
}
.combobox-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--bg-secondary);
  border: 1px solid var(--separator);
  border-radius: 12px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: var(--shadow-2);
}
.combobox-item {
  padding: 10px 12px;
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  cursor: pointer;
}
.combobox-item:hover, .combobox-item[aria-selected="true"] { background: var(--fill); }
.combobox-item .meta { color: var(--label-tertiary); font-size: 12px; }

/* =========================================================
   Analysis panel
   ========================================================= */
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.metric {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--separator);
}
.metric-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--label-tertiary);
  font-weight: 600;
}
.metric-value {
  font-family: var(--font-rounded);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.metric-sub { font-size: 11px; color: var(--label-tertiary); margin-top: 2px; }
.metric.in-range .metric-value { color: var(--success); }
.metric.out-of-range .metric-value { color: var(--warning); }

/* Análise — layout compacto */
.analysis-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.analysis-summary {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--label-secondary);
  font-weight: 500;
}
.analysis-summary .dot-sep { color: var(--label-quaternary); }

.analysis-composition {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: center;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--separator);
}
.analysis-composition .pie {
  width: 120px;
  height: 120px;
}
.analysis-composition .bar-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 0;
}
.analysis-composition .bar-legend > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--label-secondary);
}
.analysis-composition .bar-legend strong {
  margin-left: auto;
  font-weight: 600;
  color: var(--label);
}

.analysis-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
}
.analysis-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.analysis-stat-label {
  font-size: 13.5px;
  color: var(--label-secondary);
  font-weight: 500;
}
.analysis-stat-value {
  font-family: var(--font-rounded);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  letter-spacing: -0.015em;
  color: var(--label);
}
.analysis-stat-aux {
  font-size: 12px;
  font-weight: 500;
  color: var(--label-tertiary);
  margin-left: 6px;
  letter-spacing: 0;
}
.analysis-stat-hint {
  font-size: 11.5px;
  color: var(--label-tertiary);
  display: block;
  margin-top: 2px;
}

/* Temp-scale dentro da análise: mais magra, sem labels para -4/-2 °C */
.analysis-stat .temp-scale {
  height: 6px;
  margin-top: 6px;
  border-radius: 4px;
}
.analysis-stat .temp-marker {
  top: -2px;
  bottom: -2px;
  width: 2.5px;
}
.analysis-stat .temp-scale-labels {
  font-size: 10px;
  margin-top: 3px;
}
.analysis-stat .temp-scale-labels span:nth-child(2),
.analysis-stat .temp-scale-labels span:nth-child(3) { display: none; }

/* Avisos da análise — visualmente coesos */
.analysis-warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}
.analysis-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--label-secondary);
  line-height: 1.4;
}
.analysis-warning.warning {
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  color: var(--warning);
}
.analysis-warning .nav-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}
.analysis-warning .nav-icon svg { width: 14px; height: 14px; stroke-width: 1.8; }

/* Em telas estreitas (iPhone), legenda quebra para baixo do donut */
@media (max-width: 480px) {
  .analysis-composition {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
  }
  .analysis-composition .bar-legend {
    width: 100%;
  }
}

/* Composition bar */
.bar {
  height: 16px; border-radius: 999px; overflow: hidden;
  background: var(--fill);
  display: flex;
}
.bar > span { display: block; height: 100%; transition: width 0.3s cubic-bezier(0.32, 0.72, 0, 1); }
.bar-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--label-secondary); }
.bar-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 6px; }

/* Slider field */
.slider-field { display: flex; flex-direction: column; gap: 4px; }
.slider-field .row-top { display: flex; justify-content: space-between; align-items: baseline; }
.slider-field .target { font-variant-numeric: tabular-nums; color: var(--label-secondary); font-size: 13px; }
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; background: transparent; height: 26px;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; background: var(--fill-tertiary); border-radius: 999px;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  height: 22px; width: 22px; border-radius: 50%;
  background: white;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 1px 4px rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.04);
  margin-top: -9px; cursor: pointer;
}

/* =========================================================
   Barras de meta (Metas / Targets) — banda central + zonas fora
   Layout:
     escala visual da barra: ideal ± 2 × halfSpan
     banda válida (verde): ocupa o miolo central [min, max]
     marcador: posição do valor atual (clampado entre 0–100%)
     marcador no centro (50%) ⇒ valor está no ideal ⇒ balanceado
   ========================================================= */
.target-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--separator);
}
.target-row:first-child { border-top: none; padding-top: 4px; }
.target-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.target-label {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.target-value {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
}
.target-value[data-status="under"],
.target-value[data-status="over"] { color: var(--warning); }

.target-track {
  position: relative;
  height: 10px;
  background: var(--fill);
  border-radius: 999px;
  margin-top: 2px;
  overflow: visible;
}
.target-band {
  position: absolute;
  top: 0; bottom: 0;
  background: color-mix(in srgb, var(--success) 22%, transparent);
  border-radius: 999px;
}
.target-marker {
  position: absolute;
  top: -3px; bottom: -3px;
  width: 3px;
  border-radius: 2px;
  background: var(--success);
  box-shadow: 0 0 0 2px var(--bg-secondary);
  transform: translateX(-1px);
  transition: left 0.18s cubic-bezier(0.32, 0.72, 0, 1), background-color 0.15s ease;
}
.target-marker[data-status="under"],
.target-marker[data-status="over"] { background: var(--warning); }

.target-scale {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--label-tertiary);
  font-variant-numeric: tabular-nums;
}
.target-scale > :first-child { text-align: left; }
.target-scale > .target-ideal {
  text-align: center;
  font-weight: 600;
  color: var(--label-secondary);
}
.target-scale > :last-child { text-align: right; }

/* Toast */
.toast-host {
  position: fixed; left: 0; right: 0; bottom: 24px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  z-index: 100; pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: rgba(20, 20, 22, 0.92);
  color: white;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-2);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: toast-in 0.18s ease, toast-out 0.22s ease 2.4s forwards;
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 90vw;
}
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateY(20px); opacity: 0; } }

/* Modal */
.modal-host { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-host[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.32); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade-in 0.2s ease; }
.modal {
  position: relative;
  width: min(560px, 100%);
  background: var(--bg-secondary);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-2);
  max-height: 90dvh;
  display: flex; flex-direction: column;
  animation: sheet-up 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  margin-bottom: 0;
}
@media (min-width: 700px) {
  .modal-host { align-items: center; }
  .modal { border-radius: 22px; max-height: 80dvh; }
}
.modal-grabber { width: 40px; height: 5px; background: var(--fill-tertiary); border-radius: 999px; margin: 8px auto 0; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 10px;
  border-bottom: 1px solid var(--separator);
}
.modal-title { font-weight: 700; letter-spacing: -0.01em; font-size: 17px; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-footer {
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  border-top: 1px solid var(--separator);
  display: flex; gap: 8px; justify-content: flex-end;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }

/* Pie chart */
.pie-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pie { width: 160px; height: 160px; flex-shrink: 0; }
.pie circle.bg { fill: transparent; stroke: var(--fill); stroke-width: 24; }
.pie circle.slice { fill: transparent; stroke-width: 24; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray 0.4s cubic-bezier(0.32, 0.72, 0, 1); }
.pie .center-label {
  font-family: var(--font-rounded);
  font-weight: 700; font-size: 18px;
  fill: var(--label);
  text-anchor: middle;
}
.pie .center-sub { font-size: 10px; fill: var(--label-tertiary); text-anchor: middle; }

/* FPD bar / temperature scale */
.temp-scale {
  position: relative;
  height: 32px; border-radius: 8px;
  background: linear-gradient(90deg, #4d8be8, #75caff, #a6e1ff, #ffe7ad, #ffba6e);
  margin-top: 8px;
}
.temp-marker {
  position: absolute; top: -4px; bottom: -4px;
  width: 3px; background: var(--label);
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--bg-secondary);
}
.temp-scale-labels {
  display: flex; justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--label-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Settings rows */
.settings-list { display: flex; flex-direction: column; gap: 12px; }
.kv-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--separator);
}
.kv-row:first-child { border-top: none; }
.kv-row .label { font-weight: 500; }
.kv-row .desc { font-size: 12px; color: var(--label-tertiary); margin-top: 2px; }

/* Switch */
.switch {
  position: relative; display: inline-block;
  width: 51px; height: 31px;
}
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--fill-tertiary);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.18s ease;
}
.switch .slider::before {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.18);
  transition: transform 0.18s cubic-bezier(0.32, 0.72, 0, 1);
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Pills — segmented unit choice */
.unit-pills { display: inline-flex; gap: 4px; }
.unit-pills button {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--fill);
  border: none;
  font-size: 12px;
  cursor: pointer;
  color: var(--label-secondary);
}
.unit-pills button[aria-pressed="true"] {
  background: var(--tint-soft);
  color: var(--tint);
}

/* iPhone-sized: hide sidebar entirely, use bottom tab bar (iOS native) */
@media (max-width: 760px) {
  /* No mobile: grid de coluna única (sidebar tem display:none, então o
     .detail vira o único filho real do grid e ocupa 100% da largura).
     Sem isso, com `0 1fr` o auto-placement colocaria o .detail na coluna
     de 0px e o conteúdo vazaria. */
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  #sidebar-toggle { display: none; }
  .toolbar-title { font-size: 22px; }
  .editor { grid-template-columns: 1fr; }
  .ing-line {
    grid-template-columns: 22px 1fr 68px auto 28px;
    gap: 6px;
  }
  /* No mobile, toolbar e tab bar ficam opacas — sem efeito blur "leitoso"
     que escurece o conteúdo abaixo em telas pequenas. */
  .toolbar {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  /* Reserva espaço inferior para a tab bar não cobrir o conteúdo */
  .page {
    padding-bottom: calc(var(--safe-bottom) + 78px);
  }
}

/* Tab bar (rodapé) — só aparece no mobile */
.tab-bar { display: none; }
@media (max-width: 760px) {
  .tab-bar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 30;
    padding: 6px max(8px, var(--safe-right)) calc(var(--safe-bottom) + 6px) max(8px, var(--safe-left));
    background: var(--bg-secondary);
    border-top: 1px solid var(--separator);
    justify-content: space-around;
    gap: 4px;
  }
  .tab-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--label-tertiary);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease, background-color 0.15s ease;
  }
  .tab-btn:active { background: var(--fill); }
  .tab-btn[aria-current="page"] { color: var(--label); }
  .tab-btn .nav-icon {
    width: 24px; height: 24px;
    color: inherit;
  }
  .tab-btn .nav-icon svg { width: 24px; height: 24px; }
  .tab-btn[aria-current="page"] .nav-icon { color: var(--label); }
  .tab-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
}

/* Ensure SF-Symbols-like icon weight */
[data-icon] svg {
  stroke-width: 1.6;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
[data-icon].filled svg { fill: currentColor; stroke: none; }

/* Indicador de auto-save no editor de receita */
.save-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(52, 199, 89, 0.14);
  color: var(--success);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.save-status .nav-icon { width: 14px; height: 14px; }
.save-status .nav-icon svg { width: 14px; height: 14px; stroke-width: 2.4; }
.save-status.saving {
  background: rgba(255, 149, 0, 0.16);
  color: var(--warning);
}
.save-status.saving .nav-icon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Preset (tipos de sorvete) — editor de parâmetros */
.preset-params {
  display: flex; flex-direction: column; gap: 6px;
}
.preset-params-head,
.preset-params-row {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.9fr 0.9fr 28px;
  gap: 8px; align-items: center;
}
.preset-params-head {
  font-size: 11px; color: var(--label-tertiary);
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
  padding: 2px 4px;
}
.preset-params-head > span { text-align: center; }
.preset-params-head > span:first-child { text-align: left; }
.preset-param-label { font-size: 14px; font-weight: 500; }
.preset-params-row .input {
  text-align: right;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.preset-param-unit { font-size: 12px; color: var(--label-tertiary); }

/* =========================================================
   Tabela nutricional (estilo ANVISA RDC 429/2020)
   Fundo branco fixo (idêntico a um rótulo de embalagem),
   independentemente do tema claro/escuro do app.
   ========================================================= */
.nutri-label {
  border: 1.5px solid #1c1c1e;
  border-radius: 6px;
  background: #ffffff;
  font-family: var(--font-sans);
  color: #1c1c1e;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.nutri-label .title {
  font-weight: 800;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.02em;
  border-bottom: 1px solid #1c1c1e;
  padding-bottom: 4px;
  margin-bottom: 4px;
  font-size: 14px;
  color: #1c1c1e;
}
.nutri-label .header-line {
  display: flex; justify-content: space-between;
  border-bottom: 1px solid #1c1c1e;
  padding: 3px 0;
  font-size: 12px;
  color: #1c1c1e;
}
.nutri-label table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  color: #1c1c1e;
}
.nutri-label table th,
.nutri-label table td {
  text-align: right;
  padding: 4px 6px;
  font-size: 12.5px;
  border-bottom: 1px solid rgba(28, 28, 30, 0.35);
  color: #1c1c1e;
}
.nutri-label table th:first-child,
.nutri-label table td:first-child {
  text-align: left;
}
.nutri-label table thead th {
  font-weight: 700;
  font-size: 11px;
  border-bottom: 2px solid #1c1c1e;
  padding-bottom: 6px;
}
.nutri-label table tbody tr.indent td:first-child { padding-left: 18px; font-weight: 400; }
.nutri-label table tbody tr.indent2 td:first-child { padding-left: 28px; font-weight: 400; }
.nutri-label table tbody tr.major td { font-weight: 600; }
.nutri-label table tbody tr.major2 td { font-weight: 700; }
.nutri-label table tbody tr.thick-top td { border-top: 1.5px solid #1c1c1e; padding-top: 6px; }
.nutri-label table tbody tr:last-child td { border-bottom: 2px solid #1c1c1e; }
.nutri-label .footnote {
  font-size: 10.5px;
  color: rgba(28, 28, 30, 0.7);
  padding: 6px 0 0;
  line-height: 1.35;
}
.nutri-label .nd { color: rgba(28, 28, 30, 0.45); }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
