/* Menu, recipes and shopping list (on top of app.css) */
.tabbar a svg { margin-bottom: 1px; }
.cal-head h1 { text-transform: none; font-size: 1.1rem; text-align: center; flex: 1; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }
details.card > summary { margin: -2px 0; }
details[open].card > summary { margin-bottom: 10px; }

/* Week */
.day { padding: 10px 12px; }
.day.is-today { border-color: var(--accent); }
.day-title { margin: 2px 4px 6px; font-size: 1rem; }
.meal-row { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); }
.meal-row:first-of-type { border-top: 0; }
a.meal-row, .meal-link { display: flex; align-items: center; gap: 10px; padding: 10px 4px; color: var(--text); flex: 1; min-width: 0; }
.meal-label { flex: none; width: 72px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.meal-row.breakfast .meal-label { color: var(--warn); }
.meal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.meal-body .starter { font-size: .85rem; color: var(--muted); }
.meal-body .dish { font-weight: 650; }
.meal-body .meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: .82rem; color: var(--muted); }
.meal-row .chev { color: var(--muted); }
.quick { flex: none; }
.pdot { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
        color: #fff; font-size: .7rem; font-weight: 800; flex: none; vertical-align: middle; }

.grid-table { width: 100%; margin: 6px 0; }
.grid-table th, .grid-table td { text-align: center; padding: 4px 2px; border: 0; }
.grid-table th:first-child { text-align: left; font-size: .8rem; }
.grid-table.selects select { min-height: 38px; padding: 4px 6px; font-size: .85rem; }
.tick input { position: absolute; opacity: 0; }
.tick span { display: inline-block; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--border); cursor: pointer; }
.tick input:checked + span { background: var(--accent); border-color: var(--accent); }
.tick input:disabled + span { opacity: .3; }
.tick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.guidelines td { padding: 6px 4px; }
.guidelines tr.bajo td:first-child, .guidelines tr.alto td:first-child { font-weight: 650; }

