/* UNETIK ERP — асосий стиллар. Қийматлар фақат tokens.css токенлари орқали (docs/DESIGN_SYSTEM.md). */
/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: var(--fs)/1.5 var(--font);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "zero" 0;  /* slashed zero ҳеч қаерда ёқилмасин */
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: var(--fs-lg); letter-spacing: -.01em; }
h2 { font-size: var(--fs-md); }
h3 { font-size: var(--fs); }
p { margin: 0; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Рақам катакларида браузер стрелкаларини олиб ташлаймиз */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column;
  transition: width var(--t) var(--ease), transform var(--t) var(--ease);
}
.main {
  margin-left: var(--sidebar-w);
  min-width: 0;
  transition: margin-left var(--t) var(--ease);
}
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar__title { font-size: var(--fs-md); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__crumb { color: var(--text-3); font-weight: 500; }
.topbar__spacer { flex: 1; }
.content { padding: 20px; width: 100%; max-width: none; min-width: 0; animation: page-in var(--t) var(--ease) both; }
@media (min-width: 1800px) { .content { padding: 24px 32px; } }

@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Sidebar ---------- */
.sidebar__brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
  padding: 0 18px; color: var(--on-accent); font-weight: 700; letter-spacing: .06em; white-space: nowrap;
  border-bottom: 1px solid var(--sidebar-line);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: var(--radius-sm); flex: none;
  display: grid; place-items: center; font-size: var(--fs-sm); color: var(--on-accent);
  background: var(--brand-gradient);
}
.sidebar__nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-section { margin-bottom: 2px; }
.nav-section__head {
  width: 100%; display: flex; align-items: center; gap: 12px;
  height: 38px; padding: 0 10px; border: 0; border-radius: var(--radius);
  background: none; color: var(--sidebar-text); font: inherit; font-weight: 500; text-align: left; cursor: pointer;
  white-space: nowrap; transition: background var(--t-fast), color var(--t-fast);
}
.nav-section.is-active > .nav-section__head { color: var(--sidebar-active-text); background: var(--sidebar-active); position: relative; }
/* «Графит»: фаол бўлим чапида мис чизиқ */
.nav-section.is-active > .nav-section__head::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0; background: var(--sidebar-accent);
}
.nav-section.is-active > .nav-section__head .icon { color: var(--sidebar-accent); }
.nav-section__label { overflow: hidden; text-overflow: ellipsis; }
.nav-items {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--t) var(--ease);
}
.nav-section.is-open > .nav-items { grid-template-rows: 1fr; }
.nav-items > div { overflow: hidden; }
.nav-item {
  position: relative; display: block;
  padding: 7px 10px 7px 42px; margin: 1px 0; border-radius: var(--radius);
  color: var(--sidebar-text-dim); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item.is-active { background: var(--sidebar-active); color: var(--sidebar-active-text); font-weight: 500; }
.nav-item.is-active::before {
  content: ""; position: absolute; left: 26px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--sidebar-accent);
}
.nav-item__soon { opacity: .75; }
.sidebar__foot { padding: 10px; border-top: 1px solid var(--sidebar-line); }
.sidebar__foot .nav-section__head { height: 34px; font-size: var(--fs-sm); color: var(--sidebar-text-dim); }

/* Ихчам меню (компьютер) */
@media (min-width: 1024px) {
  .sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .sidebar__brand span:not(.brand-mark),
  .sidebar-collapsed .nav-section__label { opacity: 0; pointer-events: none; }
  .sidebar-collapsed .nav-section > .nav-items { display: none; }
  .sidebar-collapsed .sidebar__nav { overflow: visible; }
  .sidebar-collapsed .nav-section { position: relative; }
  .sidebar-collapsed .nav-section__head { justify-content: center; padding: 0; }
  .sidebar-collapsed .nav-section__head .icon { margin: 0; }
  /* Ихчам ҳолатда бўлим устига келинганда ички менюлар чиқади */
  .sidebar-collapsed .nav-section:hover > .nav-items,
  .sidebar-collapsed .nav-section:focus-within > .nav-items {
    display: block; position: absolute; left: calc(100% + 8px); top: 0; z-index: 50;
    min-width: 220px; padding: 6px; border-radius: var(--radius-lg);
    background: var(--sidebar-bg); box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.08);
    animation: pop-in var(--t-fast) var(--ease) both;
  }
  .sidebar-collapsed .nav-section:hover > .nav-items::before {
    content: ""; position: absolute; left: -10px; top: 0; bottom: 0; width: 10px;
  }
  .sidebar-collapsed .nav-section:hover > .nav-items > div { overflow: visible; }
  .sidebar-collapsed .nav-items .nav-item { padding-left: 14px; }
  .sidebar-collapsed .nav-items .nav-item.is-active::before { display: none; }
  .sidebar-collapsed .nav-items > div::before {
    content: attr(data-title); display: block; padding: 6px 14px 4px; color: var(--on-accent); font-weight: 600; font-size: var(--fs-sm);
  }
  .sidebar-collapsed .sidebar__foot .nav-section__label { display: none; }
  .topbar .js-mobile-menu { display: none; }
}

/* Телефон ва планшет: меню чапдан чиқади */
@media (max-width: 1023.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .main { margin-left: 0; }
  .menu-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-open .backdrop { opacity: 1; pointer-events: auto; }
  .topbar .js-collapse { display: none; }
  .content { padding: 14px; }
  .topbar { padding: 0 12px; }
}
.backdrop {
  position: fixed; inset: 0; z-index: 35; background: rgba(8, 12, 20, .45);
  opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease);
}

/* ---------- Тугмалар ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.btn:active { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: var(--on-accent); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--sm { height: 30px; padding: 0 10px; font-size: var(--fs-sm); }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--sm.btn--icon { width: 30px; }
.btn.is-loading { pointer-events: none; color: transparent; position: relative; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-3) transparent var(--text-3) var(--text-3);
  animation: spin .7s linear infinite;
}
.btn--primary.is-loading::after { border-color: var(--on-accent) transparent var(--on-accent) var(--on-accent); }

/* ---------- Формалар ---------- */
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-size: var(--fs-sm); line-height: var(--sp-5); font-weight: 500; color: var(--text-2); }
.field__help { font-size: var(--fs-xs); color: var(--text-3); }
.field__error { font-size: var(--fs-xs); color: var(--danger); }
.input, .select, textarea.input {
  width: 100%; height: var(--control-h); padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea.input { height: auto; min-height: 84px; padding: 8px 11px; resize: vertical; }
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-invalid, .field.has-error .input, .field.has-error .select { border-color: var(--danger); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
/* Select: оддий стрелка ўрнига ихчам белги, браузер стрелкаси йўқ */
.select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 11px) 50%;
  background-size: 4px 4px; background-repeat: no-repeat;
}
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.form-grid .span-all { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.checklist { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---------- Карточка, саҳифа сарлавҳаси ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head__text { flex: 1; min-width: 200px; }
.page-head__text p { margin-top: 2px; color: var(--text-2); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card__head h2 { flex: 1; }
.card__body { padding: 16px; }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-kpi { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.kpi { padding: 14px 16px; }
.kpi__label { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi__value { margin-top: 6px; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi__value.is-negative { color: var(--danger); }
.kpi__hint { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 9px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab.is-active { color: var(--primary); border-color: var(--primary); }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
  background: var(--surface-hover); color: var(--text-2);
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--primary { background: var(--primary-soft); color: var(--primary); }

/* ---------- Жадваллар ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { height: var(--row-h); padding: 6px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
/* «Графит»: сарлавҳа — кичик бош ҳарфлар, кулранг фон (Excel услуби) */
.table th { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); border-bottom-color: var(--border-strong); white-space: nowrap; position: sticky; top: 0; }
.table tbody tr { transition: background var(--t-fast); }
/* Тизим бўйлаб ягона zebra: жуфт қаторлар енгил фонда (Light/Dark — токендан) */
.table tbody tr:nth-child(even) { background: var(--row-alt); }
.spec-list:not(.order-totals):not(.spec-list--compact) > div:nth-child(even) { background: var(--row-alt); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { width: 1%; white-space: nowrap; text-align: right; }

/* Телефонда оддий жадваллар карточкага айланади */
@media (max-width: 640px) {
  .table--responsive thead { display: none; }
  .table--responsive, .table--responsive tbody, .table--responsive tr, .table--responsive td { display: block; width: 100%; }
  .table--responsive tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table--responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table--responsive td::before { content: attr(data-label); color: var(--text-3); font-size: var(--fs-sm); text-align: left; }
  .table--responsive td.actions { justify-content: flex-end; padding-top: 6px; width: 100%; }
  .table--responsive td.actions::before { content: none; }
}

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); }

/* ---------- Ҳолатлар: Empty / Loading / Error / Success ---------- */
.state { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; text-align: center; }
.state__icon {
  width: 48px; height: 48px; border-radius: var(--radius-lg); display: grid; place-items: center;
  background: var(--surface-hover); color: var(--text-3); margin-bottom: 4px;
}
.state__icon .icon { width: 24px; height: 24px; }
.state h3 { font-size: var(--fs-md); }
.state p { color: var(--text-2); max-width: 420px; }
.state--error .state__icon { background: var(--danger-soft); color: var(--danger); }
.state--success .state__icon { background: var(--success-soft); color: var(--success); }
.state--info .state__icon { background: var(--primary-soft); color: var(--primary); }

.skeleton {
  display: block; height: 12px; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border) 37%, var(--surface-hover) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
}
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: spin .7s linear infinite; }
.htmx-indicator { opacity: 0; transition: opacity var(--t-fast); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.top-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100; pointer-events: none;
  background: var(--primary); transform-origin: left; transform: scaleX(0); opacity: 0;
}
.htmx-request.top-progress, body.htmx-request .top-progress { opacity: 1; animation: progress 1.2s var(--ease) forwards; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); font-size: var(--fs-sm); }
.alert .icon { margin-top: 1px; width: 16px; height: 16px; }
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--success { background: var(--success-soft); color: var(--success); }
.alert--info { background: var(--info-soft); color: var(--info); }
.alert--warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: toast-in var(--t) var(--ease) both;
}
.toast.is-leaving { animation: toast-out var(--t) var(--ease) both; }
.toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger); }
.toast--info .toast__icon { color: var(--info); }
.toast--warning .toast__icon { color: var(--warning); }
.toast__text { flex: 1; font-size: var(--fs-sm); }

