/* Promaster MI — dashboard uslubi. Ranglar tokenlar orqali: kunduzgi va tungi rejim. */
:root {
  color-scheme: light;
  --brand: #1F3A5F; --accent: #F28C28;
  --bg: #f4f4f1; --surface: #ffffff; --surface-2: #f8f8f6; --border: #e3e2dc;
  --text: #16181d; --text-2: #52514e; --muted: #85847d;
  --pos: #1a7f4e; --neg: #c0392b; --cheaper: #2a78d6; --pricier: #e34948;
  --pos-bg: #e6f4ec; --neg-bg: #fbe9e7; --warn-bg: #fff6e5; --warn: #9a5b00;
  --nav-bg: #1F3A5F; --nav-text: #dfe6ef; --nav-active: rgba(255,255,255,.12);
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --radius: 10px;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --grid: #e6e5e0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121314; --surface: #1a1a19; --surface-2: #222221; --border: #34342f;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
    --pos: #4cc38a; --neg: #ff7a6b; --cheaper: #3987e5; --pricier: #e66767;
    --pos-bg: #16302a; --neg-bg: #3a1f1c; --warn-bg: #362a14; --warn: #f0b34a;
    --nav-bg: #0e1a29; --shadow: none; --grid: #34342f;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121314; --surface: #1a1a19; --surface-2: #222221; --border: #34342f;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
  --pos: #4cc38a; --neg: #ff7a6b; --cheaper: #3987e5; --pricier: #e66767;
  --pos-bg: #16302a; --neg-bg: #3a1f1c; --warn-bg: #362a14; --warn: #f0b34a;
  --nav-bg: #0e1a29; --shadow: none; --grid: #34342f;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--cheaper); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 0 0 8px; }

/* Layout */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav-bg); color: var(--nav-text); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 16px; }
.sidebar .logo i { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-style: normal; color: var(--brand); font-weight: 800; }
.sidebar nav a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 8px; color: var(--nav-text); margin-bottom: 2px; }
.sidebar nav a:hover { background: var(--nav-active); text-decoration: none; }
.sidebar nav a.active { background: var(--nav-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar .ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar .right { display: flex; gap: 8px; align-items: center; }
.content { padding: 20px 24px 40px; max-width: 1500px; }
.menu-btn { display: none; }

/* Components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { color: var(--text-2); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.good { color: var(--pos); } .btn.bad { color: var(--neg); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.badge.pos { background: var(--pos-bg); color: var(--pos); border-color: transparent; }
.badge.neg { background: var(--neg-bg); color: var(--neg); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.up { color: var(--pricier); font-weight: 600; } .down { color: var(--cheaper); font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.mb { margin-bottom: 16px; } .mt { margin-top: 16px; }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; font-size: 11px; color: var(--text-2); gap: 3px; }
input, select, textarea { font: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--cheaper) 40%, transparent); border-color: var(--cheaper); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-weight: 600; color: var(--text-2); background: var(--surface-2); padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr:hover td { background: var(--surface-2); }
.t .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pagination { display: flex; gap: 6px; margin-top: 12px; align-items: center; }

/* Misc */
.alert-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.alert-item:last-child { border-bottom: 0; }
.alert-item .ic { font-size: 18px; }
.rec { border-left: 3px solid var(--accent); padding: 8px 12px; margin-bottom: 10px; background: var(--surface-2); border-radius: 0 8px 8px 0; }
.summary-text p { margin: 0 0 8px; }
.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.messages li { padding: 10px 14px; border-radius: 8px; margin-bottom: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.messages .success { background: var(--pos-bg); } .messages .error { background: var(--neg-bg); } .messages .warning { background: var(--warn-bg); }
.chart { width: 100%; height: 320px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--text-2); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.post .txt { font-size: 13px; color: var(--text-2); max-height: 7.5em; overflow: hidden; }
.post .stats { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; }
.msg.q { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.a { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg .src { font-size: 11px; color: var(--muted); margin-top: 6px; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; } .chat-form textarea { flex: 1; resize: vertical; min-height: 44px; }
.offers { font-size: 12px; color: var(--text-2); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal.open { display: flex; }
.modal .box { background: var(--surface); border-radius: 12px; width: min(900px, 100%); padding: 16px; max-height: 90vh; overflow: auto; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.errorlist { color: var(--neg); font-size: 12px; margin: 2px 0; padding-left: 16px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--pos); } .dot.fail { background: var(--neg); } .dot.idle { background: var(--muted); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(380px, 100%); }
.login input { width: 100%; margin-bottom: 10px; }
.code-input { font-size: 26px; letter-spacing: 8px; text-align: center; }

@media (max-width: 1100px) { .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; z-index: 40; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .g2, .g3, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; } .topbar { padding: 10px 16px; }
  .topbar .who { display: none; } .topbar h1 { font-size: 17px; } .topbar .right { gap: 6px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .msg { max-width: 92%; }
}
.post-img { display: block; margin: -12px -12px 4px; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; background: var(--surface-2); }
.post-img img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .2s; }
.post-img:hover img { transform: scale(1.03); }
a.txt { color: var(--text-2); } a.txt:hover { color: var(--text); text-decoration: none; }
.pthumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #fff; flex: none; }
.prow { display: flex; gap: 10px; align-items: center; }

/* Tovar oynasi */
.modal .pd-box { width: min(1280px, 100%); padding: 0; max-height: 92vh; display: flex; flex-direction: column; }
.pd-loading { padding: 40px; text-align: center; }
.pd-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.pd-title { font-size: 18px; font-weight: 700; }
.pd-periods { display: flex; gap: 4px; }
.pd { display: grid; grid-template-columns: minmax(380px, 5fr) 7fr; gap: 0; overflow: auto; }
.pd-left { padding: 16px 20px; border-right: 1px solid var(--border); }
.pd-right { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.pd-hero { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.pd-img { width: 150px; height: 150px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: #fff; flex: none; }
.pd-label { font-size: 12px; color: var(--text-2); }
.pd-big { font-size: 28px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.pd-market { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 6px; }
.pd-market div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.pd-market span { display: block; font-size: 11px; color: var(--text-2); }
.pd-market b { font-variant-numeric: tabular-nums; }
.pd-section { font-weight: 700; margin: 6px 0 8px; }
.pd-offers { display: flex; flex-direction: column; gap: 8px; }
.pd-offer { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: start; padding: 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.pd-offer.best { border-color: var(--pos); box-shadow: inset 3px 0 0 var(--pos); }
.pd-offer .pthumb { width: 52px; height: 52px; }
.pd-shop { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pd-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 3px; }
.pd-offer-price { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.pd-price { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pd-deltas { display: flex; gap: 4px; }
.pd-chart { height: 440px; }
.pd-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pd-facts div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.pd-facts span { display: block; }
@media (max-width: 900px) {
  .pd { grid-template-columns: 1fr; } .pd-left { border-right: 0; border-bottom: 1px solid var(--border); }
  .pd-chart { height: 300px; } .pd-facts { grid-template-columns: 1fr; } .pd-img { width: 110px; height: 110px; }
  .pd-head { flex-wrap: wrap; }
}

/* AI yordamchi lentasi */
.ticker { display: flex; align-items: center; gap: 0; border-bottom: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.ticker-label { flex: none; padding: 8px 14px; font-weight: 700; font-size: 13px; color: var(--text); background: var(--surface-2);
  border-right: 1px solid var(--border); white-space: nowrap; }
.ticker-track { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.ticker-run { display: flex; gap: 28px; width: max-content; animation: ticker 70s linear infinite; padding: 6px 0; }
.ticker:hover .ticker-run { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.ticker-item:hover { color: var(--text); text-decoration: none; }
.ticker-item img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); background: #fff; }
.ti-icon { font-size: 16px; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-run { animation: none; } .ticker-track { overflow-x: auto; } }

/* Mening tovarlarim / do'konlar — kartochkalar */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; color: var(--text-2); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip:hover { text-decoration: none; border-color: var(--text-2); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex;
  flex-direction: column; color: var(--text); transition: box-shadow .15s, transform .15s; }
.pcard:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-2px); text-decoration: none; }
.pcard .pimg { aspect-ratio: 1 / 1; background: #fff; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border); position: relative; }
.pcard .pimg img { width: 100%; height: 100%; object-fit: contain; }
.pcard .pbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .pname { font-size: 13px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.pcard .pprice { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pcard .pmeta { font-size: 12px; color: var(--muted); }
.pcard .pbadge { position: absolute; top: 8px; left: 8px; }
.pcard .pbadge2 { position: absolute; top: 8px; right: 8px; }
.shopgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.shop { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; gap: 14px;
  align-items: center; color: var(--text); }
.shop:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); text-decoration: none; }
.slogo { width: 56px; height: 56px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 20px;
  color: #fff; overflow: hidden; background: var(--brand); }
.slogo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.shop .sname { font-weight: 700; font-size: 16px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.vs-side { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.vs-side.ours { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.vs-side .bigimg { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #fff; border-radius: 10px; border: 1px solid var(--border); }
.vs-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 140px; text-align: center; }
.vs-mid .big { font-size: 26px; font-weight: 800; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.form-card { max-width: 860px; }
.form-card .form-grid input[type=text], .form-card .form-grid input[type=number], .form-card .form-grid input[type=url], .form-card .form-grid select { width: 100%; }
.imgprev { width: 160px; height: 160px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
@media (max-width: 860px) { .vs { grid-template-columns: 1fr; } .vs-mid { flex-direction: row; min-width: 0; } .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Raqobatchilarda nima yangi */
.news-h { font-size: 14px; margin: 14px 0 8px; }
.news-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 8px; }
.news-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.news-row:hover { background: var(--surface-2); text-decoration: none; }
.news-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #fff; border: 1px solid var(--border); flex: none; }
.news-new { padding: 8px 0; border-bottom: 1px solid var(--border); }
.news-thumbs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.news-thumbs img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); }

/* Raqobatchilar yangiliklari */
.region-h { margin: 22px 0 10px; padding: 8px 12px; background: var(--brand); color: #fff; border-radius: 8px; font-size: 16px; }
.card.comp { margin-bottom: 12px; border-top: 3px solid var(--brand); }
.card.comp.quiet { border-top-color: var(--border); opacity: .85; }
.comp-name { font-size: 15px; }
.comp-head { gap: 10px; flex-wrap: wrap; }
.comp-note { margin: 10px 0; padding: 10px 12px; background: #fff8ec; border: 1px solid #f2ddb5; border-radius: 8px; font-size: 13px; color: #1d2330; }
.news-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 8px; }
.news-item { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
.news-item:hover { background: var(--surface-2); text-decoration: none; }
.news-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #fff; border: 1px solid var(--border); flex: none; }
.news-text { font-size: 13px; margin-top: 4px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) { .news-items { grid-template-columns: 1fr; } }

/* Do'kon profili */
.shop-profile .sp-head { display: flex; gap: 16px; align-items: flex-start; }
.shop-profile .sp-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: #fff; flex: none; }
.shop-profile .sp-facts { margin-top: 12px; }
.shop-profile .sp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.shop-profile .sp-ai { border-top: 1px solid var(--border); padding-top: 10px; }
@media (max-width: 640px) { .shop-profile .sp-head { flex-direction: column; } }

/* Narx markazi va andoza */
.ready-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 8px; }
.ready-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); }
.ready-item > span { font-weight: 800; }
.ready-item.ok > span { color: var(--pos); } .ready-item.miss > span { color: var(--neg); }
.ready-item.miss { background: var(--neg-bg); border-color: transparent; }
a.kpi { color: inherit; text-decoration: none; } a.kpi:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.bm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 12px; }
tr.own td { background: var(--warn-bg); }

/* Bildirishnomalar: qo'ng'iroqcha va toast */
.bell { position: relative; }
.bell .btn { position: relative; display: inline-flex; align-items: center; }
.bell-n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--neg); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.bell-menu { position: absolute; right: 0; top: calc(100% + 6px); width: min(380px, calc(100vw - 32px)); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 60; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.bell-list { max-height: 420px; overflow-y: auto; }
.ev-row { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.ev-row:hover { background: var(--surface-2); }
.ev-row.unread { background: var(--warn-bg); }
.ev-ic { font-size: 18px; line-height: 1.2; flex: none; }
.ev-t { font-weight: 700; font-size: 13px; }
.ev-s { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.ev-m { font-size: 11px; color: var(--muted); margin-top: 2px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--brand); color: #fff; border-left: 5px solid var(--accent); border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13px; animation: toastIn .3s ease; cursor: pointer; }
.toast b { display: block; margin-bottom: 2px; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
/* Yangiliklar lentasi */
.ev-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ev-chip { padding: 5px 10px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: inherit; text-decoration: none; font-size: 13px; }
.ev-chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.ev-feed .ev-row { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: var(--surface); }
.flash-card { margin-bottom: 14px; border-left: 4px solid var(--accent); } .flash-card .ev-row { border-bottom: 1px solid var(--border); padding-left: 0; }
.bell .btn { min-width: 38px; justify-content: center; }
.bell .ico { width: 18px; height: 18px; display: block; flex: none; }
/* Hisobotlar kalendari */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 8px; }
.cal th { font-size: 12px; color: var(--muted); padding: 4px; }
.cal td { border: 1px solid var(--border); height: 54px; vertical-align: top; padding: 4px; }
.cal td.out { opacity: .35; } .cal td.today { outline: 2px solid var(--accent); }
.cal .dn { font-size: 12px; color: var(--text-2); }
.cal a { display: inline-block; text-decoration: none; padding: 1px 5px; border-radius: 6px; margin-top: 2px; font-size: 14px; }
.cal .cal-am { background: #fdf0d0; } .cal .cal-pm { background: #dde8fb; }
.rt td .sc { display: inline-block; min-width: 30px; text-align: center; border-radius: 4px; padding: 1px 4px; background: var(--pos-bg); }
.rt td .sc.z { background: var(--surface-2); color: var(--muted); }
/* Do'kon: kunlik hisobot (qadamma-qadam) */
.slog-w { margin-bottom: 8px; padding: 10px 14px; }
.slog-w summary { cursor: pointer; }
.slog-w.empty { opacity: .65; }
.slog-step { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.slog-time { width: 46px; flex: none; font-weight: 700; }
.slog-img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); flex: none; }
.slog-body { flex: 1; min-width: 0; }
.slog-title { font-weight: 600; margin: 4px 0; }
@media (max-width: 600px) { .slog-img { width: 72px; height: 72px; } }
.slog-story { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 10px 0 4px; line-height: 1.6; font-size: 14px; }
.slog-story b { color: var(--text); font-weight: 700; }

/* === Telefon ko'rinishi ===================================================== */
.grid > *, .card, .main, .content > * { min-width: 0; }
code { overflow-wrap: anywhere; }
.sidebar-backdrop, .side-foot { display: none; }
@media (max-width: 860px) {
  /* Yuqori panel: bitta qator — menyu, sarlavha (2 qatorgacha), ikonkalar */
  .topbar { flex-wrap: nowrap; gap: 8px; padding: 8px 12px; }
  .topbar > .flex { flex-wrap: nowrap; min-width: 0; flex: 1; gap: 8px; }
  .topbar h1 { font-size: 16px; line-height: 1.25; min-width: 0; overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .topbar .right { flex: none; gap: 4px; }
  .topbar .right .btn { padding: 6px 8px; min-height: 36px; }
  .topbar .right select { padding: 6px 4px; font-size: 14px; }
  .topbar .logout { display: none; }
  .menu-btn { min-width: 38px; min-height: 36px; justify-content: center; font-size: 16px; }

  /* Yon menyu: ustidan chiqadi, orqasi qoraytiriladi, tashqariga bosganda yopiladi */
  .sidebar { width: 272px; max-width: 86vw; display: flex; flex-direction: column; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .sidebar nav { flex: 1; }
  .sidebar nav a { padding: 11px 12px; }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 39; }
  .side-foot { display: block; border-top: 1px solid rgba(255,255,255,.12); margin-top: 12px; padding: 12px 10px 4px; font-size: 13px; }
  .side-foot .btn { width: 100%; justify-content: center; margin-top: 8px; }
  body.nav-open { overflow: hidden; }

  /* Qatorga sig'maydigan tugmalar to'plami — gorizontal suriladi */
  .ev-filters, .tabs, .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .ev-filters::-webkit-scrollbar, .tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
  .ev-filters > *, .tabs > *, .chips > * { flex: none; white-space: nowrap; }

  .content { padding: 12px 12px 32px; }
  .card { padding: 12px; }
  .grid { gap: 12px; }
  .kpis { gap: 8px; } .kpi { padding: 10px 12px; } .kpi .value { font-size: 22px; }
  .t th, .t td { padding: 7px 8px; }
  .table-wrap .t td:first-child { min-width: 128px; } .table-wrap .t td.small { min-width: 150px; }
  .chart { height: 260px; }
  /* iPhone kiritish maydoniga bosganda sahifani kattalashtirib yubormasin */
  input, select, textarea { font-size: 16px; }
  .filters > label, .filters > select, .filters > input { flex: 1 1 140px; }
  .filters input, .filters select { width: 100%; }
  .chat { max-height: none; }
  .chat-form { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0; }

  .bell-menu { position: fixed; top: 54px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }

  /* Tovar oynasi — telefonda butun ekran */
  .modal { padding: 0; }
  .modal .box, .modal .pd-box { width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
  .pd-head { padding: 10px 12px; } .pd-left, .pd-right { padding: 12px; }
  .pd-title { font-size: 16px; }
  .pd-hero { gap: 12px; } .pd-big { font-size: 22px; }
  .pd-offer { grid-template-columns: 44px 1fr; } .pd-offer .pthumb { width: 44px; height: 44px; }
  .pd-offer-price { grid-column: 2; align-items: flex-start; text-align: left; }
  .pd-chart { height: 260px; }
  .cal td { height: 46px; padding: 2px; } .cal a { padding: 0 3px; font-size: 12px; }
  .region-h { font-size: 15px; }
  .news-item img { width: 60px; height: 60px; }
  .slog-step { gap: 8px; } .slog-time { width: 40px; }
  .shop { padding: 12px; gap: 12px; }
  /* «Matn + maydon» yorliqlari: matn tepada, maydon butun kenglikda */
  :is(.card form, form.card) label:has(> input:not([type=checkbox]):not([type=radio]):not([type=hidden]), > select, > textarea) { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--text-2); }
  :is(.card form, form.card) label:has(> input:not([type=checkbox]):not([type=radio]), > select, > textarea) > :is(input, select, textarea) { width: 100%; }
  .grid > label { margin-bottom: 0 !important; }
  .form-grid input:not([type=checkbox]):not([type=radio]), .form-grid select, .form-grid textarea { width: 100%; }
  .shop-profile .sp-head { align-items: stretch; } .shop-profile .sp-head > div { width: 100%; }
}
@media (max-width: 420px) {
  .pd-market { grid-template-columns: 1fr 1fr; }
  .pd-hero { flex-direction: column; }
  .kv { grid-template-columns: 1fr; gap: 0 0; } .kv dd { margin-bottom: 6px; }
  .pgrid { gap: 8px; } .pcard .pbody { padding: 8px 10px 10px; } .pcard .pprice { font-size: 15px; }
}
@media (min-width: 861px) { .topbar .menu-btn { display: none; } }

/* Soatlik AI xulosa */
.ai-brief { border-left: 4px solid var(--brand); }
.ai-head { font-weight: 700; margin: 8px 0; }
.ai-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ai-points li { padding: 7px 10px 7px 12px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--muted); font-size: 13px; }
.ai-points li.imp-high { border-left-color: var(--neg); } .ai-points li.imp-medium { border-left-color: var(--accent); }
.ai-adv { color: var(--text-2); font-size: 12px; margin-top: 2px; }
/* Qo'ng'iroqcha oynasi: ixcham */
.bell-menu { max-height: min(560px, calc(100vh - 80px)); display: flex; flex-direction: column; overflow: hidden; }
.bell-head .x { border: 0; background: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1; }
[hidden] { display: none !important; }
.bell-brief { padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 13px; flex: none; }
.bell-brief .bb-h { font-weight: 700; margin: 2px 0 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bell-brief ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.bell-brief li { font-size: 12px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bell-brief .bb-t { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; }
.bell-list { flex: 1; min-height: 120px; max-height: none; overflow-y: auto; }
.bell-list .ev-row { padding: 8px 12px; }
.bell-list .ev-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bell-list .ev-s { display: none; }
.bell-foot { display: block; flex: none; text-align: center; padding: 9px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 600; }
@media (max-width: 860px) {
  .bell-menu { left: auto; right: 8px; width: min(330px, calc(100vw - 24px)); max-height: min(520px, 66vh); border-radius: 14px; }
  .bell-brief { padding: 8px 12px; }
  .bell-list .ev-ic { font-size: 15px; }
}
