/* ============================================================
   Menú Semanal Post-Gastrectomía — ACCGG prototype
   Brand: #654c8e (primary), palette: #337ab7, #a397c1, #31708f,
   #3c763d, #8a6d3b
   ============================================================ */

:root {
  --brand: #654c8e;
  --brand-light: #a397c1;
  --brand-dark: #4b3868;
  --accent-blue: #337ab7;
  --accent-blue-dark: #31708f;
  --accent-green: #3c763d;
  --accent-amber: #8a6d3b;
  --bg: #faf7fd;
  --ink: #1f1530;
  --ink-soft: #4b3e63;
  --line: #e6dfee;
  --line-strong: #d3c8e2;
  --card: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Decorative brand header bar */
.brand-strip {
  height: 4px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-light) 50%, var(--accent-blue) 100%);
}

.app-header {
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: saturate(180%) blur(6px);
}
.app-header .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-lockup img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: white;
  padding: 2px;
  box-shadow: 0 0 0 1px var(--line);
  flex-shrink: 0;
}
.brand-lockup .name {
  font-weight: 700;
  color: var(--brand);
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.brand-lockup .sub {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.app-header .badge {
  font-size: 11px;
  background: var(--brand);
  color: white;
  padding: 5px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.app-header .badge.light {
  background: white;
  color: var(--brand);
  border: 1px solid var(--line-strong);
}

/* Hero */
.hero {
  background:
    radial-gradient(1200px 400px at 20% 0%, rgba(101, 76, 142, 0.10), transparent 60%),
    radial-gradient(800px 300px at 100% 10%, rgba(51, 122, 183, 0.10), transparent 60%),
    linear-gradient(180deg, #ffffff, var(--bg));
  border-bottom: 1px solid var(--line);
}
.hero .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 20px 40px;
}
.hero h1 {
  font-size: clamp(26px, 4.2vw, 40px);
  line-height: 1.1;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hero h1 .accent { color: var(--brand); }
.hero p.lead {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0 0 22px;
}
.hero .cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand);
  color: white;
  box-shadow: 0 6px 20px -8px rgba(101,76,142,0.55);
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost {
  background: white;
  color: var(--brand);
  border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--brand); }
.btn-link {
  background: transparent;
  color: var(--accent-blue);
  padding: 8px 10px;
  font-size: 13.5px;
}
.btn-link:hover { color: var(--accent-blue-dark); text-decoration: underline; }

/* Preset profiles */
.presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 24px;
}
.preset-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preset-card:hover {
  border-color: var(--brand-light);
  box-shadow: 0 8px 24px -12px rgba(101,76,142,0.35);
}
.preset-card:active { transform: translateY(1px); }
.preset-card .tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
  align-self: flex-start;
}
.tag.temprano { background: #fff4e0; color: var(--accent-amber); }
.tag.estable { background: #e7f3e8; color: var(--accent-green); }
.tag.dumping { background: #fce4ec; color: #a32a4a; }
.preset-card .name { font-weight: 700; color: var(--ink); font-size: 15px; margin-top: 2px; }
.preset-card .desc { font-size: 13px; color: var(--ink-soft); line-height: 1.45; }

/* Chat wizard */
.wizard {
  max-width: 720px;
  margin: 32px auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 60px -30px rgba(101,76,142,0.25);
  overflow: hidden;
}
.wizard-head {
  padding: 18px 20px;
  background: linear-gradient(180deg, #f6f0fb, #ffffff);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}
.wizard-head .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.wizard-head .title { font-weight: 700; color: var(--ink); font-size: 14.5px; }
.wizard-head .sub { font-size: 12.5px; color: var(--ink-soft); }

.chat {
  padding: 18px 20px 8px;
  max-height: 56vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(101,76,142,0.025) 31px 32px);
}
.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.5;
  animation: pop 0.18s ease;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.bubble.bot {
  background: #f3eef9;
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bubble.user {
  background: var(--brand);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bubble .options {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  background: white;
  border: 1.5px solid var(--brand-light);
  color: var(--brand);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { background: var(--brand); color: white; border-color: var(--brand); }
.chip.selected { background: var(--brand); color: white; border-color: var(--brand); }
.chip.muted { border-color: var(--line-strong); color: var(--ink-soft); }
.chip.muted:hover { background: var(--line); color: var(--ink); }

.wizard-foot {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fcfaff;
}
.wizard-foot input[type="text"], .wizard-foot input[type="number"] {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: white;
  font-family: inherit;
}
.wizard-foot input:focus { border-color: var(--brand); }
.wizard-foot .step-info {
  font-size: 12px;
  color: var(--ink-soft);
  margin-left: auto;
}

/* Section */
.section {
  max-width: 1120px;
  margin: 32px auto;
  padding: 0 20px;
}
.section h2 {
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.section .lede {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 18px;
}

/* Profile summary */
.profile-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
@media (min-width: 720px) {
  .profile-card { grid-template-columns: 1.4fr 1fr; }
}
.profile-card .who {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.profile-card .who .avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
}
.profile-card .who .name { font-weight: 700; font-size: 16px; }
.profile-card .who .tag { font-size: 12px; color: var(--ink-soft); }
.profile-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.profile-card .meta b { color: var(--ink); font-weight: 600; }
.profile-card .stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.stat .label {
  font-size: 11.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.stat .value { font-size: 18px; font-weight: 700; color: var(--brand); margin-top: 2px; }

/* Week bar */
.week-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 14px;
  flex-wrap: wrap;
}
.day-chip {
  background: white;
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.day-chip:hover { border-color: var(--brand-light); }
.day-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: 0 6px 18px -8px rgba(101,76,142,0.5);
}
.day-chip .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
}
.day-chip.no-symptoms .dot { background: var(--accent-green); }
.day-chip.has-symptoms .dot { background: #c98; }

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px 6px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.toggle .switch {
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.toggle .switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on { color: var(--accent-green); border-color: var(--accent-green); }
.toggle.on .switch { background: var(--accent-green); }
.toggle.on .switch::after { transform: translateX(12px); }

/* Meal grid */
.day-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.day-summary .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e7f3e8;
  color: var(--accent-green);
}
.day-summary .pill.warn { background: #fff4e0; color: var(--accent-amber); }
.day-summary .pill strong { font-weight: 700; }

.meals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 700px) {
  .meals { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .meals { grid-template-columns: repeat(5, 1fr); }
}
.meal-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: border-color 0.15s ease, transform 0.05s ease;
}
.meal-card:hover { border-color: var(--brand-light); }
.meal-card .meal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
}
.meal-card .meal-head .icon { font-size: 16px; }
.meal-card .title { font-size: 15px; font-weight: 700; line-height: 1.25; color: var(--ink); }
.meal-card .prep { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.meal-card .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.meal-card .badge-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.meal-card .badge-tag.ok { background: #e7f3e8; color: var(--accent-green); border-color: #c8e0c9; }
.meal-card .badge-tag.warn { background: #fff4e0; color: var(--accent-amber); border-color: #f0d9a8; }
.meal-card .badge-tag.info { background: #e6eff7; color: var(--accent-blue-dark); border-color: #c2d4e6; }
.meal-card .portion { font-size: 12px; color: var(--ink-soft); }
.meal-card .portion b { color: var(--ink); }
.meal-card .link {
  margin-top: auto;
  font-size: 12.5px;
  color: var(--accent-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}
.meal-card .link:hover { text-decoration: underline; color: var(--accent-blue-dark); }
.meal-card.no-symptoms { border-color: #c8e0c9; }
.meal-card.no-symptoms::before {
  content: "Día sin síntomas";
  position: absolute;
  top: -10px;
  right: 12px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--accent-green);
  color: white;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

/* Shopping list */
.shopping {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-top: 18px;
}
.shopping-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.shopping-head h3 { margin: 0; font-size: 16px; }
.shopping-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 700px) {
  .shopping-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .shopping-grid { grid-template-columns: repeat(3, 1fr); }
}
.shopping-cat h4 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.shopping-cat ul { list-style: none; padding: 0; margin: 0; }
.shopping-cat li {
  font-size: 13.5px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.shopping-cat li:last-child { border-bottom: none; }
.shopping-cat input[type="checkbox"] {
  accent-color: var(--brand);
  width: 15px;
  height: 15px;
}
.shopping-cat .qty {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}
.shopping-actions { display: flex; gap: 8px; }

/* Footer */
.app-footer {
  margin-top: 60px;
  padding: 28px 20px;
  border-top: 1px solid var(--line);
  background: white;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}
.app-footer .proto { font-weight: 600; color: var(--brand); }
.app-footer .small { font-size: 11.5px; margin-top: 6px; color: #8a82a0; }

/* Tips banner */
.tip-banner {
  background: linear-gradient(90deg, rgba(60,118,61,0.08), rgba(60,118,61,0.02));
  border: 1px solid #c8e0c9;
  color: var(--accent-green);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.tip-banner.warn {
  background: linear-gradient(90deg, rgba(138,109,59,0.08), rgba(138,109,59,0.02));
  border-color: #f0d9a8;
  color: var(--accent-amber);
}
.tip-banner b { font-weight: 700; }

/* Hide utility */
.hidden { display: none !important; }

/* Small mobile tweaks */
@media (max-width: 480px) {
  .hero .inner { padding: 32px 16px 28px; }
  .section { padding: 0 16px; }
  .wizard { margin: 20px 12px; border-radius: 14px; }
  .app-header .inner { padding: 10px 14px; }
  .brand-lockup .sub { display: none; }
  .app-header .badge { display: none; }
  .meal-card { padding: 12px; }
}