/* Recipe */
.recipe-title { font-size: 1.3rem; margin-bottom: 6px; }
.recipe-title a { color: var(--text); }
.ingredients { padding-left: 0; list-style: none; margin: 6px 0 10px; }
.ingredients li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients .qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.steps { padding-left: 1.3em; margin: 8px 0; }
.steps li { margin-bottom: 8px; }
.portions { list-style: none; padding: 0; margin: 6px 0; }
.portions li { padding: 6px 0; display: block; }
.fav { color: #e0a800; }
.cat { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pick-row { display: flex; align-items: center; gap: 10px; }
.pick-row .name { font-weight: 650; color: var(--text); display: block; margin-bottom: 2px; }

.portion-table th, .portion-table td { border: 0; padding: 4px; vertical-align: middle; }
.portion-table th { font-size: .85rem; color: var(--text); }
.portion-table input { min-height: 40px; padding: 6px 8px; }

/* Shopping */
.shop-bar { position: sticky; top: calc(53px + env(safe-area-inset-top)); z-index: 10; padding: 10px 14px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 8px; }
.progress span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .25s; }
.shop-section h2 { margin: 0 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.shop-section.all-done h2::after { content: " ✓"; color: var(--ok); }
.shop { list-style: none; padding: 0; margin: 0; }
.shop-item { display: flex; align-items: center; border-top: 1px solid var(--border); }
.shop-item:first-child { border-top: 0; }
.shop-toggle { flex: 1; display: flex; gap: 12px; align-items: flex-start; background: none; border: 0; padding: 11px 0;
               text-align: left; font: inherit; color: var(--text); cursor: pointer; min-width: 0; }
.shop-toggle .box { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border);
                    display: inline-flex; align-items: center; justify-content: center; color: transparent; margin-top: -1px; }
.shop-item.checked .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.shop-text { min-width: 0; }
.shop-name { font-weight: 600; }
.shop-amount { color: var(--accent); font-weight: 700; white-space: nowrap; }
.shop-detail { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
.shop-item.checked .shop-name, .shop-item.checked .shop-amount { text-decoration: line-through; color: var(--muted); }
.hide-checked .shop-item.checked { display: none; }
.hide-checked .shop-section.all-done { display: none; }

/* Llar in the top bar */
.llar-chip { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 4px 10px; border-radius: 999px;
             background: var(--accent-soft); color: var(--accent); font-size: .8rem; font-weight: 700; max-width: 45vw;
             overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.llar-switch select { min-height: 32px; padding: 2px 8px; font-size: .8rem; font-weight: 700; border-radius: 999px;
                      background: var(--accent-soft); color: var(--accent); border: 0; max-width: 45vw; margin-left: 6px; }
.invite-code { font: 800 1.6rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; text-align: center;
               padding: 10px; margin: 6px 0 10px; border-radius: 12px; background: var(--surface-2); }
.members { list-style: none; padding: 0; margin: 0; }
.members li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.members li:first-child { border-top: 0; }
.llar-row { padding: 6px 0; border-top: 1px solid var(--border); }
.llar-row:first-of-type { border-top: 0; }
.guests { list-style: none; padding: 0; margin: 6px 0; }
.guests li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.ing-row { display: grid; grid-template-columns: 70px 80px 1fr 36px; gap: 6px; margin-bottom: 6px; align-items: center; }
.ing-row input, .ing-row select { min-height: 40px; padding: 6px 8px; font-size: .9rem; }
.ing-row .ing-more { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* Five tabs */
.tabbar .wrap { grid-template-columns: repeat(5, 1fr); }

/* Photos */
.thumb { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-2); }
.thumb.sm { width: 44px; height: 44px; border-radius: 10px; }
.no-photo { display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.hero-photo { display: block; width: calc(100% + 32px); max-width: none; height: 190px; object-fit: cover;
              margin: -14px -16px 12px; border-radius: var(--radius) var(--radius) 0 0; }
.hero-photo.no-photo { height: 110px; font-size: 3rem; background: var(--surface-2); }
.meal-row .thumb { width: 46px; height: 46px; }

/* Today */
.today-date { font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.today-meal { display: flex; gap: 12px; align-items: flex-start; color: var(--text); }
.today-meal .thumb { width: 72px; height: 72px; }
.today-meal .portion { font-size: .88rem; margin-top: 4px; }
.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.todo li:first-child { border-top: 0; }
.todo .when { flex: none; font-size: .72rem; font-weight: 800; text-transform: uppercase; color: var(--warn);
              background: var(--warn-soft); padding: 2px 8px; border-radius: 999px; margin-top: 2px; }
.badge.ahead { background: var(--warn-soft); color: var(--warn); }
.badge.frozen { background: var(--measure-soft); color: var(--measure); }

/* Week: table view and moving dishes */
.week-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.seg a { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.seg a.on { background: var(--accent); color: var(--accent-ink); }
.week-table { overflow-x: auto; }
.week-table table { min-width: 520px; }
.week-table td { vertical-align: top; font-size: .85rem; }
.week-table td a { color: var(--text); display: block; }
.week-table .st { color: var(--muted); font-size: .78rem; display: block; }
.week-table tr.is-today td, .week-table tr.is-today th { background: var(--accent-soft); }
.moving .meal-row[data-slot] { cursor: pointer; }
.moving .meal-row[data-slot] .meal-link { pointer-events: none; }
.meal-row.picked { outline: 2px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.meal-row.drop-over { background: var(--accent-soft); }
.move-hint { position: sticky; top: calc(53px + env(safe-area-inset-top)); z-index: 9; }

/* Cooking mode */
body.cook { padding-bottom: 0; }
.cook-wrap { min-height: 100dvh; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 0 max(12px, env(safe-area-inset-bottom)); }
.cook-top { display: flex; align-items: center; gap: 8px; }
.cook-top h1 { font-size: 1rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook-step { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 16px 4px; }
.cook-step .num { font-size: .85rem; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.cook-step p { font-size: clamp(1.35rem, 5.2vw, 2rem); line-height: 1.35; margin: 10px 0 0; }
.cook-timers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cook-timer { font-variant-numeric: tabular-nums; }
.cook-timer.running { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cook-timer.done { background: var(--danger); color: #fff; border-color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.cook-nav { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.cook-nav .btn { min-height: 58px; font-size: 1.05rem; }
.cook-progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 10px 0 0; }
.cook-progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.cook-ings { list-style: none; padding: 0; margin: 0; font-size: 1.1rem; }
.cook-ings li { padding: 8px 0; border-bottom: 1px solid var(--border); }

/* Shopping: always at home */
.shop-item .staple-btn { flex: none; color: var(--muted); }
.import-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }
.ocr-status { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* --- UX pass ------------------------------------------------------------ */
.empty-art { font-size: 2.6rem; line-height: 1; margin-bottom: 6px; }
.busy { opacity: .55; pointer-events: none; }

/* Pop-up menus */
.pop-menu { position: relative; }
.pop-menu > summary { list-style: none; }
.pop-menu > summary::before { content: none; }
.pop-menu .pop { position: absolute; z-index: 25; top: calc(100% + 6px); left: 0; min-width: 230px;
                 background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px;
                 box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.pop-menu.right .pop { left: auto; right: 0; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 10px;
            border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-weight: 600;
            text-align: left; cursor: pointer; }
.pop-item:hover, .pop-item:focus-visible { background: var(--surface-2); }
.pop-item.danger { color: var(--danger); }
.pop form { margin: 0; }

/* Undo toast */
.undo-toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.undo-toast .btn { flex: none; }

/* Meals done */
.meal-row.done .dish, .is-done .today-meal b { text-decoration: line-through; text-decoration-color: var(--muted); }
.is-done { opacity: .75; }
.tomorrow { font-size: .9rem; margin: 4px 0 12px; }
.slot-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.slot-actions form { margin: 0; }
.week-table .cell { display: flex; align-items: flex-start; gap: 4px; }
.week-table .cell a { flex: 1; }

/* Bottom sheet */
dialog.sheet { margin: auto auto 0; width: min(560px, 100vw); max-height: 88dvh; border-radius: 20px 20px 0 0;
               padding-bottom: env(safe-area-inset-bottom); }
dialog.sheet[open] { animation: sheet-in .2s ease-out; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
.sheet-section { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.sheet-section h3 { margin-bottom: 8px; }

/* Shopping: details folded, big touch targets */
.shop-detail { display: none; }
.shop-item.show-detail .shop-detail { display: block; }
.shop-item .btn.icon { width: 44px; height: 44px; min-height: 44px; }
.detail-btn { color: var(--muted); font-size: 1.05rem; }

/* Recipe filters */
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border);
              border-radius: 12px; background: var(--surface); color: var(--muted); }
.search-box input { border: 0; outline: 0; min-height: 46px; padding: 0; background: transparent; }
.search-box:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.filters { margin-top: 10px; }
.filter-label { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 6px; }
.filter-chips .chip span { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.recipe-filters { margin-bottom: 8px; }

/* Steppers and onboarding steps */
.stepper { display: flex; align-items: stretch; }
.stepper input { text-align: center; border-radius: 0; min-width: 0; }
.stepper button { flex: none; width: 40px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
                  font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.stepper button:first-child { border-radius: 12px 0 0 12px; border-right: 0; }
.stepper button:last-child { border-radius: 0 12px 12px 0; border-left: 0; }
.stepper-hint { display: block; color: var(--muted); font-size: .72rem; margin-top: 2px; min-height: 1em; }
.wizard-head { margin-bottom: 12px; font-size: .85rem; font-weight: 700; color: var(--muted); }
.wizard-head .progress { margin-top: 6px; }
.wizard-head .progress span { background: var(--accent); }
.wizard-nav { display: flex; gap: 8px; }
.wizard-nav .btn { flex: 1; }

/* Computer: the week on the left, the meal on the right */
.week-detail { display: none; }
@media (min-width: 1000px) {
  body.wide main.wrap { max-width: 1180px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px;
                        align-items: start; }
  body.wide main.wrap > .week-main { min-width: 0; }
  body.wide main.wrap > .flash { grid-column: 1 / -1; }
  body.wide .week-detail { display: block; position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto;
                           border-left: 1px solid var(--border); padding-left: 20px; }
  body.wide .tabbar .wrap { max-width: 720px; }
  .meal-row.current { background: var(--accent-soft); border-radius: 10px; }
}