/* ---------- Модал ---------- */
.modal-root:empty { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(8, 12, 20, .5); animation: fade-in var(--t) var(--ease) both;
}
.modal__dialog {
  width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: modal-in var(--t) var(--ease) both;
}
.modal.is-leaving { animation: fade-out var(--t-fast) var(--ease) both; }
.modal.is-leaving .modal__dialog { animation: modal-out var(--t-fast) var(--ease) both; }
.modal__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal__head h2 { flex: 1; }
.modal__body { padding: 16px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .modal { place-items: end stretch; padding: 0; }
  .modal__dialog { width: 100%; min-width: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; animation-name: sheet-in; }
  /* Узун тугма матни (Golos Text кенгроқ) экрандан чиқмасин: тугмалар иккинчи қаторга ўтади */
  .modal__foot { flex-wrap: wrap; }
  .modal__foot .btn { flex: 1 1 auto; }
}

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: none;
}
.dropdown.is-open .dropdown__menu { display: block; animation: pop-in var(--t-fast) var(--ease) both; }
.dropdown__item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.dropdown__item.is-active { color: var(--primary); font-weight: 500; }
.dropdown__sep { height: 1px; margin: 6px 0; background: var(--border); }
.dropdown__head { padding: 8px 10px 6px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary); font-size: var(--fs-xs); font-weight: 600;
}

/* ---------- Анимациялар ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes progress { 0% { transform: scaleX(0); } 60% { transform: scaleX(.7); } 100% { transform: scaleX(.92); } }

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

/* ---------- Кириш саҳифаси ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth__card { width: min(380px, 100%); padding: 28px; animation: modal-in var(--t) var(--ease) both; }
.auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-weight: 700; letter-spacing: .06em; }
.auth__tools { position: fixed; top: 14px; right: 14px; display: flex; gap: 6px; }

/* =====================================================================================
   Excel услубидаги жадвал (товар операциялари учун)
   ===================================================================================== */
.xgrid { position: relative; }
.xgrid__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.xgrid table { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.xgrid th {
  height: var(--row-h); padding: 0 10px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); text-align: left;
  background: var(--surface-2); border-bottom: 1px solid var(--border-strong);
}
.xgrid td { padding: 0; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); position: relative; height: var(--row-h); }
.xgrid td:last-child { border-right: 0; }
.xgrid .c-no { width: var(--col-no); } .xgrid .c-brand { width: var(--col-brand); } .xgrid .c-cond { width: var(--col-cond); } .xgrid .c-model { width: auto; min-width: var(--col-model); }
.xgrid .c-price { width: var(--col-price); } .xgrid .c-qty { width: var(--col-qty); } .xgrid .c-sum { width: var(--col-sum); } .xgrid .c-del { width: 40px; }
.xgrid th.num { text-align: right; }
.xgrid td.c-no { text-align: center; color: var(--text-3); font-size: var(--fs-xs); background: var(--surface-2); }
.xgrid .cell {
  display: block; width: 100%; height: 36px; padding: 0 10px; border: 0; background: transparent; color: var(--text);
  font: inherit; font-variant-numeric: tabular-nums; outline: none;
}
.xgrid .cell.num { text-align: right; }
.xgrid .cell[readonly] { color: var(--text-2); cursor: default; }
.xgrid td:focus-within { box-shadow: inset 0 0 0 2px var(--primary); z-index: 1; background: var(--surface); }
.xgrid td.is-invalid { background: var(--danger-soft); }
.xgrid td.is-invalid:focus-within { box-shadow: inset 0 0 0 2px var(--danger); }
.xgrid td.is-warning { background: var(--warning-soft); }
.xgrid .cell-sum { padding: 0 10px; line-height: 36px; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xgrid .row-del {
  width: 100%; height: 36px; border: 0; background: none; color: var(--text-3); cursor: pointer; display: grid; place-items: center;
  transition: color var(--t-fast), background var(--t-fast);
}
.xgrid .row-del .icon { width: 15px; height: 15px; }
.xgrid tbody tr { animation: fade-in var(--t) var(--ease) both; }
.xgrid tfoot td { height: var(--row-h-foot); background: var(--surface-2); font-weight: 600; border-bottom: 0; }
.xgrid tfoot .total-label { padding: 0 10px; text-align: right; color: var(--text-2); font-weight: 500; }
.xgrid tfoot .num { padding: 0 10px; }
.xgrid__bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--border); }
.xgrid__hint { color: var(--text-3); font-size: var(--fs-xs); flex: 1; min-width: 200px; }
.xgrid__errors { margin: 0; padding: 10px 12px 0; list-style: none; display: grid; gap: 4px; }
.xgrid__errors:empty { display: none; }

.suggest {
  position: fixed; z-index: 70; min-width: 260px; max-width: 420px; max-height: 280px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: pop-in var(--t-fast) var(--ease) both;
}
.suggest__item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.suggest__item.is-active { background: var(--primary-soft); }
.suggest__model { font-weight: 600; font-family: var(--font-mono); font-size: var(--fs-sm); }
.suggest__brand { color: var(--text-2); font-size: var(--fs-xs); text-align: right; }
.suggest__spec { grid-column: 1 / -1; color: var(--text-3); font-size: var(--fs-xs); }
.suggest__empty { padding: 10px; color: var(--text-3); font-size: var(--fs-sm); }
.suggest mark { background: none; color: var(--primary); }

/* Телефонда: ҳар бир қатор карточка кўринишида, жадвал экрандан чиқиб кетмайди */
@media (max-width: 640px) {
  .xgrid table { min-width: 0; table-layout: auto; }
  .xgrid thead { display: none; }
  .xgrid tbody, .xgrid tfoot { display: block; }
  .xgrid tbody tr {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; position: relative;
    margin: 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface);
  }
  .xgrid tbody td { border-right: 0; height: auto; }
  .xgrid tbody td::before { content: attr(data-label); display: block; padding: 6px 10px 0; font-size: var(--fs-2xs); color: var(--text-3); }
  .xgrid tbody td.c-no { position: absolute; left: 0; top: 0; width: auto; padding: 6px 10px; background: none; border: 0; z-index: 2; }
  .xgrid tbody td.c-no::before { content: none; }
  .xgrid tbody td { width: auto; }
  .xgrid tbody td.c-model { grid-column: 1 / 3; grid-row: 1; padding-left: 28px; }
  .xgrid tbody td.c-qty { grid-column: 1; grid-row: 2; }
  .xgrid tbody td.c-price { grid-column: 2; grid-row: 2; }
  .xgrid tbody td.c-sum { grid-column: 3; grid-row: 2; border-right: 0; }
  .xgrid tbody td.c-brand { grid-column: 3; grid-row: 1; }
  .xgrid tbody td.c-del { position: absolute; right: 0; top: 0; width: 36px; border: 0; z-index: 2; }
  .xgrid tbody td.c-del::before { content: none; }
  .xgrid tbody td.c-del .row-del { height: 30px; }
  .xgrid tbody td.c-brand { padding-right: 32px; }
  .xgrid .cell, .xgrid .cell-sum { height: 40px; line-height: 40px; font-size: var(--fs-md); }
  .xgrid tfoot tr { display: flex; justify-content: flex-end; gap: 16px; padding: 10px 14px; }
  .xgrid tfoot td { height: auto; border: 0; background: none; padding: 0; }
  .xgrid tfoot td:empty, .xgrid tfoot .total-label { display: none; }
  .xgrid tfoot td[data-label]::before { content: attr(data-label) ": "; color: var(--text-3); font-weight: 400; }
}

/* ---------- Веб-сайт (вақтинча) ---------- */
.site { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.site h1 { font-size: var(--fs-2xl); letter-spacing: .02em; }
.site p { margin-top: 10px; color: var(--text-2); }

/* Мавзу тугмаси иконкаси */
:root[data-theme="dark"] .theme-icon-light, :root:not([data-theme="dark"]) .theme-icon-dark { display: none; }
.theme-icon-light, .theme-icon-dark { display: inline-flex; }
@media (max-width: 640px) { .lang-switch .lang-switch__label { display: none; } }
@media (min-width: 1024px) {
  .sidebar-collapsed .sidebar__foot .nav-section:hover > .nav-items { top: auto; bottom: 0; }
}

/* Ҳуқуқлар матрицаси */
.perm-section { padding: 12px 16px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.perm-section:last-child { border-bottom: 0; }
.perm-section__head .icon { color: var(--text-2); }
.perm-item { padding-left: 24px; color: var(--text-2); }
.changes { font-size: var(--fs-xs); color: var(--text-2); display: grid; gap: 2px; max-width: 520px; }
.changes code { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--text); }

/* =====================================================================================
   Dashboard
   ===================================================================================== */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--surface-hover); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented__item { position: relative; display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-2); white-space: nowrap; cursor: pointer; user-select: none; transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast); }
.segmented__item.is-active, .segmented__item:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented__item input { position: absolute; opacity: 0; pointer-events: none; }
.segmented__item:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }

