:root {
  --green: #0f7a5a; --green-dark: #0b5c44; --green-light: #e6f4ef; --yellow: #ffd54a; --red: #d93025;
  --bg: #f4f6f5; --card: #ffffff; --text: #1c2321; --muted: #667471; --line: #e1e7e4; --danger: #c0392b;
  --radius: 14px; --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101514; --card: #1a201e; --text: #eef2f0; --muted: #98a5a1; --line: #2a3330; --green-light: #14352b; }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; }
#app { min-height: 100dvh; }
main { padding: 0 0 calc(var(--nav-h) + 90px); max-width: 600px; margin: 0 auto; }
.pad { padding: 16px; }
[hidden] { display: none !important; }
h1 { font-size: 26px; margin: 8px 0 14px; letter-spacing: -.3px; }
h2 { font-size: 19px; margin: 18px 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
a.link { color: var(--green); font-weight: 700; text-decoration: none; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 14px; }
.center { text-align: center; padding: 30px 12px; color: var(--muted); }
.error { color: var(--danger); font-size: 14px; margin: 6px 0; min-height: 1em; }
.spinner { text-align: center; padding: 30px; color: var(--muted); }

/* ---- формуляри ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=tel], input[type=password], input[type=email], input[type=date], select, textarea {
  width: 100%; padding: 12px 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font-family: inherit; }
input:focus, select:focus { outline: 2px solid var(--green); border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 8px 0 12px; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.btn { display: block; width: 100%; padding: 14px; font-size: 16px; font-weight: 700; border: 0; border-radius: 12px; background: var(--green); color: #fff; cursor: pointer; font-family: inherit; }
.btn:disabled { opacity: .6; }
.btn.secondary { background: var(--green-light); color: var(--green-dark); }
.btn.outline { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn.small { width: auto; padding: 9px 16px; font-size: 14px; border-radius: 999px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn + .btn { margin-top: 10px; }

/* ---- горна лента на Начало ---- */
.hero { padding: 18px 16px 8px; }
.hero .ph { display: flex; justify-content: space-between; align-items: flex-start; }
.hero .ph .name { font-weight: 700; font-size: 15px; }
.hero .ph .sub { font-size: 13px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--green-light); color: var(--green-dark); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.chip .coin { width: 20px; height: 20px; border-radius: 50%; background: var(--yellow); display: inline-block; text-align: center; line-height: 20px; color: #6b4e00; font-size: 12px; }
.hello { font-size: 28px; font-weight: 800; margin: 12px 0 6px; }
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pill { flex: none; border: 1.5px solid var(--green); color: var(--green); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; background: transparent; text-decoration: none; }

/* ---- банери ---- */
.banners { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 16px 6px; }
.banner { flex: none; width: 88%; scroll-snap-align: start; border-radius: 16px; overflow: hidden; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.08); text-decoration: none; color: inherit; }
.banner img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--green-light); }
.banner .t { padding: 12px 14px; font-weight: 700; }
.banner .t small { display: block; font-weight: 500; color: var(--muted); }
.banner.placeholder { background: linear-gradient(135deg, var(--green), #12986f); color: #fff; padding: 22px 18px; min-height: 130px; display: flex; flex-direction: column; justify-content: center; }
.banner.placeholder b { font-size: 20px; }

/* ---- секции ---- */
.sec { padding: 10px 16px 0; }
.sec .spread h2 { margin: 0; }

/* ---- промоции ---- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px; }
.promo { background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; flex-direction: column; }
.promo img, .promo .noimg { width: 100%; aspect-ratio: 1/1; object-fit: contain; background: #fff; display: block; }
.promo .noimg { display: flex; align-items: center; justify-content: center; color: #b9c6c1; font-size: 44px; background: var(--green-light); }
.promo .b { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.promo .n { font-weight: 700; font-size: 15px; line-height: 1.25; }
.promo .old { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.promo .tag { display: inline-block; background: var(--red); color: #fff; font-weight: 800; font-size: 12px; padding: 3px 8px; border-radius: 6px; width: fit-content; }
.promo .new { color: var(--red); font-weight: 900; font-size: 22px; }
.promo .new small { font-size: 12px; font-weight: 600; }
.promo .when { background: #e3f0fb; color: #1b4f8a; font-size: 12px; font-weight: 700; border-radius: 6px; padding: 4px 8px; width: fit-content; margin-top: auto; }
.addlist { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; color: var(--green); font-size: 16px; }
.promo .imgwrap { position: relative; }

/* ---- купони ---- */
.coupon { display: flex; background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin: 0 16px 12px; min-height: 150px; }
.coupon .img { width: 42%; background: #fff7d6; display: flex; align-items: center; justify-content: center; position: relative; }
.coupon .img img { width: 100%; height: 100%; object-fit: contain; }
.coupon .img .noimg { font-size: 40px; color: #d9b100; }
.coupon .body { flex: 1; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.coupon .off { background: var(--yellow); color: #3a2c00; font-weight: 900; font-size: 18px; border-radius: 8px; padding: 6px 10px; width: fit-content; line-height: 1.1; }
.coupon .off small { display: block; font-size: 11px; font-weight: 600; }
.coupon .t { font-weight: 700; font-size: 16px; }
.coupon .d { color: var(--muted); font-size: 13px; }
.coupon .btn { margin-top: auto; padding: 11px; border-radius: 999px; }
.coupon.active { outline: 2px solid var(--green); }
.coupon.active .btn { background: var(--green-light); color: var(--green-dark); }
.cnt { color: var(--red); font-weight: 700; font-size: 14px; margin: -8px 16px 12px; }

/* ---- брошури ---- */
.brochure { background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.06); text-decoration: none; color: inherit; display: block; }
.brochure img, .brochure .noimg { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: var(--green-light); }
.brochure .noimg { display: flex; align-items: center; justify-content: center; font-size: 44px; color: #b9c6c1; }
.brochure .t { padding: 10px 12px 12px; font-weight: 700; }
.brochure .t small { display: block; font-weight: 500; color: var(--muted); }

/* ---- профил ---- */
.phead { background: var(--green); color: #fff; padding: 26px 16px 22px; }
.phead .name { font-size: 30px; font-weight: 900; color: var(--yellow); }
.phead .chip { background: #fff; color: var(--green-dark); }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.quick a { text-decoration: none; color: #fff; text-align: center; font-size: 12px; font-weight: 600; }
.quick .ic { width: 64px; height: 64px; border-radius: 50%; background: #fff; color: var(--green); margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; margin: 0 16px 14px; }
.list a, .list .item { display: flex; align-items: center; gap: 12px; padding: 15px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; font-weight: 600; }
.list a:last-child, .list .item:last-child { border-bottom: 0; }
.list .ic { width: 28px; text-align: center; font-size: 20px; color: var(--green); }
.list .chev { margin-left: auto; color: var(--muted); }
.kv { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; gap: 12px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--green); text-decoration: none; font-weight: 700; padding: 14px 16px 4px; font-size: 15px; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; }
.topbar h1 { margin: 0; font-size: 20px; }

/* ---- бележки ---- */
.filters { display: flex; gap: 8px; padding: 6px 16px 10px; overflow-x: auto; }
.filters button { flex: none; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font-family: inherit; }
.filters button.on { background: var(--green); color: #fff; border-color: var(--green); }
.month { font-size: 14px; color: var(--muted); font-weight: 700; margin: 14px 16px 4px; }
.sale { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; background: var(--card); }
.sale .ic { font-size: 24px; color: var(--text); }
.sale .info { flex: 1; min-width: 0; }
.sale .info .d { font-weight: 700; font-size: 17px; }
.sale .info .sub { color: var(--muted); font-size: 13px; }
.sale .sum { text-align: right; font-weight: 800; font-size: 17px; white-space: nowrap; }
.sale .sum small { display: block; color: var(--green); font-weight: 600; font-size: 12px; }
.star { background: none; border: 0; font-size: 22px; color: #c9d2ce; padding: 4px; }
.star.on { color: #f2b01e; }

/* ---- бележка ---- */
.receipt { background: #fffdf7; color: #222; border-radius: 6px; padding: 18px 16px; margin: 8px 16px; font-family: ui-monospace, "SF Mono", Consolas, "Courier New", monospace; font-size: 13px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.receipt .c { text-align: center; } .receipt .big { font-size: 15px; font-weight: 700; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
.receipt .r { display: flex; justify-content: space-between; gap: 8px; }
.receipt .item { margin: 5px 0; } .receipt .item .n { font-weight: 600; }
.receipt .item .q { display: flex; justify-content: space-between; color: #444; }
.receipt .storned { text-decoration: line-through; opacity: .6; }
.receipt .total { font-size: 16px; font-weight: 800; } .receipt .saved { color: var(--green-dark); font-weight: 700; }
.receipt .foot { text-align: center; color: #666; font-size: 11px; margin-top: 10px; }

/* ---- списък за пазар ---- */
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.todo input[type=checkbox] { width: 22px; height: 22px; }
.todo.done span { text-decoration: line-through; color: var(--muted); }
.todo .del { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 18px; }
.addrow { display: flex; gap: 8px; padding: 12px 16px; }
.addrow input { flex: 1; }
.suggest { margin: -6px 16px 8px; background: var(--card); border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.12); overflow: hidden; }
.suggest div { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }

/* ---- плаващ бутон Карта + долно меню ---- */
.cardbtn { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); z-index: 6;
  background: var(--green); color: #fff; border: 0; border-radius: 999px; padding: 14px 20px; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 22px rgba(15,122,90,.4); font-family: inherit; }
.cardbtn .cardico { font-size: 20px; } .cardbtn .chev { border-left: 1px solid rgba(255,255,255,.4); padding-left: 12px; font-size: 18px; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: space-around; z-index: 5; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
.nav a .ico { font-size: 21px; line-height: 1; }
.nav a.active { color: var(--green); }

/* ---- overlay с картата ---- */
.overlay { position: fixed; inset: 0; z-index: 20; background: var(--green); color: #fff; overflow: auto; }
.overlay .in { max-width: 600px; margin: 0 auto; padding: 16px; }
.overlay .close { background: none; border: 0; color: #fff; font-size: 30px; line-height: 1; padding: 6px 4px; }
.overlay h1 { font-size: 30px; margin: 6px 0 4px; }
.cardface { background: #fff; color: #111; border-radius: 16px; padding: 18px; margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cardface .logo { align-self: flex-start; color: var(--green); font-weight: 900; font-size: 18px; }
.cardface #qr { width: 210px; height: 210px; }
.cardface #qr img, .cardface #qr canvas { width: 210px !important; height: 210px !important; }
.cardface svg { width: 100%; max-width: 340px; height: auto; }
.cardface .holder { align-self: flex-start; }
.cardface .holder b { display: block; font-size: 18px; }
.cardface .holder span { color: #555; font-family: ui-monospace, Consolas, monospace; letter-spacing: 2px; font-size: 18px; }
.cardface .toggle { align-self: stretch; display: flex; gap: 6px; }
.cardface .toggle button { flex: 1; border: 1.5px solid var(--line); background: #f4f6f5; border-radius: 999px; padding: 8px; font-weight: 700; color: #333; font-family: inherit; }
.cardface .toggle button.on { background: var(--green); color: #fff; border-color: var(--green); }
.overlay .note { text-align: center; margin: 16px 0; font-size: 16px; }
.overlay .warn { background: rgba(255,255,255,.15); border-radius: 10px; padding: 10px 12px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 86px); transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; max-width: 90%; }
.auth { padding: 24px 16px; }
.auth .logo { text-align: center; color: var(--green); font-weight: 900; font-size: 26px; margin-bottom: 14px; }
.join { background: var(--green-light); color: var(--green-dark); border-radius: 12px; padding: 12px 14px; font-weight: 600; margin-bottom: 14px; }
