/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  /* ── DESIGN TOKENS v2 (sprint 3) — everything consumes these ──
     Palette: warm paper base + the landing's green family (brand link).
     All pairs used for text meet WCAG AA on their backgrounds. */

  /* neutrals (warm paper ramp) */
  --bg: #f6f4ee;
  --bg-deep: #edeae1;
  --card: #ffffff;
  --ink: #1c2620;
  --ink-soft: #3d4a42;
  --muted: #67736b;
  --line: #e4e2d9;
  --line-soft: #f1efe8;

  /* brand green (same hue family as the landing) */
  --accent: #2f855a;
  --accent-hover: #256b48;
  --accent-strong: #1d5c3c;
  --accent-soft: #d9f0e3;
  --accent-pale: #f0f9f4;
  --accent-glow: rgba(47, 133, 90, .18);

  /* urgency tier language (inventario + compras share it) */
  --t-urgente: #c2410c;  --t-urgente-bg: #fff0e8;  --t-urgente-line: #f5c8ad;
  --t-semana: #b45309;   --t-semana-bg: #fdf3dd;   --t-semana-line: #f1d8a1;
  --t-gradual: #1d6fa5;  --t-gradual-bg: #eaf4fb;  --t-gradual-line: #bedcf0;
  --t-reserva: #4b5563;  --t-reserva-bg: #f1f3f5;  --t-reserva-line: #d5dadf;
  --t-gusto: #a1425f;    --t-gusto-bg: #fdeef3;    --t-gusto-line: #f2c6d4;

  /* type scale — the only 5 sizes */
  --fs-xs: .78rem;
  --fs-s: .875rem;
  --fs-m: 1rem;
  --fs-l: 1.35rem;
  --fs-xl: 2.1rem;

  /* spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 14px; --sp-4: 20px; --sp-5: 32px; --sp-6: 52px;

  /* radii — 3 only */
  --r: 18px;
  --r-sm: 12px;
  --r-xs: 8px;

  /* elevation — 2 only */
  --shadow: 0 2px 14px rgba(28, 38, 32, .07);
  --shadow-md: 0 12px 36px rgba(28, 38, 32, .13);

  /* motion */
  --t-fast: 160ms cubic-bezier(.2, .7, .3, 1);
  --t-slow: 240ms cubic-bezier(.2, .7, .3, 1);

  /* recipe-type badges (kept, harmonized) */
  --vegano: #5b3fa8;       --vegano-bg: #efe9fb;
  --vegetariano: #22619c;  --vegetariano-bg: #e9f3fb;
  --pescado: #0e7d88;      --pescado-bg: #e3f6f8;
  --carne: #ad4e1e;        --carne-bg: #fdeee2;
  --snack: #b03434;        --snack-bg: #fdeeee;
  --variable: #67736b;     --variable-bg: #f1f3f5;

  /* legacy priority pills → tier aliases */
  --pill-green-bg: var(--accent-soft); --pill-green-color: var(--accent-strong);
  --pill-teal-bg: var(--t-gradual-bg); --pill-teal-color: var(--t-gradual);
  --pill-orange-bg: var(--t-semana-bg); --pill-orange-color: var(--t-semana);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
ul, ol { padding-left: 1.2rem; }
li { margin: 6px 0; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 8px rgba(31,41,51,.06);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 16px;
}
.nav-brand {
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent);
  white-space: nowrap;
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  padding: 6px 12px;
  border-radius: var(--r-xs);
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--accent-pale); color: var(--accent); }
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  padding: 4px 8px;
  border-radius: var(--r-xs);
  color: var(--ink-soft);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  padding: 48px 6vw;
  background: linear-gradient(135deg, #e8f7ee 0%, #fff7e6 60%, #fce7f3 100%);
  border-bottom: 1px solid var(--line);
  max-width: 100%;
}
.hero-content { flex: 1; min-width: 0; }
.eyebrow {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  display: block;
  margin-bottom: 12px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--ink);
}
.hero-desc {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 600px;
  margin-bottom: 20px;
}
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
}
.pill-green  { background: var(--pill-green-bg);  color: var(--pill-green-color); }
.pill-teal   { background: var(--pill-teal-bg);   color: var(--pill-teal-color); }
.pill-orange { background: var(--pill-orange-bg); color: var(--pill-orange-color); }