.dash-head { align-items: flex-end; }
.dash-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; margin-bottom: 14px; }
.dash-filter__label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.dash-filter__range { display: none; align-items: center; gap: 8px; animation: page-in var(--t) var(--ease) both; }
.dash-filter:has(input[value=custom]:checked) .dash-filter__range { display: flex; }
.dash-filter__range .input { height: 30px; width: 150px; }
.dash-body { transition: opacity var(--t) var(--ease); }
.dash-body.htmx-request { opacity: .45; pointer-events: none; }
.dash-period { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); margin: 0 0 10px; }
.dash-section { margin-bottom: 16px; }
.dash-section__title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-bottom: var(--sp-3); }
.dash-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.dash-grid--goods { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1279.98px) { .dash-grid--goods { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
@keyframes tile-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dash-tile { transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.dash-tile .kpi__label { align-items: flex-start; }
.dash-tile .kpi__label .icon { margin-top: 1px; }
.dash-tile .kpi__label span:first-of-type { flex: 1; min-width: 0; }
.dash-tile__window { flex: none; font-size: var(--fs-2xs); padding: 1px 6px; border-radius: var(--radius-pill); background: var(--surface-hover); color: var(--text-3); }
.dash-tile .kpi__value small { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }
.dash-tile .kpi__hint { display: flex; align-items: center; gap: 4px; }
.dash-tile .kpi__hint a { display: inline-flex; align-items: center; gap: 4px; }
.dash-tile.is-empty .kpi__value { color: var(--text-3); }
.dash-tile--warning { border-left: 3px solid var(--warning); }
.dash-tile--danger { border-left: 3px solid var(--danger); }

.dash-row { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); margin-bottom: 16px; }
@media (max-width: 1279.98px) { .dash-row { grid-template-columns: minmax(0, 1fr); } }

.legend { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.legend__dot { width: 10px; height: 10px; border-radius: var(--radius-xs); display: inline-block; }
.legend__dot--1, .series-1 { background: var(--series-1); fill: var(--series-1); }
.legend__dot--2, .series-2 { background: var(--series-2); fill: var(--series-2); }

.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart { display: block; width: 100%; min-width: 520px; height: auto; }
.chart__grid { stroke: var(--border); stroke-width: 1; }
.chart__axis { stroke: var(--border-strong); stroke-width: 1; }
.chart__tick { fill: var(--text-3); font-size: var(--fs-2xs); font-variant-numeric: tabular-nums; }
.chart__hit { fill: transparent; }
.chart__group:hover .chart__hit { fill: var(--surface-hover); }
.chart__bar { transition: opacity var(--t-fast); }
.chart:hover .chart__bar { opacity: .55; }
.chart .chart__group:hover .chart__bar { opacity: 1; }
.chart--ghost { opacity: .7; }
.chart-wrap { position: relative; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; transform: translate(-50%, calc(-100% - 10px)); transition: opacity var(--t-fast); }
.chart-tip[hidden] { display: block; opacity: 0; }
.chart-tip__title { font-weight: 600; margin-bottom: var(--sp-1); }
.chart-tip__row { display: flex; align-items: center; gap: 6px; }
.chart-tip__row b { margin-left: auto; padding-left: var(--sp-3); }
.chart-empty { position: relative; }
.chart-empty__msg { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; padding: 16px; color: var(--text-2); font-size: var(--fs-sm); }
.chart-empty__msg .icon { color: var(--primary); margin-bottom: 4px; }
.chart-empty__msg strong { color: var(--text); font-size: var(--fs); }
.chart-empty__msg span { max-width: 340px; }

.dash-alerts .state { padding: 32px 16px; }
.alert-list { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.alert-list__item { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: var(--radius); transition: background var(--t-fast); }
.alert-list__icon { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: var(--radius); }
.alert-list__item--danger .alert-list__icon { background: var(--danger-soft); color: var(--danger); }
.alert-list__item--warning .alert-list__icon { background: var(--warning-soft); color: var(--warning); }
.alert-list__item--info .alert-list__icon { background: var(--info-soft); color: var(--info); }
.alert-list__text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: var(--fs-sm); }
.alert-list__text span { color: var(--text-2); font-size: var(--fs-sm); }

.split-bar { display: flex; gap: 2px; height: 14px; border-radius: var(--radius-pill); overflow: hidden; background: var(--surface); }
.split-bar__seg { display: block; min-width: 4px; transition: flex-basis var(--t) var(--ease); }
.split-bar.is-empty .split-bar__seg { background: var(--surface-hover); }
.split-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; }

@media (max-width: 640px) {
  .dash-filter { padding: 10px; }
  .dash-filter .segmented { width: 100%; }
  .dash-filter .segmented__item { flex: 1; justify-content: center; padding: 0 6px; }
  .dash-filter__range { width: 100%; }
  .dash-filter__range .input { flex: 1; width: auto; min-width: 0; }
  .dash-head .segmented { width: 100%; }
  .dash-head .segmented__item { flex: 1; justify-content: center; }
  .dash-grid, .dash-grid--goods { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dash-tile { padding: 12px; }
  .dash-tile .kpi__value { font-size: var(--fs-lg); }
  .dash-tile__window { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dash-grid > *, .dash-row > .card, .dash-split, .dash-filter__range { animation: none; }
}

/* =====================================================================================
   Каталог: категориялар
   ===================================================================================== */
.thumb { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-hover); border: 1px solid var(--border); color: var(--text-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .icon { width: 18px; height: 18px; }
.thumb--lg { width: 72px; height: 72px; border-radius: var(--radius-lg); }
.thumb--lg .icon { width: 26px; height: 26px; }
.thumb--xl { width: 64px; height: 64px; border-radius: var(--radius-lg); }
.cat-name { display: inline-flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.cat-name:hover { text-decoration: none; }
.cat-name:hover strong { color: var(--primary); }
.cat-name strong { font-weight: 500; transition: color var(--t-fast); }
.cat-name__text { display: grid; gap: 1px; min-width: 0; }
.cat-name__text .dim { font-size: var(--fs-xs); }
.cat-name__branch { color: var(--text-3); display: inline-flex; }
.cat-row--child td:first-child { padding-left: 30px; }
.cat-table tbody tr:not(.cat-row--child) td { border-top: 1px solid var(--border); }
.is-context { opacity: .55; }
.cat-head { align-items: center; }
.img-field { display: flex; align-items: center; gap: 14px; }
.img-field input[type=file] { max-width: 100%; font-size: var(--fs-sm); color: var(--text-2); }
.img-field input[type=file]::file-selector-button { height: 32px; margin-right: 10px; padding: 0 12px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; }
.badge .icon { width: 13px; height: 13px; }
.chip { display: inline-block; margin: 1px 4px 1px 0; padding: 1px 7px; border-radius: var(--radius-pill); font-size: var(--fs-xs);
  background: var(--surface-hover); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.attr-options { max-width: 380px; }
.modal__dialog--sm { width: min(460px, 100%); }
/* Хусусият тури: «Рўйхатдан танлаш» бўлмаса қийматлар, «Ҳа/Йўқ» бўлса бирлик яширилади */
.attr-form:not(:has([data-attr-type] option[value=choice]:checked)) .attr-form__options { display: none; }
.attr-form:has([data-attr-type] option[value=boolean]:checked) .attr-form__unit { display: none; }
.attr-form__unit > .field, .attr-form__options > .field { height: 100%; }
@media (max-width: 640px) {
  .cat-row--child td:first-child { padding-left: 0; }
  .table--responsive .cat-name { justify-content: flex-end; }
  .attr-options { max-width: none; }
  .img-field { align-items: flex-start; }
}

/* =====================================================================================
   Каталог: брендлар ва маҳсулотлар
   ===================================================================================== */
.thumb--md { width: 44px; height: 44px; }
.thumb--logo { background: var(--media-bg); }
.thumb--logo img { object-fit: contain; padding: 3px; }
.product-table .cat-name__text strong { font-weight: 600; }

/* Маҳсулот формаси: чапда асосий, ўнгда расм ва ҳолат */
.product-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.product-layout--detail { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
@media (max-width: 1023.98px) { .product-layout, .product-layout--detail { grid-template-columns: minmax(0, 1fr); } }
.product-form { padding-bottom: 8px; }
.form-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  margin: 16px -20px -20px; padding: 12px 20px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px); border-top: 1px solid var(--border);
}
@media (max-width: 1023.98px) { .form-bar { margin: 16px -14px -14px; padding: 10px 14px; } }
@media (max-width: 640px) {
  .card__head { flex-wrap: wrap; }
  .card__head .badge { height: auto; min-height: 22px; white-space: normal; }
  .form-bar { margin: 16px -14px -14px; padding: 10px 14px; flex-wrap: nowrap; }
  .form-bar .btn { flex: 1; min-width: 0; padding: 4px 8px; height: auto; min-height: 38px; white-space: normal; line-height: 1.2; }
  .form-bar a.btn { display: none; }
}

.upload-drop {
  display: grid; justify-items: center; gap: 4px; padding: 18px 12px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-2); font-weight: 500;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.upload-drop.is-over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.upload-drop .dim { font-weight: 400; font-size: var(--fs-xs); }
.upload-drop .icon { width: 22px; height: 22px; }
input.js-multi-images:focus-visible + .img-grid, .upload-drop:focus-within { outline: 2px solid var(--primary); }
.img-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.img-grid:empty { display: none; }
.img-tile { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-hover);
  animation: page-in var(--t) var(--ease) both; }
.img-tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity var(--t-fast), filter var(--t-fast); }
.img-tile__main, .img-tile__remove, .img-tile__badge {
  position: absolute; display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: var(--radius-pill);
  font-size: var(--fs-2xs); font-weight: 500; background: rgba(15, 23, 42, .72); color: var(--on-accent); cursor: pointer;
}
.img-tile__main { left: 4px; bottom: 4px; }
.img-tile__main input { width: 12px; height: 12px; margin: 0; accent-color: var(--primary); }
.img-tile__remove { right: 4px; top: 4px; padding: 4px; }
.img-tile__remove input { position: absolute; opacity: 0; pointer-events: none; }
.img-tile__remove .icon { width: 14px; height: 14px; }
.img-tile__badge { left: 4px; bottom: 4px; cursor: default; }
.img-tile:has(.img-tile__remove input:checked) img { opacity: .3; filter: grayscale(1); }
.img-tile:has(.img-tile__remove input:checked) .img-tile__remove { background: var(--danger); }
.img-tile:has(.img-tile__main input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.model-check { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; animation: page-in var(--t) var(--ease) both; }
.model-check .icon { width: 14px; height: 14px; }

/* Маҳсулот карточкаси */
.spec-list { margin: 0; }
.spec-list > div { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--border); }
.spec-list > div:last-child { border-bottom: 0; }
.spec-list dt { color: var(--text-2); }
.spec-list dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.product-gallery { overflow: hidden; }
.product-gallery__main { aspect-ratio: 1; display: grid; place-items: center; background: var(--media-bg); }
.product-gallery__main img { width: 100%; height: 100%; object-fit: contain; animation: page-in var(--t) var(--ease) both; }
.product-gallery__thumbs { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); overflow-x: auto; }
.product-gallery__thumbs .thumb { padding: 0; cursor: pointer; background: var(--media-bg); }
.product-gallery__thumbs .thumb.is-active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.product-description { color: var(--text-2); max-width: 820px; }
.product-description p + p { margin-top: 8px; }

/* =====================================================================================
   Харидлар
   ===================================================================================== */

/* Serial Number: модель + омбор гуруҳлари, Excel катаклари (4×5 / 5 / 10 устун) */
.sn-groups { display: grid; gap: 14px; padding: 14px; }
.sn-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; overflow: hidden; }
.sn-group__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.sn-group__title { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.sn-group__title strong { font-size: var(--fs); }
.sn-group__wh { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--text); }
.sn-group__wh .icon { width: 15px; height: 15px; color: var(--text-2); }
.sn-group__qty { margin-left: auto; font-variant-numeric: tabular-nums; }
.sn-group__part { font-size: var(--fs-xs); }
.sn-scroll { overflow-x: auto; display: grid; gap: 10px; padding: 10px 12px 12px; }
.sn-grid { --cols: 5; display: grid; grid-template-columns: 40px repeat(var(--cols), minmax(88px, 1fr)); width: 100%;
  border-top: 1px solid var(--border); border-left: 1px solid var(--border); font-size: var(--fs-sm); }
.sn-row { display: contents; }
.sn-cell, .sn-rowhead, .sn-colhead, .sn-corner { min-height: 30px; padding: 5px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.sn-colhead, .sn-rowhead, .sn-corner { background: var(--surface-hover); color: var(--text-3); font-size: var(--fs-2xs); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.sn-rowhead { padding: 5px 2px; }
.sn-cell { position: relative; font-family: var(--font-mono); color: var(--text); word-break: break-all; line-height: 1.35; transition: background var(--t) var(--ease); }
a.sn-cell:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.sn-cell::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.sn-cell--success::before { background: var(--success); }
.sn-cell--warning::before { background: var(--warning); }
.sn-cell--danger::before { background: var(--danger); }
.sn-cell--info::before { background: var(--info); }
.sn-cell--primary::before { background: var(--primary); }
.sn-cell--empty { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-hover) 6px 7px); }
@media (max-width: 640px) {
  .sn-groups { padding: 10px; gap: 10px; }
  .sn-scroll { padding: 8px; }
  .sn-grid { grid-template-columns: 32px repeat(var(--cols), minmax(96px, 1fr)); font-size: var(--fs-xs); }
}

.tx-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.js-rate-field.is-optional { opacity: .7; }
.xgrid select.cell { appearance: none; cursor: pointer; padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.xgrid select.cell option { background: var(--surface); color: var(--text); }
.xgrid--purchase table { min-width: 720px; }
@media (max-width: 640px) {
  .xgrid--purchase table { min-width: 0; }
  .xgrid--purchase tbody td.c-cond { grid-column: 1; grid-row: 2; }
  .xgrid--purchase tbody td.c-qty { grid-column: 2; grid-row: 2; }
  .xgrid--purchase tbody td.c-price { grid-column: 3; grid-row: 2; }
  .xgrid--purchase tbody td.c-sum { grid-column: 1 / -1; grid-row: 3; border-top: 1px solid var(--border); }
  .xgrid--purchase tbody td.c-sum::before { display: inline; padding: 0 0 0 10px; }
  .xgrid--purchase tbody td.c-sum .cell-sum { display: inline-block; float: right; height: 30px; line-height: 30px; }
}

.purchase-summary .spec-list dd { text-align: right; font-variant-numeric: tabular-nums; }
.purchase-summary .is-total { background: var(--surface-2); }
.purchase-summary .is-total dt, .purchase-summary .is-total dd { font-weight: 600; color: var(--text); }
.purchase-summary .is-negative { color: var(--danger); }
.product-side { position: sticky; top: 72px; }
@media (max-width: 1023.98px) { .product-side { position: static; } }

.purchase-kpi .kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  animation: page-in var(--t) var(--ease) both; }
.purchase-kpi .kpi__value small, .dash-tile small { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }
.kpi--warning { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)) !important; background: var(--warning-soft) !important; }
.purchase-columns { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 16px; align-items: start; }
@media (max-width: 1023.98px) { .purchase-columns { grid-template-columns: minmax(0, 1fr); } }
.purchase-lines .cat-name__text .dim { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pay-list { margin: 0; padding: 0; list-style: none; }
.pay-list__item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pay-list__item:last-child { border-bottom: 0; }
.pay-list__main { flex: 1; display: grid; gap: 3px; min-width: 0; }
.pay-list__main .dim { font-size: var(--fs-sm); }
.shots { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.shots .thumb { transition: transform var(--t-fast), box-shadow var(--t-fast); }

.totals-bar { display: flex; gap: 8px 20px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.totals-bar__item { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); }
.contact { display: grid; gap: 1px; font-size: var(--fs-sm); }
.contact .dim { font-size: var(--fs-xs); }
.balance-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.balance-line strong { font-size: var(--fs-lg); }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .table--responsive .contact { text-align: right; }
  .purchase-lines .cat-name__text .dim { max-width: 200px; }
}
.return-status:not(:has(input[value=refund]:checked)) .js-refund-field { display: none; }
@media (max-width: 640px) {
  .tx-form .form-bar { flex-wrap: wrap; }
  .tx-form .form-bar .btn { flex: 1 1 140px; white-space: normal; height: auto; min-height: 38px; line-height: 1.2; }
}
@media (max-width: 640px) {
  .purchase-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .purchase-kpi .kpi { padding: 10px 12px; }
  .purchase-kpi .kpi__value { font-size: var(--fs-md); }
}

/* ---------- Сифат назорати ---------- */
.modal__dialog--wide { width: min(820px, 100%); }
.text-danger { color: var(--danger); }
.chip--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chip--primary { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.qc-nav { margin-left: auto; }
.qc-kpi .kpi--warning .kpi__value { color: var(--warning); }
.spec-list--compact > div { padding: 6px 0; grid-template-columns: minmax(90px, 30%) 1fr; }
.qgrid table { min-width: 980px; }
.qgrid .c-serial { width: 220px; } .qgrid .c-param { width: 118px; } .qgrid .c-result { width: 190px; } .qgrid .c-note { width: auto; min-width: 160px; }
.qgrid th.c-param { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qgrid__serial { display: flex; flex-direction: column; justify-content: center; min-height: 36px; padding: 4px 10px; line-height: 1.25; }
.qgrid__serial .dim { font-size: var(--fs-2xs); }
.qgrid__std { font-size: var(--fs-xs); display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end; }
.qgrid td.is-bad { background: var(--danger-soft); }
.qgrid td.is-bad .cell { color: var(--danger); font-weight: 600; }
.qgrid tr.is-error td { background: var(--danger-soft); }
.qgrid__err td { padding: 4px 10px; height: auto; background: var(--surface-2); }
.qgrid__auto { display: block; padding: 0 10px 4px; font-size: var(--fs-2xs); line-height: 1.2; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qgrid__auto:empty { display: none; }
.qgrid__auto.is-passed { color: var(--success); } .qgrid__auto.is-failed { color: var(--danger); } .qgrid__auto.is-partial { color: var(--warning); }
.qgrid .c-result .cell { height: 30px; }
.qc-form .form-bar { justify-content: space-between; }
.qc-stats { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 16px 0; }
.qc-values { max-width: 380px; }
.qc-values .chip { white-space: normal; }
.qc-groups { display: grid; gap: 0; }
.qc-group + .qc-group { border-top: 6px solid var(--surface-2); }
.qc-group__head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; }
.qc-history { padding: 14px 16px; display: grid; gap: 12px; }
.qc-history h3 { font-size: var(--fs); }
.qc-attempt { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 8px; }
.qc-attempt__table td { padding: 4px 8px; }
.modal__dialog--xl { width: min(1040px, 100%); }
.std-params .input, .std-params .select { min-width: 90px; }
.std-params td:nth-child(2) .select { min-width: 120px; } .std-params td:nth-child(4) .select { min-width: 190px; }
.std-params td:last-child { width: 44px; } .std-params td:last-child .check { gap: 4px; color: var(--text-3); }
.std-params td:first-child .input { min-width: 150px; }
.std-params tr.is-error td { background: var(--danger-soft); }
@media (max-width: 1023.98px) { .qc-nav { margin-left: 0; width: 100%; min-width: 0; } .page-head > .row:has(> .qc-nav) { min-width: 0; max-width: 100%; } }
@media (max-width: 640px) {
  .qgrid table { min-width: 0; }
  .qgrid tbody tr[data-row] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .qgrid tbody tr[data-row] td { width: auto; min-width: 0; }
  .qgrid__auto { white-space: normal; }
  .qc-form .form-bar .xgrid__hint { display: none; }
  .qc-form .form-bar .btn { width: 100%; justify-content: center; }
  .qgrid .card__head { flex-wrap: wrap; }
  .qgrid tbody td.c-serial { grid-column: 1 / -1; padding-left: 22px; }
  .qgrid tbody td.c-result, .qgrid tbody td.c-note { grid-column: 1 / -1; }
  .qgrid tbody td.c-serial::before { content: none; }
  .qgrid__err { display: block; margin: -6px 10px 10px; }
  .qgrid__err td { display: block; }
  .qgrid__std { justify-content: flex-start; }
}

/* ---------- Омборлар (ЭТАП-07) ---------- */
.wh-actions { margin-bottom: 12px; flex-wrap: wrap; }
.wh-company + .wh-company { margin-top: 20px; }
.wh-company .dash-section__title { margin-bottom: 10px; }
.wh-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.wh-card { padding: 14px 16px; display: grid; gap: 10px; animation: page-in .25s ease both; }
.wh-card.is-muted { opacity: .6; }
.wh-card__head { display: flex; gap: 10px; align-items: center; }
.wh-card__icon { width: 36px; height: 36px; border-radius: var(--radius-lg); display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.wh-card__icon--success { background: var(--success-soft); color: var(--success); }
.wh-card__icon--warning { background: var(--warning-soft); color: var(--warning); }
.wh-card__icon--danger { background: var(--danger-soft); color: var(--danger); }
.wh-card__value { font-size: var(--fs-xl); font-weight: 650; font-variant-numeric: tabular-nums; }
.wh-card__value small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); }
.wh-card__meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); }
.wh-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wh-qty__input { width: 90px; text-align: right; margin-left: auto; }
.wh-timeline { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.wh-timeline li { padding: 8px 10px; border-left: 3px solid var(--border); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: var(--fs-sm); }
.box-layout { display: grid; gap: 16px; grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
.box-qr .card__body { display: grid; justify-items: center; gap: 6px; text-align: center; }
.box-qr__img svg { width: 200px; height: 200px; display: block; background: var(--media-bg); border-radius: var(--radius); }
.box-qr__code { font-size: var(--fs-md); font-weight: 650; }
.box-action { display: grid; gap: 8px; border-top: 1px solid var(--border); }
form.box-action:has(input[name=reason]) { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 1023.98px) { .box-layout { grid-template-columns: 1fr; } form.box-action:has(input[name=reason]) { grid-template-columns: 1fr; } }

/* ---------- Узоқ босиб судраш (карточкалар, чап меню) ---------- */
[data-sortable] > [data-sort-id] { -webkit-touch-callout: none; }
.is-sorting, .is-sorting * { -webkit-user-select: none; user-select: none; cursor: grabbing !important; }
.sort-pressing { transform: scale(.98); transition: transform .35s var(--ease); }
.sort-dragging { position: relative; z-index: 70; pointer-events: none; opacity: .92; animation: none !important;
  transition: none !important; box-shadow: var(--shadow-lg); }
.nav-section.sort-dragging, .nav-item.sort-dragging { background: var(--sidebar-bg); border-radius: var(--radius); }
.sort-target { outline: 2px dashed var(--primary); outline-offset: 2px; border-radius: var(--radius); }
.sidebar .sort-target { outline-color: var(--sidebar-accent); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .sort-pressing { transform: none; } }

/* ---------- Логистика: жўнатмалар ва йўл чизиғи ---------- */
.text-danger { color: var(--danger); }
.ship-actions { gap: 8px; flex-wrap: wrap; margin-left: auto; }
.ship-actions form { display: contents; }
.ship-kpi { margin: 12px 0 16px; }
.ship-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
.ship-card { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; animation: page-in .25s ease both; }
.ship-card.is-late { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.ship-card--wide { margin-bottom: 4px; }
.ship-card__head { display: flex; gap: 10px; align-items: center; }
.ship-card__title { flex: 1; min-width: 0; }
.ship-card__title .dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ship-card__qty { font-size: var(--fs-xl); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ship-card__qty small { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }
.ship-card__goods { display: flex; flex-wrap: wrap; gap: 4px; }
.ship-track { display: grid; gap: 8px; }
.ship-track__bar { position: relative; height: 6px; border-radius: var(--radius-pill); background: var(--surface-hover); overflow: hidden; }
.ship-track__bar span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--primary);
  transform-origin: left; animation: ship-grow .7s var(--ease) both; }
.ship-track.is-late .ship-track__bar span { background: var(--danger); }
@keyframes ship-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ship-track__steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.ship-track__step { display: grid; justify-items: center; gap: 2px; text-align: center; font-size: var(--fs-2xs); color: var(--text-3); }
.ship-track__dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border);
  background: var(--surface); transition: background .2s, border-color .2s; }
