:root {
    --ink: #243d32;
    --muted: #6b766e;
    --green: #244d3d;
    --cream: #f8f7f2;
    --line: #e0e5dc;
    --accent: #d9ebaf;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: system-ui, -apple-system, sans-serif; font-size: 15px; }
h1, h2, h3, .brand { color: var(--ink); }
h1 { font-family: Georgia, serif; font-size: clamp(36px, 4.4vw, 58px); line-height: 1.08; letter-spacing: -1.7px; margin: 16px 0; }
h2 { font-size: 25px; font-weight: 650; letter-spacing: -.6px; margin: 8px 0; }
h3 { font-size: 19px; font-weight: 650; margin: 8px 0; }
p { line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button { min-height: 44px; border-radius: 9px; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; }
input:not([type=checkbox]), select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #cbd4c7; border-radius: 8px; background: white; color: var(--ink); min-height: 44px; }
input[type=checkbox] { accent-color: var(--green); width: 20px; height: 20px; flex-shrink: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, summary:focus-visible { outline: 3px solid #b3cc98; outline-offset: 2px; }
label { display: block; font-size: 13px; font-weight: 600; }
label input, label select, label textarea { margin-top: 6px; }
label.check-label { display: flex; gap: 9px; align-items: center; font-weight: 500; }
.check-label input { margin: 0; }
.primary { background: var(--green); color: white; padding: 12px 20px; font-weight: 600; }
.primary:hover { background: #35614e !important; color: white !important; }
.outline { background: white; color: var(--ink); border: 1px solid #ced8c9; }
.subtle { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.full { width: 100%; }
.eyebrow { font-size: 10px; font-weight: 750; letter-spacing: 1.8px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 19px max(5%, calc((100vw - 1180px) / 2)); background: #fffefa; border-bottom: 1px solid var(--line); }
.brand { font-size: 23px; font-weight: 800; text-decoration: none; letter-spacing: -.7px; white-space: nowrap; }
.shell { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.hero { display: flex; align-items: center; justify-content: space-between; padding: 44px 0 30px; gap: 24px; }
.hero p { color: var(--muted); }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; padding: 15px 0; color: var(--muted); }
.tabs button.active { border-color: var(--green); color: var(--green); font-weight: 700; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 24px 0; }
.section-heading p { margin: 4px 0; }
.filters { display: flex; flex-direction: column; gap: 9px; min-width: 235px; }
.recipe-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.recipe-card { background: white; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.recipe-photo { position: relative; height: 195px; display: grid; place-items: center; background: radial-gradient(circle at 60% 40%, #f0e7d7, #e1e8d9); }
.recipe-photo > span:first-child:not(.category-pill) { font-size: 70px; }
.recipe-photo img { width: 100%; height: 100%; object-fit: cover; }
.category-pill { position: absolute; left: 14px; bottom: 12px; background: #fffffff0; padding: 4px 11px; border-radius: 20px; font-size: 11px; }
.favorite { position: absolute; right: 12px; top: 12px; border-radius: 50%; background: white; padding: 5px 11px; color: #8a682a; font-size: 19px; }
.recipe-content { padding: 19px; }
.recipe-content h3 { margin-top: 0; overflow-wrap: anywhere; }
.recipe-content p { font-size: 13px; margin: 7px 0; }
.recipe-cost { font-size: 13px; font-weight: 650; margin: 15px 0; }
.card-actions { display: flex; justify-content: space-between; gap: 6px; }
.empty { grid-column: 1 / -1; text-align: center; padding: 55px 20px; border: 1px dashed #bfcbb9; border-radius: 16px; background: #f0f3e9; }
.empty > span { font-size: 50px; }
.empty p { max-width: 400px; margin: 10px auto; color: var(--muted); }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 23px; }
.weekbar { display: flex; gap: 15px; align-items: center; }
.weekbar label { display: flex; gap: 12px; align-items: center; }
.weekbar input { margin: 0; width: auto; }
.generation { display: flex; align-items: end; gap: 18px; flex-wrap: wrap; }
.generation > label { max-width: 170px; }
fieldset { border: none; margin: 0; padding: 0; display: flex; gap: 12px; }
fieldset legend { font-size: 13px; margin-bottom: 10px; }
fieldset label { display: flex; align-items: center; gap: 4px; }
.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 25px; }
.day-card { background: white; border: 1px solid var(--line); border-radius: 13px; padding: 15px; }
.day-card h3 { font-size: 15px; text-transform: capitalize; margin-bottom: 18px; }
.meal-slot { width: 100%; text-align: left; background: transparent; border: 1px dashed #ccd5c7; padding: 12px; margin: 5px 0; display: flex; flex-direction: column; gap: 8px; min-height: 100px; }
.meal-slot.filled { border: 1px solid #dce4d3; background: #f1f5e9; }
.meal-slot strong { font-size: 13px; overflow-wrap: anywhere; }
.meal-slot small { color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat { padding: 22px; border-radius: 14px; background: #eaf0df; display: flex; flex-direction: column; gap: 9px; }
.stat span { font-size: 13px; }
.stat strong { font-size: 30px; letter-spacing: -1px; }
.stat small { font-size: 11px; }
.stat.over-budget { background: #fae2d8; color: #863e29; }
.budget-form { display: flex; gap: 16px; align-items: end; margin-top: 18px; }
.aisle-heading { margin-top: 30px; }
.shopping-item { background: white; padding: 20px; border: 1px solid var(--line); margin: 10px 0; border-radius: 12px; }
.shopping-item.done { border-left: 5px solid #84a670; }
.shopping-item p { font-size: 13px; }
.item-heading { display: flex; gap: 20px; justify-content: space-between; align-items: start; }
.item-heading label { font-size: 17px; text-transform: capitalize; }
.item-heading > strong { white-space: nowrap; }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline-form label { max-width: 210px; flex: 1; min-width: 130px; }
details { margin-top: 17px; border-top: 1px solid var(--line); padding-top: 15px; }
summary { font-size: 13px; padding: 8px 0; }
details form { margin-top: 12px; }
dialog { border: 0; border-radius: 18px; padding: 26px; max-width: 760px; width: calc(100% - 30px); max-height: 92dvh; color: var(--ink); }
dialog::backdrop { background: #132a22aa; backdrop-filter: blur(3px); }
dialog form > label { margin: 18px 0; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.close-dialog { background: #f0f2eb; border: 0; font-size: 26px; min-width: 44px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.ingredient-row { position: relative; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; padding: 15px 42px 15px 15px; background: #f4f5ef; border-radius: 10px; margin: 10px 0; }
.ingredient-aisle { grid-column: 1 / -1; }
.remove-ingredient { position: absolute; right: 0; top: 10px; background: transparent; border: 0; font-size: 22px; width: 40px; }
#notice { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 30px); padding: 15px 22px; color: white; background: var(--green); border-radius: 10px; box-shadow: 0 5px 25px #0002; z-index: 100; }
#notice.error { background: #883e2c; }
/* Sitúa los avisos sobre los diálogos nativos sin moverlos fuera del flujo de accesibilidad. */
body:has(dialog[open]) #notice { z-index: 9999; }
footer { font-size: 12px; color: var(--muted); padding: 40px 0 24px; text-align: center; }
.login-wrap { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 8%; max-width: 1100px; padding: 40px; margin: auto; }
.login-story p { max-width: 350px; color: var(--muted); }
.login-form { padding: 36px; }
.login-form label { margin: 22px 0; }
.login-form button { width: 100%; }
.login-form h2 { margin-top: 30px; }
.plate { display: grid; place-items: center; border: 16px solid #e5e9db; background: #f0f2e6; border-radius: 50%; width: 190px; height: 190px; font-size: 85px; margin: 25px 0; }
@media (max-width: 900px) {
    .recipe-grid { grid-template-columns: repeat(2, 1fr); }
    .plan-grid { grid-template-columns: repeat(2, 1fr); }
    .summary-grid { gap: 9px; }
    .stat { padding: 16px; }
    .stat strong { font-size: 24px; }
}
@media (max-width: 600px) {
    body { font-size: 14px; }
    input:not([type=checkbox]), select, textarea { font-size: 16px; }
    .shell { padding: 0 16px; }
    .hide-small { display: none; }
    .topbar { padding: 12px 16px; }
    .hero { padding: 29px 0 24px; flex-direction: column; align-items: start; gap: 10px; }
    .hero h1 { font-size: 40px; }
    .hero .primary { width: 100%; }
    .tabs { gap: 14px; margin-bottom: 20px; }
    .tabs button { font-size: 12px; flex: 1; padding: 12px 0; }
    .section-heading { align-items: stretch; flex-direction: column; gap: 10px; }
    .recipe-grid { grid-template-columns: 1fr; gap: 18px; }
    .recipe-photo { height: 210px; }
    .recipe-content { padding: 17px; }
    .plan-grid { grid-template-columns: 1fr; }
    .day-card { padding: 15px; }
    .meal-slot { min-height: 75px; }
    .summary-grid { grid-template-columns: 1fr; }
    .stat strong { font-size: 30px; }
    .generation { padding: 16px; gap: 14px; }
    .generation > label { flex: 1; }
    .generation fieldset { flex-wrap: wrap; }
    .generation .primary { width: 100%; }
    .budget-form { flex-direction: column; align-items: stretch; padding: 16px; }
    .weekbar { gap: 8px; justify-content: space-between; }
    .weekbar label { font-size: 11px; gap: 5px; }
    .weekbar input { max-width: 155px; padding: 8px 4px; }
    .shopping-item { padding: 15px; }
    .item-heading { gap: 10px; }
    .item-heading label { font-size: 15px; }
    .item-heading > strong { font-size: 13px; }
    dialog { padding: 17px; width: calc(100% - 16px); }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid label:first-child { grid-column: 1 / -1; }
    .ingredient-row { grid-template-columns: 1fr 1fr; }
    .ingredient-name { grid-column: 1 / -1; }
    .login-wrap { display: block; padding: 26px 18px; }
    .login-story h1 { font-size: 37px; }
    .login-story .plate { display: none; }
    .login-form { padding: 23px; margin-top: 30px; }
}
@media print {
    body { background: white; color: black; }
    .topbar, .hero, .tabs, footer, #notice, #recipes-view, #week-view, #print-list, .budget-form, .stock-form, details, .weekbar button { display: none !important; }
    #shopping-view, #weekbar { display: block !important; }
    .shell { max-width: none; }
    .shopping-item { break-inside: avoid; padding: 10px; }
    .summary-grid { grid-template-columns: repeat(3, 1fr); }
}
