/* Bếp Nhà Mình: warm kitchen colours, big friendly touch targets, phone first. */
:root {
    --bg: #fbf7f0; --card: #fff; --ink: #2b2620; --muted: #7a6f63; --line: #ece3d6;
    --green: #2f6b3f; --green-2: #4f9a62; --green-soft: #e3f1e5; --red: #c2482d; --red-soft: #fbe6df;
    --amber: #e39b27; --amber-soft: #fdf0d8; --blue: #3c78b5; --blue-soft: #e2eef9;
    --radius: 16px; --shadow: 0 2px 10px rgba(60, 40, 20, .08);
    --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 'Be Vietnam Pro', system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: Lora, Georgia, serif; line-height: 1.25; margin: 0; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 10px; background: rgba(251, 247, 240, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 30px; }
.brand b { display: block; font: 700 19px Lora, serif; color: var(--green); }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -2px; }
.spacer { flex: 1; }
.sync { font-size: 13px; padding: 6px 10px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
main { max-width: 1100px; margin: 0 auto; padding: 14px 16px calc(96px + var(--safe-b)); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; gap: 4px; padding: 6px 8px calc(6px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 12px rgba(60, 40, 20, .06); }
.tabs a { flex: 1; max-width: 140px; display: grid; justify-items: center; padding: 4px; border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tabs a span { font-size: 22px; line-height: 1.2; }
.tabs a.on { color: var(--green); background: var(--green-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 12px; font-weight: 700; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.amber { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.section { margin: 18px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section h2 { font-size: 20px; }

/* browse */
.search { display: flex; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px 6px 4px 12px; box-shadow: var(--shadow); }
.search input { flex: 1; border: 0; outline: 0; padding: 8px 0; background: none; font-size: 16px; min-width: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 6px 12px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-top: 12px; }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; text-align: left; }
.card .ph { aspect-ratio: 4 / 3; background: #f1e8da center / cover; display: grid; place-items: center; font-size: 40px; }
.card .bd { padding: 8px 10px 10px; display: grid; gap: 3px; }
.card .nm { font-weight: 700; font-size: 14px; line-height: 1.3; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--green-soft); color: var(--green); }
.tag.warn { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.amber { background: var(--amber-soft); color: #9a6410; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* recipe page */
.hero { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 420px; width: 100%; background: #f1e8da center / cover; box-shadow: var(--shadow); }
.hero .back { position: absolute; left: 10px; top: 10px; background: rgba(255, 255, 255, .92); border-radius: 99px; padding: 6px 12px; font-weight: 700; }
.recipe { display: grid; gap: 14px; }
.recipe h1 { font-size: 26px; margin-top: 4px; }
.recipe .en { color: var(--muted); font-style: italic; margin-top: -8px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; text-align: center; font-size: 12px; color: var(--muted); }
.facts b { display: block; color: var(--ink); font-size: 16px; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.box h3 { font-size: 17px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; font-family: 'Be Vietnam Pro'; font-size: 14px; font-weight: 600; }
.stepper button { width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 800; font-size: 18px; }
.ings { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ings li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ings li:last-child { border: 0; }
.ings .q { font-weight: 700; min-width: 86px; color: var(--green); }
.ings .nt { color: var(--muted); font-size: 13px; }
.ings .role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 6px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: s; }
.steps li { display: flex; gap: 10px; cursor: pointer; }
.steps li::before { counter-increment: s; content: counter(s); flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--amber-soft); color: #9a6410; font-weight: 800; display: grid; place-items: center; font-size: 13px; }
.steps li.done { color: var(--muted); text-decoration: line-through; }
.steps li.done::before { content: '✓'; background: var(--green-soft); color: var(--green); }
.nut { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.nut div { border-radius: 12px; padding: 8px; background: var(--bg); text-align: center; font-size: 12px; color: var(--muted); }
.nut b { display: block; font-size: 18px; color: var(--ink); }
.bars { display: grid; gap: 6px; margin-top: 10px; }
.bar { display: grid; grid-template-columns: 110px 1fr 54px; gap: 8px; align-items: center; font-size: 13px; }
.bar i { display: block; height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar i b { display: block; height: 100%; border-radius: 6px; background: var(--green-2); }
.bar span:last-child { text-align: right; font-weight: 700; }
.note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

/* planner */
.plan-tools { display: grid; gap: 10px; }
.weeknav { display: flex; align-items: center; gap: 8px; }
.weeknav b { flex: 1; text-align: center; font-size: 15px; }
.days { display: grid; gap: 10px; margin-top: 10px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.day.today { border-color: var(--green-2); box-shadow: 0 0 0 2px var(--green-soft), var(--shadow); }
.day > header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.day > header b { font: 700 16px Lora, serif; }
.day > header .sum { margin-left: auto; font-size: 12px; color: var(--muted); }
.meal { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: start; padding: 6px 0; border-top: 1px dashed var(--line); }
.meal .lbl { font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 6px; }
.dishes { display: flex; gap: 6px; flex-wrap: wrap; }
.dish { display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; font-weight: 600; max-width: 100%; }
.dish .th { width: 34px; height: 34px; border-radius: 9px; background: #f1e8da center / cover; flex: 0 0 auto; display: grid; place-items: center; font-size: 16px; }
.dish .x { color: var(--muted); padding: 0 2px; font-size: 14px; }
.meal .acts { display: flex; gap: 2px; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; }
.icon-btn.on { background: var(--amber-soft); }
.daybars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.daybars div { font-size: 11px; color: var(--muted); }
.daybars i { display: block; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 2px; }
.daybars i b { display: block; height: 100%; background: var(--green-2); }
.daybars i b.over { background: var(--red); }
.week-sum { display: flex; gap: 6px; flex-wrap: wrap; }

/* shopping */
.aisle { margin-top: 12px; }
.aisle h3 { font-size: 16px; margin-bottom: 6px; }
.items { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.items li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.items li:last-child { border: 0; }
.items li .ck { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); flex: 0 0 auto; display: grid; place-items: center; font-size: 13px; color: #fff; }
.items li.got .ck { background: var(--green); border-color: var(--green); }
.items li.got .tx { text-decoration: line-through; color: var(--muted); }
.items .tx { flex: 1; display: grid; }
.items .tx small { color: var(--muted); font-size: 12px; }
.items .amt { font-weight: 700; white-space: nowrap; }

/* forms, sheets */
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field select { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 16px; }
.count { display: inline-flex; align-items: center; gap: 10px; }
.count button { width: 36px; height: 36px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 20px; font-weight: 800; }
.count b { min-width: 20px; text-align: center; font-size: 18px; }
.sheet-wrap { position: fixed; inset: 0; z-index: 30; background: rgba(30, 20, 10, .35); display: grid; align-items: end; justify-items: center; }
.sheet { width: min(640px, 100%); max-height: 86vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); display: grid; gap: 12px; animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet h2 { font-size: 20px; }
.pick { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.pick button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.pick .th { width: 48px; height: 48px; border-radius: 10px; background: #f1e8da center / cover; flex: 0 0 auto; }
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); z-index: 40; background: rgba(43, 38, 32, .94); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; max-width: 90vw; text-align: center; }

@media (min-width: 900px) {
    .recipe { grid-template-columns: 1.1fr 1fr; align-items: start; }
    .recipe .wide { grid-column: 1 / -1; }
    .days { grid-template-columns: repeat(2, 1fr); }
}
@media print {
    .top, .tabs, .btn, .icon-btn { display: none !important; }
    main { padding: 0; }
}
