:root {
  --accent: #ff5722;
  --accent-2: #ff8a3d;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #8a8f98;
  --line: #eceef1;
  --ok: #16a34a;
  --shadow: 0 6px 22px rgba(0, 0, 0, .08);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a; --card: #1d2026; --text: #f2f3f5; --muted: #9aa0aa; --line: #2a2e36;
    --shadow: 0 6px 22px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: 86px;
}
.hidden { display: none !important; }

/* ===== Til ekrani ===== */
.lang-screen {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(160deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lang-card { text-align: center; color: #fff; }
.logo-big { font-size: 80px; }
.lang-card h1 { font-size: 30px; margin: 6px 0; }
.lang-card p { opacity: .9; margin-bottom: 22px; }
.lang-btn {
  display: block; width: 240px; margin: 10px auto; padding: 14px;
  border: none; border-radius: 14px; background: #fff; color: var(--text);
  font-size: 16px; font-weight: 600; box-shadow: var(--shadow);
}

/* ===== Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.brand-logo { font-size: 22px; }
.lang-toggle {
  border: 1px solid var(--line); background: transparent; color: var(--text);
  border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: 13px;
}

/* ===== Kategoriyalar ===== */
.cats {
  position: sticky; top: 56px; z-index: 9;
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px;
  background: var(--bg); -ms-overflow-style: none; scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 9px 15px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== Katalog ===== */
.catalog { padding: 4px 16px 20px; }
.cat-title { font-size: 17px; font-weight: 800; margin: 18px 2px 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card .ph {
  height: 120px; background: linear-gradient(135deg, #fff2ec, #ffe0d0);
  display: flex; align-items: center; justify-content: center; font-size: 46px;
}
.card img.ph { object-fit: cover; width: 100%; }
.card .info { padding: 10px 12px 12px; display: flex; flex-direction: column; flex: 1; }
.card .name { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.card .desc { color: var(--muted); font-size: 12px; margin: 3px 0 8px; flex: 1; }
.card .bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .price { font-weight: 800; font-size: 15px; }
.add {
  border: none; background: var(--accent); color: #fff; border-radius: 10px;
  width: 38px; height: 38px; font-size: 22px; font-weight: 700; flex: 0 0 auto;
}
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 30px; height: 30px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-size: 18px; font-weight: 700; }
.qty .c { min-width: 18px; text-align: center; font-weight: 700; }

/* ===== Savatcha bar ===== */
.cart-bar {
  position: fixed; left: 14px; right: 14px; bottom: 14px; z-index: 30;
  height: 54px; border: none; border-radius: 16px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
  box-shadow: 0 8px 24px rgba(255, 87, 34, .4);
}
.cart-bar-left { display: flex; align-items: center; gap: 8px; }
.badge { background: rgba(255,255,255,.25); border-radius: 999px; padding: 2px 9px; font-size: 13px; }

/* ===== Modal / sheet ===== */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; }
.sheet {
  background: var(--card); width: 100%; border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto; position: relative;
}
.sheet.tall { min-height: 70vh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head h2, .success h2 { font-size: 19px; }
.x { position: absolute; top: 14px; right: 14px; border: none; background: var(--bg); color: var(--muted); width: 32px; height: 32px; border-radius: 50%; font-size: 16px; }

/* Mahsulot modal */
#pm-body .pm-img { height: 200px; border-radius: 16px; background: linear-gradient(135deg, #fff2ec, #ffe0d0); display: flex; align-items: center; justify-content: center; font-size: 80px; margin-bottom: 14px; overflow: hidden; }
#pm-body img.pm-img { object-fit: cover; width: 100%; }
#pm-body h2 { font-size: 21px; }
#pm-body .pm-desc { color: var(--muted); margin: 6px 0 14px; }
#pm-body .pm-foot { display: flex; align-items: center; justify-content: space-between; }
#pm-body .pm-price { font-size: 22px; font-weight: 800; }

/* Savatcha ichi */
#cart-items .ci { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
#cart-items .ci .ci-emoji { width: 44px; height: 44px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 24px; overflow: hidden; flex: 0 0 auto; }
#cart-items .ci img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; }
#cart-items .ci .ci-name { flex: 1; font-size: 14px; }
#cart-items .ci .ci-name small { color: var(--muted); }

/* Forma */
.form { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.lbl { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.form input, .form textarea {
  width: 100%; padding: 13px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font-size: 15px;
}
.loc-btns { display: flex; gap: 8px; }
.ghost { flex: 1; padding: 12px; border-radius: 12px; border: 1px dashed var(--accent); background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; }
.map { position: relative; height: 230px; border-radius: 14px; overflow: hidden; margin-top: 4px; border: 1px solid var(--line); }
.hint { font-size: 12px; color: var(--muted); }

/* Manzil qidiruv */
.search-wrap { position: relative; }
.addr-search { width: 100%; padding: 13px 13px 13px 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 11px center; color: var(--text); font-size: 15px; }
.addr-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; }
.addr-results .res { padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.addr-results .res:last-child { border-bottom: none; }
.addr-results .res:active { background: var(--bg); }
.addr-results .res b { display: block; font-weight: 600; }
.addr-results .res small { color: var(--muted); font-size: 12px; }
.addr-results .res.empty { color: var(--muted); text-align: center; }

/* Tanlangan manzil */
.addr-text { margin-top: 8px; padding: 11px 13px; border-radius: 12px; background: #fff1ec; border: 1px solid #ffd9cc; font-size: 13.5px; color: var(--text); display: flex; gap: 8px; align-items: flex-start; }
@media (prefers-color-scheme: dark) { .addr-text { background: #2a1f1b; border-color: #4a342b; } }
.addr-text::before { content: "📍"; }

/* Xarita markaziy pin (drag o'rniga barqaror) */
.map-center-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); font-size: 34px; z-index: 400; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }

.pay-opts { display: flex; gap: 8px; }
.pay { flex: 1; }
.pay input { display: none; }
.pay span { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-size: 13.5px; font-weight: 600; }
.pay input:checked + span { border-color: var(--accent); background: #fff1ec; color: var(--accent); }
@media (prefers-color-scheme: dark) { .pay input:checked + span { background: #2a1f1b; } }

.totals { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.totals .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; color: var(--muted); }
.totals .row.total { color: var(--text); font-size: 18px; font-weight: 800; margin-top: 4px; }

.primary { margin-top: 14px; height: 52px; border: none; border-radius: 14px; background: var(--accent); color: #fff; font-size: 16px; font-weight: 700; width: 100%; }
.primary:disabled { opacity: .55; }

/* Success */
.success { text-align: center; padding: 20px 6px; }
.success-emoji { font-size: 64px; }
.success p { color: var(--muted); margin: 8px 0 16px; }
.status-track { display: flex; flex-direction: column; gap: 8px; margin: 0 0 18px; text-align: left; }
.status-track .st { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 14px; }
.status-track .st.done { background: #eafaf0; color: var(--ok); font-weight: 600; }
@media (prefers-color-scheme: dark) { .status-track .st.done { background: #142a1d; } }