.ship-track__dot .icon { width: 12px; height: 12px; }
.ship-track__step.is-done { color: var(--text); }
.ship-track__step.is-done .ship-track__dot { background: var(--success); border-color: var(--success); color: var(--on-accent); }
.ship-track__date { font-variant-numeric: tabular-nums; color: var(--text-3); }
.ship-track__meta { font-size: var(--fs-sm); display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.ship-track__meta .icon { width: 14px; height: 14px; vertical-align: -2px; }
.ship-check { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ship-serials { padding: 12px 16px; border-top: 1px solid var(--border); }
.ship-serials summary { cursor: pointer; font-weight: 500; margin-bottom: 8px; }
.ship-cost { display: grid; gap: 4px; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
@media (max-width: 640px) {
  .ship-grid { grid-template-columns: 1fr; }
  .ship-actions { margin-left: 0; width: 100%; }
  .ship-track__label { font-size: var(--fs-2xs); }
}
@media (prefers-reduced-motion: reduce) { .ship-track__bar span { animation: none; } }

/* ---------- Сотувлар ---------- */
.xgrid .c-disc { width: 92px; }
.xgrid--sale table { min-width: 900px; }
.xgrid .c-model { position: relative; }
.xgrid .cell-hint { position: absolute; right: 6px; bottom: 1px; font-size: var(--fs-2xs); line-height: 13px; color: var(--text-3);
  pointer-events: none; white-space: nowrap; }
.xgrid--sale td.c-model .cell { padding-bottom: 6px; }
.xgrid .cell-hint:empty { display: none; }
@media (max-width: 640px) {
  .xgrid--sale table { min-width: 0; }
  .xgrid--sale tbody td.c-disc { grid-column: 1; grid-row: 3; border-top: 1px solid var(--border); }
  .xgrid--sale tbody td.c-sum { grid-column: 2 / -1; grid-row: 3; }
  .xgrid .cell-hint { bottom: 4px; }
}
.sale-form .js-rate-field.is-optional .input { opacity: .6; }
.sale-form .js-prepay { margin: 4px 0 8px; width: 100%; }
.sale-form .js-prepay .segmented__item { flex: 1; justify-content: center; }
.sale-actions { gap: 8px; flex-wrap: wrap; margin-left: auto; }
.sale-actions form { display: contents; }
.plain-list { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.alert .plain-list { padding-left: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 3px; }
.chips .chip { margin: 0; }
.sale-totals { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.sale-totals__item { display: grid; gap: 1px; font-size: var(--fs-sm); }
.sale-totals__item strong { font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.order-filter { flex-wrap: wrap; }
.order-card__money { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; font-size: var(--fs-sm); }
.order-card__money > div { display: grid; gap: 1px; }
.order-card__money strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.order-card__warn { margin: 0; padding: 8px 10px; list-style: none; border-radius: var(--radius); background: var(--warning-soft); font-size: var(--fs-sm); }
.order-card__warn .icon { width: 14px; height: 14px; vertical-align: -2px; color: var(--warning); }
.progress { height: 6px; border-radius: var(--radius-pill); background: var(--surface-hover); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width .4s var(--ease); }
.return-info { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-sm); }
.return-info__serials { flex-basis: 100%; overflow-wrap: anywhere; }
.found-sale .alert { align-items: center; flex-wrap: wrap; }
.warranty-card__status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 12px;
  border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-md); }
.warranty-card__status .icon { width: 22px; height: 22px; }
.warranty-card__status.is-ok { background: var(--success-soft); color: var(--success); }
.warranty-card__status.is-bad { background: var(--danger-soft); color: var(--danger); }
.warranty-card__status span { color: var(--text-2); }
.warranty-card .spec-list > div { padding-left: 0; padding-right: 0; }
@media (max-width: 640px) {
  .sale-actions { margin-left: 0; width: 100%; }
  .order-card__money { grid-template-columns: 1fr 1fr; }
}
.sale-form .product-layout > .stack, .sale-form .product-layout > .stack > * { min-width: 0; }
button.segmented__item { border: 0; background: none; font: inherit; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
button.segmented__item.is-active { background: var(--surface); color: var(--text); }
.order-filter .dim { margin-left: 6px; font-variant-numeric: tabular-nums; }
.order-card { align-content: start; }

/* ---------- Молия ---------- */
.text-success { color: var(--success); }
.kpi--success { border-color: color-mix(in srgb, var(--success) 40%, var(--border)) !important; }
.kpi--danger .kpi__value { color: var(--danger); }
.fin-kpi { margin-bottom: 0; }
.fin-kpi .kpi__value { overflow-wrap: anywhere; }
.acc-grid { display: grid; gap: 10px; padding: 12px 16px 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.acc-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: inherit; text-decoration: none; min-width: 0; transition: border-color .15s, transform .15s, box-shadow .15s; }
.acc-card.is-context { opacity: .6; }
.acc-card__icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-lg); background: var(--surface-2); color: var(--primary); flex: none; }
.acc-card__body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.acc-card__body strong, .acc-card__body .dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-card__body .dim { font-size: var(--fs-xs); }
.acc-card__balance { margin-top: 4px; font-size: var(--fs-md); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc-card__balance small { color: var(--text-3); font-weight: 500; }
.exp-cats { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.exp-cat { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-sm); }
.exp-cat strong { font-variant-numeric: tabular-nums; }
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cat-list__item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cat-list__item.is-context { opacity: .6; }
.cat-list__name { flex: 1; min-width: 0; }
.debt-docs { display: flex; flex-wrap: wrap; gap: 6px; }
.debt-doc { display: inline-flex; gap: 4px; align-items: baseline; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--fs-xs); color: inherit; text-decoration: none; white-space: nowrap; }
.debt-doc.is-overdue { background: var(--danger-soft); color: var(--danger); }
.ic-sum { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.ic-details { border-top: 1px solid var(--border); }
.ic-details > summary { cursor: pointer; padding: 10px 16px; color: var(--text-3); font-size: var(--fs-sm); }
.dash-tile__split { list-style: none; margin: 8px 0 2px; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); }
.dash-tile__split li { display: grid; gap: 1px; padding-left: 8px; border-left: 2px solid var(--border); }
.dash-tile__split span { color: var(--text-2); font-size: var(--fs-2xs); }
.dash-tile__split strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-tile__subs { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 1px; font-size: var(--fs-2xs); color: var(--text-2); }
.dash-tile__subs li { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.dash-tile__subs li span:last-child { font-variant-numeric: tabular-nums; color: var(--text); }

/* ===== Аукцион (ЭТАП-11) ===== */
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: currentColor; vertical-align: 1px;
  animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.countdown.is-soon { color: var(--danger); }
.countdown.is-over { color: var(--text-3); }
.countdown--big { display: block; font-size: var(--fs-2xl); line-height: 1.15; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.countdown.is-soon.countdown--big { animation: live-pulse 1s ease-in-out infinite; }
.auc-kpi { margin-bottom: 0; }
.auc-kpi a.kpi { color: inherit; text-decoration: none; transition: border-color var(--t-fast), transform var(--t-fast); }
.auc-states { display: inline-flex; }

.lot-board { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.lot-card { display: grid; grid-template-rows: 150px auto; overflow: hidden; color: inherit; text-decoration: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); animation: tile-in var(--t) var(--ease) both; }
.lot-card__img { display: grid; place-items: center; background: var(--media-bg); color: var(--text-3); border-bottom: 1px solid var(--border); }
.lot-card__img img { width: 100%; height: 150px; object-fit: contain; }
.lot-card__body { display: grid; gap: 6px; padding: 12px 14px 14px; min-width: 0; }
.lot-card__title { font-size: var(--fs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lot-card__price { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-top: 4px; border-top: 1px dashed var(--border); }
.lot-card__price strong { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.lot-card__meta { display: flex; gap: 14px; font-size: var(--fs-sm); color: var(--text-2); }
.lot-card__meta span { display: inline-flex; align-items: center; gap: 4px; }
.lot-card__leader { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lot-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); align-items: start; }
@media (max-width: 1023.98px) { .lot-layout { grid-template-columns: minmax(0, 1fr); } }
.lot-live { overflow: hidden; }
.lot-live__body { display: grid; gap: 12px; padding: 16px; }
.lot-live__top { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.lot-live__clock, .lot-live__price { display: grid; gap: 2px; }
.lot-live__price { text-align: right; }
.lot-live__amount { font-size: var(--fs-2xl); line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--primary); animation: page-in var(--t) var(--ease) both; }
.lot-live__amount small { font-size: var(--fs); color: var(--text-2); font-weight: 500; }
.lot-live__stats { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-sm); }
.lot-live__stats span { display: inline-flex; align-items: center; gap: 5px; }
.lot-live__bids { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.lot-live__bids .table th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.lot-live__bids tr.is-leader td { background: var(--success-soft); }
.lot-live__bids tr:first-child td { animation: tile-in var(--t) var(--ease) both; }
.lot-live__empty { padding: 6px 2px; }
.lot-bid__row { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: end; }
.lot-bid__row .field { margin: 0; }
@media (max-width: 640px) {
  .lot-bid__row { grid-template-columns: minmax(0, 1fr); }
  .lot-live__price { text-align: left; }
  .countdown--big { font-size: var(--fs-xl); }
  .lot-live__amount { font-size: var(--fs-xl); }
}
.lot-calc { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: var(--fs-sm); color: var(--text-2); }
.lot-calc strong { color: var(--text); font-variant-numeric: tabular-nums; }
.img-tile > .btn { position: absolute; right: 4px; top: 4px; background: var(--surface); }
.notify-item { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.notify-item__text { margin: 0; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: var(--fs-sm); line-height: 1.5; white-space: pre-line; }
.text-warning { color: var(--warning); }
@media (prefers-reduced-motion: reduce) {
  .live-dot, .countdown.is-soon.countdown--big, .lot-card, .lot-live__amount, .lot-live__bids tr:first-child td { animation: none; }
}

/* Маҳсулот формаси: сайт учун таржималар */
.site-langs { margin-top: 12px; }
.site-langs > summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }

/* ---------- Веб-сайт бўлими ---------- */
[data-lang-pane][hidden] { display: none !important; }
.lang-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-lg); background: var(--surface-hover); margin-bottom: 14px; }
.lang-tab { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-sm); font-weight: 500; padding: 5px 12px; border-radius: var(--radius-sm); cursor: pointer; position: relative; }
.lang-tab.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.lang-tab.has-error::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.site-head-link { display: inline-flex; align-items: center; gap: 6px; }
.banner-thumb { width: 120px; height: 48px; border-radius: var(--radius); overflow: hidden; flex: none; display: grid; place-items: center; color: var(--on-accent); font-size: var(--fs-2xs); font-weight: 600; }
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; }
.banner-thumb--dark { background: var(--swatch-banner-dark); }
.banner-thumb--blue { background: var(--swatch-banner-blue); }
.banner-thumb--light { background: var(--swatch-banner-light); color: var(--swatch-ink); }
.seo-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; padding: 16px; border-top: 1px solid var(--border); }
.seo-row:first-child { border-top: 0; }
.seo-row__name strong { display: block; }
.seo-row__name .dim { font-size: var(--fs-xs); }
.mono-note code { background: var(--surface-hover); padding: 1px 5px; border-radius: var(--radius-xs); font-size: var(--fs-xs); }
@media (max-width: 1023.98px) { .seo-row { grid-template-columns: 1fr; gap: 8px; } .banner-thumb { width: 84px; height: 40px; } }

/* ---------- Сайт мижозлари: даражалар ---------- */
.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tier-card { padding: 14px 16px; position: relative; overflow: hidden; }
.tier-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--swatch-tier-silver-line); }
.tier-card--gold::before { background: var(--swatch-tier-gold-line); }
.tier-card--vip::before { background: var(--swatch-tier-vip-line); }
.tier-card__head { display: flex; align-items: center; gap: 8px; }
.tier-card__head .btn { margin-left: auto; }
.tier-card__dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
.tier-card__dl dt { font-size: var(--fs-2xs); color: var(--text-3); }
.tier-card__dl dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.tier-card__perks { margin-top: 10px; font-size: var(--fs-sm); color: var(--text-2); display: grid; gap: 4px; }
.tier-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--radius-pill); font-size: var(--fs-2xs); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--on-accent); background: var(--swatch-tier-silver); }
.tier-chip--gold { background: var(--swatch-tier-gold); }
.tier-chip--vip { background: var(--swatch-tier-vip); }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 12px; border-radius: var(--radius, 10px); background: var(--surface-hover); }
.kv dt { font-size: var(--fs-2xs); color: var(--text-3); }
.kv dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }

