:root {
  --bg: #071016; --card: #0e1a21; --card2: #13232c; --line: #1c2f39; --input: #0b161d;
  --txt: #f4f7f8; --muted: #91a4ad; --dim: #5f7380;
  --red: #ff1738; --blue: #168cff; --green: #18d66b; --orange: #ffae22; --light: #dfe8ef;
  --r-lg: 18px; --r: 14px; --r-sm: 10px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--txt); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Inter, Arial, sans-serif;
  font-size: 15px; line-height: 1.35; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; background: var(--bg); }
@media (min-width: 520px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
#view { padding: calc(var(--safe-t) + 8px) 0 calc(var(--tabbar-h) + var(--safe-b) + 24px); }
body.no-tabbar #view { padding-bottom: calc(var(--safe-b) + 96px); }
body.no-tabbar #tabbar { display: none; }
.pad { padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.bold { font-weight: 800; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack > * + * { margin-top: 12px; }
.section-title { font-size: 17px; font-weight: 800; margin: 18px 16px 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Шапка главной */
.brandbar { display: flex; align-items: center; gap: 12px; padding: 6px 16px 12px; }
.brandbar .logo { flex: 1; min-width: 0; }
.logo-title { font-size: 26px; font-weight: 900; letter-spacing: .5px; line-height: 1; white-space: nowrap; }
.logo-title span { color: var(--red); }
.logo-sub { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: #c9d4da; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flag { border-radius: 3px; overflow: hidden; flex: none; }
.bell { position: relative; flex: none; width: 36px; height: 40px; display: grid; place-items: center; border: 0; background: none; }
.dot-badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center;
}

/* Поиск */
.search { margin: 0 16px; display: flex; align-items: center; gap: 8px; background: var(--light); color: #4f6370;
  border-radius: 12px; padding: 0 12px; height: 44px; }
.search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 14px; color: #0b161d; outline: none; min-width: 0; }
.search input::placeholder { color: #6d808c; }

/* Марки */
.brands { display: flex; justify-content: space-between; padding: 16px 16px 8px; overflow-x: auto; gap: 8px; scrollbar-width: none; }
.brands::-webkit-scrollbar { display: none; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: #dfe6ea; min-width: 52px;
  background: none; border: 0; padding: 4px; border-radius: 10px; }
.brand.active { color: #fff; background: var(--card2); }

/* Баннер модели */
.banner { position: relative; margin: 8px 16px 0; border-radius: var(--r-lg); overflow: hidden; height: 190px;
  background: linear-gradient(135deg, #1b3340, #0b151b); }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(4, 10, 14, .85)); }
.banner-title { position: absolute; left: 14px; bottom: 14px; z-index: 1; font-size: 19px; font-weight: 800; }
.banner-btn { position: absolute; right: 12px; bottom: 10px; z-index: 1; display: flex; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: 10px; border: 1.5px solid #6fb4ff; background: rgba(7, 16, 22, .7); font-size: 14px; font-weight: 600; }

/* Категории */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 16px 0; }
.cat { background: var(--card); border: 2px solid transparent; border-radius: 12px; overflow: hidden; text-align: center; padding-bottom: 8px; }
.cat.active { border-color: var(--red); }
.cat img, .cat .ph { width: 100%; height: 70px; object-fit: cover; }
.cat-name { font-size: 14px; font-weight: 700; margin-top: 6px; }

/* Верхняя панель экранов */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; min-height: 52px;
  padding: calc(var(--safe-t)) 8px 0; background: rgba(7, 16, 22, .94); backdrop-filter: blur(10px); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border: 0; background: none; display: grid; place-items: center; border-radius: 12px; }
.icon-btn.round { background: rgba(7, 16, 22, .65); border-radius: 50%; }
.icon-btn.active { color: var(--red); }

/* Чипы и сегменты */
.chips { display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 14px; border-radius: 10px;
  border: 0; background: var(--card2); color: #d5dee3; font-size: 13px; font-weight: 600; }
.chip.active { background: var(--red); color: #fff; }
.chip.light { background: var(--light); color: #0b161d; }
.seg { display: flex; gap: 6px; padding: 8px 16px; overflow-x: auto; }
.seg button { flex: none; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; color: #cfd8dd; }
.seg button.active { background: var(--light); color: #0b161d; border-color: var(--light); }
.seg.blue button.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Карточки деталей */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 16px; }
.pcard { background: var(--card); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.pcard .img { position: relative; aspect-ratio: 4 / 3; background: #1a2a33; }
.pcard .img { overflow: hidden; }
.pcard .img img, .pcard .img .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pcard .body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.pcard .name { font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .sub { font-size: 12px; color: var(--muted); }
.pcard .price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.price { font-size: 18px; font-weight: 900; }
.ph { display: grid; place-items: center; color: var(--dim); background: #13222a; }
.heart { border: 0; background: none; width: 32px; height: 32px; display: grid; place-items: center; color: #dfe6ea; padding: 0; }
.heart.on { color: var(--red); }

/* Бейджи, рейтинг, аватары */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 800; width: max-content; }
.badge.green { background: var(--green); color: #04210f; }
.badge.orange { background: var(--orange); color: #2a1a00; }
.badge.red { background: var(--red); color: #fff; }
.badge.blue { background: var(--blue); color: #fff; }
.badge.gray { background: #2a3b45; color: #dfe6ea; }
.rating { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: #dfe6ea; }
.rating svg { color: var(--orange); }
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: #22333d; }
.avatar.initials { display: grid; place-items: center; color: #fff; font-weight: 800; }
.seller-mini { display: flex; align-items: center; gap: 6px; margin-top: 4px; min-width: 0; }
.seller-mini .nm { font-size: 12px; font-weight: 600; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px; border: 0;
  border-radius: 12px; font-weight: 800; font-size: 15px; background: var(--card2); color: #fff; }
.btn.red { background: var(--red); }
.btn.blue { background: var(--blue); }
.btn.green { background: var(--green); color: #04210f; }
.btn.outline { background: transparent; border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn.lg { height: 56px; font-size: 18px; border-radius: 14px; }
.btn.sm { height: 36px; font-size: 14px; border-radius: 10px; padding: 0 12px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }
.btn-row > .field { flex: 1; min-width: 0; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 0; flex: none; }
.round-btn.green { background: var(--green); color: #fff; }
.cta { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 6;
  padding: 10px 16px calc(var(--safe-b) + 12px); background: linear-gradient(180deg, transparent, var(--bg) 30%); }

/* Карточка детали */
.gallery { position: relative; }
.gallery .slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 4px 12px 0; border-radius: var(--r); }
.gallery .slides::-webkit-scrollbar { display: none; }
.gallery .slides img, .gallery .slides .ph { flex: none; width: 100%; height: 260px; object-fit: cover; scroll-snap-align: start; }
.gallery .over { position: absolute; top: calc(var(--safe-t) + 14px); left: 20px; right: 20px; display: flex; justify-content: space-between; }
.gallery .over .icon-btn { color: #fff; }
.thumbs { display: flex; gap: 8px; padding: 10px 16px 0; overflow-x: auto; }
.thumbs button { flex: none; width: 72px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #13222a; }
.thumbs button.active { border-color: var(--blue); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.part-head { padding: 12px 16px 0; }
.part-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.part-price { font-size: 28px; font-weight: 900; margin-top: 10px; }
.specs { margin: 14px 16px 0; padding: 4px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.spec { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; color: #dfe6ea; }
.spec svg { color: var(--muted); flex: none; }

/* Карточки и списки */
.card { background: var(--card); border-radius: var(--r); padding: 12px; }
.cards { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.line-item { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: 12px; padding: 8px; }
.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: #13222a; }
.ph.thumb { display: grid; }
.line-item .nm { font-size: 14px; font-weight: 700; }
.qty { width: 28px; height: 28px; border: 1.5px solid var(--line); border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; }
.kv b { font-weight: 800; }
.note { background: var(--card); border-radius: 12px; padding: 10px 12px; color: #cfd8dd; font-size: 14px; }
.divider { height: 1px; background: var(--line); margin: 12px 16px; }
.menu-list { margin: 0 16px; background: var(--card); border-radius: var(--r); overflow: hidden; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; border: 0; background: none;
  text-align: left; border-bottom: 1px solid var(--line); font-size: 15px; }
.menu-list > :last-child { border-bottom: 0; }

/* Сбор у продавцов */
.pick-group { display: flex; gap: 8px; }
.pick-group .pin { color: var(--red); flex: none; align-self: flex-end; padding-bottom: 14px; }
.pick-card { flex: 1; background: var(--card); border-radius: var(--r); padding: 10px; }
.check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #3d5361; background: #dfe8ef33; flex: none; display: grid; place-items: center; }
.check.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Cargo */
.checklist .ci { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.checklist .ci:last-child { border-bottom: 0; }
.ci .mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #5f7380; display: grid; place-items: center; flex: none; }
.ci .mark.on { background: var(--green); border-color: var(--green); color: #04210f; }
.ci .cnt { margin-left: auto; color: var(--muted); font-weight: 700; }

/* Формы */
.form { padding: 0 16px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--dim); margin-top: 4px; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 11px 12px; border-radius: 12px; border: 1px solid #29414c;
  background: var(--input); color: #fff; font: inherit; outline: none; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--blue); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid .slot { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card2); display: grid; place-items: center; border: 1.5px dashed #3d5361; }
.photo-grid .slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid .slot .del { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; }
.auth-box { padding: 24px 16px; }
.auth-box .logo-title { text-align: center; }

/* Меню */
#tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 10;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; align-items: stretch;
  background: rgba(9, 18, 24, .97); border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: #a9b8c0; position: relative; }
.tab.active { color: var(--blue); }
.tab .dot-badge { top: 4px; right: calc(50% - 22px); }
.fab-wrap { flex: 1; display: grid; place-items: center; }
.fab { width: 58px; height: 58px; margin-top: -22px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(255, 23, 56, .45); border: 4px solid var(--bg); position: relative; }
.fab .dot-badge { top: -4px; right: -4px; background: #fff; color: var(--red); }

/* Состояния */
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #23363f; border-top-color: var(--blue); margin: 60px auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 48px 24px; }
.empty .btn { margin-top: 14px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px); opacity: 0;
  background: #f4f7f8; color: #071016; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; z-index: 50;
  transition: .25s; pointer-events: none; max-width: 90%; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Нижняя шторка */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 85vh; overflow: auto; background: var(--card); border-radius: 20px 20px 0 0; padding: 14px 16px calc(var(--safe-b) + 16px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head h3 { margin: 0; font-size: 18px; }
.option { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 13px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 15px; text-align: left; }
.option.active { color: var(--blue); font-weight: 700; }

/* Языки: выбор языка и письмо справа налево (арабский, урду, фарси) */
.lang-list { display: flex; flex-direction: column; gap: 10px; }
.lang-btn { height: 54px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: #fff; font-size: 19px; font-weight: 700; }
.lang-btn.active { border-color: var(--blue); background: #12304d; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.menu-list a, .menu-list button, .option { text-align: start; }
[dir="rtl"] input[type="tel"], [dir="rtl"] input[type="number"] { direction: ltr; text-align: right; }
[dir="rtl"] body { font-family: Tahoma, "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif; }
[lang="hi"] body { font-family: "Nirmala UI", "Noto Sans Devanagari", -apple-system, "Segoe UI", Arial, sans-serif; }

/* Счётчики админа */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 16px 6px; }
.stat { background: var(--card); border-radius: var(--r); padding: 10px 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 24px; font-weight: 900; }
.stat span { font-size: 12px; color: var(--muted); line-height: 1.2; }