.budget-card {
  background: var(--card);
  border-radius: var(--r);
  padding: 24px 28px;
  box-shadow: var(--shadow-md);
  min-width: 220px;
  flex-shrink: 0;
  align-self: center;
}
.budget-label { font-size: .8rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.budget-amount { font-size: 2rem; font-weight: 900; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.budget-note { font-size: .78rem; color: var(--muted); margin-bottom: 14px; }
.budget-badges { display: flex; flex-direction: column; gap: 6px; }
.budget-tag {
  display: block;
  padding: 5px 10px;
  border-radius: var(--r-xs);
  font-size: .78rem;
  font-weight: 600;
  background: var(--line-soft);
  color: var(--muted);
  text-align: center;
}
.active-tag { background: var(--accent-soft); color: var(--accent); }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main { max-width: 1200px; margin: 0 auto; padding: 28px 5vw 60px; }

.priorities-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.priority-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  flex: 1;
  min-width: 170px;
}
.pi-icon { font-size: 1.4rem; flex-shrink: 0; }
.priority-item strong { display: block; font-size: .9rem; }
.priority-item small { color: var(--muted); font-size: .78rem; }

.alert-box {
  background: #fffbeb;
  border: 1px solid #f6e05e;
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: .88rem;
  color: #744210;
  margin-bottom: 24px;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 0;
}

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.panel-header { margin-bottom: 20px; }
.panel-header h2 { font-size: 1.25rem; font-weight: 800; margin-bottom: 4px; }
.panel-desc { font-size: .88rem; color: var(--muted); }

/* ============================================================
   WEEK TABS (MENÚ)
   ============================================================ */
.week-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.week-tab {
  border: 2px solid var(--line);
  background: var(--line-soft);
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 8px 16px;
  font-size: .88rem;
  font-weight: 700;
  transition: all .18s;
}
.week-tab:hover { border-color: var(--accent); color: var(--accent); }
.week-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.week-focus {
  background: var(--accent-pale);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: .9rem;
  color: var(--accent-hover);
}
.week-focus strong { font-size: 1rem; }

.day-table { width: 100%; border-collapse: collapse; }
.day-table th {
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 2px solid var(--line);
}
.day-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: .88rem;
  vertical-align: top;
}
.day-table tr:last-child td { border-bottom: none; }
.day-table tr.training-day td:first-child { border-left: 3px solid var(--accent); }
.day-name { font-weight: 700; white-space: nowrap; }
.training-badge {
  display: inline-block;
  font-size: .7rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 700;
  margin-left: 6px;
}
.meal-cell { color: var(--ink-soft); }
.meal-snack { color: var(--muted); font-size: .82rem; }
.meal-pe { color: var(--accent); font-size: .8rem; font-weight: 600; }

/* ============================================================
   COMPRAS
   ============================================================ */
