/* Desim сотув: сотувчи иш қуроли. Тинч, мазмун биринчи; акцент битта (фирюза) */
:root {
  --ink: #1b2437;
  --ink-2: #44506a;
  --muted: #6b7690;
  --line: #e2e6ee;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3f0;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --err: #b42318;
  --err-soft: #fdecea;
  --ok: #0f766e;
  --radius: 12px;
  --radius-s: 8px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, white); outline-offset: 2px; }
.muted { color: var(--muted); }
.err { color: var(--err); }
.hidden, [hidden] { display: none !important; }

/* ---------- тугмалар ва майдонлар ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s); cursor: pointer; font-weight: 600;
  transition: background .15s, border-color .15s; }
.btn:hover { background: #f1f4f8; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #0b5f58; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); font-weight: 500; }
.btn.ghost:hover { background: #e9edf3; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.field input, .field select, .input { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); font-size: 15px; }
.field input:focus, .input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { color: var(--muted); font-size: 12px; }

/* ---------- юқори панель ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 16px; padding: 10px 24px; max-width: 1760px; margin: 0 auto; }
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; min-height: 44px; padding: 0 56px 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: 16px; }
.search input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 12px var(--font); color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.seg a { padding: 8px 14px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.seg a:hover { text-decoration: none; background: #f1f4f8; }
.seg a.on { background: var(--ink); color: #fff; }
.toolbar-select { min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0 10px; background: var(--surface); }
.userbar { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.userbar form { margin: 0; }
.cartbtn { position: relative; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
.badge[data-n="0"] { background: var(--line); color: var(--muted); }

/* ---------- категория чиплари ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 24px 0; max-width: 1760px; margin: 0 auto; }
.chip { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 14px; }
.chip:hover { text-decoration: none; border-color: var(--ink-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- каталог ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; padding: 16px 24px 40px; max-width: 1760px; margin: 0 auto; align-items: start; }
.result-line { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: #c9d0dc; }
.card.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.card .ph { position: relative; aspect-ratio: 4 / 3; background: #eceff4; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stock { position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 255, 255, .94); font-size: 12px; font-weight: 600; }
.stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.stock.low::before { background: #d97706; }
.stock.none::before { background: #9aa3b5; }
.stock.none { color: var(--muted); }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { font-size: 14.5px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.price { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.price small { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.price.none { font-size: 14px; font-weight: 500; color: var(--muted); }
.card .act { margin-top: auto; }
.stepper { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; border: 1px solid var(--accent); border-radius: var(--radius-s); background: var(--accent-soft); overflow: hidden; }
.stepper button { height: 40px; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--accent); }
.stepper button:hover { background: #cfe9e5; }
.stepper input { width: 100%; height: 40px; border: 0; background: transparent; text-align: center; font-weight: 700; font-size: 16px; }
.stepper input:focus { outline: none; background: #fff; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; padding: 24px 0 0; color: var(--muted); }
.empty { text-align: center; padding: 64px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h2 { font-size: 18px; margin-bottom: 6px; }

/* ---------- таклиф панели (саватча) ---------- */
.cart { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 92px); box-shadow: 0 10px 30px -18px rgba(27, 36, 55, .35); }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.cart-head h2 { font-size: 17px; }
.cart-mode { padding: 0 18px 12px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.cart-mode b { color: var(--ink); }
.cart-items { overflow: auto; padding: 4px 18px; min-height: 64px; }
.cart-empty { padding: 18px 0; color: var(--muted); font-size: 14px; }
.row { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef1f5; }
.row:last-child { border-bottom: 0; }
.row img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #eceff4; }
.row .nm { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .sub { font-size: 13px; color: var(--muted); }
.row .mini { display: inline-grid; grid-template-columns: 26px 38px 26px; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-top: 4px; }
.row .mini button { height: 28px; border: 0; background: #f4f6f9; cursor: pointer; }
.row .mini input { width: 38px; height: 28px; border: 0; text-align: center; font-weight: 600; }
.row .x { align-self: start; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 4px; }
.row .x:hover { color: var(--err); }
.row .sum { font-weight: 700; text-align: right; white-space: nowrap; }
.cart-foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; color: var(--ink-2); }
.total b { font-size: 24px; color: var(--ink); letter-spacing: -.01em; }
.reason { font-size: 13px; color: var(--muted); text-align: center; min-height: 18px; }
.success { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.success .ok { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ok); }
.success .ok i { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; min-width: 0; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--bg); font-size: 13px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--warn-soft); color: var(--warn); }
.pill.done { background: var(--accent-soft); color: var(--ok); }
.pill.off { background: #eceff4; color: var(--muted); }
.pill.bad { background: var(--err-soft); color: var(--err); }

.posts { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow: auto; }
.post { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px; background: #fafbfc; }
.post-hd { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.post-hd img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: #eceff4; }
.post-hd b { font-size: 13.5px; line-height: 1.3; }
.post-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.post details { margin-top: 8px; font-size: 13px; }
.post pre { white-space: pre-wrap; font: 12.5px/1.45 var(--font); margin: 6px 0 0; padding: 8px; background: var(--surface); border-radius: 6px; max-height: 180px; overflow: auto; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { margin-top: 3px; }
.tgstat { padding: 10px 12px; border-radius: var(--radius-s); background: var(--accent-soft); font-size: 14px; }
.tgstat.warn { background: var(--warn-soft); }
.tgstat.bad { background: var(--err-soft); color: var(--err); }
.tgstat .row2 { display: flex; gap: 6px; margin-top: 8px; }
.tgstat input { flex: 1; min-width: 0; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.alt summary { cursor: pointer; color: var(--ink-2); font-size: 13.5px; padding: 4px 0; }
.alt .linkbox { margin-top: 8px; }

/* ---------- кириш ва ички саҳифалар ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-size: 26px; letter-spacing: -.02em; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.page { max-width: 1040px; margin: 0 auto; padding: 24px; }
.page h1 { font-size: 24px; margin-bottom: 16px; letter-spacing: -.01em; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); background: #f8f9fb; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num { text-align: right; white-space: nowrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 20px; }
.panel h2 { font-size: 17px; margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.inline { display: inline; }
.inline input { min-height: 32px; width: 120px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- мижоз саҳифаси (телефондан очилади) ---------- */
.client { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }
.client .hd { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 18px; }
.client h1 { font-size: 22px; margin: 4px 0 2px; letter-spacing: -.01em; }
.client .lines { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.client .line { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid #eef1f5; }
.client .line:last-child { border-bottom: 0; }
.client .line img { width: 76px; height: 76px; border-radius: 8px; object-fit: cover; background: #eceff4; }
.client .line .nm { font-weight: 600; }
.client .line .sub { color: var(--muted); font-size: 14px; }
.client .line .sum { font-weight: 700; white-space: nowrap; }
.client .grand { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 14px; background: #f8f9fb; border-top: 1px solid var(--line); }
.client .grand b { font-size: 26px; }
.client .note { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); color: #0b4f49; }

/* ---------- мослашув ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .cart { position: static; max-height: none; }
  .topbar-in { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .userbar { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