/* ЭТАП-13: ойлик табель */
.tsheet { font-size: var(--fs-xs); }
.tsheet th, .tsheet td { padding: 6px 4px; }
.tsheet__name { min-width: 160px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tsheet__day { text-align: center; min-width: 24px; color: var(--text-2, inherit); font-weight: 500; }
.tsheet__cell { text-align: center; font-weight: 600; }
.tsheet__cell.is-off, .tsheet__day.is-off { background: var(--surface-2, rgba(127,127,127,.06)); }
.tsheet__cell.is-ok { color: var(--success); }
.tsheet__cell.is-late { color: var(--warning); }

/* ЭТАП-14: ҳисоботлар */
.rep-tabs { margin-bottom: 16px; max-width: 100%; overflow-x: auto; }
.rep-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.rep-filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rep-filter .label { font-size: var(--fs-xs); color: var(--text-2); }
.rep-filter--btns { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.rep-sub { border-top: 1px solid var(--border); padding-top: 10px; padding-bottom: 10px; font-size: var(--fs-sm); }
.rep-table .neg { color: var(--danger); }
.rep-total td { background: var(--surface-2); border-top: 2px solid var(--border); }
@media (max-width: 640px) { .rep-filters { grid-template-columns: 1fr 1fr; } .rep-filter--btns { grid-column: 1 / -1; } }

/* ЭТАП-15: созламалар */
.sys-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sys-links { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.sys-links li { display: flex; gap: 8px; align-items: flex-start; }
.sys-links .icon { flex: none; margin-top: 2px; }
@media (max-width: 1023.98px) { .sys-grid { grid-template-columns: 1fr; } }
/* Тизим параметрлари: тўлов усуллари рўйхати (фаол белгиси + номи) */
.pay-methods { display: grid; gap: 6px; }
.pay-methods__row { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; }
.pay-methods__row .field__error { grid-column: 2; }
.pay-methods__on { display: inline-flex; justify-content: center; cursor: pointer; }
.pay-methods__on input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

/* Сериялар (ЭТАП-15+) */
.series-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
.series-list { list-style: none; margin: 0; padding: 4px 0; }
.series-list li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 16px; min-height: 44px; border-top: 1px solid var(--border); }
.series-list li:first-child { border-top: 0; }
.series-list li.is-context { opacity: .6; }
.series-list__count { margin-left: auto; font-variant-numeric: tabular-nums; }
.series-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1px solid transparent; }
.series-dot--blue { background: var(--swatch-blue); } .series-dot--purple { background: var(--swatch-purple); } .series-dot--red { background: var(--swatch-red); }
.series-dot--gold { background: var(--swatch-gold); } .series-dot--green { background: var(--swatch-green); } .series-dot--orange { background: var(--swatch-orange); }
.series-dot--black { background: var(--swatch-black); border-color: var(--border-strong); } .series-dot--white { background: var(--swatch-white); border-color: var(--border-strong); }
.series-dot--gray { background: var(--swatch-gray); }
@media (max-width: 640px) { .series-grid { grid-template-columns: 1fr; } }
.dir-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dir-chip { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-pill); cursor: pointer; font-size: var(--fs-sm); font-weight: 500; user-select: none; background: var(--surface); }
.dir-chip input { position: absolute; opacity: 0; pointer-events: none; }
.dir-chip:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--text); }
.dir-chip:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 1px; }
/* Маҳсулот формаси: бир устунли жойлашув, 3 устунли катаклар */
.product-layout--single { grid-template-columns: minmax(0, 1fr); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1279.98px) { .form-grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.product-side-row { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.money-input { position: relative; }
.money-input .input { padding-right: 52px; }
.money-input__cur { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); pointer-events: none; }
@media (max-width: 1023.98px) { .form-grid--3, .form-grid--4, .form-grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .product-side-row { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .form-grid--3, .form-grid--4, .form-grid--5 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Янги харид ва янги сотув: бир устун, «Буюртма → Товарлар → Жами → Тўлов шарти» битта бўлимда ---------- */
.order-layout > .stack, .order-layout > .stack > * { min-width: 0; }
.order-sheet { overflow: visible; }
.order-sheet__sec + .order-sheet__sec, .ic-order-form__sec + .ic-order-form__sec { border-top: 1px solid var(--border); }
.order-sheet__sec > .card__head, .ic-order-form__sec > .card__head { border-bottom: 0; padding-bottom: 0; }
.order-sheet__sec > .card__head h2 { font-size: var(--fs-md); }
/* Товарлар ва харажатлар жадвали: Excel катаклари, бир қаторда, zebra (харид, сотув, ички буюртма — ягона услуб) */
.xgrid--form .xgrid__scroll { margin: 8px 16px 0; border: 1px solid var(--grid-line); border-radius: var(--radius); background: var(--surface); }
.xgrid.xgrid--form table { min-width: 760px; }
.xgrid.xgrid--sale table { min-width: 860px; }
.xgrid--form th { height: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--grid-line); border-right: 1px solid var(--grid-line); }
.xgrid--form th:last-child, .xgrid--form td:last-child { border-right: 0; }
.xgrid--form td { height: var(--row-h); border-color: var(--grid-line); }
.xgrid--form tbody tr:nth-child(even) { background: var(--row-alt); }
.xgrid--form .cell, .xgrid--form .row-del { height: 38px; }
.xgrid--form .cell-sum { line-height: 38px; }
.xgrid--form tfoot td { border-right: 0; }
.xgrid--form .xgrid__bar { border-top: 0; padding: 10px 16px 16px; }
.xgrid--form .xgrid__errors { padding: 8px 16px 0; }
/* Қўшимча харажатлар — товарлар жадвали билан бир хил катаклар */
.xgrid--exp .c-kind { width: 200px; } .xgrid--exp .c-note { width: auto; }
.xgrid.xgrid--exp table { min-width: 560px; }
.xgrid--exp tbody { counter-reset: exp; }
.xgrid--exp tbody tr { counter-increment: exp; }
.xgrid--exp.xgrid tbody td.c-no::after { content: counter(exp); }
.xgrid--exp .xgrid__scroll:not(:has(tbody tr)) { display: none; }
/* Жами: кўрсаткичлар бир қаторда */
.order-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 12px 16px 16px; }
.order-totals > div, .order-totals > div:last-child {
  display: grid; grid-template-columns: 1fr; gap: 4px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.order-totals dt { font-size: var(--fs-sm); }
.purchase-summary .order-totals dd, .ic-pay .order-totals dd { text-align: left; font-size: var(--fs-md); }
.purchase-summary .order-totals .is-total, .ic-pay .order-totals .is-total { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
@media (max-width: 640px) {
  /* Телефонда ҳам бир қатор: карточкага айланмайди, жадвал ён томонга суриб кўрилади */
  .xgrid--form .xgrid__scroll { margin: 8px 12px 0; }
  .xgrid.xgrid--form table { table-layout: fixed; }
  .xgrid.xgrid--form thead { display: table-header-group; }
  .xgrid.xgrid--form tbody { display: table-row-group; }
  .xgrid.xgrid--form tfoot { display: table-footer-group; }
  .xgrid.xgrid--form tbody tr, .xgrid.xgrid--form tfoot tr { display: table-row; margin: 0; border: 0; border-radius: 0; padding: 0; background: none; }
  .xgrid.xgrid--form tbody tr:nth-child(even) { background: var(--row-alt); }
  .xgrid.xgrid--form tbody td, .xgrid.xgrid--form tfoot td {
    display: table-cell; position: relative; width: auto; padding: 0; height: 38px; border: 0;
    border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); z-index: auto;
  }
  .xgrid.xgrid--form tbody td.c-no, .xgrid.xgrid--form tbody td.c-del { position: relative; padding: 0; }
  .xgrid.xgrid--form tbody td.c-no { background: var(--surface-2); }
  .xgrid.xgrid--form tbody td.c-del, .xgrid.xgrid--form tfoot td:last-child { border-right: 0; }
  .xgrid.xgrid--form tbody td::before, .xgrid.xgrid--form tfoot td::before { content: none; display: none; }
  .xgrid.xgrid--form tfoot td { background: var(--surface-2); border-bottom: 0; }
  .xgrid.xgrid--form tfoot td:empty, .xgrid.xgrid--form tfoot .total-label { display: table-cell; }
  .xgrid.xgrid--form tbody td .cell, .xgrid.xgrid--form .cell-sum { height: 38px; line-height: 38px; font-size: var(--fs-md); }
  .xgrid.xgrid--form tbody td.c-sum .cell-sum { display: block; float: none; }
  .xgrid.xgrid--form .row-del { height: 38px; }
  .order-totals { grid-template-columns: 1fr 1fr; }
}

/* Ҳисоботлар: «Устунлар» танлови, аниқ чегаралар ва zebra (Light/Dark — токенлардан) */
@media (min-width: 641px) {
  .rep-filter--btns { grid-column: span 2; flex-wrap: nowrap; }
}
@media (max-width: 640px) { .rep-table tbody tr { border-bottom: 1px solid var(--grid-line); } }
.rep-cols { position: relative; }
.rep-cols > summary { list-style: none; cursor: pointer; }
.rep-cols > summary::-webkit-details-marker { display: none; }
.rep-cols__menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 220px; max-width: min(320px, calc(100vw - 32px));
  max-height: 60vh; overflow-y: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius, 10px); box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,.18)); }