.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.tabs { display: flex; gap: 8px; }
.tab-btn {
  border: 2px solid var(--line);
  background: var(--line-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: .88rem;
  font-weight: 700;
  transition: all .18s;
}
.tab-btn:hover { border-color: var(--accent); color: var(--accent); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.shop-meta { display: flex; align-items: center; gap: 10px; }
.counter {
  font-size: .84rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
}
.btn-outline {
  border: 2px solid var(--line);
  background: none;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: .82rem;
  transition: all .15s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.shop-section { margin-bottom: 20px; }
.shop-section-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.shop-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.shop-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--line-soft);
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .15s;
  -webkit-user-select: none;
  user-select: none;
}
.shop-item:hover { border-color: var(--accent); background: var(--accent-pale); }
.shop-item.checked { background: #f0faf5; border-color: var(--accent-soft); opacity: .7; }
.shop-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  background: white;
  margin-top: 1px;
  transition: all .15s;
}
.shop-item.checked .shop-checkbox { background: var(--accent); border-color: var(--accent); color: white; }
.shop-item-info { flex: 1; min-width: 0; }
.shop-item-name { font-size: .9rem; font-weight: 600; }
.shop-item.checked .shop-item-name { text-decoration: line-through; color: var(--muted); }
.shop-item-meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.shop-item-price { font-size: .8rem; font-weight: 700; color: var(--accent); margin-top: 2px; }
.shop-priority {
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  margin-top: 2px;
  align-self: flex-start;
}
.priority-alta { background: #fee2e2; color: #991b1b; }
.priority-media { background: #fef3c7; color: #92400e; }
.priority-baja { background: var(--line-soft); color: var(--muted); }

.shop-note { font-size: .8rem; color: var(--muted); margin-top: 12px; font-style: italic; }

/* ============================================================
   INVENTARIO
   ============================================================ */
.inv-grid { display: flex; flex-direction: column; gap: 6px; }
.inv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--line-soft);
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
}
.inv-item-name { font-size: .9rem; font-weight: 600; flex: 1; }
.inv-item-status { font-size: .78rem; color: var(--muted); flex: 1; }
.inv-badge {
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}
.inv-reserva { background: var(--accent-soft); color: var(--accent); }
.inv-usar { background: #fef3c7; color: #92400e; }

/* Inventory category groups */
.inv-cat-group { margin-bottom: 16px; }
.inv-cat-title {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

/* ============================================================
   BATCH COOKING
   ============================================================ */
.batch-section { margin-bottom: 16px; }
.batch-section-title {
  font-size: .84rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.batch-list { list-style: none; padding: 0; }
.batch-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: .88rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
}
.batch-list li:last-child { border-bottom: none; }
.batch-list li::before {
  content: "→";
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}
.batch-tip {
  background: var(--accent-pale);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-xs);
  padding: 10px 12px;
  font-size: .84rem;
  color: var(--accent-hover);
  margin-top: 12px;
}

/* ============================================================
   RECETAS
   ============================================================ */
.recipe-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.filter-btn {
  border: 2px solid var(--line);
  background: var(--line-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: .84rem;
  font-weight: 700;
  transition: all .15s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.recipe-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px;
  background: var(--bg);
  cursor: pointer;
  transition: all .18s;
  position: relative;
}
.recipe-card:hover { box-shadow: var(--shadow-md); border-color: var(--line); transform: translateY(-2px); }
.recipe-card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.recipe-card-title { font-weight: 800; font-size: .95rem; flex: 1; line-height: 1.3; }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.badge-vegano      { background: var(--vegano-bg);      color: var(--vegano); }
.badge-vegetariano { background: var(--vegetariano-bg); color: var(--vegetariano); }
.badge-pescado     { background: var(--pescado-bg);     color: var(--pescado); }
.badge-carne       { background: var(--carne-bg);       color: var(--carne); }
.badge-variable    { background: var(--variable-bg);    color: var(--variable); }

.recipe-meta { display: flex; gap: 12px; font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.recipe-meta span { display: flex; align-items: center; gap: 4px; }
.recipe-proteins { font-size: .82rem; color: var(--ink-soft); margin-bottom: 6px; }
.recipe-detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .84rem;
}
.recipe-card.expanded .recipe-detail { display: block; }
.recipe-card.expanded { box-shadow: var(--shadow-md); }
.recipe-detail h4 { font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 10px 0 4px; }
.recipe-detail ul { padding-left: 1.1rem; }
.recipe-detail li { margin: 3px 0; color: var(--ink-soft); }
.recipe-adapt { background: #fffbeb; border-radius: var(--r-xs); padding: 8px 10px; margin-top: 10px; font-size: .82rem; color: #92400e; }
.badge-batch { background: #e0f2f1; color: #004d40; }
.recipe-expand-hint { font-size: .78rem; color: var(--accent); margin-top: 8px; font-weight: 600; }

/* ============================================================
   PRESUPUESTO
   ============================================================ */
.presup-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.presup-tab {
  border: 2px solid var(--line);
  background: var(--line-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 18px;
  font-size: .88rem;
  font-weight: 700;
  transition: all .15s;
}
.presup-tab:hover { border-color: var(--accent); color: var(--accent); }
.presup-tab.active { background: var(--accent); border-color: var(--accent); color: white; }

.presup-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.presup-card {
  background: var(--accent-pale);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-sm);
  padding: 16px;
  text-align: center;
}
.presup-card-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.presup-card-amount { font-size: 1.5rem; font-weight: 900; color: var(--accent); margin: 4px 0; }
.presup-card-note { font-size: .78rem; color: var(--muted); }

.presup-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.presup-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--line-soft);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.presup-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.presup-table tr:last-child td { border-bottom: none; font-weight: 700; background: var(--line-soft); }
.presup-total-row td { font-weight: 800; background: var(--accent-pale) !important; color: var(--accent); }

/* ============================================================
   GUSTOS
   ============================================================ */
.gustos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.gusto-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px;
  background: var(--bg);
}
.gusto-icon { font-size: 1.8rem; margin-bottom: 8px; }
.gusto-name { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.gusto-desc { font-size: .83rem; color: var(--muted); }
.gusto-freq { font-size: .78rem; font-weight: 700; color: var(--accent); margin-top: 6px; }

.gustos-rule {
  background: linear-gradient(135deg, #f0faf5, #fffbeb);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-sm);
  padding: 16px 20px;
  font-size: .9rem;
  color: var(--ink-soft);
}
.gustos-rule strong { color: var(--accent); }

/* ============================================================
   BOLETAS
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--r-sm);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  background: var(--line-soft);
  margin-bottom: 16px;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-pale);
}
.upload-icon { font-size: 2.4rem; margin-bottom: 8px; }
.upload-label { font-size: .95rem; color: var(--ink-soft); margin-bottom: 4px; }
.upload-hint { font-size: .8rem; color: var(--muted); }

.upload-form {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.upload-preview-wrap {
  flex-shrink: 0;
  width: 120px;
}
#uploadPreview {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  display: block;
}
.pdf-label {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  font-size: .88rem;
  color: var(--muted);
  font-weight: 600;
}
.upload-fields {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.upload-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.upload-fields select,
.upload-fields input[type="date"],
.upload-fields input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: .88rem;
  color: var(--ink);
  background: var(--card);
  transition: border-color .15s;
}
.upload-fields select:focus,
.upload-fields input:focus {
  outline: none;
  border-color: var(--accent);
}
.upload-btns {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 9px 20px;
  font-weight: 700;
  font-size: .88rem;
  transition: background .15s;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.upload-status {
  border-radius: var(--r-xs);
  padding: 10px 14px;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.upload-status.loading { background: #eff6ff; color: #1d4ed8; }
.upload-status.success { background: var(--accent-soft); color: var(--accent); }
.upload-status.error   { background: #fee2e2; color: #991b1b; }

/* Receipts gallery */
.receipts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.receipt-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--card);
  transition: box-shadow .18s;
}
.receipt-card:hover { box-shadow: var(--shadow-md); }
.receipt-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  cursor: pointer;
  background: var(--line-soft);
}
.receipt-pdf-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--line-soft);
  cursor: pointer;
  color: var(--muted);
}
.receipt-info {
  padding: 10px 12px;
}
.receipt-store {
  font-weight: 700;
  font-size: .9rem;
  color: var(--ink);
}
.receipt-date {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
}
.receipt-total {
  font-size: .88rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}
.receipt-note {
  font-size: .78rem;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}
.receipt-actions {
  display: flex;
  gap: 6px;
  padding: 0 12px 10px;
}
.btn-icon {
  border: 1px solid var(--line);
  background: var(--line-soft);
  color: var(--muted);
  border-radius: var(--r-xs);
  padding: 4px 10px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  flex: 1;
  text-align: center;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-pale); }
