:root {
  --bg: #f7f3ec;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #6b7280;
  --line: #e8e1d5;
  --blue: #1d3f8f;
  --blue-2: #2c58bd;
  --gold: #c99a2e;
  --green: #1f8a5b;
  --red: #c2412d;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(29, 36, 51, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Manrope, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 15px; line-height: 1.45;
  padding-bottom: 90px;
}
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
[hidden] { display: none !important; }

.announce {
  background: var(--blue); color: #fff; text-align: center;
  padding: 8px 48px 8px 14px; font-size: 13px; font-weight: 600; position: relative;
}
.announce-x {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 36px; border: 0; background: none; color: #fff; font-size: 24px; line-height: 1;
}

/* Header */
.header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: rgba(247, 243, 236, .92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.logo {
  font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 20px;
  color: var(--blue); text-decoration: none; white-space: nowrap;
}
.logo-mark { color: var(--gold); }
.search { flex: 1; }
.search input {
  width: 100%; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; outline: none;
}
.search input:focus { border-color: var(--blue-2); }
.cart-btn {
  position: relative; border: 0; background: var(--blue); color: #fff;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  flex-shrink: 0;
}
.badge {
  position: absolute; top: -4px; right: -4px; background: var(--gold); color: #fff;
  font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px;
  display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--bg);
}
.badge.pop { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }

.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.hero { padding: 22px 0 8px; }
.hero h1 {
  font-family: Fraunces, Georgia, serif; font-size: clamp(26px, 5vw, 42px);
  line-height: 1.1; margin: 0 0 6px;
}
.hero h1 em { color: var(--blue); font-style: italic; }
.hero p { margin: 0; color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 14px; border-radius: 999px; white-space: nowrap; font-weight: 600; font-size: 13px;
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Mahsulotlar — telefonda 2 ta yonma-yon */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); } }


.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow); isolation: isolate;
}
.card-img {
  aspect-ratio: 4 / 5; background-color: #f1ece4; background-size: cover; background-position: center; cursor: pointer; position: relative; overflow: hidden;
}
.card-img img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; transition: transform .3s; }
.card-img:hover img { transform: scale(1.04); }
.tag-opt {
  position: absolute; left: 0; top: 0; background: var(--gold); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 0 0 10px 0;
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.card-name { font-weight: 700; font-size: 14px; line-height: 1.3; cursor: pointer; }
.price { font-weight: 800; font-size: 16px; color: var(--ink); }
.opt { font-size: 12px; color: var(--green); font-weight: 600; }
.card-actions { margin-top: auto; padding-top: 8px; }

.btn {
  border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 700;
  background: var(--blue); color: #fff; width: 100%; transition: background .15s;
}
.btn:hover { background: var(--blue-2); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--blue); border: 1px solid var(--blue); }

