:root {
  --bg: #f4f7f5; --card: #ffffff; --ink: #14201a; --muted: #5d6d65; --line: #dde6e1;
  --accent: #1f9d6b; --accent-ink: #ffffff; --accent-soft: #e2f4ec; --warn: #b45309; --warn-soft: #fef3c7;
  --danger: #b91c1c; --danger-soft: #fee2e2; --p: #2563eb; --c: #d97706; --f: #9333ea;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1512; --card: #17201b; --ink: #e8f0ec; --muted: #9aaba2; --line: #26332c;
    --accent: #34c38a; --accent-ink: #06130d; --accent-soft: #173327; --warn: #f59e0b; --warn-soft: #3a2a0a;
    --danger: #f87171; --danger-soft: #3b1414; --p: #60a5fa; --c: #fbbf24; --f: #c084fc;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: .75rem 0 .5rem; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.lang-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 4px 12px; min-height: 32px; font-weight: 700; cursor: pointer; }
.view { max-width: 760px; margin: 0 auto; padding: 16px; outline: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar[hidden] { display: none; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 600; }
.tabbar a .ico { font-size: 1.1rem; line-height: 1; }
.tabbar a.active { color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row > .grow { flex: 1 1 160px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 460px) { .grid3 { grid-template-columns: 1fr 1fr; } .grid4 { grid-template-columns: 1fr 1fr; } }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-height: 42px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { margin-bottom: 10px; }
button, .btn { font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 10px 16px; min-height: 42px; cursor: pointer; background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button.secondary, .btn.secondary { background: var(--accent-soft); color: var(--ink); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.danger { background: var(--danger-soft); color: var(--danger); }
button.small { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
button:disabled { opacity: .55; cursor: default; }
button.block, .btn.block { width: 100%; }
.stat { display: flex; flex-direction: column; }
.stat .v { font-size: 1.5rem; font-weight: 800; }
.stat .l { font-size: .8rem; color: var(--muted); }
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s; }
.bar.over > i { background: var(--danger); }
.bar.p > i { background: var(--p); } .bar.c > i { background: var(--c); } .bar.f > i { background: var(--f); }
.macro { margin: 8px 0; }
.macro .row { font-size: .85rem; margin-bottom: 3px; }
.pill { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--accent-soft); color: var(--ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.low { background: var(--danger-soft); color: var(--danger); }
.note { background: var(--warn-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: .88rem; }
.info { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.entry { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.entry .n { font-weight: 600; }
.entry .m { font-size: .8rem; color: var(--muted); }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { border: 2px dashed var(--line); border-radius: 12px; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6px; position: relative; overflow: hidden; background: var(--bg); cursor: pointer; margin: 0; }
.slot .t { font-size: .72rem; font-weight: 700; color: var(--muted); position: relative; z-index: 1; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot.has { border-style: solid; border-color: var(--accent); }
.slot.has .t { background: rgba(0,0,0,.6); color: #fff; padding: 2px 6px; border-radius: 6px; }
.slot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
table.items { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.items th { text-align: left; font-size: .75rem; color: var(--muted); padding: 4px; }
table.items td { padding: 4px; vertical-align: top; border-top: 1px solid var(--line); }
table.items input { min-height: 36px; padding: 6px 8px; }
table.items input.g { width: 76px; }
table.items .num { text-align: right; white-space: nowrap; }
table.items tfoot td { font-weight: 800; }
.src { font-size: .72rem; color: var(--muted); display: block; margin-top: 2px; }
.results { list-style: none; margin: 6px 0 0; padding: 0; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.results:empty { display: none; }
.results li { padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.results li:hover, .results li:focus { background: var(--accent-soft); outline: none; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 10px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.recipe { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; cursor: pointer; }
.recipe .n { font-weight: 700; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.day-plan { border-left: 3px solid var(--accent); padding-left: 10px; margin: 12px 0; }
.ex { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ex:last-child { border-bottom: 0; }
.ex .n { font-weight: 700; }
.ex details summary { cursor: pointer; font-size: .82rem; color: var(--muted); }
.sets { display: grid; grid-template-columns: 2.2em 1fr 1fr; gap: 6px; align-items: center; margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100vw - 32px); font-weight: 600; box-shadow: var(--shadow); }
.toast[hidden] { display: none; }
.toast.err { background: var(--danger); color: #fff; }
.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--card); color: var(--ink); }
.modal::backdrop { background: rgba(0,0,0,.5); }
.modal > div { padding: 18px; }
.auth { max-width: 420px; margin: 16px auto; }
.hero { text-align: center; margin: 8px 0 18px; }
.hero img { width: 72px; height: 72px; }
.shop li { display: flex; gap: 10px; align-items: center; }
.shop li.done span { text-decoration: line-through; color: var(--muted); }
.shop input { width: 20px; min-height: 20px; }
.hidden { display: none !important; }
.linkbtn { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; font-weight: 600; text-decoration: underline; cursor: pointer; }
/* v0.2: fő fotó, extra fotók, kapcsoló, csúszka */
.slot.main { min-height: 180px; margin-bottom: 10px; }
.slot.main .t { font-size: .85rem; }
.photos.two { grid-template-columns: repeat(2, 1fr); margin-top: 8px; }
details > summary { cursor: pointer; margin: 6px 0; }
.toggle { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; }
.toggle input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.toggle label { margin: 0; font-size: 1rem; color: var(--ink); }
input[type=range] { padding: 0; min-height: 32px; accent-color: var(--accent); background: transparent; border: 0; }
tr[data-testid=oil-row] td { color: var(--muted); }
/* tételtábla: fix oszlopszélességek, hogy 375 px-en se lógjon ki */
table.items { table-layout: fixed; }
table.items th:nth-child(2), table.items td:nth-child(2) { width: 64px; }
table.items th:nth-child(3), table.items td:nth-child(3) { width: 42px; }
table.items th:nth-child(4), table.items td:nth-child(4) { width: 68px; }
table.items th:nth-child(5), table.items td:nth-child(5) { width: 34px; }
table.items input, table.items input.g { width: 100%; }
table.items td.mc, table.items td:nth-child(4) { font-size: .75rem; white-space: normal; }
table.items td:first-child { overflow-wrap: anywhere; }
/* címke a név mellett */
.pill.gap { margin-left: 8px; }
/* Frissítés-sáv (update-banner.js) */
.bp-upd { position: fixed; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 2147483000; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 999px; background: rgba(12,20,16,.95); color: #eef7f2; border: 1px solid var(--accent); box-shadow: 0 8px 30px rgba(0,0,0,.35); font: 600 14px/1.2 system-ui, sans-serif; max-width: calc(100vw - 24px); animation: bp-upd-in .35s ease-out; }
.bp-upd .m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-upd .go { cursor: pointer; border: 0; border-radius: 999px; padding: 8px 16px; min-height: 0; background: var(--accent); color: #06130d; font: 800 14px/1 system-ui, sans-serif; }
.bp-upd .x { cursor: pointer; border: 0; background: transparent; color: inherit; opacity: .7; font-size: 18px; line-height: 1; padding: 4px 8px; min-height: 0; }
@keyframes bp-upd-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