.btn-icon.danger:hover { border-color: #dc2626; color: #dc2626; background: #fee2e2; }

/* Productos habituales */
.items-toolbar { margin-top: 16px; margin-bottom: 16px; }
.items-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.item-input {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: .88rem;
  color: var(--ink);
  background: var(--card);
  flex: 1;
  min-width: 140px;
  transition: border-color .15s;
}
.item-input:focus { outline: none; border-color: var(--accent); }
.item-input.short { flex: 0 0 130px; min-width: 0; }

.items-cat { margin-bottom: 20px; }
.items-cat-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.items-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
}
.item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  transition: all .15s;
}
.item-row:hover { border-color: var(--accent-soft); background: var(--accent-pale); }
.item-row-info { flex: 1; min-width: 0; }
.item-row-name { font-weight: 700; font-size: .9rem; }
.item-row-meta { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.item-row-count {
  font-size: .76rem;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

/* Modal (image lightbox) */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--card);
  border-radius: var(--r);
  padding: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  position: relative;
}
.modal-box img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  border-radius: var(--r-xs);
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,.5);
  border: none;
  border-radius: 999px;
  color: white;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: rgba(0,0,0,.8); }
.modal-loading {
  padding: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
}

/* Utility states */
.loading-msg, .empty-msg, .error-msg {
  padding: 24px;
  text-align: center;
  font-size: .9rem;
  border-radius: var(--r-xs);
  margin-top: 12px;
}
.loading-msg { color: var(--muted); background: var(--line-soft); }
.empty-msg   { color: var(--muted); background: var(--line-soft); font-style: italic; }
.error-msg   { color: #991b1b; background: #fee2e2; }

/* btn-outline small variant */
.btn-outline.small { padding: 5px 12px; font-size: .8rem; }

/* ============================================================
   LIVE DOT — indicator in nav
   ============================================================ */
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  margin-left: 6px;
  vertical-align: middle;
  transition: background .3s;
}
.live-dot.live-ok  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.live-dot.live-err { background: #ef4444; }

/* ============================================================
   MEAL EATEN — menu table interactivity
   ============================================================ */
.meal-clickable {
  cursor: pointer;
  transition: background .15s, opacity .15s;
  user-select: none;
}
.meal-clickable:hover { background: var(--accent-pale); }
.meal-eaten {
  background: var(--accent-soft) !important;
  opacity: .65;
  text-decoration: line-through;
}
.meal-text { display: block; }
.meal-text-editable {
  cursor: text;
  border-radius: 4px;
  transition: background .15s;
}
.meal-text-editable:hover { background: rgba(47,133,90,.08); }
.meal-toggle {
  cursor: pointer;
  display: inline-block;
  transition: opacity .15s;
  border: none;
  font: inherit;
  font-size: .65rem;
}
.meal-toggle:hover { opacity: .7; }
.meal-edited { background: #fffbeb !important; }
.meal-edited:hover { background: #fef3c7 !important; }
.meal-edit-input {
  width: 100%;
  border: 2px solid var(--accent);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: .82rem;
  font-family: inherit;
  background: white;
  outline: none;
  box-shadow: 0 0 0 3px rgba(47,133,90,.15);
}
.meal-ate-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: 1px 7px;
  margin-top: 3px;
  letter-spacing: .03em;
}

/* ============================================================
   WEEK PROGRESS BAR
   ============================================================ */
.week-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 16px;
}
.week-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.week-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .4s ease;
}
.week-progress-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

/* ============================================================
   INVENTORY CONSUMED TOGGLE
   ============================================================ */
.inv-item { cursor: pointer; transition: opacity .2s, background .15s; }
.inv-item:hover { background: var(--accent-pale); }
.inv-item.inv-consumed { opacity: .45; }
.inv-item.inv-consumed .inv-item-name { text-decoration: line-through; }
.inv-done { font-size: .7rem; color: var(--accent); font-weight: 700; margin-left: 4px; }

/* ============================================================
   CHAT PANEL
   ============================================================ */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(47,133,90,.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, background .15s;
}
.chat-fab:hover { background: var(--accent-hover); transform: scale(1.07); }

.chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 199;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(.97);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s ease, opacity .18s ease;
}
.chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--accent);
  color: white;
}
.chat-header-title { font-weight: 700; font-size: .95rem; }
.chat-header-sub   { font-size: .75rem; opacity: .8; }
.chat-header-close {
  background: rgba(255,255,255,.2);
  border: none;
  color: white;
  border-radius: 50%;
  width: 28px; height: 28px;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.chat-header-close:hover { background: rgba(255,255,255,.35); }

.chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--line-soft);
}
.quick-prompt-btn {
  font-size: .75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  line-height: 1.4;
}
.quick-prompt-btn:hover { background: var(--accent-pale); border-color: var(--accent); color: var(--accent); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
  max-height: 320px;
}

.chat-bubble { display: flex; }
.chat-user    { justify-content: flex-end; }
.chat-assistant { justify-content: flex-start; }

