/* BUYACAR — light theme */
:root {
  --ink: #0F172A; --text: #334155; --muted: #64748B; --line: #EEF2F6; --line-2: #E2E8F0;
  --bg: #F8FAFC; --surface: #FFFFFF; --photo: #EEF2F7;
  --accent: #2563EB; --accent-ink: #1D4ED8; --accent-soft: #EFF6FF;
  --green: #166534; --green-soft: #DCFCE7; --amber: #92400E; --amber-soft: #FEF3C7;
  --red: #991B1B; --red-soft: #FEE2E2; --blue: #1E40AF; --blue-soft: #DBEAFE;
  --radius: 18px;
}
body.p-admin { --accent: #4F46E5; --accent-ink: #4338CA; --accent-soft: #EEF2FF; }
body.p-seller { --accent: #1D4ED8; --accent-ink: #1D4ED8; --accent-soft: #EFF6FF; }
body.p-buyer { --accent: #0F766E; --accent-ink: #0F766E; --accent-soft: #F0FDFA; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* System fonts: nothing to download, text appears instantly (all support Uzbek Cyrillic) */
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--accent-ink); }
h1 { margin: 0; font-size: 26px; font-weight: 700; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.brand { font-weight: 800; letter-spacing: .05em; color: var(--accent-ink); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* layout: sidebar portals */
.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 232px; background: var(--surface); border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 900px) { .side { flex: 0 0 248px; position: sticky; top: 0; height: 100vh; } }
.side .brand { font-size: 20px; padding: 0 12px; }
.side .brand span { font-weight: 500; font-size: 13px; letter-spacing: 0; color: var(--muted); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: block; padding: 10px 12px; border-radius: 10px; color: #475569; text-decoration: none; font-size: 15px; }
.side nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side .me { margin-top: auto; padding: 0 12px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 700px) { .main { padding: 20px 16px; } .side { padding: 16px; gap: 12px; } .side nav { flex-direction: row; flex-wrap: wrap; } }

.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card.hl { border: 2px solid var(--accent); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.li.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.li b { display: block; font-size: 15px; }
.li span.sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 15px; }

/* controls */
.btn { min-height: 44px; padding: 0 18px; border-radius: 12px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; border: 1px solid #CBD5E1; background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.orange { background: #B45309; border-color: #B45309; color: #fff; }
.btn.danger { border-color: #FCA5A5; color: var(--red); }
.btn.ghost { border-color: var(--accent); color: var(--accent-ink); }
.btn.big { min-height: 52px; font-size: 16px; width: 100%; white-space: normal; text-align: center; padding: 8px 14px; line-height: 1.3; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn:disabled { background: #E2E8F0; border-color: #E2E8F0; color: var(--muted); cursor: not-allowed; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
form.inline { display: inline; margin: 0; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.f input, .f select, .f textarea, input.inp { height: 44px; border: 1px solid #CBD5E1; border-radius: 10px; padding: 0 12px; font: inherit; font-size: 15px; font-weight: 400; background: #fff; color: var(--ink); width: 100%; }
.f textarea { height: auto; padding: 10px 12px; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pw { display: flex; gap: 6px; }
.pw input { flex: 1 1 auto; min-width: 0; }

.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.teal { background: #CCFBF1; color: #115E59; }
.chip.gray { background: #F1F5F9; color: #475569; }
.chip.dark { background: var(--ink); color: #fff; }
.chip.type-fixed { background: #fff; color: var(--ink); border: 1px solid var(--line-2); }
.chip.type-up { background: var(--green-soft); color: var(--green); }
.chip.type-down { background: var(--amber-soft); color: var(--amber); }

.note { padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.note.ok { background: var(--green-soft); color: #14532D; }
.note.err { background: var(--red-soft); color: var(--red); font-weight: 600; }
.note.info { background: var(--accent-soft); color: var(--ink); }
.note.warn { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.messages { display: flex; flex-direction: column; gap: 8px; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; font-weight: 600; }
.t td { padding: 10px 12px; border-top: 1px solid #F1F5F9; }
.t tr.hl td { background: #F0FDF4; }
.scroll { overflow-x: auto; border: 1px solid var(--line-2); border-radius: 12px; }

/* car cards & photos */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.cc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; color: var(--ink); text-decoration: none; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.photo { position: relative; aspect-ratio: 16 / 10; background: var(--photo); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo svg { width: 80%; height: auto; }
.photo .chip { position: absolute; left: 12px; top: 12px; }
.photo .count { position: absolute; right: 12px; bottom: 12px; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.92); font-size: 12px; font-weight: 600; color: var(--text); }
.cc .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.cc .name { font-size: 17px; font-weight: 700; }
.cc .price { font-size: 20px; font-weight: 800; margin-top: 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cc .price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.cc .extra { font-size: 13px; font-weight: 600; color: #B45309; }
.hero { aspect-ratio: 21 / 8; max-height: 300px; background: var(--photo); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero svg { height: 82%; width: auto; }

/* buyer: phone first */
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1180px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .l { display: flex; align-items: center; gap: 16px; }
.topbar .brand { font-size: 19px; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 8px 14px; border-radius: 999px; color: #475569; text-decoration: none; font-size: 15px; font-weight: 500; }
.topnav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; border: 0; cursor: pointer; font-family: inherit; }
.back { width: 40px; height: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: center; background: #F1F5F9; color: var(--ink); text-decoration: none; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 96px; display: flex; flex-direction: column; gap: 16px; }
.tabbar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: #fff; border-top: 1px solid var(--line); padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); justify-content: space-around; }
.tabbar a { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.tabbar a.on { color: var(--accent-ink); font-weight: 700; }
@media (max-width: 700px) { .topnav { display: none; } .tabbar { display: flex; } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chips a { flex: 0 0 auto; height: 40px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; text-decoration: none; background: #fff; color: var(--text); border: 1px solid var(--line-2); }
.chips a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.search { width: 100%; max-width: 520px; height: 48px; border: 1px solid var(--line-2); border-radius: 14px; padding: 0 16px; font: inherit; font-size: 16px; background: #fff; }

.detail { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.detail .left { flex: 3 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.detail .right { flex: 1 1 360px; min-width: 0; }
.gallery { position: relative; aspect-ratio: 4 / 3; background: var(--photo); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .zoom { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.photo img, .hero img, .prow .pic img { height: 100%; }
img { max-width: 100%; }
.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.gallery svg { width: 86%; height: auto; }
.gallery .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(255,255,255,.92); font-size: 22px; cursor: pointer; }
.gallery .prev { left: 10px; } .gallery .next { right: 10px; }
.gallery .count { position: absolute; right: 12px; bottom: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(15,23,42,.7); color: #fff; font-size: 12px; font-weight: 600; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; }
.thumbs button { flex: 0 0 72px; height: 54px; border-radius: 10px; border: 2px solid transparent; padding: 0; overflow: hidden; background: #E2E8F0; cursor: pointer; }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles div { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tiles span { display: block; font-size: 12px; color: var(--muted); }
.tiles b { display: block; margin-top: 2px; font-size: 16px; }
@media (max-width: 700px) {
  .detail { gap: 16px; }
  .gallery { border-radius: 0; margin: -20px -16px 0; }
}

/* bid panel */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.panel .big-price { font-size: 30px; font-weight: 800; }
.prog { position: relative; height: 10px; border-radius: 5px; background: #E2E8F0; }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: #16A34A; }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hist { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; font-size: 13px; padding: 6px 10px; border-radius: 8px; background: #F8FAFC; }
.hist.me { background: var(--green-soft); }
.queue-box { padding: 16px; border-radius: 12px; background: #F0FDFA; border: 1px solid #99F6E4; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; color: #134E4A; }
.mono { font-variant-numeric: tabular-nums; }

/* purchases */
.prow { display: flex; gap: 12px; align-items: center; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; }
.prow .pic { flex: 0 0 108px; height: 76px; border-radius: 12px; background: var(--photo); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.prow .pic img { width: 100%; height: 100%; object-fit: cover; }
.prow .pic svg { width: 92%; height: auto; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 24px; }
.login .logo { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); }
.login .logo .brand { font-size: 32px; }
.login .box { background: #fff; border: 1px solid var(--line-2); border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }

/* add car */
.radios { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.radio { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; cursor: pointer; font-size: 14px; border: 1px solid #CBD5E1; background: #fff; }
.radio:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); }
.radio .t { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.ico { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: #fff; border: 1px solid #CBD5E1; }
.sale-fields { display: none; }
.sale-fields.on { display: grid; }
.drop { border: 2px dashed #CBD5E1; border-radius: 12px; padding: 20px; text-align: center; color: var(--muted); cursor: pointer; background: #F8FAFC; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.previews img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
