:root {
  --bg: #eaf0fb;            /* ochiq havorang fon (Altrix uslubi) */
  --panel: #ffffff;
  --panel-soft: #f4f7fc;
  --text: #131c33;
  --muted: #6a7591;
  --border: #e6ebf4;
  --blue: #3168f0;          /* asosiy aksent (ko'k) */
  --blue-strong: #2454d6;
  --blue-soft: #eaf1ff;
  --accent: #3168f0;
  --pink: #e0379a;
  --brand-grad: linear-gradient(135deg, #6d4afc 0%, #a23bff 50%, #e0379a 100%);
  --green: #0f9d63;
  --green-soft: #e8f8f0;
  --red: #e0364f;
  --red-soft: #fff0f2;
  --yellow: #f5bd2f;
  --purple: #8a3bff;
  --purple-soft: #f2ebff;
  --cyan: #19c2ff;
  --nav: #16142e;           /* quyuq binafsha-ko'mir */
  --nav-soft: #2a2748;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(20, 18, 43, 0.05), 0 10px 30px rgba(20, 18, 43, 0.06);
  --shadow-hover: 0 16px 40px rgba(49, 104, 240, 0.15), 0 3px 10px rgba(20, 18, 43, 0.06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --anim: 1; /* animatsiyalar (0 = o'chiq) */
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Animatsiyalar o'chirilganda barcha o'tishlarni to'xtatamiz */
body.no-anim *, body.no-anim *::before, body.no-anim *::after {
  transition: none !important;
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
html { scroll-behavior: smooth; }

/* Zamonaviy nozik scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 80% -10%, rgba(49, 104, 240, 0.10), transparent 34rem),
    radial-gradient(circle at 0% 8%, rgba(49, 104, 240, 0.06), transparent 28rem),
    var(--bg);
}

body.auth-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: var(--panel);
  color: var(--text);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.22s ease, transform 0.22s ease;
  display: flex;
  flex-direction: column;
}
.nav { flex: 1; }
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.sidebar-username {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout-btn {
  width: 100%;
  padding: 9px;
  background: var(--red-soft);
  border: 1px solid rgba(224,54,79,0.25);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-logout-btn:hover { background: rgba(224,54,79,0.14); }

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 4px 12px 22px;
}
/* Sidebar inline logo — o'rtacha xajm, theme-aware matn */
.brand-logo-inline {
  width: auto;
  height: 38px;
  display: block;
  transition: transform 0.35s var(--ease);
}
.brand:hover .brand-logo-inline { transform: scale(1.04); }
/* Logoning qora yozuvlari: oq fonda qora, tungi rejimda oq */
.su-ink { fill: #14122b; }
body.dark .su-ink { fill: #ffffff; }
/* Login kartochkasi foni theme-aware (oq/quyuq) — su-ink default qoidaga ergashadi */
.auth-logo-inline { height: 64px; }

.brand-mark {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 18px rgba(109, 74, 252, 0.35));
  transition: transform 0.35s var(--ease);
}
.brand-mark svg { display: block; }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }
/* Wordmark — gradient matn (auth oq fonda ko'rinishi uchun) */
.auth-brand strong {
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-group {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 18px 14px 8px;
  opacity: 0.75;
}

.nav-button {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.nav-button:hover {
  background: var(--panel-soft);
  color: var(--text);
}
.nav-button.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 20px rgba(49, 104, 240, 0.32);
}
.nav-button.active .nav-icon,
.nav-button.active .nav-text small { color: rgba(255,255,255,0.85); }

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 auto;
}

.nav-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.nav-text small {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
}

.main {
  min-width: 0;
}

.topbar {
  height: 48px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(16px);
}

.topbar-controls,
.connect-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button {
  min-width: 36px;
  height: 36px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.icon-button:hover {
  background: var(--panel-soft);
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(16, 27, 51, 0.08);
}

#menuButton {
  display: grid;
  place-content: center;
  gap: 4px;
}

#menuButton span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.text-button {
  width: auto;
  padding: 0 12px;
}

.user-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
}

.select-control,
.field input {
  height: 36px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 0 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.select-control:focus,
.field input:focus,
.field textarea:focus {
  outline: 0;
  border-color: rgba(114, 27, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(114, 27, 255, 0.1);
}

.select-control {
  min-width: 180px;
}

/* Ko'p do'kon tanlash (multi-select) */
.shop-multi { position: relative; }
.shop-multi-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; min-width: 180px; padding: 0 12px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 8px; font-family: inherit; font-size: 14px; cursor: pointer;
  justify-content: space-between;
}
.shop-multi-btn:hover:not(:disabled) { border-color: rgba(114, 27, 255, 0.5); }
.shop-multi-btn:disabled { opacity: .6; cursor: default; }
.shop-multi.open .shop-multi-btn { border-color: rgba(114, 27, 255, 0.55); box-shadow: 0 0 0 4px rgba(114, 27, 255, 0.1); }
.shop-multi-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 220px; max-height: 320px; overflow-y: auto;
  background: var(--panel, #fff); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; box-shadow: 0 18px 40px rgba(0,0,0,.16);
}
.shop-multi-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text);
}
.shop-multi-item:hover { background: var(--panel-soft, rgba(114,27,255,.06)); }
.shop-multi-item input { width: 16px; height: 16px; accent-color: var(--blue, #3168f0); cursor: pointer; }
.shop-multi-sep { height: 1px; background: var(--border); margin: 4px 2px; }
body.dark .shop-multi-btn { background: var(--panel-soft); }

.connect-band {
  max-width: 1400px;
  margin: 14px auto 8px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

h1 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.2;
}

p {
  margin: 0;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.field textarea {
  min-height: 104px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.wide-field {
  width: min(820px, 100%);
}

.settings-form {
  display: grid;
  gap: 18px;
}

.template-list {
  display: grid;
  gap: 18px;
}

.template-card {
  display: grid;
  gap: 8px;
  padding: 12px 0 2px;
  border-top: 1px solid var(--border);
}

.template-card:first-child {
  border-top: 0;
  padding-top: 2px;
}

.template-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.template-title h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 600;
}

.template-stars {
  min-width: 60px;
  min-height: 28px;
  border-radius: 16px;
  background: #eef3fb;
  color: #ff6b1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 0;
  padding: 0 10px;
  box-shadow: inset 0 0 0 1px rgba(98, 124, 155, 0.08);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 10px;
}

.template-grid .wide-field {
  width: 100%;
}

.template-grid .field span {
  font-size: 12px;
  opacity: .7;
}

.template-grid textarea {
  min-height: 60px;
  font-size: 13px;
  line-height: 1.4;
}

/* Yashil/qizil toggle switch */
.toggle {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.toggle-track {
  width: 48px;
  height: 26px;
  border-radius: 999px;
  background: #e23b3b;
  position: relative;
  transition: background 0.2s ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  transition: transform 0.2s ease;
}
.toggle input:checked + .toggle-track {
  background: #25c462;
}
.toggle input:checked + .toggle-track::after {
  transform: translateX(22px);
}

.star-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.star-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.star-chip span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 18px;
  background: var(--panel-soft);
  color: #fb7417;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.star-chip input:checked + span {
  background: #e6edf8;
  box-shadow: inset 0 0 0 1px var(--border);
}

.star-chip:hover span {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(251, 116, 23, 0.13);
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.preview-box {
  width: min(820px, 100%);
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  display: grid;
  gap: 6px;
}

@media (max-width: 860px) {
  .template-grid {
    grid-template-columns: 1fr;
  }

  .template-title {
    align-items: flex-start;
    flex-direction: column;
  }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.load-more-line {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
  padding: 12px 0 2px;
  color: var(--muted);
}

.api-field input {
  width: 340px;
}

.small-field input {
  width: 150px;
}

.primary-button,
.ghost-button,
.export-button {
  height: 38px;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.primary-button {
  background: linear-gradient(135deg, var(--blue), var(--blue-strong));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(49, 104, 240, 0.30);
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(49, 104, 240, 0.36);
}

.ghost-button,
.export-button {
  background: #fff;
  color: var(--blue-strong);
}

.ghost-button:hover,
.export-button:hover {
  transform: translateY(-2px);
  border-color: rgba(49, 104, 240, 0.35);
  box-shadow: 0 12px 26px rgba(49, 104, 240, 0.14);
}

.primary-button:active,
.ghost-button:active,
.export-button:active,
.mini-button:active,
.nav-button:active {
  transform: translateY(0) scale(0.98);
}

.status-line,
.warnings,
.content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  min-height: 24px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.ok {
  background: var(--green);
}

.dot.busy {
  background: var(--yellow);
  animation: pulseDot 1s ease-in-out infinite;
}

.dot.error {
  background: var(--red);
}

.warnings {
  margin-top: 12px;
}

.warning-box {
  background: #fff8e7;
  border: 1px solid #f1dca3;
  color: #6f5300;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
}

.content {
  padding-bottom: 24px;
}

.account-summary {
  background: #0f1f3d;
  color: #fff;
  border-radius: 8px;
  padding: 20px;
  margin: 0 0 16px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  box-shadow: var(--shadow);
}

.account-summary p {
  color: #c8d3e6;
}

.account-summary h2 {
  margin: 4px 0 6px;
  font-size: 24px;
}

.eyebrow {
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-summary .eyebrow {
  color: #8fb0ff;
}

.summary-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-metrics div {
  min-width: 140px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 12px 14px;
}

.summary-metrics strong {
  display: block;
  font-size: 22px;
}

.summary-metrics span {
  display: block;
  margin-top: 3px;
  color: #c8d3e6;
  font-size: 12px;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.store-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.store-card h3 {
  margin: 4px 0 14px;
  font-size: 18px;
}

.store-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.store-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.store-card dt {
  color: var(--muted);
}

.store-card dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

.panel:hover {
  transform: translateY(-3px);
  border-color: rgba(49, 104, 240, 0.18);
  box-shadow: var(--shadow-hover);
}

/* Kontent kirish animatsiyasi (yumshoq paydo bo'lish) */
@keyframes su-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.content > * { animation: su-rise 0.42s var(--ease) both; }
.content > *:nth-child(2) { animation-delay: 0.04s; }
.content > *:nth-child(3) { animation-delay: 0.08s; }
.content > *:nth-child(4) { animation-delay: 0.12s; }
.panel { animation: su-rise 0.42s var(--ease) both; }

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.panel h2,
.panel h3 {
  margin: 0;
}

.panel h2 {
  font-size: 16px;
}

.panel h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 64px;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
}
.metric-ic {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 19px;
  background: var(--blue-soft);
}
.metric-body { min-width: 0; }
.metric-body > span { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.metric:hover {
  transform: translateY(-3px);
  border-color: rgba(49, 104, 240, 0.18);
  box-shadow: var(--shadow-hover);
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.metric.green .metric-ic { background: var(--green-soft); }
.metric.green strong { color: var(--green); }
.metric.red .metric-ic { background: var(--red-soft); }
.metric.red strong { color: var(--red); }
.metric.blue .metric-ic { background: var(--blue-soft); }

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
thead th:first-child { border-top-left-radius: 10px; }
thead th:last-child { border-top-right-radius: 10px; }

tbody tr { transition: background 0.15s var(--ease); }
tbody tr:hover td { background: var(--panel-soft); }
tbody tr:last-child td { border-bottom: none; }

td.num,
th.num {
  text-align: right;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffe38a;
  color: #7a5100;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.done {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.bad {
  background: var(--red-soft);
  color: var(--red);
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 30px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--blue-strong);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.mini-button:hover:not(:disabled) {
  background: #eef4ff;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(47, 111, 236, 0.14);
}

.mini-button:disabled {
  border-color: var(--border);
  color: var(--muted);
  background: var(--panel-soft);
  cursor: default;
}

.mini-link {
  margin-left: 8px; font-size: 12px; font-weight: 600;
  color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--muted);
}
.mini-link:hover { color: var(--blue); border-color: var(--blue); }

.bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(22px, 1fr));
  align-items: end;
  gap: 6px;
  height: 220px;
  padding-top: 14px;
  border-bottom: 1px solid var(--border);
}

.bar {
  min-height: 4px;
  background: linear-gradient(180deg, #5a8bff, var(--blue) 70%, var(--blue-strong));
  border-radius: 7px 7px 3px 3px;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.2s var(--ease), filter 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.bar:hover {
  transform: translateY(-4px) scaleY(1.03);
  filter: saturate(1.15);
  box-shadow: 0 14px 30px rgba(49, 104, 240, 0.28);
}

.bar span {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #65748d;
  color: #fff;
  font-size: 11px;
  border-radius: 4px;
  padding: 2px 4px;
}

.bar-labels {
  display: grid;
  grid-template-columns: repeat(24, minmax(22px, 1fr));
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

/* Haftalik buyurtmalar tahlili (stacked: sotilgan/bekor) */
.wk-legend { display: flex; gap: 18px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.wk-leg { display: inline-flex; align-items: center; gap: 6px; }
.wk-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
/* Haftalik chart — chiroyli, to'liq, ortiqcha kesiladi */
.wk-panel { display: flex; flex-direction: column; }
.wk-panel .wk-plot { flex: 1 1 auto; }
.wk-plot { position: relative; min-height: 320px; overflow: hidden; }
/* Chizma maydoni — svg va nuqtalar AYNAN shu konteynerni to'ldiradi (koordinatalar mos keladi) */
.wk-area { position: absolute; top: 4px; right: 4px; bottom: 26px; left: 32px; }
.wk-area > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wk-dots { position: absolute; inset: 0; pointer-events: none; }
.wk-pt {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--c, var(--blue));
  transform: translate(-50%, -50%); pointer-events: auto; cursor: default;
  box-shadow: 0 1px 3px rgba(0,0,0,.12); transition: transform .12s var(--ease);
}
.wk-pt:hover { transform: translate(-50%, -50%) scale(1.35); }
.wk-yaxis { position: absolute; left: 0; top: 4px; bottom: 26px; width: 30px; }
.wk-yaxis span {
  position: absolute; right: 0; transform: translateY(-50%);
  font-size: 11px; color: var(--muted); white-space: nowrap;
}
.wk-days { position: absolute; left: 32px; right: 0; bottom: 0; height: 24px; }
.wk-days span {
  position: absolute; bottom: 0;
  font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap;
}

.donut-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.donut {
  width: 190px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--purple) var(--value), #b9dcff 0);
  position: relative;
  box-shadow: 0 20px 36px rgba(114, 27, 255, 0.14);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.donut:hover {
  transform: scale(1.03);
  filter: saturate(1.15);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 50px;
  background: var(--panel);
  border-radius: 50%;
}

.legend-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f4f6f9;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-title {
  max-width: 460px;
  font-weight: 700;
}

.product-sku {
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.empty {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.loading .content,
.loading .connect-band,
.loading .status-line,
.loading .warnings {
  pointer-events: none;
  filter: saturate(0.82);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: rgba(238, 243, 249, 0.62);
  backdrop-filter: blur(7px);
}

.loading .loading-overlay {
  display: grid;
}

.loading-card {
  min-width: 260px;
  display: grid;
  justify-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  padding: 24px 28px;
  box-shadow: 0 26px 80px rgba(16, 27, 51, 0.18);
}

.loading-card small {
  color: var(--muted);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(114, 27, 255, 0.12);
  border-top-color: var(--purple);
  border-right-color: var(--cyan);
  animation: spin 0.78s linear infinite;
}

.chart-tooltip {
  position: relative;
}

.chart-tooltip::before,
.chart-tooltip::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 40;
}

.chart-tooltip::before {
  content: attr(data-tooltip);
  bottom: calc(100% + 12px);
  min-width: max-content;
  max-width: 300px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #101827;
  color: #fff;
  box-shadow: 0 16px 40px rgba(16, 24, 39, 0.24);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.chart-tooltip::after {
  content: "";
  bottom: calc(100% + 6px);
  width: 10px;
  height: 10px;
  background: #101827;
  transform: translate(-50%, 8px) rotate(45deg);
}

.chart-tooltip:hover::before,
.chart-tooltip:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Profil bo'limi ── */
.profile-hero { display: flex; align-items: center; gap: 18px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #fff; background: var(--brand-grad); flex: 0 0 auto; box-shadow: 0 10px 26px rgba(109,74,252,0.35); }
.profile-id { flex: 1; min-width: 0; }
.profile-id h2 { margin: 0; font-size: 20px; }
.profile-id p { margin: 2px 0 8px; color: var(--muted); font-size: 13px; }
.profile-badge { display: inline-block; font-size: 12px; font-weight: 600; color: var(--blue-strong); background: var(--purple-soft); padding: 4px 10px; border-radius: 999px; }
.settings-list { display: flex; flex-direction: column; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-row strong { display: block; font-size: 14px; }
.setting-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.setting-row > span { color: var(--muted); font-size: 14px; }
/* Toggle switch */
.switch { width: 46px; height: 26px; border-radius: 999px; border: none; background: var(--border); cursor: pointer; padding: 0; position: relative; flex: 0 0 auto; transition: background 0.25s var(--ease); }
.switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.2); transition: transform 0.25s var(--ease); }
.switch.on { background: var(--blue); }
.switch.on span { transform: translateX(20px); }

body.dark {
  --bg: #0e1424;
  --panel: #161f33;
  --panel-soft: #1e283f;
  --text: #e8edf7;
  --muted: #9aa6be;
  --border: #28324a;
  --blue-soft: #1c2a4a;
  --nav: #0b1020;
  --nav-soft: #1e283f;
  --shadow-hover: 0 18px 46px rgba(49, 104, 240, 0.22), 0 3px 10px rgba(0, 0, 0, 0.20);
}

body.dark .select-control,
body.dark .field input,
body.dark .field textarea,
body.dark .ghost-button,
body.dark .export-button {
  background: #111827;
  color: var(--text);
}

body.dark .loading-overlay {
  background: rgba(17, 24, 39, 0.62);
}

body.dark .loading-card {
  background: rgba(23, 32, 51, 0.9);
  border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    width: 260px;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .connect-band,
  .grid.two,
  .grid.three,
  .account-summary,
  .donut-row {
    grid-template-columns: 1fr;
  }
  /* KPI tiles — mobil/planshetda 2 ustun (joyni samarali ishlatish) */
  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* Mobil sidebar ortidagi qorong'i fon */
  .sidebar.open::after {
    content: "";
    position: fixed;
    inset: 0 0 0 260px;
    background: rgba(10, 14, 26, 0.45);
    backdrop-filter: blur(2px);
  }

  .connect-band {
    display: grid;
  }

  .account-summary {
    display: grid;
    align-items: stretch;
  }

  .api-field input,
  .small-field input,
  .select-control {
    width: 100%;
    min-width: 0;
  }

  .connect-form {
    align-items: end;
  }
}

@media (min-width: 1051px) {
  .sidebar {
    width: 220px;
  }

  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 680px) {
  .topbar,
  .connect-band,
  .status-line,
  .warnings,
  .content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .connect-form,
  .topbar-controls {
    width: 100%;
  }

  .topbar {
    height: auto;
    min-height: 60px;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .field {
    width: 100%;
  }

  .primary-button,
  .ghost-button {
    flex: 1 1 120px;
  }

  .bars,
  .bar-labels {
    grid-template-columns: repeat(12, minmax(22px, 1fr));
  }

  .summary-metrics {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 65% 18%, rgba(49, 104, 240, 0.40), transparent 30rem),
    radial-gradient(circle at 22% 72%, rgba(109, 74, 252, 0.28), transparent 24rem),
    rgba(14, 20, 36, 0.82);
  padding: 18px;
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(16, 27, 51, 0.26);
  padding: 26px;
  animation: riseIn 0.34s ease both;
}

.auth-brand {
  color: var(--text);
  padding: 0 0 12px;
}

.auth-card h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.auth-error {
  min-height: 20px;
  color: var(--red);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseDot {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 189, 47, 0.42);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(245, 189, 47, 0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===================== ORDER MANAGEMENT ===================== */

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.status-tab {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-tab:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.status-tab.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.actions-cell {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.action-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.confirm-btn {
  background: var(--green-soft);
  color: var(--green);
  border-color: #c2e9d4;
}

.confirm-btn:hover:not(:disabled) {
  background: var(--green);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(9, 148, 86, 0.25);
}

.cancel-btn {
  background: var(--red-soft);
  color: var(--red);
  border-color: #fad4d4;
}

.cancel-btn:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(193, 38, 46, 0.22);
}

.save-btn {
  background: var(--panel-soft);
  color: var(--blue);
  border-color: var(--border);
}

.save-btn:hover:not(:disabled) {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  transform: translateY(-1px);
}

.action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.danger-button {
  height: 36px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: var(--red-soft);
  color: var(--red);
  border-color: #fad4d4;
  cursor: pointer;
  transition: all 0.15s ease;
}

.danger-button:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
  box-shadow: 0 8px 20px rgba(193, 38, 46, 0.25);
}

.danger-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.order-id-tag {
  font-family: monospace;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.order-item-mini {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  max-width: 300px;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.scheme-tag {
  background: var(--purple-soft);
  color: var(--purple);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ===================== CANCEL MODAL ===================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 26px 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 36px 80px rgba(16, 27, 51, 0.28), 0 8px 24px rgba(16, 27, 51, 0.12);
  animation: slideUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  background: var(--panel-soft);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--red-soft);
  color: var(--red);
}

.modal-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

/* ===================== PRICE INPUT ===================== */

.price-input {
  width: 140px;
  height: 32px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 0 10px;
  font-size: 13px;
  text-align: right;
  background: var(--panel);
  color: var(--text);
  transition: all 0.15s ease;
}

.price-input:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 236, 0.12);
}

.product-title-sm {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.sku-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===================== FBS WIZARD ===================== */

.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.wizard-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: var(--panel-soft);
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.wizard-step:last-child { border-right: 0; }

.wizard-step.active {
  background: rgba(47, 111, 236, 0.07);
  color: var(--blue-strong);
}

.wizard-step.done {
  background: var(--green-soft);
  color: var(--green);
}

.wizard-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid currentColor;
  flex-shrink: 0;
}

.step-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.selected-row {
  background: rgba(47, 111, 236, 0.04);
}

/* Drop-off point cards */

.dop-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.dop-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  background: var(--panel-soft);
}

.dop-card:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(47, 111, 236, 0.12);
}

.dop-card.selected {
  border-color: var(--blue);
  background: rgba(47, 111, 236, 0.06);
  box-shadow: 0 0 0 4px rgba(47, 111, 236, 0.1);
}

.dop-card-type {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 6px;
}

.dop-card-address {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.dop-card-coords {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Time slot buttons */

.timeslot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.timeslot-btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.timeslot-btn:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.timeslot-btn.selected {
  border-color: var(--blue);
  background: rgba(47, 111, 236, 0.08);
  color: var(--blue-strong);
  font-weight: 600;
}

/* Invoice summary card */

.confirm-summary {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}

.summary-item:last-child { border-bottom: 0; }

.summary-item span {
  color: var(--muted);
  font-size: 14px;
}

.summary-item strong {
  font-size: 15px;
  font-weight: 600;
}

/* Success box */

.success-box {
  background: var(--green-soft);
  border: 1.5px solid #c2e9d4;
  border-radius: 12px;
  padding: 22px 26px;
}

.success-box h3 {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 18px;
}

.success-box p {
  color: var(--text);
  margin-bottom: 6px;
  font-size: 14px;
}

/* Date filter bar */
.date-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 0 16px;
  flex-wrap: wrap;
}
.date-filter-bar .field {
  min-width: 140px;
}
.date-filter-bar .primary-button {
  height: 38px;
  padding: 0 20px;
  align-self: flex-end;
  margin-bottom: 0;
}

/* ===== Kunlik sotuvlar — bir kunlik picker ===== */
.day-picker { display: inline-flex; align-items: center; gap: 6px; }
.day-nav {
  width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--panel); border-radius: 10px;
  color: var(--text); cursor: pointer; transition: all .15s;
}
.day-nav:hover:not([disabled]) { border-color: var(--blue); color: var(--blue); }
.day-nav[disabled] { opacity: .35; cursor: default; }
.day-current {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 150px; height: 34px; padding: 0 14px;
  background: var(--panel-soft); border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--text);
}
.day-current input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.sku-total td { border-top: 2px solid var(--border); background: var(--panel-soft); }
.day-status { margin-left: 8px; font-size: 13px; color: var(--muted); }
.day-status.err { color: var(--red); }

/* ===== Sana oralig'i (date-range) filtri ===== */
.dr { position: relative; padding: 4px 0 12px; }
.dr-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.dr-field {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; height: 40px; padding: 0 14px; max-width: 320px;
  background: var(--panel-soft);
  border: 1px solid transparent; border-radius: 11px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dr-field:hover { border-color: var(--blue, #3168f0); }
.dr-field-text { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; }
.dr-field-text.dr-ph { font-weight: 500; color: var(--muted); }
.dr-field svg { color: var(--muted); flex: none; width: 16px; height: 16px; }
.dr-presets { display: flex; flex-wrap: nowrap; gap: 7px; margin-top: 9px; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; }
.dr-presets::-webkit-scrollbar { display: none; }
.dr-chip {
  border: 1px solid var(--border);
  background: transparent; color: var(--text);
  font-size: 12.5px; font-weight: 500; padding: 6px 13px; white-space: nowrap; flex: none;
  border-radius: 999px; cursor: pointer; transition: all .15s;
}
.dr-chip:hover { border-color: var(--blue, #3168f0); color: var(--blue, #3168f0); }

.dr { display: inline-block; text-align: left; }
.dr-field { margin-left: auto; }
.dr-presets { justify-content: flex-end; }
.dr-pop {
  position: absolute; top: calc(100% + 6px); right: 0; left: auto; z-index: 200;
  background: var(--panel, #fff);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 14px;
  box-shadow: 0 18px 48px rgba(20,18,43,.18);
  animation: drIn .14s var(--ease, ease);
}
@keyframes drIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dr-head { display: flex; align-items: flex-start; gap: 4px; }
.dr-nav {
  flex: none; width: 32px; height: 32px; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 9px;
  color: var(--text); cursor: pointer; transition: background .15s;
}
.dr-nav:hover { background: var(--panel-soft); }
.dr-months { display: flex; gap: 20px; }
.dr-month { min-width: 210px; }
.dr-month-title { text-align: center; font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.dr-month-title span { margin-left: 12px; }
.dr-week, .dr-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dr-week span { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .03em; color: var(--muted); padding-bottom: 6px; }
.dr-day {
  position: relative; height: 30px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text); cursor: pointer; border-radius: 8px;
  transition: background .12s;
}
.dr-day:hover:not(.dr-mute):not(.dr-sel) { background: var(--panel-soft); }
.dr-day.dr-mute { color: var(--border); cursor: default; }
.dr-day.dr-in { background: var(--blue-soft); border-radius: 0; }
.dr-day.dr-sel { background: var(--text); color: #fff; font-weight: 600; border-radius: 8px; z-index: 1; }
.dr-day.dr-start { border-radius: 8px 0 0 8px; }
.dr-day.dr-end { border-radius: 0 8px 8px 0; }
.dr-day.dr-sel.dr-start, .dr-day.dr-sel.dr-end { border-radius: 8px; }
.dr-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.dr-btn { height: 40px; padding: 0 24px; border-radius: 11px; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .15s; border: 1px solid transparent; }
.dr-btn:hover { opacity: .9; }
.dr-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.dr-primary { background: var(--text); color: #fff; }
body.dark .dr-primary { background: var(--blue, #3168f0); }
body.dark .dr-day.dr-sel { background: var(--blue, #3168f0); }
@media (max-width: 720px) {
  .dr-months { flex-direction: column; gap: 18px; }
  .dr-month { min-width: 240px; }
  .dr-pop { left: 50%; transform: translateX(-50%); max-width: 92vw; overflow: auto; }
}

/* Xabarnomalar sahifasi */
.notify-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.notify-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border, rgba(128,128,128,.25)); border-radius: 12px; cursor: pointer; transition: background .15s; }
.notify-row:hover { background: rgba(128,128,128,.08); }
.notify-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: #7c3aed; cursor: pointer; flex-shrink: 0; }
.notify-label { display: flex; flex-direction: column; gap: 2px; }
.notify-label small { opacity: .65; }

/* Telegram orqali kirish */
.auth-divider { display: flex; align-items: center; text-align: center; margin: 6px 0; opacity: .6; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: rgba(128,128,128,.3); }
.auth-divider span { padding: 0 12px; font-size: 13px; }
.telegram-login-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 46px; }
.tg-switch-link { font-size: 12px; }
.tg-switch-link a { color: #5b9cf6; text-decoration: none; opacity: .8; }
.tg-switch-link a:hover { opacity: 1; text-decoration: underline; }
.auth-hint { font-size: 12px; opacity: .6; text-align: center; margin: 4px 0 0; }
.auth-logout-btn { width: 100%; margin-top: 8px; padding: 10px; background: rgba(255,80,80,0.1); border: 1px solid rgba(255,80,80,0.3); border-radius: 10px; color: #e05555; font-size: 14px; cursor: pointer; }
.auth-logout-btn:hover { background: rgba(255,80,80,0.2); }
.tg-switch-hint { margin: 10px 0 0; padding: 12px 14px; background: rgba(91,156,246,0.1); border: 1px solid rgba(91,156,246,0.3); border-radius: 10px; font-size: 13px; line-height: 1.7; color: var(--text, #333); }

/* ── P&L (foyda-zarar) hisoboti ───────────────────────────────────── */
.pnl-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.pnl-segment { display: inline-flex; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 2px; }
.pnl-seg-btn { padding: 9px 20px; border: none; border-radius: 9px; background: transparent; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); transition: all .18s ease; }
.pnl-seg-btn:hover { color: var(--text); }
.pnl-seg-btn.active { background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; box-shadow: 0 4px 14px rgba(47,111,236,.32); }
.pnl-refresh { padding: 9px 18px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); transition: all .15s; }
.pnl-refresh:hover { border-color: var(--blue); color: var(--blue); }

/* KPI kartalar */
.pnl-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.pnl-kpi { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .18s, box-shadow .18s; }
.pnl-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.pnl-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.pnl-kpi-green::before { background: var(--green); }
.pnl-kpi-blue::before { background: var(--blue); }
.pnl-kpi-purple::before { background: var(--purple); }
.pnl-kpi-amber::before { background: var(--yellow); }
.pnl-kpi-red::before { background: var(--red); }
.pnl-kpi-icon { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 13px; font-size: 22px; background: var(--panel-soft); }
.pnl-kpi-green .pnl-kpi-icon { background: var(--green-soft); }
.pnl-kpi-blue .pnl-kpi-icon { background: rgba(47,111,236,.1); }
.pnl-kpi-purple .pnl-kpi-icon { background: var(--purple-soft); }
.pnl-kpi-amber .pnl-kpi-icon { background: rgba(245,189,47,.16); }
.pnl-kpi-red .pnl-kpi-icon { background: var(--red-soft); }
.pnl-kpi-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pnl-kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.pnl-kpi-value { font-size: 22px; font-weight: 800; line-height: 1.1; letter-spacing: -.4px; }
.pnl-kpi-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.pnl-kpi-green .pnl-kpi-value { color: var(--green); }
.pnl-kpi-red .pnl-kpi-value { color: var(--red); }

/* Jadval */
.pnl-panel { padding-bottom: 6px; }
.pnl-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
.pnl-table { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; }
.pnl-table th, .pnl-table td { padding: 11px 16px; text-align: right; border-bottom: 1px solid var(--border); }
.pnl-table thead th { background: var(--nav); color: #fff; font-weight: 600; position: sticky; top: 0; font-size: 12.5px; letter-spacing: .2px; }
.pnl-table .pnl-label { text-align: left; font-weight: 600; position: sticky; left: 0; background: var(--panel); z-index: 1; }
.pnl-table thead th.pnl-label { background: var(--nav); z-index: 3; }
.pnl-table thead th.pnl-ytd { background: var(--blue-strong); }
.pnl-table tbody tr:hover td { background: var(--panel-soft); }
.pnl-table tbody tr:hover .pnl-label { background: var(--panel-soft); }
.pnl-table .pnl-ytd { font-weight: 700; background: rgba(47,111,236,.07); }
/* Bo'lim sarlavhalari (rang bo'yicha) */
.pnl-section td { font-weight: 800; text-transform: uppercase; font-size: 11.5px; letter-spacing: .6px; text-align: left; padding: 9px 16px; position: sticky; left: 0; }
.pnl-sec-income td     { background: linear-gradient(90deg, var(--green-soft), transparent); color: var(--green); }
.pnl-sec-expenses td   { background: linear-gradient(90deg, rgba(239,68,68,.08), transparent); color: var(--red); }
.pnl-sec-profitability td { background: linear-gradient(90deg, rgba(99,102,241,.08), transparent); color: #6366f1; }
.pnl-sec-result td     { background: linear-gradient(90deg, rgba(16,185,129,.12), transparent); color: var(--green); }
/* O'tgan davrga nisbatan % o'zgarish */
.pnl-delta { display: block; font-size: 10px; font-weight: 600; margin-top: 1px; opacity: .85; }
.pnl-delta-up { color: var(--green); }
.pnl-delta-down { color: var(--red); }
/* Qator turlari */
.pnl-row-dim td { color: var(--muted); font-size: 13px; }
.pnl-row-exp td { color: var(--red); }
.pnl-row-exp .pnl-label::before { content: "− "; opacity: .6; }
.pnl-row-exp-total td { color: var(--red); font-weight: 700; border-top: 1px solid rgba(239,68,68,.2); }
.pnl-row-exp-total .pnl-label::before { content: "Σ "; opacity: .5; }
.pnl-row-metric td { color: #6366f1; font-weight: 600; }
.pnl-row-profit td { font-weight: 800; font-size: 14.5px; background: var(--green-soft) !important; color: var(--green); }
.pnl-row-profit .pnl-label { background: var(--green-soft) !important; }

/* AI tovar kartochkasi */
.ai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
.ai-panel .field { margin-top: 12px; }
.ai-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .ai-row { grid-template-columns: 1fr; } }
.ai-panel textarea, .ai-panel input[type="text"], .ai-panel select { width: 100%; box-sizing: border-box; }
.ai-result { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.ai-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ai-result-head h3 { margin: 0; font-size: 15px; }
.ai-text { white-space: pre-wrap; word-break: break-word; background: var(--panel-soft); border-radius: 12px; padding: 14px; font-family: inherit; font-size: 13.5px; line-height: 1.55; margin: 10px 0 0; max-height: 420px; overflow: auto; }
.ai-image { width: 100%; border-radius: 14px; margin-top: 10px; box-shadow: var(--shadow); }
.ai-src-preview { max-width: 180px; border-radius: 10px; margin-top: 6px; border: 1px solid var(--border); }

/* AI tovar kartochkasi — strukturali natija */
.ai-card-result { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; gap: 18px; }
.ai-field-group { }
.ai-fg-label { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.ai-fg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .ai-fg-row { grid-template-columns: 1fr; } }
.ai-fg-col { background: var(--panel-soft); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.ai-fg-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.ai-fg-head span:first-child { font-weight: 600; }
.ai-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.ai-count.over { color: var(--red); font-weight: 700; }
.ai-copy { margin-left: auto; background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.ai-count + .ai-copy { margin-left: 4px; }
.ai-copy:hover { background: var(--panel); }
.ai-fg-col .ai-text { margin: 0; background: transparent; padding: 0; max-height: 260px; }
.ai-cat-path { background: var(--panel-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ai-cat-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ai-cat-row b { color: var(--text); }
.ai-cat-lang { flex: none; }
.ai-cat-row .ai-copy { margin-left: auto; }
.ai-cat-fix { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.ai-cat-select { flex: 1; min-width: 220px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 12.5px; }
/* Xususiyatlar ro'yxati */
.ai-attrs { display: flex; flex-direction: column; gap: 8px; }
.ai-attr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .ai-attr-row { grid-template-columns: 1fr; } }
.ai-attr-cell { display: flex; align-items: center; gap: 6px; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.ai-attr-cell .ai-text { margin: 0; background: transparent; padding: 0; flex: 1; max-height: none; white-space: pre-wrap; }
.ai-attr-cell .ai-copy { flex: none; }
.ai-dim-note { font-size: 11px; color: var(--red); margin-left: 8px; }
.ai-dim-ok { font-size: 11px; color: var(--green); margin-left: 8px; font-weight: 600; }
.ai-mxik-name { font-size: 12px; color: var(--muted); margin-top: 4px; }
/* AI tarix */
.ai-history { margin: 12px 0 4px; border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--panel-soft); }
.ai-history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ai-history-head h3 { margin: 0; font-size: 15px; }
.ai-history-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; }
.ai-history-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: border-color .15s; }
.ai-history-item:hover { border-color: var(--accent, #6366f1); }
.ai-hi-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ai-hi-main b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-hi-date { font-size: 11px; color: var(--muted); }
.ai-hi-del { flex: none; background: transparent; border: none; cursor: pointer; font-size: 15px; opacity: .6; }
.ai-hi-del:hover { opacity: 1; }
.ai-hi-empty { color: var(--muted); font-size: 13px; margin: 6px 0; }
.ai-dim-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.ai-dim-cell { display: flex; align-items: center; gap: 5px; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 5px 8px; font-size: 13px; color: var(--muted); }
.ai-dim-cell b { color: var(--text); }
.ai-dim-lbl { color: var(--muted); }
.ai-dim-unit { color: var(--muted); font-size: 11px; }

/* Loading / holat */
.pnl-loading { text-align: center; padding: 56px 24px; }
.pnl-loading h3 { margin: 18px 0 6px; font-size: 18px; }
.pnl-loading p { color: var(--muted); margin: 0; }
.pnl-spinner { width: 44px; height: 44px; margin: 0 auto; border: 4px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: pnl-spin .8s linear infinite; }
@keyframes pnl-spin { to { transform: rotate(360deg); } }
.pnl-state { padding: 40px 24px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--border); border-radius: 14px; }
.pnl-state-error { color: var(--red); border-color: rgba(193,38,46,.3); background: var(--red-soft); }

/* ── Skeleton (yuklanish) ── */
@keyframes sk-shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--panel-soft) 25%, var(--border) 37%, var(--panel-soft) 63%); background-size: 800px 100%; animation: sk-shimmer 1.4s var(--ease) infinite; }
.sk-circ { width: 42px; height: 42px; border-radius: 12px; flex: 0 0 auto; }
.sk-kpi { display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 64px; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sk-head { margin-bottom: 14px; }
.sk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
body.no-anim .sk { animation: none; }

/* ── Refresh tugmasi spin ── */
#refreshButton { font-size: 18px; line-height: 1; }
body.loading #refreshButton { animation: pnl-spin 0.8s linear infinite; color: var(--blue); }

/* ── Qo'shimcha micro-animatsiyalar ── */
.metric-ic { transition: transform 0.25s var(--ease); }
.metric:hover .metric-ic { transform: scale(1.08) rotate(-4deg); }
.status-pill, .pnl-delta, .profile-badge { transition: transform 0.18s var(--ease); }
.icon-button { transition: transform 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease); }
.icon-button:active { transform: scale(0.92); }

/* ── Mobil sayqal (har bo'lim) ── */
@media (max-width: 760px) {
  #pageTitle { font-size: 22px; }
  #pageSubtitle { font-size: 13px; }
  .panel { padding: 13px; }
  .panel-header h2 { font-size: 16px; }
  /* KPI gridlar 2 ustun */
  .pnl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sk-row { grid-template-columns: repeat(2, 1fr); }
  /* P&L jadval mobilda gorizontal scroll qulay */
  .pnl-table-wrap { -webkit-overflow-scrolling: touch; }
  /* Segment/toggle tugmalar to'liq enga */
  .pnl-segment { flex-wrap: wrap; }
  /* AI bo'limlar bitta ustun */
  .ai-fg-row, .ai-attr-row, .ai-row { grid-template-columns: 1fr; }
  /* Profil hero ustma-ust */
  .profile-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  /* Topbar ixcham */
  .topbar { padding: 0 12px; }
  .icon-button.text-button { padding: 0 8px; }
}
@media (max-width: 440px) {
  .metric-row { grid-template-columns: 1fr; }
  .metric strong { font-size: 19px; }
  #pageTitle { font-size: 20px; }
}

/* ── SVG ikonkalar (universal) ── */
.ic { width: 20px; height: 20px; display: block; }
.nav-icon { background: transparent; }
.nav-icon .ic { width: 19px; height: 19px; }
.nav-button.active .nav-icon { color: #fff; }
.metric-ic .ic { width: 21px; height: 21px; color: var(--blue); }
.metric.green .metric-ic .ic { color: var(--green); }
.metric.red .metric-ic .ic { color: var(--red); }
.pnl-kpi-icon .ic { width: 20px; height: 20px; }

/* ── Tipografika boyitish (qalin/ingichka) ── */
.nav-text strong { font-weight: 600; letter-spacing: -0.01em; }
.nav-text small { font-weight: 400; }
.metric-body > span { font-weight: 500; letter-spacing: .01em; }
.metric strong { font-weight: 800; }
.pnl-kpi-label { font-weight: 500; text-transform: uppercase; letter-spacing: .04em; font-size: 10.5px; opacity: .85; }
.pnl-kpi-value { font-weight: 800; letter-spacing: -0.015em; }
.pnl-kpi-value small { font-weight: 500; opacity: .7; }

/* ── KPI gridni ixchamlash: 5×2 toza joylashuv ── */
@media (min-width: 1100px) {
  .pnl-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.pnl-kpi { padding: 13px 14px; }

/* ── Xabarlar lentasi (saytda) ── */
.notif-feed { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-soft); }
.notif-ic { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; background: var(--blue-soft); color: var(--blue); }
.notif-green .notif-ic { background: var(--green-soft); color: var(--green); }
.notif-red .notif-ic { background: var(--red-soft); color: var(--red); }
.notif-amber .notif-ic { background: #fff5e6; color: #c77a0a; }
.notif-body { min-width: 0; flex: 1; }
.notif-text { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.5; color: var(--text); }
.notif-time { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }

/* ── Assortiment ── */
.ass-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.ass-search { flex: 1; min-width: 220px; height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); }
.ass-count { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.ass-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ass-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.ass-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.ass-top { display: flex; gap: 12px; }
.ass-img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: 0 0 auto; background: var(--panel-soft); }
.ass-noimg { display: grid; place-items: center; color: var(--muted); }
.ass-noimg .ic { width: 26px; height: 26px; }
.ass-head { min-width: 0; flex: 1; }
.ass-title { font-size: 14px; display: block; line-height: 1.35; }
.ass-variant { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.ass-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ass-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.ass-badge.green { background: var(--green-soft); color: var(--green); }
.ass-badge.red { background: var(--red-soft); color: var(--red); }
.ass-badge.gray { background: var(--panel-soft); color: var(--muted); }
.ass-badge.orange { background: #fff3e0; color: #e67700; }
.ass-badge.soft { background: var(--blue-soft); color: var(--blue-strong); }
.ass-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.ass-grid > div { display: flex; flex-direction: column; }
.ass-grid span { font-size: 11px; color: var(--muted); }
.ass-grid b { font-size: 14px; font-weight: 700; }
.ass-grid b.neg { color: var(--red); }
.ass-grid b.pos { color: var(--green); }
.ass-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }
.ass-meta code { background: var(--panel-soft); padding: 1px 6px; border-radius: 6px; color: var(--text); }

/* ── Assortiment: filtr va saralash ── */
.ass-filters { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.ass-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ass-chip { border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s var(--ease); }
.ass-chip:hover { background: var(--panel-soft); color: var(--text); }
.ass-chip.active { background: var(--blue-strong); color: #fff; border-color: var(--blue-strong); }
.ass-sort { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-left: auto; }
.ass-sort select { height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); font-size: 12px; cursor: pointer; }

/* ── ABC tahlil belgisi ── */
.abc-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; font-size: 12px; font-weight: 800; }
.abc-badge.abc-a { background: var(--green-soft); color: var(--green); }
.abc-badge.abc-b { background: var(--blue-soft); color: var(--blue-strong); }
.abc-badge.abc-c { background: var(--panel-soft); color: var(--muted); }

/* ── Assortiment: ko'rinish tugmasi (karta / ro'yxat) ── */
.ass-viewtoggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel); }
.ass-viewtoggle button { border: none; background: transparent; color: var(--muted); padding: 0 14px; height: 40px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease); }
.ass-viewtoggle button + button { border-left: 1px solid var(--border); }
.ass-viewtoggle button.active { background: var(--blue-soft); color: var(--blue-strong); }
.ass-viewtoggle button:hover:not(.active) { background: var(--panel-soft); color: var(--text); }

/* ── Assortiment: guruh (rang variantlari) ── */
.ass-clickable { cursor: pointer; }
.ass-top { align-items: flex-start; }
.ass-caret { margin-left: auto; color: var(--muted); font-size: 14px; transition: transform .2s var(--ease); align-self: center; }
.ass-caret.open { transform: rotate(180deg); }
.ass-variants { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 8px; }
.ass-var { display: flex; align-items: center; gap: 10px; background: var(--panel-soft); border-radius: 10px; padding: 8px 10px; flex-wrap: wrap; }
.ass-var-img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; background: var(--panel); }
.ass-var-main { min-width: 90px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ass-var-name { font-size: 13px; font-weight: 600; }
.ass-var-sku { font-size: 10px; color: var(--muted); }
.ass-var-badge { margin-top: 2px; }
.ass-var-stat { display: flex; flex-direction: column; min-width: 52px; }
.ass-var-stat span { font-size: 10px; color: var(--muted); }
.ass-var-stat b { font-size: 13px; font-weight: 700; }
.ass-var-stat b.neg { color: var(--red); }
.ass-var-stat b.pos { color: var(--green); }

/* ── Assortiment: ro'yxat (spiska) ko'rinishi ── */
.assl-wrap { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.assl-group { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); min-width: 1010px; }
.assl-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.assl-thead { min-width: 1010px; padding: 4px 12px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.assl-thead .assl-c { font-size: 11px; font-weight: 700; color: var(--muted); }
.assl-img-h { width: 40px; flex: 0 0 auto; }
.assl-head.ass-clickable:hover { background: var(--panel-soft); }
.assl-sub { background: var(--panel-soft); border-top: 1px dashed var(--border); }
.assl-caret { width: 16px; flex: 0 0 auto; text-align: center; }
.assl-img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; background: var(--panel-soft); }
.assl-name { flex: 1; min-width: 150px; display: flex; flex-direction: column; }
.assl-name b { font-size: 13px; }
.assl-name small { font-size: 10px; color: var(--muted); }
.assl-c { display: flex; flex-direction: column; width: 70px; flex: 0 0 auto; font-size: 13px; font-weight: 700; text-align: left; }
.assl-c i { font-style: normal; font-size: 10px; color: var(--muted); font-weight: 500; }
.assl-c b.neg, .assl-c.neg, .assl-c b.neg { color: var(--red); }
.assl-c b.pos { color: var(--green); }
.assl-thead .assl-c i { display: none; }

/* ── Matn sig'mасligi / o'qilishini ta'minlash (global) ── */
.content, .panel, .main { min-width: 0; }
/* Uzun matnlar o'raladi (joyidan chiqib ketmaydi) */
.panel, .metric, .pnl-kpi, .ass-card, .notif-item, .setting-row, .nav-text,
.ass-card *, .pnl-kpi *, .metric *, .notif-body * {
  overflow-wrap: break-word;
  word-break: break-word;
}
/* Flex bolalar qisqarishi uchun (ellipsis ishlashi uchun) */
.metric-body, .pnl-kpi-body, .ass-head, .notif-body, .nav-text, .panel-header > div { min-width: 0; }
/* KPI sonlari o'rtasidan (bo'shliqdan ham) BO'LINMAYDI — bir qatorda turadi */
.metric strong, .pnl-kpi-value { white-space: nowrap; line-height: 1.2; }
.metric-body > span, .pnl-kpi-label, .nav-text small, .ass-variant {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Panel sarlavhasi va tavsifi */
.panel-header h2 { line-height: 1.3; overflow-wrap: break-word; }
.panel-header p { overflow-wrap: break-word; }
/* Sahifa sarlavhasi sig'masa o'raladi */
#pageTitle, #pageSubtitle { overflow-wrap: break-word; }
/* Status qatori uzun bo'lsa o'raladi */
.status-line { flex-wrap: wrap; }
.status-line span { overflow-wrap: anywhere; }
/* Jadval kataklari juda cho'zilmasin */
td, th { overflow-wrap: break-word; }
/* Kod/qiymatlar (SKU, barcode, MXIK) sig'masa o'raladi */
.ass-meta code, .ai-text, .notif-text { overflow-wrap: anywhere; }
/* P&L jadvalidagi label ustuni juda kengaymasin */
.pnl-label { max-width: 240px; overflow-wrap: break-word; white-space: normal; }
/* Select/inputlar konteynerdan oshmasin */
select, input, textarea { max-width: 100%; box-sizing: border-box; }
/* Rasmlar konteynerdan oshmasin */
img { max-width: 100%; }

/* ── KPI strip (to'liq kenglik — to'liq sonlar sig'adi) ── */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px; }
.kpi-strip .metric { min-height: 70px; }
/* KPI qiymati: to'liq son, bo'linmaydi, sig'masa shriftni kichik tabnum bilan */
.metric strong { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pnl-kpi-value { font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric strong { font-size: 16px; }
}

/* Buyurtma jadvali: manfiy ustunlar (komissiya/logistika) */
td.num.neg { color: var(--muted); }

/* So'nggi buyurtmalar — sahifalash (pagination) */
.pg-bar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.pg-left { display: flex; align-items: center; gap: 10px; }
.pg-per {
  height: 34px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-soft, transparent);
  color: var(--text); font-family: inherit; font-size: 14px; cursor: pointer;
}
.pg-per-label { color: var(--muted); font-size: 14px; }
.pg-right { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg-num, .pg-nav {
  min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); background: transparent; color: var(--text);
  border-radius: 9px; font-family: inherit; font-size: 14px; cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.pg-num:hover:not(.pg-active), .pg-nav:hover:not(:disabled) { background: var(--panel-soft, rgba(49,104,240,.08)); border-color: var(--blue); }
.pg-active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; cursor: default; }
.pg-nav:disabled { opacity: .4; cursor: not-allowed; }
.pg-ell { padding: 0 6px; color: var(--muted); }
@media (max-width: 600px) { .pg-per-label { display: none; } }

/* Buyurtma komissiya foizi */
.ord-pct { color: var(--muted); font-size: 11px; font-weight: 500; }

/* Sxema yorlig'i (FBO/FBS/DBS) */
.sch-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.sch-fbo { background: rgba(49, 104, 240, .15); color: #3168f0; }
.sch-fbs { background: rgba(22, 199, 132, .15); color: #11a36a; }
.sch-dbs { background: rgba(245, 159, 11, .15); color: #d97a06; }

/* ── Top 5 mahsulot (rasm + nom + soni + %) ── */
.top-list { display: flex; flex-direction: column; gap: 10px; }
.top-row { display: flex; align-items: center; gap: 12px; }
.top-rank { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; background: var(--blue-soft); color: var(--blue-strong); font-size: 12px; font-weight: 700; }
.top-img { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 11px; object-fit: cover; background: var(--panel-soft); }
.top-noimg { display: grid; place-items: center; color: var(--muted); }
.top-noimg .ic { width: 22px; height: 22px; }
.top-info { flex: 1; min-width: 0; }
.top-name { font-size: 13.5px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-meter { height: 6px; border-radius: 999px; background: var(--panel-soft); margin-top: 6px; overflow: hidden; }
.top-meter span { display: block; height: 100%; background: var(--brand-grad); border-radius: 999px; }
.top-stat { text-align: right; flex: 0 0 auto; }
.top-stat b { display: block; font-size: 14px; }
.top-stat span { font-size: 11px; color: var(--muted); }

/* Buyurtma jadvalida mahsulot rasmi */
.ord-prod { display: flex; align-items: center; gap: 10px; }
.ord-img { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 9px; object-fit: cover; background: var(--panel-soft); }
.ord-noimg { display: grid; place-items: center; color: var(--muted); }
.ord-noimg .ic { width: 18px; height: 18px; }
.ord-prod-info { min-width: 0; }
/* Top 5 SKU */
.top-sku { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ── Rasmlar: hover'da kichik ko'tarilish + katta preview oynasi ── */
.ass-img, .top-img, .ord-img, .notif-item img {
  transition: transform 0.25s var(--ease);
  cursor: zoom-in;
}
.ass-img:hover, .top-img:hover, .ord-img:hover, .notif-item img:hover { transform: scale(1.06); }
/* Katta hover-preview oynasi (to'liq o'lchamida) */
.img-zoom-pop {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(20, 18, 43, 0.45);
  border: 3px solid #fff;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.18s var(--ease), transform 0.22s var(--ease);
}
.img-zoom-pop.show { opacity: 1; transform: scale(1); }
.img-zoom-pop img { display: block; width: 100%; height: 100%; object-fit: contain; background: #fff; }
body.no-anim .img-zoom-pop { transition: none; }
