@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/app/fonts/plus-jakarta-sans-latin.woff2) format("woff2"); }
:root {
  --bg: #f7f4ee; --card: #ffffff; --ink: #1c2420; --muted: #6b746e; --line: #ebe6dc; --soft: #f1ede5;
  --accent: #17855a; --accent-2: #0f6b47; --accent-soft: #e2f3ea; --on-accent: #ffffff;
  --warn: #c9521f; --warn-soft: #fdeae0; --sun: #f5b83d;
  --radius: 20px; --shadow: 0 1px 2px rgba(28,36,32,.05), 0 6px 20px rgba(28,36,32,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101412; --card: #1a1f1c; --ink: #eef2ef; --muted: #9ba59f; --line: #2a312d; --soft: #222925;
    --accent: #3fbf84; --accent-2: #2fa06c; --accent-soft: #1b3428; --on-accent: #08130d;
    --warn: #f08a5d; --warn-soft: #3a2419; --sun: #f5c25a; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; }

/* Cabecera y pestañas */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; min-width: 0; }
.brand b { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) { .brand { font-size: 15px; gap: 6px; } .brand img { width: 26px; height: 26px; } .top .pill { font-size: 11px; } }
.brand img { border-radius: 9px; }
.pill { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 5px 10px; border-radius: 99px; white-space: nowrap; }
.pill:empty { display: none; }
main { max-width: 600px; margin: 0 auto; padding: 4px 16px 24px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tabs button { background: none; border: 0; color: var(--muted); font-size: 11.5px; min-width: 0; font-weight: 600; padding: 4px 0; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; }
.tabs button span { font-size: 21px; filter: grayscale(1); opacity: .7; transition: .15s; }
.tabs button.on { color: var(--accent); }
.tabs button.on span { filter: none; opacity: 1; transform: translateY(-1px); }

/* Tipografía y bloques */
h1, h2, h3 { letter-spacing: -.02em; margin: 0; }
.hero { padding: 10px 2px 16px; }
.hero h1 { font-size: 27px; font-weight: 800; line-height: 1.15; }
.hero p { margin: 6px 0 0; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 12px; }
.card-h .ico { font-size: 18px; }
.card-h .right { margin-left: auto; display: flex; gap: 6px; }
.sub { font-weight: 600; font-size: 14px; margin: 16px 0 8px; }
.sub:first-of-type { margin-top: 0; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 0 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px 6px; cursor: pointer; border-radius: 8px; }
.link:active { background: var(--accent-soft); }

/* Días */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days button { aspect-ratio: 1; max-width: 46px; width: 100%; justify-self: center; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--card); font-weight: 700; cursor: pointer; transition: .12s; }
.days button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Comidas */
.meals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meal { position: relative; text-align: left; border: 1.5px solid var(--line); background: var(--card); border-radius: 16px; padding: 12px; cursor: pointer; transition: .12s; }
.meal .e { font-size: 24px; display: block; margin-bottom: 4px; }
.meal b { display: block; }
.meal small { color: var(--muted); font-size: 12px; }
.meal.on { border-color: var(--accent); background: var(--accent-soft); }
.meal.on::after { content: "✓"; position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 800; display: grid; place-items: center; }

/* Personas */
.stepper { display: flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 99px; padding: 4px; }
.stepper button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--card); font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); }
.stepper b { min-width: 34px; text-align: center; font-size: 18px; }