.stepper {
  display: flex; align-items: center; justify-content: space-between;
  background: #eef2fb; border-radius: 12px; overflow: hidden;
}
.stepper button {
  border: 0; background: transparent; width: 40px; height: 40px;
  font-size: 20px; font-weight: 700; color: var(--blue);
}
.stepper input {
  width: 44px; text-align: center; border: 0; background: transparent; font-weight: 700;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Pastki savat paneli */
.cart-bar {
  position: fixed; left: 12px; right: 84px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 30; border: 0; border-radius: 16px; background: var(--ink); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: rise .25s ease;
}
.cart-bar { white-space: nowrap; font-size: 14px; }
.cart-bar-count { background: var(--gold); color: #fff; border-radius: 10px; min-width: 24px; height: 24px; display: grid; place-items: center; font-weight: 800; font-size: 12px; padding: 0 6px; }
.cart-bar-total { font-weight: 800; margin-right: auto; }
.cart-bar-go { color: var(--gold); font-weight: 700; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 720px) { .cart-bar { left: auto; right: 90px; width: 380px; } }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(20, 24, 33, .55);
  display: grid; place-items: end center;
}
@media (min-width: 720px) { .modal { place-items: center; } }
.modal-card {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  border-radius: 20px 20px 0 0; position: relative; animation: rise .25s ease;
}
@media (min-width: 720px) { .modal-card { border-radius: 20px; } }
.product-modal img { width: 100%; height: min(62vh, 560px); object-fit: contain; display: block; background: #fff; }
.pm-body { padding: 16px 18px 22px; display: grid; gap: 8px; }
.pm-body h3 { margin: 0; font-family: Fraunces, Georgia, serif; font-size: 22px; }
.pm-desc { color: var(--muted); margin: 0; }
.opt-box {
  background: #eaf6ef; color: var(--green); border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 600;
}
.close {
  position: absolute; right: 12px; top: 10px; z-index: 2; border: 0; background: rgba(255,255,255,.9);
  width: 36px; height: 36px; border-radius: 50%; font-size: 24px; line-height: 1; color: var(--ink);
}

/* Savat drawer */
.drawer-wrap { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20, 24, 33, .55); }
.drawer {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(440px, 100%);
  background: var(--bg); display: flex; flex-direction: column; animation: slide .25s ease;
}
@keyframes slide { from { transform: translateX(100%); } }
.drawer-head { position: relative; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-family: Fraunces, Georgia, serif; }
.drawer-head .close { top: 12px; }
.drawer-body { overflow: auto; padding: 14px 18px 30px; flex: 1; }

.line {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px; background: #fff;
  border-radius: 14px; padding: 10px; margin-bottom: 10px;
}
.line img { width: 64px; height: 80px; object-fit: contain; border-radius: 0; background: #fff; border: 1px solid var(--line); }
.line-name { font-weight: 700; font-size: 14px; }
.line-meta { font-size: 12px; color: var(--muted); }
.line-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 8px; }
.line-row .stepper button { width: 32px; height: 32px; font-size: 18px; }
.line-row .stepper input { width: 36px; }
.line-sum { font-weight: 800; }
.hint { font-size: 12px; color: var(--gold); font-weight: 600; margin-top: 4px; }
.hint.ok { color: var(--green); }
.remove { border: 0; background: none; color: var(--red); font-size: 12px; padding: 0; }

.totals { background: #fff; border-radius: 14px; padding: 12px 14px; margin: 12px 0; display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-weight: 800; font-size: 18px; border-top: 1px dashed var(--line); padding-top: 8px; }
.discount { color: var(--green); }

.promo-row { display: flex; gap: 8px; }
.promo-row input { flex: 1; text-transform: uppercase; }
.promo-row .btn { width: auto; }
.msg { font-size: 13px; margin: 6px 0 0; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }

.form { display: grid; gap: 10px; margin-top: 14px; }
.form h3 { margin: 6px 0 0; font-size: 16px; }
.field, .promo-row input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; outline: none;
}
.field:focus, .promo-row input:focus { border-color: var(--blue-2); }
textarea.field { resize: vertical; min-height: 70px; }

.success { text-align: center; padding: 30px 10px; }
.success .big { font-size: 56px; }
.success h3 { font-family: Fraunces, Georgia, serif; font-size: 24px; margin: 6px 0; }

/* Support */
.support-btn {
  position: fixed; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 31;
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--gold); color: #fff;
  display: grid; place-items: center; box-shadow: 0 10px 26px rgba(201,154,46,.45);
}
.support-btn .dot {
  position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--red); border: 2px solid #fff;
}
.support {
  position: fixed; z-index: 70; right: 16px; bottom: calc(82px + env(safe-area-inset-bottom));
  width: min(370px, calc(100% - 32px)); height: min(520px, 70vh); background: #fff;
  border-radius: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); display: flex; flex-direction: column;
  overflow: hidden; animation: rise .2s ease;
}
.support-head { background: var(--blue); color: #fff; padding: 14px 16px; position: relative; }
.support-head small { display: block; opacity: .8; font-size: 12px; }
.support-head .close { top: 12px; background: rgba(255,255,255,.15); color: #fff; }
.support-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-list { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: #f6f7fb; }
.bubble { max-width: 80%; padding: 9px 12px; border-radius: 14px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble small { display: block; font-size: 10px; opacity: .6; margin-top: 3px; }
.bubble.client { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.bubble.admin { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; }
.chat-input .btn { width: auto; }
.chat-start { padding: 18px; display: grid; gap: 10px; }
.chat-empty { color: var(--muted); text-align: center; font-size: 13px; margin: auto; }

.toast {
  position: fixed; left: 50%; top: 70px; transform: translate(-50%, -20px); z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 380px) {
  .logo { font-size: 17px; }
  .card-body { padding: 8px 10px 10px; }
  .price { font-size: 15px; }
}

/* Buyurtmalarim tugmasi */
.icon-btn {
  border: 1px solid var(--line); background: #fff; color: var(--blue);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
}

/* Buyurtmalar tarixi */
.order-card { background: #fff; padding: 14px; margin-bottom: 12px; display: grid; gap: 10px; }
.order-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.order-date { font-size: 12px; color: var(--muted); }
.status-pill { justify-self: start; font-size: 12px; font-weight: 700; padding: 4px 10px; background: #eef2fb; color: var(--blue); }
.status-pill.s-yangi { background: #fdf3dc; color: #946d12; }
.status-pill.s-yetkazildi { background: #eaf6ef; color: var(--green); }
.status-pill.s-bekor { background: #fbe9e6; color: var(--red); }
.order-items { display: grid; gap: 8px; }
.order-item { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.order-item img, .order-item .ph { width: 48px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.order-row { display: flex; justify-content: space-between; }
.order-row.grand { font-weight: 800; font-size: 16px; border-top: 1px dashed var(--line); padding-top: 8px; }

/* Rasm orqasida o'sha rasmning xiralashtirilgan nusxasi — rasm to'liq ko'rinadi, ramka bo'sh qolmaydi */
/* Rasm orqasida o'sha rasmning xiralashtirilgan nusxasi — rasm to'liq ko'rinadi, ramka bo'sh qolmaydi */
.card-img::before {
  content: ''; position: absolute; inset: -30px; background: inherit;
  filter: blur(22px) brightness(.92); transform: scale(1.1);
}

.stock { font-size: 12px; color: var(--muted); font-weight: 600; }
.stock.out { color: var(--red); font-weight: 700; }

.more { display: grid; justify-items: center; gap: 6px; padding: 22px 0 10px; }
.more .btn { width: auto; min-width: 260px; padding: 13px 22px; }
.more small { color: var(--muted); }

.tag-opt { z-index: 2; }

/* Gramm bilan sotiladigan mahsulotlar */
.per { font-weight: 500; color: var(--muted); font-size: 12px; }
.qty-wrap { display: flex; align-items: baseline; justify-content: center; gap: 2px; flex: 1; }
.qty-unit { font-size: 12px; color: var(--muted); font-weight: 600; }
.stepper input { width: 52px; }
.gram-note { font-size: 13px; color: var(--muted); }
.gram-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.gchip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-weight: 700; font-size: 13px; color: var(--ink); }
.gchip.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- Kirish (telefon + ism + familiya) ---------- */
.field.readonly { background: #f3f1ec; color: #555; display: flex; align-items: center; }
.login-form h3 { margin-bottom: 2px; }
.link-btn { background: none; border: 0; padding: 0; color: #1f3a8a; font: inherit; font-size: 14px; cursor: pointer; text-decoration: underline; }
.account-row { font-size: 14px; color: #555; margin: 0 0 12px; }

/* Tepadagi "Kirish" tugmasi */
.account-btn {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--blue); background: #fff; color: var(--blue);
  font: inherit; font-weight: 600; cursor: pointer; max-width: 170px;
}
.account-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn.in { background: #eef2fb; border-color: var(--line); }
@media (max-width: 560px) {
  .account-btn { padding: 0 12px; }
  .account-btn.in span { display: none; }
  .logo { font-size: 17px; margin-right: auto; }
  .header { flex-wrap: wrap; row-gap: 8px; }
  .search { order: 10; flex-basis: 100%; } /* telefonda qidiruv ikkinchi qatorda — tugmalar sig'sin */
}