.chat-bubble-inner {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: .87rem;
  line-height: 1.5;
}
.chat-user .chat-bubble-inner {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-assistant .chat-bubble-inner {
  background: var(--line-soft);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.chat-assistant .chat-bubble-inner h3,
.chat-assistant .chat-bubble-inner h4 { font-size: .88rem; margin: 6px 0 2px; }
.chat-assistant .chat-bubble-inner ul  { margin: 4px 0; padding-left: 1.1rem; }
.chat-assistant .chat-bubble-inner li  { margin: 2px 0; }
.chat-assistant .chat-bubble-inner code {
  background: var(--line);
  border-radius: 4px;
  padding: 0 4px;
  font-size: .83em;
}
.chat-thinking {
  font-size: 1.3rem;
  letter-spacing: 4px;
  animation: think .8s infinite alternate;
}
@keyframes think { from { opacity: .3; } to { opacity: 1; } }

.chat-upgrade-row {
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
}
.chat-upgrade-btn {
  font-size: .74rem;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  cursor: pointer;
  transition: background .15s;
}
.chat-upgrade-btn:hover { background: var(--accent); color: white; }

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.chat-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: .88rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: white;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--accent-hover); }

/* ============================================================
   SETTINGS MODAL
   ============================================================ */
.settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.settings-modal.open { display: flex; }
.settings-box {
  background: var(--card);
  border-radius: var(--r);
  padding: 28px;
  width: min(420px, 100%);
  box-shadow: var(--shadow-md);
  position: relative;
}
.settings-box h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.settings-box .settings-sub {
  font-size: .83rem;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.settings-close {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--line-soft);
  border: none;
  border-radius: 50%;
  width: 30px; height: 30px;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.settings-close:hover { background: var(--line); }
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.settings-field label {
  font-size: .83rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.settings-field input {
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: 9px 12px;
  font-size: .9rem;
  font-family: monospace;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color .15s;
}
.settings-field input:focus { border-color: var(--accent); }
.api-status {
  font-size: .8rem;
  font-weight: 600;
  margin-top: 4px;
}
.api-status.ok      { color: var(--accent); }
.api-status.missing { color: #b91c1c; }
.settings-btns {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.settings-btns .btn-primary  { flex: 1; }
.settings-btns .btn-outline  { flex: 0; }
.settings-upgrade-hint {
  margin-top: 16px;
  padding: 12px;
  background: var(--accent-pale);
  border-radius: var(--r-xs);
  font-size: .8rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.settings-upgrade-hint strong { color: var(--accent); }

/* Demo banner */
.demo-banner {
  background: var(--ink);
  color: #fff;
  text-align: center;
  padding: 9px 14px;
  font-size: .85rem;
}
.demo-banner a { color: #68d391; font-weight: 700; text-decoration: underline; }

/* Toast — non-blocking error/info notices */
.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .85rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 400;
  max-width: min(92vw, 480px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Nav settings button */
.nav-settings-btn {
  background: none;
  border: none;
  padding: 6px 8px;
  font-size: 1rem;
  border-radius: var(--r-xs);
  color: var(--muted);
  transition: color .15s, background .15s;
  display: flex; align-items: center; gap: 4px;
}
.nav-settings-btn:hover { color: var(--accent); background: var(--accent-pale); }

/* ============================================================
   MENU MOBILE CARDS
   ============================================================ */
.menu-table-wrap { overflow-x: auto; }
.menu-cards { display: none; }

.day-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--card);
}
.day-card-train { border-left: 3px solid var(--accent); }
.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--line-soft);
  border-bottom: 1px solid var(--line);
}
.day-card-name { font-weight: 800; font-size: .95rem; }
.day-card-meal {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .15s;
}
.day-card-meal.meal-eaten { background: var(--accent-soft); opacity: .7; }
.day-card-meal.meal-edited { background: #fffbeb; }
.day-card-meal-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 3px;
}
.day-card-meal-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.day-card-meal-body .meal-text {
  flex: 1;
  font-size: .88rem;
  line-height: 1.4;
}
.meal-card-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.meal-card-toggle:hover { background: var(--accent-pale); border-color: var(--accent); }
.day-card-snack {
  padding: 7px 14px;
  font-size: .78rem;
  color: var(--muted);
  background: var(--bg);
}
.menu-cards .menu-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: var(--ink);
  color: rgba(255,255,255,.6);
  font-size: .84rem;
  border-top: none;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 5vw 28px;
}
.footer-brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 32px;
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 36px;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-col-title {
  font-weight: 700;
  color: rgba(255,255,255,.9);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}
.footer-col a,
.footer-col span {
  color: rgba(255,255,255,.55);
  font-size: .84rem;
  transition: color .15s;
  text-decoration: none;
}
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: .78rem;
  color: rgba(255,255,255,.35);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hero { flex-direction: column; padding: 32px 5vw; }
  .budget-card { min-width: 0; width: 100%; }
  .budget-badges { flex-direction: row; justify-content: center; }
  .two-col-grid { grid-template-columns: 1fr; }
  .cards-3 { grid-template-columns: 1fr; }
  .day-table { font-size: .82rem; }
  .day-table .meal-snack, .day-table .meal-pe { display: none; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .menu-table-wrap { display: none; }
  .menu-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
  .footer-cols { grid-template-columns: 1fr; gap: 20px; }
  .footer-inner { padding: 32px 5vw 20px; }
  .nav-links { display: none; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: var(--card); border-bottom: 1px solid var(--line); padding: 12px 5vw; z-index: 99; box-shadow: var(--shadow-md); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 12px; font-size: .95rem; }
  .nav-toggle { display: block; }
  .hero { padding: 24px 5vw; }
  .hero h1 { font-size: 2rem; }
  main { padding: 16px 4vw 40px; }
  .panel { padding: 20px; }
  .priorities-bar { gap: 8px; }
  .priority-item { min-width: 140px; }
  .shop-items { grid-template-columns: 1fr; }
  .recipe-grid { grid-template-columns: 1fr; }
  .gustos-grid { grid-template-columns: 1fr 1fr; }
  .presup-summary { grid-template-columns: 1fr 1fr; }
  .day-table th:nth-child(3), .day-table td:nth-child(3) { display: none; }
  .upload-form { flex-direction: column; }
  .upload-preview-wrap { width: 100%; }
  #uploadPreview { width: 100%; height: 180px; }
  .pdf-label { width: 100%; height: 100px; }
  .receipts-grid { grid-template-columns: 1fr 1fr; }
  .items-add { flex-direction: column; }
  .item-input, .item-input.short { flex: none; width: 100%; }
  .items-list-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   DESIGN SYSTEM v2 — component layer (sprint 3)
   Appended last on purpose: wins the cascade over legacy ad-hoc
   rules while they are progressively deleted. Tokens only.
   ============================================================ */

/* — accessibility floor — */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
/* tap-target floor */
.meal-card-toggle { width: 44px; height: 44px; }
.nav-settings-btn, .nav-toggle, .chat-header-close, .settings-close, .modal-close { min-width: 44px; min-height: 44px; }

/* — type scale application — */
.hero h1 { font-size: var(--fs-xl); letter-spacing: -.02em; }
.panel-header h2, section h2 { font-size: var(--fs-l); letter-spacing: -.01em; }
.panel-desc, .hero-desc { font-size: var(--fs-s); }
body { font-size: var(--fs-m); }

/* — one button system — */
.btn-primary, .btn-outline, .tab-btn, .week-tab, .quick-prompt-btn, .chat-upgrade-btn, .filter-btn {
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn-primary {
  background: var(--accent);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.tab-btn.active, .week-tab.active, .filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* — urgency tiers: designed component, felt before read —
   Groups render in fixed order: urgente, semana, gradual, reservas, gustos. */
.inv-cat-group { border-left: 4px solid var(--line); border-radius: var(--r-xs); padding-left: var(--sp-3); margin-bottom: var(--sp-4); }
.inv-cat-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: var(--sp-2);
}
.inv-cat-group:nth-of-type(1) { border-left-color: var(--t-urgente); }
.inv-cat-group:nth-of-type(1) .inv-cat-title { background: var(--t-urgente-bg); color: var(--t-urgente); }
.inv-cat-group:nth-of-type(1) .inv-item { border-color: var(--t-urgente-line); }
.inv-cat-group:nth-of-type(2) { border-left-color: var(--t-semana); }
.inv-cat-group:nth-of-type(2) .inv-cat-title { background: var(--t-semana-bg); color: var(--t-semana); }
.inv-cat-group:nth-of-type(3) { border-left-color: var(--t-gradual); }
.inv-cat-group:nth-of-type(3) .inv-cat-title { background: var(--t-gradual-bg); color: var(--t-gradual); }
.inv-cat-group:nth-of-type(4) { border-left-color: var(--t-reserva); }
.inv-cat-group:nth-of-type(4) .inv-cat-title { background: var(--t-reserva-bg); color: var(--t-reserva); }
.inv-cat-group:nth-of-type(5) { border-left-color: var(--t-gusto); }
.inv-cat-group:nth-of-type(5) .inv-cat-title { background: var(--t-gusto-bg); color: var(--t-gusto); }

/* shopping priority speaks the same tier language */
.priority-alta { background: var(--t-urgente-bg) !important; color: var(--t-urgente) !important; }
.priority-media { background: var(--t-semana-bg) !important; color: var(--t-semana) !important; }
.priority-baja { background: var(--t-reserva-bg) !important; color: var(--t-reserva) !important; }

/* — week progress: the hero of the menu — */
.week-progress { gap: var(--sp-3); }
.week-progress-bar {
  height: 14px;
  border-radius: 999px;
  background: var(--bg-deep);
  box-shadow: inset 0 1px 3px rgba(28,38,32,.08);
}
.week-progress-fill {
  background: linear-gradient(90deg, var(--accent), #48a26f);
  border-radius: 999px;
  transition: width var(--t-slow);
}
.week-progress-label {
  font-size: var(--fs-xs);
  font-weight: 800;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
}

/* — chat panel polish — */
.chat-header { background: linear-gradient(120deg, var(--accent-strong), var(--accent)); }
.chat-fab { box-shadow: 0 10px 28px var(--accent-glow), var(--shadow); transition: transform var(--t-fast), box-shadow var(--t-fast); }
.chat-fab:hover { transform: scale(1.06) translateY(-1px); }
.chat-user .chat-bubble-inner { background: var(--accent-strong); }

/* — cards breathe the same — */
.panel { border: 1px solid var(--line); }
.recipe-card, .gusto-card, .inv-item, .shop-item, .day-card {
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.recipe-card:hover, .day-card:hover { box-shadow: var(--shadow); border-color: var(--accent-soft); }

/* — meal states read as product, not spreadsheet — */
.meal-eaten { position: relative; }
.meal-edited { background: #fdf6df !important; }
.meal-ate-badge { letter-spacing: .02em; }

/* — toast aligned to tokens — */
.toast { border-radius: var(--r-sm); box-shadow: var(--shadow-md); font-size: var(--fs-s); }

/* — demo: "tu mes en números" (the shareable moment) — */
.demo-stats {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  border-radius: var(--r);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.demo-stats-head {
  font-weight: 800;
  font-size: var(--fs-m);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.demo-stats-head span { font-size: var(--fs-xs); font-weight: 600; opacity: .75; }
.demo-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.demo-stat {
  background: rgba(255,255,255,.12);
  border-radius: var(--r-sm);
  padding: var(--sp-3);
  text-align: center;
}
.demo-stat .ds-v { font-size: var(--fs-l); font-weight: 800; line-height: 1.15; }
.demo-stat .ds-l { font-size: var(--fs-xs); opacity: .85; margin-top: 4px; }
.ds-bar { height: 6px; background: rgba(255,255,255,.25); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.ds-bar div { height: 100%; background: #fff; border-radius: 999px; }
@media (max-width: 700px) { .demo-stats-grid { grid-template-columns: 1fr 1fr; } }

/* — demo: coach marks — */
.coach-mark {
  position: absolute;
  z-index: 350;
  width: 280px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: var(--fs-s);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  animation: coach-in var(--t-slow) both;
}
@keyframes coach-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.coach-mark span { flex: 1 1 100%; }
.coach-next {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: var(--fs-xs);
}
.coach-close {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 30px;
  height: 30px;
}

/* ============================================================
   PREMIUM PASS (sprint 3, night 2) — structure over text
   ============================================================ */

/* — hero: quieter, more confident — */
.hero {
  background:
    radial-gradient(ellipse 70% 90% at 8% 0%, rgba(47,133,90,.10), transparent 60%),
    radial-gradient(ellipse 50% 70% at 95% 10%, rgba(251,191,36,.08), transparent 60%),
    var(--card);
  padding: var(--sp-6) 6vw var(--sp-5);
}
.hero h1 { letter-spacing: -.03em; }
.hero-desc { color: var(--ink-soft); font-size: var(--fs-m); margin-bottom: var(--sp-3); }
.eyebrow { letter-spacing: .12em; }
.budget-range { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.budget-range-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.budget-range-bar span { display: block; height: 100%; width: 50%; background: linear-gradient(90deg, var(--accent), #48a26f); border-radius: 999px; }

/* — panels: overline kicker + calmer headers — */
.panel { padding: var(--sp-5); }
.panel-header { margin-bottom: var(--sp-4); }
.panel-header h2::before {
  content: '';
  display: block;
  width: 28px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  margin-bottom: 10px;
}
.alert-box { padding: 8px 14px; font-size: var(--fs-xs); border-radius: 999px; display: inline-block; }

/* — week tabs as segmented control — */
.week-tabs { display: inline-flex; background: var(--bg-deep); border-radius: 999px; padding: 4px; gap: 2px; }
.week-tab { border: none; border-radius: 999px; background: transparent; padding: 8px 18px; font-weight: 700; font-size: var(--fs-s); color: var(--ink-soft); }
.week-tab.active { background: var(--ink); color: #fff; box-shadow: var(--shadow); }

/* — menu: icon-only mark, text is the content — */
.meal-cell-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.meal-cell-row .meal-text { flex: 1; }
.meal-dot {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.meal-dot:hover { border-color: var(--accent); transform: scale(1.1); }
.meal-eaten .meal-dot, .meal-dot[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.meal-eaten { opacity: 1; }
.meal-eaten .meal-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(47,133,90,.5); }

/* — compras: one line per item — */
.shop-items { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.shop-item { padding: 9px 12px; align-items: center; }
.shop-item-name { display: flex; align-items: center; gap: 6px; font-size: var(--fs-s); }
.shop-item-meta { font-size: var(--fs-xs); margin-top: 0; }
.shop-item-price { font-size: var(--fs-xs); font-weight: 800; color: var(--accent-strong); white-space: nowrap; align-self: center; }
.shop-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; padding: 0 !important; }
.shop-dot.priority-alta  { background: var(--t-urgente) !important; }
.shop-dot.priority-media { background: var(--t-semana) !important; }
.shop-dot.priority-baja  { background: var(--t-reserva-line) !important; }

/* — inventario: chip grid, tier speaks through color — */
.inv-cat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.inv-cat-count { font-size: var(--fs-xs); font-weight: 800; color: var(--muted); background: var(--bg-deep); border-radius: 999px; padding: 2px 10px; }
.inv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.inv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 13px;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-soft);
  min-height: 34px;
  transition: border-color var(--t-fast), background var(--t-fast), opacity var(--t-fast);
}
.inv-chip:hover { border-color: var(--accent); background: var(--accent-pale); }
.inv-chip-check {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  color: #fff;
  flex-shrink: 0;
}
.inv-chip.inv-consumed { opacity: .55; text-decoration: line-through; }
.inv-chip.inv-consumed .inv-chip-check { background: var(--accent); border-color: var(--accent); }
.inv-cat-group:nth-of-type(1) .inv-chip:not(.inv-consumed) { border-color: var(--t-urgente-line); background: var(--t-urgente-bg); color: var(--t-urgente); }
.inv-cat-group:nth-of-type(2) .inv-chip:not(.inv-consumed) { border-color: var(--t-semana-line); background: var(--t-semana-bg); color: var(--t-semana); }
.inv-cat-group:nth-of-type(5) .inv-chip:not(.inv-consumed) { border-color: var(--t-gusto-line); background: var(--t-gusto-bg); color: var(--t-gusto); }

/* — batch: hero checklist + folds — */
.batch-hero { border: 1px solid var(--t-semana-line); background: var(--t-semana-bg); border-radius: var(--r-sm); padding: var(--sp-3); margin-bottom: var(--sp-3); }
.batch-hero-title { font-weight: 800; font-size: var(--fs-s); color: var(--t-semana); margin-bottom: var(--sp-2); }
.batch-steps { display: flex; flex-direction: column; gap: 5px; }
.batch-step { display: grid; grid-template-columns: 26px 84px 1fr; gap: 8px; align-items: baseline; background: var(--card); border-radius: var(--r-xs); padding: 8px 10px; font-size: var(--fs-xs); }
.batch-step-ic { font-size: 1rem; }
.batch-step-urg { font-weight: 800; white-space: nowrap; }
.batch-step.u-0 .batch-step-urg { color: var(--t-urgente); }
.batch-step.u-1 .batch-step-urg { color: var(--t-semana); }
.batch-step.u-2 .batch-step-urg { color: var(--accent-strong); }
.batch-step-txt { color: var(--ink-soft); }
.fold { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0; margin-bottom: var(--sp-2); background: var(--card); overflow: hidden; }
.fold summary { cursor: pointer; font-weight: 700; font-size: var(--fs-s); padding: 12px 16px; list-style: none; display: flex; align-items: center; gap: 8px; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: '›'; margin-left: auto; color: var(--muted); transform: rotate(90deg); transition: transform var(--t-fast); }
.fold[open] summary::after { transform: rotate(-90deg); }
.fold summary:hover { background: var(--accent-pale); }
.fold-n { font-size: var(--fs-xs); font-weight: 800; color: var(--muted); background: var(--bg-deep); border-radius: 999px; padding: 1px 8px; }
.fold .batch-list { padding: 0 16px 12px 32px; margin: 0; font-size: var(--fs-s); color: var(--ink-soft); }

@media (max-width: 640px) {
  .hero { padding: var(--sp-5) 5vw; }
  .batch-step { grid-template-columns: 22px 1fr; }
  .batch-step-txt { grid-column: 1 / -1; }
}

/* — recetas: chevron affordance instead of 15 repeated hints — */
.recipe-card { position: relative; }
.recipe-card::after {
  content: '›';
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--muted);
  font-size: 1.1rem;
  transform: rotate(90deg);
  transition: transform var(--t-fast), color var(--t-fast);
}
.recipe-card.expanded::after { transform: rotate(-90deg); color: var(--accent); }
.recipe-card-header { padding-right: 22px; }

/* — gustos: compact tiles — */
.gusto-card { text-align: center; padding: var(--sp-3); cursor: default; }
.gusto-icon { font-size: 1.6rem; }
.gusto-name { font-weight: 700; font-size: var(--fs-s); margin-top: 4px; }
.gusto-freq { font-size: var(--fs-xs); font-weight: 700; color: var(--accent-strong); background: var(--accent-pale); border-radius: 999px; padding: 3px 10px; display: inline-block; margin-top: 6px; }
.gustos-rule { font-size: var(--fs-s); }

/* ============================================================
   APP SHELL v3 — dark premium nav + live status appbar
   (visibly the same brand as the landing)
   ============================================================ */

.nav {
  background: rgba(16, 22, 19, .96);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
}
.nav-brand { color: #fff; }
.nav-links a { color: rgba(255,255,255,.72); }
.nav-links a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-settings-btn { color: rgba(255,255,255,.72); }
.nav-settings-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-toggle { color: rgba(255,255,255,.85); }
@media (max-width: 640px) {
  .nav-links { background: #101613; border-bottom: 1px solid rgba(255,255,255,.08); }
  .nav-links a { color: rgba(255,255,255,.8); }
}

.appbar {
  background:
    radial-gradient(ellipse 60% 120% at 10% -20%, rgba(74,222,128,.16), transparent 60%),
    linear-gradient(160deg, #101613, #16241c 70%, #14261d);
  color: #fff;
  border-bottom: 1px solid var(--line);
}
.appbar-in {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp-5) 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.appbar-greet { font-size: var(--fs-l); font-weight: 800; letter-spacing: -.01em; }
.appbar-sub { color: rgba(255,255,255,.6); font-size: var(--fs-s); margin-top: 2px; }
.appbar-stats { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.ab-stat {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-sm);
  padding: 12px 18px;
  min-width: 132px;
}
.ab-stat-v { font-size: 1.3rem; font-weight: 800; line-height: 1.1; }
.ab-stat-v small { font-size: .8em; opacity: .8; }
.ab-stat-l { font-size: var(--fs-xs); color: rgba(255,255,255,.6); margin-top: 2px; }
.ab-bar { height: 5px; border-radius: 999px; background: rgba(255,255,255,.15); margin-top: 8px; overflow: hidden; }
.ab-bar div { height: 100%; background: #4ade80; border-radius: 999px; transition: width var(--t-slow); }
.ab-stat-pills span { font-size: 1.05rem; margin-right: 3px; cursor: default; }

@media (max-width: 640px) {
  .appbar-in { padding: var(--sp-4) 5vw; }
  .ab-stat { flex: 1; min-width: 100px; padding: 10px 12px; }
  .ab-stat-pills { display: none; }
}
