:root {
  --primary: #2B90D9;
  --primary-dark: #1C7BC2;
  --ink: #10192A;
  --muted: #697587;
  --muted-2: #9BA6B5;
  --border: #EEF2F6;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --red: #F5473D;
  --orange: #FB8C00;
  --green: #16A368;
  --chip: #F2F5F8;
  --chip-active-bg: #E9F4FB;
  --shadow: 0 2px 8px rgba(16, 25, 42, 0.05);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", system-ui, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior-y: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(76px + var(--safe-bottom));
}
.screen.no-nav { padding-bottom: var(--safe-bottom); }

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: calc(14px + var(--safe-top)) 16px 12px;
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header h1 { font-size: 21px; font-weight: 800; margin: 0; }
.header .back {
  width: 34px; height: 34px; border: none; border-radius: 10px;
  background: var(--chip); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.header .back svg { width: 18px; height: 18px; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border: none; border-radius: 11px;
  background: var(--chip); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }
.badge-dot {
  position: absolute; top: 7px; right: 8px; width: 8px; height: 8px;
  border-radius: 999px; background: var(--red); border: 1.5px solid #fff;
}

/* ---------- Search + chips ---------- */
.search {
  display: flex; align-items: center; gap: 9px; background: var(--chip);
  border-radius: 12px; padding: 11px 13px; margin-top: 12px;
}
.search svg { width: 16px; height: 16px; flex: none; }
.search input {
  border: none; background: transparent; outline: none; font-size: 14px;
  width: 100%; color: var(--ink);
}
.chips { display: flex; gap: 7px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12px; padding: 7px 13px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--chip); color: var(--muted);
}
.chip.dark { background: var(--ink); color: #fff; }
.chip.info { background: var(--chip-active-bg); color: var(--primary-dark); }
.chip.promo { background: #FFF1E6; color: #C2410C; }
.chip.on { background: var(--primary); color: #fff; }

/* ---------- Feed ---------- */
.feed { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }

.card {
  display: block; text-decoration: none; color: inherit; background: var(--card);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer;
  border: none; width: 100%; text-align: left; padding: 0; font: inherit;
}
.card-img {
  position: relative; height: 136px; display: flex; align-items: center; justify-content: center;
  color: var(--muted-2); font-size: 12px;
}
.card-badge {
  position: absolute; top: 11px; left: 11px; color: #fff; font-size: 14px; font-weight: 800;
  padding: 4px 11px; border-radius: 9px;
}
.heart {
  position: absolute; top: 9px; right: 9px; width: 32px; height: 32px; border: none; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.heart svg { width: 16px; height: 16px; }
.card-body { padding: 12px 14px 14px; }
.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.card-brand { font-size: 15px; font-weight: 700; }
.card-cat { font-size: 11px; color: var(--muted-2); }
.card-desc { font-size: 13px; color: var(--muted); line-height: 1.45; margin-bottom: 9px; }
.card-meta { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--muted-2); }
.card-desc s { color: var(--muted-2); }
.card-desc b { color: var(--ink); }

/* ---------- Detail ---------- */
.detail-hero { height: 220px; display: flex; align-items: center; justify-content: center; color: var(--muted-2); position: relative; }
.detail-body { padding: 18px 16px; display: flex; flex-direction: column; gap: 16px; }
.detail-title { font-size: 22px; font-weight: 800; margin: 0; }
.kv { display: flex; gap: 10px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 6px 12px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.pill.green { background: #E6F6EE; color: var(--green); }
.pill.red { background: #FDEAE9; color: var(--red); }
.pill.orange { background: #FFF2E0; color: var(--orange); }
.price-row { display: flex; align-items: baseline; gap: 10px; }
.price-new { font-size: 24px; font-weight: 800; }
.price-old { font-size: 16px; color: var(--muted-2); text-decoration: line-through; }

/* ---------- Promo code block ---------- */
.promo-block {
  background: #F0F8FD; border: 1.5px dashed var(--primary); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.promo-label { font-size: 12px; color: var(--muted); }
.promo-code-row { display: flex; align-items: center; gap: 10px; }
.promo-code {
  flex: 1; font-size: 20px; font-weight: 800; letter-spacing: 2px; color: var(--ink); text-align: center;
}
.btn-copy {
  border: none; background: var(--primary); color: #fff; font-size: 13px; font-weight: 700;
  padding: 11px 15px; border-radius: 10px; cursor: pointer; white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: block; width: 100%; text-align: center; text-decoration: none;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 700;
  padding: 16px; border-radius: 14px; border: none; cursor: pointer;
}
.btn-ghost {
  display: block; width: 100%; text-align: center; background: var(--chip); color: var(--ink);
  font-size: 15px; font-weight: 600; padding: 14px; border-radius: 12px; border: none; cursor: pointer;
}
.sticky-cta {
  position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--border);
  padding: 14px 16px calc(16px + var(--safe-bottom));
}

/* ---------- Filter ---------- */
.filter-body { flex: 1; padding: 18px 16px; display: flex; flex-direction: column; gap: 22px; }
.filter-group-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 7px; }
.chips-wrap .chip { white-space: normal; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.toggle { width: 46px; height: 26px; border-radius: 999px; background: #DCE3EB; position: relative; cursor: pointer; border: none; transition: background .15s; flex: none; }
.toggle .knob { position: absolute; left: 2px; top: 2px; width: 22px; height: 22px; border-radius: 999px; background: #fff; transition: left .15s; }
.toggle.on { background: var(--green); }
.toggle.on .knob { left: 22px; }
.range-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.range-val { font-size: 15px; font-weight: 800; color: var(--primary); }
input[type="range"] { width: 100%; accent-color: var(--primary); }

/* ---------- Promokodlar ---------- */
.coupon {
  background: var(--card); border-radius: 16px; padding: 14px; box-shadow: var(--shadow);
}
.coupon.expired { opacity: 0.55; }
.coupon-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.coupon-brand { font-size: 15px; font-weight: 700; }
.coupon-desc { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.coupon-desc b { color: var(--ink); }
.coupon-code {
  flex: 1; font-size: 18px; font-weight: 800; letter-spacing: 2px; text-align: center;
  background: #F0F8FD; border: 1.5px dashed var(--primary); border-radius: 10px; padding: 10px;
}
.coupon-code.dead { color: var(--muted-2); background: #F7F9FB; border-color: #CDD6E0; text-decoration: line-through; }
.coupon-foot { font-size: 11px; color: var(--muted-2); margin-top: 9px; }

/* ---------- Onboarding ---------- */
.onboard { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px calc(24px + var(--safe-bottom)); gap: 20px; text-align: center; }
.onboard .logo { width: 84px; height: 84px; border-radius: 24px; background: linear-gradient(135deg, var(--primary), #5BB4EF); display: flex; align-items: center; justify-content: center; font-size: 42px; margin: 0 auto; }
.onboard h1 { font-size: 26px; margin: 0; }
.onboard p { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0; }
.onboard .steps { display: flex; flex-direction: column; gap: 12px; text-align: left; margin: 8px 0; }
.onboard .step { display: flex; gap: 12px; align-items: center; background: var(--card); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.onboard .step .emoji { font-size: 24px; }
.onboard .step .txt { font-size: 14px; }
.onboard .step .txt b { display: block; }
.onboard .step .txt span { color: var(--muted); font-size: 12px; }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 18px 16px; }
.avatar { width: 56px; height: 56px; border-radius: 999px; background: linear-gradient(135deg, var(--primary), #5BB4EF); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; font-weight: 700; }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-sub { font-size: 13px; color: var(--muted); }
.list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 14px; padding: 15px 16px; box-shadow: var(--shadow); font-size: 15px; cursor: pointer; }
.list-item .left { display: flex; align-items: center; gap: 12px; }
.list-item .val { color: var(--muted); font-size: 13px; }
.stat-row { display: flex; gap: 10px; padding: 0 16px; margin-bottom: 16px; }
.stat { flex: 1; background: var(--card); border-radius: 14px; padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat .num { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- States ---------- */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px; text-align: center; color: var(--muted); }
.empty .big { font-size: 48px; }
.skeleton { background: linear-gradient(90deg, #eef2f6 25%, #e4e9f0 37%, #eef2f6 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; border-radius: 18px; height: 230px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto;
  background: var(--card); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 9px 0 calc(10px + var(--safe-bottom)); z-index: 20;
}
.nav-item { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted-2); font-size: 10px; }
.nav-item svg { width: 21px; height: 21px; }
.nav-item.active { color: var(--primary); font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(90px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 14px; padding: 11px 18px; border-radius: 999px;
  z-index: 50; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