.rep-cols__item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); font-size: var(--fs-sm); cursor: pointer; }
.rep-cols__item:has(input:disabled) { opacity: .6; cursor: default; }

/* Вазифа №11: хабарномалар қўнғироғи ва марказ */
.bell { position: relative; }
.bell__dot { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius); background: var(--primary); color: var(--on-accent); font-size: var(--fs-2xs); font-weight: 600; line-height: 16px; text-align: center; }
.bell__dot--warn { background: var(--warning); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--border); }
.notice:first-child { border-top: 0; }
.notice--unread { background: var(--surface-hover); }
.notice__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notice__meta { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.ic-actions { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); margin-top: 16px; }
.ic-lines input.input { min-width: 90px; }

/* ---------- Ички буюртма формаси: ягона .xgrid--form (Бренд · Модель · Ҳолат · Нарх · Миқдор · Сумма) ---------- */
.ic-order-form > .ic-order-form__sec:first-child { padding: 16px; }
.xgrid--ic td.c-model .cell { padding-bottom: 6px; }
.xgrid--ic .cell::placeholder { color: var(--text-3); }
.ic-pay .order-totals { padding: 12px 0 0; }

/* Сотув: Serial Number киритиш — Excel катаклари, ҳар қути 4 қатор × 5 устун */
.sn-boxes { display: grid; gap: 10px; overflow-x: auto; }
.sn-box__head { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.sn-entry .sn-cell { padding: 0; }
.sn-entry .sn-cell input { width: 100%; height: 100%; min-height: 30px; padding: 5px 8px; border: 0; background: transparent;
  color: inherit; font: inherit; }
.sn-entry .sn-cell input:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
.sn-entry .sn-row .sn-cell.is-dup { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.sn-entry .sn-row:nth-child(odd) .sn-cell { background-color: var(--row-alt, transparent); }
.js-serials-box[hidden] { display: none; }

/* Хабарномалар маркази: кимга (компания ранги), тури, жонли ҳолат; Excel zebra жадвал */
.co-0 { --co: var(--co-0); } .co-1 { --co: var(--co-1); } .co-2 { --co: var(--co-2); }
.co-3 { --co: var(--co-3); } .co-4 { --co: var(--co-4); } .co-5 { --co: var(--co-5); }
.co-badge { display: inline-block; margin: 1px 4px 1px 0; padding: 2px 8px; border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 600;
  white-space: nowrap; color: var(--co); background: color-mix(in srgb, var(--co) 13%, transparent); border: 1px solid color-mix(in srgb, var(--co) 35%, transparent); }
.nc__head { flex-wrap: wrap; gap: 8px; }
.nc__filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px 0; }
.nc__filters:last-of-type { padding-bottom: 10px; }
.nc__label { font-size: var(--fs-xs); color: var(--text-3); margin-right: 4px; }
.nc__filters .chip { margin: 0; padding: 4px 10px; font-size: var(--fs-sm); text-decoration: none; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.nc__filters .chip .icon { width: 14px; height: 14px; }
.nc__filters .chip--on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.nc__filters .co-chip { border-left: 3px solid var(--co); }
.nc-table { border-top: 1px solid var(--grid-line); }
@media (min-width: 641px) { .nc-table td { vertical-align: top; } }
.nc-type { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-size: var(--fs-sm); color: var(--text-2); margin-top: 4px; }
.nc-table td.nc-state { display: table-cell; }
.nc-state .badge { display: flex; width: fit-content; margin-bottom: 3px; }
.nc-type .icon { width: 15px; height: 15px; color: var(--text-2); }
.nc-doc { min-width: 180px; overflow-wrap: anywhere; }
.nc-row--unread .nc-title { font-weight: 600; }
.nc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-right: 6px; vertical-align: middle; }
.nc-row--act td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.nc-sub { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.nc-dir { font-weight: 500; }
.nc-dir + .nc-sub { display: block; }
.nc-table .badge { white-space: nowrap; }
.nc-table .badge .icon { width: 12px; height: 12px; }
@media (max-width: 640px) {
  .nc-table td.nc-doc { display: block; text-align: left; }
  .nc-table td.nc-doc::before { display: block; }
  .nc-row--act { box-shadow: inset 3px 0 0 var(--warning); }
  .nc-table td { flex-wrap: wrap; white-space: normal; }
  .nc-dir + .nc-sub { display: inline; }
  .nc-table td.nc-state { display: flex; flex-direction: row; justify-content: flex-end; }
  .nc-state .badge { display: inline-flex; }
  .nc-table td.nc-who { align-items: center; }
  .nc-table .nc-type { margin-top: 0; }
}
/* ---------- Компаниялараро: бўлим навигацияси, ҳаёт босқичлари, кейинги қадам, қарз ---------- */
.ic-tabs { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-hover); overflow-x: auto; scrollbar-width: none; }
.ic-tabs::-webkit-scrollbar { display: none; }
.ic-tabs__item { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
.ic-tabs__item .icon { width: 16px; height: 16px; }
.ic-tabs__item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.ic-tabs__count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-lg); background: var(--warning); color: var(--on-accent); font-size: var(--fs-xs); font-weight: 600; line-height: 20px; text-align: center; }
.ic-tabs__item--end { margin-left: auto; }
.ic-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 16px; }
.ic-subtabs__item { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.ic-subtabs__item .icon { width: 15px; height: 15px; }
.ic-subtabs__item.is-active { border-color: var(--primary); color: var(--primary); background: var(--surface); }
.ic-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 16px; }
.ic-how__step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; }
.ic-how__no { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--on-accent); font-weight: 600; font-size: var(--fs-sm); line-height: 26px; text-align: center; }
.ic-how__step strong { display: block; }
.ic-how__step p { margin: 2px 0 0; color: var(--text-2); font-size: var(--fs-xs); line-height: 1.4; }
.ic-more { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.ic-more__card { display: flex; flex-direction: column; gap: 8px; padding: 16px; color: var(--text); }
.ic-more__card .icon { width: 22px; height: 22px; color: var(--primary); }
.ic-more__card p { margin: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.45; }
.ic-more__go { margin-top: auto; color: var(--primary); font-size: var(--fs-sm); font-weight: 500; }
.ic-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); list-style: none; margin: 0 0 16px; padding: 14px 16px; counter-reset: icstep; }
.ic-steps li { position: relative; padding-top: 34px; text-align: center; font-size: var(--fs-sm); counter-increment: icstep; min-width: 0; }
.ic-steps li::before { content: counter(icstep); position: absolute; top: 0; left: 50%; z-index: 1; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); color: var(--text-3); font-weight: 600; line-height: 22px; }
.ic-steps li + li::after { content: ""; position: absolute; top: 12px; right: 50%; width: 100%; height: 2px; background: var(--border); }
.ic-steps li.is-done::before { content: "✓"; border-color: var(--success); background: var(--success); color: var(--on-accent); }
.ic-steps li.is-done + li::after, .ic-steps li.is-done::after { background: var(--success); }
.ic-steps li.is-current::before { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.ic-steps li.is-failed::before { content: "✕"; border-color: var(--danger); background: var(--danger); color: var(--on-accent); }
.ic-steps__label { display: block; font-weight: 600; color: var(--text); }
.ic-steps li.is-todo .ic-steps__label { color: var(--text-3); font-weight: 500; }
.ic-steps__meta { display: block; color: var(--text-3); font-size: var(--fs-xs); overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .ic-steps { grid-auto-flow: row; gap: 10px; padding: 12px 14px; }
  .ic-steps li { padding: 2px 0 2px 38px; text-align: left; min-height: 26px; }
  .ic-steps li::before { left: 0; margin-left: 0; }
  .ic-steps li + li::after { top: -12px; left: 12px; right: auto; width: 2px; height: 14px; }
  .ic-steps__meta { display: inline; margin-left: 6px; }
}
.ic-next { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 16px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border)); border-radius: var(--radius); background: var(--primary-soft); }
.ic-next--wait { border-color: var(--border); background: var(--surface-hover); }
.ic-next__text { flex: 1 1 260px; min-width: 0; }
.ic-next__text strong { display: block; }
.ic-next__text span { color: var(--text-2); font-size: var(--fs-sm); }
.ic-h2 { margin: 0 0 10px; font-size: var(--fs-md); font-weight: 600; }
.ic-debts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin-bottom: 16px; }
.ic-debt { padding: 14px 16px; }
.ic-debt__dir { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.ic-debt__value { margin-top: 4px; font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.ic-debt__value small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); }
.ic-debt__hint { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; }
.ic-todo { list-style: none; margin: 0; padding: 0; }
.ic-todo li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); }
.ic-todo li:first-child { border-top: 0; }
.ic-todo li:nth-child(even) { background: var(--row-alt); }
.ic-todo__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ic-todo__body .dim { font-size: var(--fs-sm); }
.ic-status-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ic-status-chips .btn small { margin-left: 4px; opacity: .75; }
@media (max-width: 640px) { .ic-todo li { flex-wrap: wrap; } }
.ic-kpi a.kpi, a.kpi.card { color: inherit; text-decoration: none; }

