/* Meal plan pages: app-style layer. */
.mp-page {
    --mp-ink: #1b2a24;
    --mp-text: #4a5a53;
    --mp-muted: #6f7f78;
    --mp-line: #e2e8e4;
    --mp-line-strong: #d3dbd6;
    --mp-surface: #f6f8f7;
    --mp-green: #03875f;
    --mp-green-lip: #026447;
    --mp-bright: #12b886;
    --mp-sel-bg: #eafaf3;
    --mp-sel-border: #3fcf9b;
    --mp-sel-lip: #19b37f;
    --mp-sel-ink: #05603f;
    --mp-spring: cubic-bezier(.34, 1.56, .64, 1);
    -webkit-tap-highlight-color: transparent;
}
.mp-page :focus-visible { outline: 3px solid #7fdcb8; outline-offset: 3px; }

/* ---------- Buttons ---------- */
.mp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 48px;
    padding: 0 20px;
    border: 2px solid transparent;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: transform .1s ease, box-shadow .1s ease, filter .15s ease, background-color .15s ease;
}
.mp-btn i { font-size: 12px; }
.mp-btn:active { transform: translateY(4px); box-shadow: 0 0 0 transparent !important; }
.mp-btn-white { background: #fff; border-color: var(--mp-line); box-shadow: 0 4px 0 var(--mp-line); color: var(--mp-ink); }
@media (hover: hover) { .mp-btn-white:hover { background: var(--mp-surface); border-color: var(--mp-line-strong); box-shadow: 0 4px 0 var(--mp-line-strong); } }
.mp-btn-green { background: var(--mp-green); box-shadow: 0 4px 0 var(--mp-green-lip); color: #fff; }
.mp-btn-bright { background: #34d399; box-shadow: 0 4px 0 #0f9f6e; color: #04291f; }
@media (hover: hover) { .mp-btn-green:hover, .mp-btn-bright:hover { filter: brightness(1.07); } }
.mp-btn-block { width: 100%; }

/* ---------- Hero ---------- */
.mp-page .hero-cta {
    background: #34d399 !important;
    border-radius: 18px !important;
    box-shadow: 0 5px 0 #0f9f6e !important;
    transition: transform .1s ease, box-shadow .1s ease, filter .15s ease !important;
}
.mp-page .hero-cta:hover { transform: none !important; filter: brightness(1.06); }
.mp-page .hero-cta:active { transform: translateY(5px) !important; box-shadow: 0 0 0 #0f9f6e !important; }
.mp-hero-ghost {
    border-width: 2px !important;
    border-radius: 18px !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, .22);
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    transition: transform .1s ease, box-shadow .1s ease, background-color .15s ease !important;
}
.mp-hero-ghost:active { transform: translateY(4px) !important; box-shadow: none; }
.mp-stat {
    border-width: 2px !important;
    border-radius: 18px !important;
    box-shadow: 0 4px 0 rgba(0, 0, 0, .16);
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}
.mp-hero-art { position: relative; }
.mp-hero-art > .mp-hero-glowbox { display: none; }
.mp-hero-photo { border-width: 2px !important; box-shadow: 0 8px 0 rgba(0, 0, 0, .22) !important; }
.mp-hero-badge { border: 2px solid var(--mp-line) !important; box-shadow: 0 5px 0 var(--mp-line) !important; }
.mp-hero-pip {
    position: absolute;
    z-index: 2;
    top: -88px;          /* sits on the photo edge */
    right: 26px;
    width: 88px;
    animation: mmPopIn .6s var(--mp-spring) .2s backwards;
}
.mp-hero-pip .mm-mascot { width: 100%; }

/* ---------- Sticky section bar ---------- */
.mp-page .mp-sticky-bar {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 2px solid var(--mp-line);
}
.mp-page .mp-sticky-bar a, .mp-page .mp-sticky-bar button { border-radius: 12px; }

/* ---------- Cards ---------- */
.mp-card {
    border: 2px solid var(--mp-line) !important;
    border-radius: 22px !important;
    box-shadow: 0 5px 0 var(--mp-line) !important;
    transition: none !important;
}
.mp-card:hover { transform: none !important; }
.mp-card-green { border-color: #bdebd6 !important; box-shadow: 0 5px 0 #9fdfc3 !important; }
.mp-card-rose { border-color: #fbd0d8 !important; box-shadow: 0 5px 0 #f7b3c0 !important; }
.mp-card-amber { border-color: #fde2a6 !important; box-shadow: 0 5px 0 #f9cf6f !important; }
.mp-card-flat { box-shadow: none !important; }
.mp-page details.mp-card[open] { border-color: var(--mp-sel-border) !important; box-shadow: 0 5px 0 var(--mp-sel-lip) !important; background: #fbfefc; }

/* ---------- The 7 days ---------- */
.mp-plan-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; margin-bottom: 22px; }
.mp-plan-pip { flex: 0 0 auto; width: 70px; align-self: center; }
.mp-plan-pip .mm-mascot { width: 100%; }
@media (max-width: 639px) {
    .mp-plan-head { position: relative; padding-right: 64px; }
    .mp-plan-pip { position: absolute; top: -6px; right: 0; width: 56px; }
    .mp-plan-head .mp-btn { width: 100%; }
}

/* day tabs */
.mp-tabs {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}
.mp-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 9px 4px 8px;
    border: 2px solid var(--mp-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 0 var(--mp-line);
    color: var(--mp-muted);
    text-decoration: none;
    transition: transform .1s ease, box-shadow .1s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.mp-tab:active { transform: translateY(4px); box-shadow: none; }
@media (hover: hover) { .mp-tab:hover:not([aria-selected="true"]) { border-color: var(--mp-line-strong); color: var(--mp-ink); } }
.mp-tab-day { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.mp-tab-num { color: var(--mp-ink); font-size: 20px; font-weight: 800; line-height: 1.1; }
.mp-tab-kcal { font-size: 11px; font-weight: 700; }
.mp-tab[aria-selected="true"] {
    border-color: var(--mp-green);
    background: var(--mp-green);
    box-shadow: 0 4px 0 var(--mp-green-lip);
    color: #d4f5e7;
}
.mp-tab[aria-selected="true"] .mp-tab-num { color: #fff; }
@media (max-width: 639px) {
    .mp-tabs { display: flex; gap: 8px; margin: 0 -16px 16px; padding: 2px 16px 8px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; scrollbar-width: none; }
    .mp-tabs::-webkit-scrollbar { display: none; }
    .mp-tab { flex: 0 0 62px; scroll-snap-align: start; }
}

/* one day at a time once the script is running (all days print) */
.mp-tabs-on .mp-day-card:not(.is-active) { display: none; }
.mp-tabs-on .mp-day-card.is-active { animation: mpDayIn .32s ease; }
@keyframes mpDayIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mp-days { display: grid; gap: 22px; }

.mp-day-card {
    overflow: hidden;
    border: 2px solid var(--mp-line);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 5px 0 var(--mp-line);
}
.mp-day-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 18px;
    padding: 18px 22px;
    border-bottom: 2px solid var(--mp-line);
    background: var(--mp-sel-bg);
}
.mp-day-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mp-day-num {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--mp-green);
    box-shadow: 0 4px 0 var(--mp-green-lip);
    color: #fff;
    line-height: 1;
}
.mp-day-num span { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; opacity: .75; }
.mp-day-num b { margin-top: 2px; font-size: 22px; font-weight: 800; }
.mp-page .mp-day { margin: 0; color: var(--mp-ink); font-weight: 800; }
.mp-day-theme {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 5px;
    padding: 3px 9px;
    border-radius: 8px;
    background: #fff;
    color: var(--mp-sel-ink);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.mp-day-theme i { color: #f0a800; font-size: 9px; }
.mp-day-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mp-day-kcal { padding: 7px 12px; border-radius: 12px; background: var(--mp-ink); color: #cfd8d3; font-size: 12px; font-weight: 700; }
.mp-day-kcal b { color: #fff; font-size: 14px; font-weight: 800; }
.mp-day-macro { padding: 7px 10px; border: 2px solid transparent; border-radius: 12px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.mp-m-p, .mp-mc-p { background: #e3f7ee; color: #05603f; }
.mp-m-c, .mp-mc-c { background: #ffecef; color: #b4234a; }
.mp-m-f, .mp-mc-f { background: #fff4d6; color: #9a6300; }

.mp-meals { display: grid; gap: 12px; padding: 16px; background: var(--mp-surface); }
@media (min-width: 900px) { .mp-meals { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 18px; } }
.mp-meal-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    border: 2px solid var(--mp-line);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 4px 0 var(--mp-line);
}
.mp-meal-photo {
    position: relative;
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(135deg, #e7f7ef, #d3efe2);
}
.mp-meal-photo img { width: 100%; height: 100%; object-fit: cover; }
.mp-meal-icon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mp-bright); font-size: 28px; }
@media (min-width: 640px) { .mp-meal-photo { width: 112px; height: 112px; } }
.mp-meal-body { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.mp-meal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 5px; }
.mp-slot {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 8px;
    background: var(--mp-sel-bg);
    color: var(--mp-sel-ink);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.mp-slot i { font-size: 10px; }
.mp-time { display: inline-flex; align-items: center; gap: 5px; color: var(--mp-muted); font-size: 12px; font-weight: 700; }
.mp-time i { font-size: 11px; }
.mp-page .mp-meal { margin: 0 0 4px; color: var(--mp-ink); }
.mp-meal-desc { margin: 0 0 10px; color: var(--mp-text); font-size: 13px; line-height: 1.55; }
.mp-macros { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.mp-macros span { padding: 4px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 800; }
.mp-mc-kcal { background: var(--mp-ink); color: #fff; }
/* phones: photo + slot/name side by side, description and macros full width below */
@media (max-width: 639px) {
    .mp-meal-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 12px; padding: 12px; }
    .mp-meal-body { display: contents; }
    .mp-meal-photo { grid-row: 1 / span 2; width: 72px; height: 72px; border-radius: 14px; }
    .mp-meal-meta { grid-column: 2; align-self: end; margin-bottom: 3px; }
    .mp-page .mp-meal { grid-column: 2; align-self: start; }
    .mp-meal-desc { grid-column: 1 / -1; margin: 10px 0; }
    .mp-macros { grid-column: 1 / -1; }
    .mp-day-head { padding: 14px 16px; }
    .mp-day-macro, .mp-day-kcal { padding: 6px 9px; font-size: 11.5px; }
    .mp-meals { padding: 12px; }
    .mp-day-note { margin: 0 12px 12px; }
}

.mp-day-note {
    display: flex;
    gap: 12px;
    margin: 0 16px 16px;
    padding: 14px 16px;
    border: 2px solid #fde2a6;
    border-radius: 16px;
    background: #fffaeb;
}
.mp-day-note i { flex: 0 0 auto; margin-top: 3px; color: #f0a800; }
.mp-day-note p { margin: 0; color: var(--mp-text); font-size: 14px; line-height: 1.6; }
.mp-meals + .mp-day-note { margin-top: 0; }
.mp-day-nav { display: none; }
.mp-tabs-on .mp-day-nav { display: flex; justify-content: space-between; gap: 10px; padding: 0 16px 18px; }
.mp-day-nav .mp-btn { min-width: 0; }
@media (max-width: 479px) { .mp-day-nav .mp-btn { flex: 1 1 0; padding: 0 12px; font-size: 13px; } }

.mp-week {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
    padding: 20px 22px;
    border-radius: 22px;
    background: var(--mp-ink);
    box-shadow: 0 5px 0 #0b1511;
    color: #fff;
}
.mp-week-label { color: #9fb3aa; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.mp-week-value { margin-top: 3px; font-size: 16px; font-weight: 700; }
@media (max-width: 639px) { .mp-week .mp-btn { width: 100%; } }

/* ---------- Grocery ---------- */
.mp-tick-bar { height: 12px; margin: 0 0 22px; overflow: hidden; border-radius: 999px; background: var(--mp-line); }
.mp-tick-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--mp-bright); transition: width .35s var(--mp-spring); }
.mp-page .mp-grocery input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin-top: 0;
    border: 2px solid var(--mp-line-strong);
    border-radius: 7px;
    background: #fff center / 13px no-repeat;
    box-shadow: 0 2px 0 var(--mp-line);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, transform .25s var(--mp-spring);
}
.mp-page .mp-grocery input[type="checkbox"]:checked {
    border-color: var(--mp-bright);
    background-color: var(--mp-bright);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    box-shadow: 0 2px 0 #0f9f6e;
    transform: scale(1.06);
}
.mp-page .mp-grocery input[type="checkbox"]:focus { box-shadow: 0 0 0 3px rgba(18, 184, 134, .25); }
.mp-page .mp-grocery { align-items: center; padding: 6px 0; }

/* ---------- CTA band ---------- */
.mp-cta { position: relative; }
.mp-cta-pip { position: absolute; right: 44px; bottom: 0; width: 150px; pointer-events: none; }
.mp-cta-pip .mm-mascot { width: 100%; }
@media (max-width: 1023px) { .mp-cta-pip { display: none; } }

/* ---------- Hub (/meal-plans) ---------- */
.mp-hub-card {
    border: 2px solid var(--mp-line) !important;
    border-radius: 24px !important;
    box-shadow: 0 5px 0 var(--mp-line) !important;
    transition: transform .1s ease, box-shadow .1s ease, border-color .15s ease !important;
}
.mp-hub-card:hover { transform: none !important; border-color: var(--mp-sel-border) !important; box-shadow: 0 5px 0 var(--mp-sel-lip) !important; }
.mp-hub-card:active { transform: translateY(4px) !important; box-shadow: 0 1px 0 var(--mp-sel-lip) !important; }
.mp-hub-card img { transform: none !important; }
.mp-hub-go {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 2px solid var(--mp-line);
    border-radius: 14px;
    box-shadow: 0 3px 0 var(--mp-line);
    color: var(--mp-green);
    font-size: 14px;
    font-weight: 800;
}
.mp-hub-go i { font-size: 12px; }
.mp-hub-card:hover .mp-hub-go { border-color: var(--mp-green); background: var(--mp-green); box-shadow: 0 3px 0 var(--mp-green-lip); color: #fff; }
.mp-hub-pip { width: 84px; margin: 0 auto 10px; animation: mmPopIn .6s var(--mp-spring) .15s backwards; }
.mp-hub-pip .mm-mascot { width: 100%; }

@media (prefers-reduced-motion: reduce) {
    .mp-page *, .mp-page *::before, .mp-page *::after { animation: none !important; transition: none !important; }
}

/* Print ("Print the plan" and Ctrl+P) */
.mp-print-head { display: none; }
@media print {
    @page { margin: 14mm 12mm; }
    html, body { background: #fff !important; }
    body { padding-top: 0 !important; color: #111 !important; }
    body > *:not(main) { display: none !important; }
    .mp-page > *:not(#the-plan):not(#grocery):not(.mp-print-head):not(.mp-print-keep) { display: none !important; }
    html[data-print="grocery"] .mp-page > #the-plan,
    html[data-print="grocery"] .mp-page > .mp-print-keep { display: none !important; }
    .no-print, .mp-tabs, .mp-day-nav, .mp-plan-pip, .mp-meal-photo { display: none !important; }
    .mp-page section { padding: 0 !important; margin: 0 !important; background: #fff !important; border: 0 !important; }
    .mp-page .max-w-5xl, .mp-page .max-w-3xl { max-width: none !important; padding: 0 !important; }
    *, .mp-page .mp-card, .mp-page .mp-day-card, .mp-page .mp-meal-card { box-shadow: none !important; animation: none !important; }
    .mp-page { background: #fff !important; }

    .mp-print-head { display: block; margin-bottom: 6mm; padding-bottom: 3mm; border-bottom: 2px solid #111; }
    .mp-print-head strong { display: block; font-size: 20pt; line-height: 1.15; }
    .mp-print-head span { display: block; margin-top: 2mm; color: #444; font-size: 9.5pt; }

    .mp-plan-head { display: block; margin-bottom: 4mm; }
    .mp-plan-head .mp-lead { font-size: 9.5pt !important; color: #444 !important; }
    .mp-days { display: block; }
    .mp-day-card, .mp-tabs-on .mp-day-card:not(.is-active) {
        display: block !important;
        margin: 0 0 4mm;
        border: 1.5px solid #bbb;
        border-radius: 8px;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .mp-day-head { padding: 2mm 3.5mm; background: #f1f1f1 !important; border-bottom: 1.5px solid #bbb; }
    .mp-page .mp-day { font-size: 12pt !important; }
    .mp-day-theme { margin-top: 1mm; padding: 0 2mm; font-size: 7pt; }
    .mp-day-kcal, .mp-day-macro { padding: 1mm 2mm; font-size: 8pt; }
    .mp-day-kcal b { font-size: 9pt; }
    .mp-day-num { width: auto; height: auto; flex-direction: row; gap: 4px; padding: 1mm 3mm; background: #111 !important; color: #fff !important; }
    .mp-day-num span { font-size: 8pt; opacity: 1; }
    .mp-day-num b { margin: 0; font-size: 11pt; }
    .mp-day-kcal { background: #111 !important; }
    .mp-day-macro, .mp-day-theme { background: #fff !important; border: 1px solid #ccc !important; color: #222 !important; }
    .mp-meals { display: block; padding: 0 4mm; background: #fff !important; }
    .mp-meal-card { display: block; padding: 1.6mm 0; border: 0; border-bottom: 1px solid #ddd; border-radius: 0; }
    .mp-meal-card:last-child { border-bottom: 0; }
    .mp-meal-meta { margin-bottom: .5mm; }
    .mp-slot, .mp-time { font-size: 7.5pt; }
    .mp-slot { padding: 0; background: none !important; color: #111 !important; }
    .mp-page .mp-meal { margin-bottom: .5mm; font-size: 10pt !important; }
    .mp-meal-desc { margin-bottom: 1mm; font-size: 8.5pt; line-height: 1.4; color: #333; }
    .mp-macros span { padding: 0 2mm 0 0; background: none !important; color: #111 !important; font-size: 8pt; }
    .mp-day-note { margin: 0 3.5mm 2.5mm; padding: 1.5mm 2.5mm; background: #fff !important; border: 1px solid #ccc; }
    .mp-day-note p { font-size: 8.5pt; line-height: 1.4; }
    .mp-week { margin: 0 0 8mm; padding: 3mm 4mm; background: #fff !important; border: 1.5px solid #bbb; color: #111; }
    .mp-week-label { color: #444; }

    #grocery { break-before: page; page-break-before: always; }
    html[data-print="grocery"] #grocery { break-before: auto; page-break-before: auto; }
    #grocery .mp-lead { font-size: 9.5pt !important; color: #444 !important; }
    .mp-tick-bar { display: none !important; }
    #mp-grocery { display: block !important; columns: 2; column-gap: 8mm; }
    .mp-aisle { break-inside: avoid; page-break-inside: avoid; margin: 0 0 5mm; padding: 0 !important; border: 0 !important; background: #fff !important; }
    .mp-aisle > div:first-child { margin-bottom: 1mm !important; padding-bottom: 1mm !important; border-bottom: 1.5px solid #111 !important; }
    .mp-aisle ul > li + li { margin-top: 0 !important; }
    .mp-aisle > div:first-child > span:first-child { display: none !important; }
    .mp-page .mp-grocery { gap: 2mm; padding: .2mm 0; }
    #grocery .mp-h2 { font-size: 15pt !important; }
    #grocery > div > div:first-child { margin-bottom: 1mm !important; }
    .mp-page .mp-grocery input[type="checkbox"] { width: 11px; height: 11px; border: 1.5px solid #333 !important; border-radius: 2px; background: #fff !important; }
    .mp-page .mp-grocery input[type="checkbox"]:checked { background: #fff !important; }
    .mp-grocery span { font-size: 9pt; line-height: 1.3; color: #111 !important; text-decoration: none !important; }

    .mp-print-keep { break-inside: avoid; margin-top: 6mm !important; }
    .mp-print-keep div { background: #fff !important; border: 1px solid #ccc !important; }
    a { color: #111 !important; text-decoration: none !important; }
}
