/* Кулинарный склад — в стиле приложения Claude (iOS, тёмная тема со свечением) */
:root {
  --bg: #F2F2F7; --surface: #FFFFFF; --surface-2: #E9E9EE; --text: #000; --muted: #8A8A8E; --line: #E3E3E8;
  --accent: #0A84FF; --brand: #D97757; --glass: rgba(255, 255, 255, .74); --glass-line: rgba(0, 0, 0, .06);
  --green: #1E8A4C; --yellow: #C78A00; --red: #C8423A; --greenbg: #E3F3E8; --yellowbg: #FFF3D1; --redbg: #FBE6E3;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --surface: rgba(28, 28, 30, .82); --surface-2: #2C2C2E; --text: #fff; --muted: #8D8D93; --line: #2C2C2E;
    --glass: rgba(30, 30, 32, .72); --glass-line: rgba(255, 255, 255, .08);
    --green: #3BB36C; --yellow: #F2B636; --red: #EC6A60; --greenbg: #1F3A2A; --yellowbg: #3D3214; --redbg: #43221F; }
  html { background: radial-gradient(ellipse 95% 55% at 5% 102%, rgba(217, 119, 87, .55), rgba(217, 119, 87, .15) 45%, transparent 75%),
    radial-gradient(ellipse 80% 50% at 100% 88%, rgba(10, 132, 255, .38), rgba(10, 132, 255, .1) 50%, transparent 75%), #000;
    background-attachment: fixed; min-height: 100%; }
  body { background: transparent !important; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); letter-spacing: -.01em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2); border: 0; border-radius: 12px; padding: 11px 13px; width: 100%; outline: none; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 2px var(--accent); }
.btn { border: 0; border-radius: 14px; padding: 12px 16px; background: var(--surface-2); color: var(--text); font-weight: 600; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { color: var(--red); }
.btn:active, .row:active, .card:active { transform: scale(.98); }

/* вход */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 340px; text-align: center; }
.login-logo { font-size: 64px; }
.login-box h1 { margin: 6px 0 4px; font-size: 26px; }
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.error { color: var(--red); min-height: 1em; }

/* страницы */
.tab-page { padding: calc(14px + var(--safe-t)) 14px calc(110px + var(--safe-b)); max-width: 720px; margin: 0 auto; }
header.big { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin: 4px 2px 10px; }
header.big h1 { font-size: 30px; font-weight: 800; margin: 0; }
.sum { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill { font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.pill.red { background: var(--redbg); color: var(--red); } .pill.yellow { background: var(--yellowbg); color: var(--yellow); }
.pill.green { background: var(--greenbg); color: var(--green); }
.search { margin-bottom: 8px; }
.seg { display: flex; padding: 3px; border-radius: 11px; background: var(--surface-2); margin-bottom: 8px; }
.seg button { flex: 1; border: 0; background: none; color: var(--text); font-weight: 600; font-size: 13.5px; padding: 7px 0; border-radius: 9px; }
.seg button.on { background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .14); }
@media (prefers-color-scheme: dark) { .seg button.on { background: #3A3A3C; } }
.chips { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.chips button { flex-shrink: 0; border: 0; border-radius: 999px; padding: 6px 13px; background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13.5px; }
.chips button.on { background: var(--text); color: var(--bg); }
.group-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 14px 4px 6px; }
.list { background: var(--surface); border-radius: 18px; overflow: hidden; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: .5px solid var(--line); cursor: pointer; }
.row:first-child { border-top: 0; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.dot.green { background: var(--green); } .dot.yellow { background: var(--yellow); } .dot.red { background: var(--red); }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); margin-top: 1px; }
.row-sub .warn { color: var(--yellow); font-weight: 600; } .row-sub .bad { color: var(--red); font-weight: 600; }
.row-qty { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; line-height: 1.45; }

/* рецепты и «что приготовить» */
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 4px 8px; }
.sec h2 { font-size: 19px; margin: 0; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--surface); border-radius: 18px; padding: 12px 14px; cursor: pointer; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.card-top { display: flex; gap: 12px; align-items: center; }
.card-emoji { font-size: 30px; width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; flex-shrink: 0; }
.card h3 { margin: 0; font-size: 16.5px; }
.card .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.miss { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.miss span { font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--redbg); color: var(--red); }
details.more summary { list-style: none; cursor: pointer; color: var(--accent); font-weight: 600; margin: 14px 4px 8px; }
details.more summary::-webkit-details-marker { display: none; }

/* покупки */
.shop-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.shop-actions .btn { flex: 1; }
.shop-add { display: grid; grid-template-columns: 1fr 64px 70px 46px; gap: 6px; margin-bottom: 8px; }
.shop-add input, .shop-add select { padding: 10px 8px; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); flex-shrink: 0; display: grid; place-items: center; background: none; }
.check:active { background: var(--greenbg); border-color: var(--green); }
.src { font-size: 12px; color: var(--muted); }

/* нижняя панель */
.tabbar { position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); z-index: 30; display: flex; padding: 5px; max-width: 520px; margin: 0 auto;
  border-radius: 30px; background: var(--glass); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: .5px solid var(--glass-line); box-shadow: 0 8px 28px rgba(0, 0, 0, .16); }
.tabbar button { position: relative; flex: 1; border: 0; background: none; color: var(--text); font-size: 10.5px; font-weight: 600; display: flex;
  flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 5px; border-radius: 24px; }
.tabbar button span { font-size: 21px; line-height: 1.1; }
.tabbar button.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tb-badge { position: absolute; top: 2px; right: calc(50% - 22px); background: #FF3B30; color: #fff; font: 700 11px/17px var(--sans); font-style: normal;
  min-width: 17px; padding: 0 5px; border-radius: 9px; text-align: center; }
.fab { position: fixed; right: 18px; bottom: calc(92px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%; border: 0; z-index: 20;
  background: var(--accent); color: #fff; font-size: 28px; box-shadow: 0 6px 20px rgba(10, 132, 255, .4); }

/* нижнее окно */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 88vh; overflow-y: auto; background: var(--bg);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + var(--safe-b)); max-width: 720px; margin: 0 auto; }
@media (prefers-color-scheme: dark) { .sheet { background: #1C1C1E; } }
.sheet::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--surface-2); margin: 0 auto 10px; }
.sheet h2 { margin: 2px 0 10px; font-size: 21px; }
.form { display: flex; flex-direction: column; gap: 9px; }
.form label { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: -4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.three { display: grid; grid-template-columns: 1fr 90px; gap: 8px; }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ing-row { display: grid; grid-template-columns: 1fr 70px 66px 34px; gap: 5px; align-items: center; }
.ing-row input, .ing-row select { padding: 9px 7px; }
.ing-row button { border: 0; background: none; color: var(--red); font-size: 20px; }
.ing-list { display: flex; flex-direction: column; gap: 0; background: var(--surface); border-radius: 14px; overflow: hidden; }
.ing { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-top: .5px solid var(--line); font-size: 15px; }
.ing:first-child { border-top: 0; }
.ing .ok { color: var(--green); font-weight: 600; } .ing .no { color: var(--red); font-weight: 600; } .ing .opt { color: var(--muted); }
.steps { margin: 0; padding-left: 20px; line-height: 1.45; } .steps li { margin: 6px 0; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + var(--safe-b)); z-index: 60; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; max-width: 86vw; text-align: center; }
