:root {
  --bg: #14161c; --card: #1e2129; --card2: #262a34; --line: #313643;
  --text: #eef0f4; --muted: #9aa1b0; --accent: #ff5a5f; --ok: #3ecf8e; --warn: #f5b942; --blue: #5aa9ff;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
h1 { font-size: 20px; margin: 0; }
h2.sub { font-size: 15px; color: var(--muted); margin: 24px 0 8px; font-weight: 600; }
input, select, textarea {
  width: 100%; background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
label.check input { width: auto; }

.btn { border: 0; border-radius: 10px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; background: var(--card2); color: var(--text); white-space: nowrap; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); color: #0b1a12; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 12px; padding: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
main { padding: 14px 14px 100px; max-width: 720px; margin: 0 auto; }
.bottom { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.bottom button { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 0 10px; font-size: 20px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.bottom button span { font-size: 11px; }
.bottom button.active { color: var(--accent); }

.row { display: flex; gap: 8px; margin-bottom: 12px; }
.row .qty { width: 70px; flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; }

.item { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.item img, .item .ph { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--card2); flex: none; display: grid; place-items: center; font-size: 20px; }
.item .main { flex: 1; min-width: 0; cursor: pointer; }
.item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { font-size: 12px; color: var(--muted); }
.item.done { opacity: .55; }
.item.done .name { text-decoration: line-through; }
.item input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--ok); flex: none; }
.stepper { display: flex; align-items: center; gap: 4px; flex: none; }
.stepper button { width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--card2); color: var(--text); font-size: 16px; cursor: pointer; }
.stepper .v { min-width: 56px; text-align: center; font-size: 13px; cursor: pointer; }

.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--card2); color: var(--muted); margin-left: 4px; }
.badge.manuel { background: rgba(62,207,142,.15); color: var(--ok); }
.badge.openprices { background: rgba(90,169,255,.15); color: var(--blue); }
.badge.none { background: rgba(245,185,66,.15); color: var(--warn); }
.price { font-weight: 700; flex: none; }

.summary { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; padding: 10px 2px; }
.summary b { color: var(--text); }

.recipe { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.recipe h3 { margin: 0 0 4px; font-size: 17px; }
.recipe .sum { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { background: var(--card2); border-radius: 99px; padding: 4px 10px; font-size: 12px; }
.recipe ul, .recipe ol { margin: 6px 0 10px; padding-left: 20px; }
.recipe ul { list-style: none; padding-left: 0; }
.recipe li { margin: 3px 0; }
.recipe .buy { color: var(--warn); }
.recipe details summary { cursor: pointer; color: var(--blue); font-size: 13px; margin: 4px 0; }
.recipe .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 700px) { .modal { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.hint { font-size: 12px; color: var(--muted); background: var(--card2); border-radius: 10px; padding: 8px 10px; }
.hint.blue { border-left: 3px solid var(--blue); }
.hint.warn { border-left: 3px solid var(--warn); }
#reader { width: 100%; border-radius: 12px; overflow: hidden; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.err { color: var(--accent); font-size: 13px; margin: 0; min-height: 1em; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 99px; font-weight: 600; font-size: 14px; z-index: 30; max-width: 90vw; text-align: center; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
