/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  --bg: #f7f5ef;
  --card: #ffffff;
  --ink: #1f2933;
  --ink-soft: #374151;
  --muted: #6b7280;
  --accent: #2f855a;
  --accent-hover: #276749;
  --accent-soft: #dff3e7;
  --accent-pale: #f0faf5;
  --line: #e5e7eb;
  --line-soft: #f3f4f6;
  --shadow: 0 4px 20px rgba(31,41,51,.07);
  --shadow-md: 0 8px 32px rgba(31,41,51,.1);
  --r: 20px;
  --r-sm: 12px;
  --r-xs: 8px;

  /* tipo badges */
  --vegano: #6b46c1;       --vegano-bg: #ede9fe;
  --vegetariano: #2b6cb0;  --vegetariano-bg: #ebf8ff;
  --pescado: #0694a2;      --pescado-bg: #e3f8fa;
  --carne: #c05621;        --carne-bg: #feecdc;
  --snack: #c53030;        --snack-bg: #fff5f5;
  --variable: #718096;     --variable-bg: #f7fafc;

  /* priority pills */
  --pill-green-bg: #d1fae5; --pill-green-color: #065f46;
  --pill-teal-bg: #ccfbf1;  --pill-teal-color: #134e4a;
  --pill-orange-bg: #fed7aa; --pill-orange-color: #7c2d12;
}

/* ============================================================
   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; }

/* ============================================================
   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; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  text-align: center;
  padding: 32px 5vw;
  color: var(--muted);
  font-size: .84rem;
  border-top: 1px solid var(--line);
  background: var(--card);
}
footer p + p { margin-top: 4px; }

/* ============================================================
   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; }
}
@media (max-width: 640px) {
  .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; }
}
