/* ============ Kamra – stíluslap ============ */
:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #f0f3ef;
  --surface-3: #e6ebe4;
  --text: #17201a;
  --muted: #637067;
  --border: #dfe5dc;
  --accent: #15803d;
  --accent-2: #22c55e;
  --accent-soft: #dcfce7;
  --accent-text: #ffffff;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(16, 24, 16, .05), 0 4px 16px rgba(16, 24, 16, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 16, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 236px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1310; --surface: #161d18; --surface-2: #1c251f; --surface-3: #243028;
    --text: #e7efe9; --muted: #92a197; --border: #2a362e;
    --accent: #22c55e; --accent-2: #4ade80; --accent-soft: #143d24; --accent-text: #06260f;
    --warn: #fbbf24; --warn-soft: #3d2f0d; --danger: #f87171; --danger-soft: #3f1717;
    --info: #60a5fa; --info-soft: #172b4a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1310; --surface: #161d18; --surface-2: #1c251f; --surface-3: #243028;
  --text: #e7efe9; --muted: #92a197; --border: #2a362e;
  --accent: #22c55e; --accent-2: #4ade80; --accent-soft: #143d24; --accent-text: #06260f;
  --warn: #fbbf24; --warn-soft: #3d2f0d; --danger: #f87171; --danger-soft: #3f1717;
  --info: #60a5fa; --info-soft: #172b4a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.brand-name { font-weight: 750; font-size: 19px; letter-spacing: -.02em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 550; position: relative;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-link .count {
  margin-left: auto; background: var(--accent); color: var(--accent-text);
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px;
}
.sidebar-foot { margin-top: auto; display: flex; gap: 8px; padding: 0 4px; }

.main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1280px; width: 100%; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { font-size: 28px; letter-spacing: -.025em; font-weight: 750; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 40;
    flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border); justify-content: space-around;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
  }
  .brand, .sidebar-foot { display: none; }
  .nav-link { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; flex: 1; }
  .nav-link .count { position: absolute; top: 2px; right: 50%; transform: translateX(22px); margin: 0; }
  .main { padding: 18px 16px 100px; }
  .page-head h1 { font-size: 24px; }
  .mobile-top { display: flex !important; }
}
.mobile-top { display: none; justify-content: space-between; align-items: center; margin-bottom: 14px; }