/* Операцияни ўчириш тугмаси ва тасдиқлаш ойнаси (apps/core/deletion.py) */
.op-del { color: var(--danger); }
.op-del-summary th { width: 40%; font-weight: 500; color: var(--text-2); }
.alert ul { margin: 6px 0 4px 18px; padding: 0; }

/* Байроқли компания номи: UNETIK (Хитой) / HICOM (Ўзбекистон) */
.flag { display: inline-block; flex: none; vertical-align: -2px; border-radius: var(--radius-xs); box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
.co-name { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.co-name b { font-weight: 600; }

/* Тасдиқлаш попаплари: чапда — Хитой (UNETIK) сўровлари, ўнгда — Ўзбекистон (HICOM) сўровлари */
.apop-wrap { pointer-events: none; }
.apop { position: fixed; top: 68px; z-index: 75; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 84px); overflow-y: auto; overscroll-behavior: contain; pointer-events: none; padding: 2px; }
.apop--left { left: 16px; }
.apop--right { right: 16px; }
.apop-card, .apop-more { pointer-events: auto; }
.apop-card { --acc: var(--primary); position: relative; padding: 12px 14px 12px 16px; border-radius: var(--radius-lg, 12px);
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--acc) 40%, var(--border)); box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm); overflow: hidden; }
.apop-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--acc); }
.apop-card--right::before { inset: 0 0 0 auto; }
.apop-card--cn { --acc: var(--flag-cn); }
.apop-card--uz { --acc: var(--flag-uz); }
.apop-card__head { display: flex; align-items: flex-start; gap: 10px; }
.apop-card__flag .flag { margin-top: 2px; }
.apop-card__ttl { flex: 1; min-width: 0; display: grid; gap: 1px; }
.apop-card__ttl strong { font-size: var(--fs); line-height: 1.3; }
.apop-card__from { font-size: var(--fs-xs); color: var(--text-2); }
.apop-card__from b { color: var(--acc); }
.apop-card__x { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin: -4px -6px 0 0; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text-2); cursor: pointer; }
.apop-card__x:focus-visible { background: var(--surface-hover); color: var(--text); }
.apop-card__facts { display: grid; gap: 4px; margin: 10px 0 0; }
.apop-card__facts > div { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: baseline; }
.apop-card__facts dt { color: var(--text-3, var(--text-2)); font-size: var(--fs-xs); }
.apop-card__facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.apop-card__facts dd .co-name { white-space: normal; }
.apop-card__effect { display: flex; gap: 6px; margin: 10px 0 0; padding: 8px 10px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--acc) 9%, transparent); color: var(--text); line-height: 1.4; }
.apop-card__effect .icon { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--acc); }
.apop-card__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.apop-card__actions form { display: contents; }
.apop-card__reject { display: flex; gap: 6px; margin-top: 8px; }
.apop-card__reject[hidden] { display: none; }
.apop-card__reject .input { flex: 1; min-width: 0; height: 32px; }
.apop-more { justify-self: start; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: var(--fs-sm); }
.apop--right .apop-more { justify-self: end; }
.apop-more--m { display: none; }
.apop-card--in.apop-card--left { animation: apop-in-l .42s cubic-bezier(.2, .9, .25, 1.05) both; }
.apop-card--in.apop-card--right { animation: apop-in-r .42s cubic-bezier(.2, .9, .25, 1.05) both; }
.apop-card--out { transition: opacity .2s, transform .2s; opacity: 0; }
.apop-card--out.apop-card--left { transform: translateX(-24px); }
.apop-card--out.apop-card--right { transform: translateX(24px); }
@keyframes apop-in-l { from { opacity: 0; transform: translateX(calc(-100% - 24px)); } to { opacity: 1; transform: none; } }
@keyframes apop-in-r { from { opacity: 0; transform: translateX(calc(100% + 24px)); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .apop-card--in { animation-duration: .01s !important; } }
/* Телефон: иккала томон пастдан бир устунда, лекин ҳар бири ўз четидан чиқади */
@media (max-width: 640px) {
  .apop-wrap { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 75; display: grid; gap: 8px; max-height: 72vh;
    overflow-y: auto; overscroll-behavior: contain; pointer-events: auto; }
  .apop { position: static; width: auto; max-height: none; overflow: visible; padding: 0; }
  .apop-card { padding: 10px 12px 10px 14px; }
  .apop-card__facts > div { grid-template-columns: 84px 1fr; }
  .apop-card ~ .apop-card, .apop .apop-more { display: none; }  /* телефонда ҳар томондан биттадан, ихчам */
  .apop-more--m { display: block; justify-self: center; }
}

/* «Возврат товаров»: поставщик товарлари жадвали (харид жадвали билан бир хил катаклар, zebra) */
.xgrid--vz .c-lot { width: 150px; }
.xgrid--vz .c-max { width: var(--col-qty); }
.xgrid.xgrid--vz table { min-width: 900px; }
.xgrid--vz tbody { counter-reset: vz; }
.xgrid--vz tbody tr { counter-increment: vz; }
.xgrid--vz.xgrid tbody td.c-no::after { content: counter(vz); }
.xgrid--vz .vz-cell { display: block; padding: 0 10px; line-height: 38px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xgrid--vz .vz-cell.num { text-align: right; font-variant-numeric: tabular-nums; }
.xgrid--vz .c-max .vz-cell { color: var(--text-3); }
.xgrid--vz tfoot td[data-vz-total=sum] { line-height: 1.4; padding-top: 8px; padding-bottom: 8px; white-space: nowrap; }
.vz-batch-lines .num { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .xgrid.xgrid--vz table { min-width: 1060px; } }