/* Presupuesto */
.money { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin: 2px 0 14px; }
.money small { font-size: 22px; font-weight: 700; color: var(--muted); margin-left: 4px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: 99px; outline: none; margin: 8px 0 4px;
  background: linear-gradient(to right, var(--accent) 0 var(--p, 50%), var(--soft) var(--p, 50%) 100%); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: var(--card);
  border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.18); cursor: grab; }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); cursor: grab; }
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.feas { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 11px 12px; margin-top: 14px; font-size: 14px; }
.feas .i { font-size: 18px; line-height: 1.2; }
.feas.ok { background: var(--accent-soft); color: var(--ink); }
.feas.ko { background: var(--warn-soft); color: var(--ink); }
.feas.wait { background: var(--soft); color: var(--muted); }
.feas b { font-weight: 700; }
.feas .acts { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Botones */
.btn { border: 0; border-radius: 16px; padding: 15px 18px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 16px;
  cursor: pointer; width: 100%; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .1s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; box-shadow: none; }
.btn.ghost { background: var(--card); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn.sm { width: auto; padding: 8px 12px; font-size: 13px; border-radius: 12px; box-shadow: none; }
.btn.sm.ghost { box-shadow: inset 0 0 0 1.5px currentColor; }
.cta { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); padding-top: 8px; background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.cta p { text-align: center; margin: 8px 0 0; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 14px; padding: 8px 13px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; transition: .12s; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.chip.no.on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; list-style: none; }
details summary::-webkit-details-marker { display: none; }

/* Resumen del menú */
.summary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.summary .money { color: #fff; margin: 4px 0 4px; }
.summary .money small { color: rgba(255,255,255,.75); }
.summary .meta { font-size: 14px; opacity: .9; }
.summary .bar { background: rgba(255,255,255,.25); }
.summary .bar > i { background: #fff; }
.summary.over { background: linear-gradient(135deg, #d4652f, #b0441a); }
.bar { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-top: 12px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tags span { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 99px; background: rgba(255,255,255,.18); }

/* Días del menú */
.day-card { padding: 6px 14px; }
.day-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; padding: 10px 0 4px; }
.day-card h3 .kcal-day { float: right; text-transform: none; letter-spacing: 0; font-weight: 600; }
.dish { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.dish:first-of-type { border-top: 0; }
.dish .emo { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 25px; background: var(--soft); }
.dish .kind { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.dish .name { font-weight: 700; line-height: 1.25; }
.dish .info { font-size: 13px; color: var(--muted); }
.icon-btn { border: 0; background: var(--soft); border-radius: 12px; width: 38px; height: 38px; font-size: 17px; flex: none; cursor: pointer; }
.icon-btn:active { transform: rotate(-90deg); transition: .2s; }

/* Lista */
.item { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.item:first-child { border-top: 0; }
.item input { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; margin: 0; display: grid; place-items: center; cursor: pointer; }
.item input:checked { background: var(--accent); border-color: var(--accent); }
.item input:checked::after { content: "✓"; color: var(--on-accent); font-size: 13px; font-weight: 800; }
.item.done .pname { text-decoration: line-through; color: var(--muted); }
.pname { font-weight: 600; line-height: 1.3; }
.price { font-weight: 800; white-space: nowrap; }

/* Hoja de receta */
dialog { border: 0; border-radius: 24px 24px 0 0; padding: 0; width: 100%; max-width: 600px; margin: auto auto 0; max-height: 90vh;
  background: var(--card); color: var(--ink); }
dialog[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
dialog::backdrop { background: rgba(0,0,0,.45); }
#sheet-body { padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.big-emo { font-size: 46px; line-height: 1; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.meta-chips span { font-size: 13px; padding: 5px 10px; border-radius: 99px; background: var(--soft); }
.ing { list-style: none; padding: 0; margin: 0; }
.ing li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.ing li:first-child { border-top: 0; }
ol.steps { padding-left: 0; list-style: none; counter-reset: s; margin: 0; }
ol.steps li { counter-increment: s; display: flex; gap: 12px; margin-bottom: 12px; }
ol.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px; display: grid; place-items: center; }

.notice { background: var(--warn-soft); border-radius: 16px; padding: 14px; margin-bottom: 12px; font-size: 14px; }
.notice b { color: var(--warn); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big-emo { margin-bottom: 12px; }
a { color: var(--accent); }

/* Secciones plegables */
details.fold { padding: 0; }
details.fold summary { display: flex; align-items: center; gap: 10px; padding: 16px; list-style: none; cursor: pointer; color: var(--ink); }
details.fold summary .ico { font-size: 18px; }
details.fold summary b { display: block; }
details.fold summary small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.fold .chev { font-size: 22px; color: var(--muted); transition: transform .15s; }
details.fold[open] .chev { transform: rotate(90deg); }
.fold-body { padding: 0 16px 16px; }

/* Selector de forma de cocinar */
.seg { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.seg button { flex: 1 0 auto; border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; text-align: center; }
.seg button small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.search { flex: 1; min-width: 0; font: inherit; padding: 11px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--soft); color: var(--ink); outline: none; }
.search:focus { border-color: var(--accent); background: var(--card); }
#qlist .dish:first-child { border-top: 0; }
dialog { overflow-y: auto; }

.guide-row { display: flex; flex-wrap: wrap; gap: 8px; }
.guide-row span { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 8px 10px; border-radius: 14px; background: var(--soft); font-size: 12px; color: var(--muted); }
.guide-row b { font-size: 16px; color: var(--ink); }
.legal-note { font-size: 12.5px; color: var(--muted); background: var(--soft); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.legal-note b { color: var(--ink); }
.foot-links { text-align: center; font-size: 12.5px; color: var(--muted); margin: 18px 0 8px; }
.foot-links a { color: inherit; }
.acct-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 4px 0; }
.acct-consent input { margin-top: 3px; flex: none; }
.acct-consent a { color: var(--accent-2); }
.notice .acts { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.notice.protein { background: var(--soft); border: 1px solid var(--warn-soft); }
.protein-hint { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.protein-hint .acts { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Cifra del presupuesto editable */
.money-in { display: flex; align-items: baseline; gap: 2px; cursor: text; }
.money-in input { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; border-bottom: 2px dashed var(--line);
  padding: 0; width: 3.4ch; min-width: 1.4ch; outline: none; -moz-appearance: textfield; appearance: textfield; }
.money-in input:focus { border-bottom-color: var(--accent); }
.money-in input::-webkit-outer-spin-button, .money-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.money-in .pen { font-size: 18px; color: var(--muted); margin-left: 6px; }

/* PDF: solo se imprime la hoja limpia */
#print { display: none; }
@media print {
  @page { margin: 14mm; }
  :root { color-scheme: light; }
  html, body { background: #fff !important; color: #111 !important; padding: 0 !important; font-size: 12pt; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; }
  #print header { border-bottom: 2px solid #17855a; margin-bottom: 10px; }
  #print h1 { font-size: 20pt; margin: 0 0 2px; color: #17855a; }
  #print header p { margin: 0 0 8px; color: #555; }
  #print h2 { font-size: 14pt; margin: 14px 0 6px; }
  #print h3 { font-size: 11pt; margin: 12px 0 4px; }
  #print table { width: 100%; border-collapse: collapse; }
  #print td, #print th { padding: 5px 6px; border-bottom: 1px solid #ddd; vertical-align: top; text-align: left; }
  #print tr { break-inside: avoid; }
  #print .p-menu th { width: 24%; }
  #print .p-menu span { color: #666; }
  #print .p-list small { display: block; color: #666; font-size: 9.5pt; }
  #print .box { width: 18px; font-size: 13pt; }
  #print .num { text-align: right; white-space: nowrap; }
  #print .tot td { font-weight: 700; border-bottom: 0; }
  #print .p-basic { color: #444; margin: 0; }
  #print footer { margin-top: 16px; font-size: 9pt; color: #888; }
}

/* Cuenta */
.top-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acct-btn { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 17px;
  display: grid; place-items: center; cursor: pointer; padding: 0; filter: grayscale(1); opacity: .8; }
.acct-btn.in { filter: none; opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.acct-form { display: grid; gap: 10px; margin-top: 12px; }
.acct-form .search { width: 100%; }
.acct-mail { font-weight: 700; margin: 14px 0 4px; word-break: break-all; }
.acct-msg { margin: 4px 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 600; }
.acct-msg.ok { background: var(--accent-soft); color: var(--accent); }
.btn.link { background: none; border: 0; box-shadow: none; color: var(--muted); font-size: 14px; text-decoration: underline; }
.btn.link.danger { color: var(--warn); }

/* Favoritos y recetas propias */
.icon-btn.fav { color: var(--muted); font-size: 19px; }
.icon-btn.fav.on { color: #e0465e; background: #fde7ea; }
@media (prefers-color-scheme: dark) { .icon-btn.fav.on { background: #3a1d23; color: #ff7489; } }
.rform { display: grid; gap: 10px; margin-top: 12px; }
.rform label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.rform .search { width: 100%; }
.rform textarea { font: inherit; resize: vertical; min-height: 110px; }
.rform .sub { margin-top: 4px; }
.ing-row { display: flex; align-items: center; gap: 8px; }
.ing-row .search { width: 86px; flex: none; text-align: right; }
.ing-row .muted { width: 26px; font-size: 13px; }