/* ---------- Komponensek ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px 0;
}
.card-head h3 { font-size: 16px; font-weight: 650; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
  text-decoration: none;
}
a.chip, a.badge { text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 7px; width: 36px; height: 36px; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 5px; }

.input, select.input, textarea.input {
  width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 120px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 36px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.badge-ok { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--surface); padding: 5px 12px;
  border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--muted);
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.empty {
  text-align: center; padding: 44px 20px; color: var(--muted);
}
.empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: 8px; }

/* ---------- Áttekintés ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 980px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: center; cursor: pointer; }
.stat:hover { border-color: var(--accent); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
}
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.list-plain { list-style: none; margin: 0; padding: 8px 8px 12px; }
.list-plain li {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
}
.list-plain li:hover { background: var(--surface-2); }
.list-plain .grow { flex: 1; min-width: 0; }
.day-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Leltár ---------- */
.quick-add {
  display: grid; grid-template-columns: 2.2fr .8fr .9fr 1.1fr auto; gap: 8px; padding: 14px;
  margin-bottom: 16px; align-items: end;
}
@media (max-width: 820px) {
  .quick-add { grid-template-columns: 1fr 1fr; }
  .quick-add .qa-name { grid-column: 1 / -1; }
  .quick-add .btn { grid-column: 1 / -1; }
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .search { flex: 1; min-width: 200px; }
.filters select.input { width: auto; }
.cat-group { margin-bottom: 18px; }
.cat-title {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 4px 8px;
}
.inv-list { overflow: hidden; }
.inv-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border);
}
.inv-row:last-child { border-bottom: 0; }
.inv-row.zero .inv-name { color: var(--muted); }
.inv-name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inv-meta { display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.stepper {
  display: flex; align-items: center; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); overflow: hidden;
}
.stepper button {
  border: 0; background: transparent; width: 34px; height: 34px; cursor: pointer;
  font-size: 18px; color: var(--muted); display: grid; place-items: center;
}
.stepper button:hover { background: var(--surface-3); color: var(--text); }
.stepper input {
  width: 64px; border: 0; background: transparent; text-align: right; outline: none;
  font-weight: 650; padding: 0 2px; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper .unit { padding-right: 6px; font-size: 13px; color: var(--muted); min-width: 30px; }
.low .stepper { border-color: var(--warn); }
@media (max-width: 560px) {
  .inv-row { grid-template-columns: 1fr auto; }
  .inv-row .row-actions { display: none; }
  .stepper input { width: 48px; }
}

/* ---------- Receptek ---------- */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.recipe-card { padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, transform .15s; }
.recipe-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.recipe-card h3 { font-size: 17px; }
.recipe-card .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.progress.warn > div { background: var(--warn); }
.progress.danger > div { background: var(--danger); }
.ing-preview { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ing-preview .miss { color: var(--danger); font-weight: 600; }

.ing-table { width: 100%; border-collapse: collapse; }
.ing-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.ing-table tr:last-child td { border-bottom: 0; }
.ing-table .st { width: 26px; }
.ing-table .num { text-align: right; white-space: nowrap; }
.dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.dot.ok { background: var(--accent-soft); color: var(--accent); }
.dot.no { background: var(--danger-soft); color: var(--danger); }
.dot.opt { background: var(--surface-2); color: var(--muted); }
.instructions { white-space: pre-wrap; background: var(--surface-2); padding: 14px; border-radius: 10px; margin: 0; }

.recipe-img {
  margin: -16px -16px 0; width: calc(100% + 32px); aspect-ratio: 16 / 8; object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-2);
}
.recipe-hero { width: 100%; aspect-ratio: 5 / 2; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.ie-info { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -2px 0 8px; }
.ie-info:empty { display: none; }
.import-error {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 550;
}
.import-head { display: flex; gap: 14px; align-items: flex-start; }
.import-head img { width: 132px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; flex: none; }
.import-desc { margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ing-edit-row { display: grid; grid-template-columns: 2fr .9fr .9fr auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 560px) {
  .ing-edit-row { grid-template-columns: 1fr 1fr auto; }
  .ing-edit-row .ie-name { grid-column: 1 / -1; }
}

/* ---------- Heti menü ---------- */
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-title { font-weight: 650; min-width: 190px; text-align: center; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 820px) { .week-grid { grid-template-columns: minmax(0, 1fr); } }
.day-col { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.day-col.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.day-col.past { opacity: .7; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; }
.day-head b { font-size: 15px; }
.slot { display: flex; flex-direction: column; gap: 5px; }
.slot-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.slot-add {
  border: 1px dashed var(--border); background: transparent; border-radius: 8px; color: var(--muted);
  padding: 2px 0; cursor: pointer; font-size: 13px; width: 26px; height: 22px; line-height: 1;
}
.slot-add:hover { border-color: var(--accent); color: var(--accent); }
.meal-chip {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px;
  background: var(--surface-2); font-size: 13px; font-weight: 550; border-left: 3px solid var(--accent);
  cursor: pointer;
}
.meal-chip.partial { border-left-color: var(--warn); }
.meal-chip.missing { border-left-color: var(--danger); }
.meal-chip.cooked { opacity: .55; text-decoration: line-through; }
.meal-chip .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--accent); }
.legend .l-partial::before { background: var(--warn); }
.legend .l-missing::before { background: var(--danger); }

.pick-list { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.pick-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; background: var(--surface);
}
.pick-item:hover { border-color: var(--accent); }
.pick-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.pick-item .grow { flex: 1; }

/* ---------- Bevásárlólista ---------- */
.shop-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .shop-wrap { grid-template-columns: minmax(0, 1fr); } .side-card { position: static; } }
.shop-add { display: grid; grid-template-columns: minmax(0, 1fr) 90px 100px auto; gap: 8px; padding: 12px; margin-bottom: 14px; }
@media (max-width: 560px) { .shop-add { grid-template-columns: minmax(0, 1fr) 56px 64px auto; } }
.shop-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.shop-item:last-child { border-bottom: 0; }
.shop-item .box {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); flex: none;
  display: grid; place-items: center; cursor: pointer; background: var(--surface); color: transparent;
  transition: all .15s;
}
.shop-item .box:hover { border-color: var(--accent); }
.shop-item.checked .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.shop-item.checked .si-name { text-decoration: line-through; color: var(--muted); }
.shop-item .grow { flex: 1; min-width: 0; cursor: pointer; }
.si-name { font-weight: 600; }
.si-reason { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-qty { display: flex; align-items: center; gap: 4px; }
.si-qty input { width: 64px; text-align: right; padding: 5px 8px; }
.side-card { position: sticky; top: 20px; }
.side-card .card-pad { display: flex; flex-direction: column; gap: 12px; }
.big-progress { height: 10px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 12, 9, .55); z-index: 100;
  display: grid; place-items: center; padding: 16px; animation: fade .15s ease;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: 18px; width: min(620px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease;
  border: 1px solid var(--border);
}
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; gap: 10px; }
.modal-head h2 { font-size: 20px; letter-spacing: -.01em; }
.modal-body { padding: 6px 20px 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@media (max-width: 560px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; width: 100%; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 11px;
  box-shadow: var(--shadow-lg); font-weight: 550; font-size: 14px; animation: pop .2s ease; max-width: 360px;
}
.toast.error { background: var(--danger); color: #fff; }
@media (max-width: 820px) { .toasts { left: 16px; right: 16px; top: 12px; } .toast { max-width: none; } }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
