:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --grid: #ebeae6;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77766f;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --seq: #2a78d6;
  --good: #0ca30c;
  --good-text: #006300;
  --critical: #d03b3b;
  --critical-bg: #fbeceb;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121211;
    --surface-1: #1a1a19;
    --surface-2: #232321;
    --border: #2f2f2c;
    --grid: #2a2a28;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --seq: #3987e5;
    --good-text: #4cc54c;
    --critical-bg: #3a1f1e;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface-1: #1a1a19;
  --surface-2: #232321;
  --border: #2f2f2c;
  --grid: #2a2a28;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #8f8e86;
  --accent: #3987e5;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --seq: #3987e5;
  --good-text: #4cc54c;
  --critical-bg: #3a1f1e;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* --- Yon menyu va sahifa tuzilishi --- */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 12px; background: var(--surface-1); border-right: 1px solid var(--border);
}
.sidebar-brand { font-weight: 680; font-size: 16px; letter-spacing: -.01em; color: var(--text-primary);
  text-decoration: none; padding: 2px 10px; }
.sidebar-brand span { display: block; color: var(--text-muted); font-weight: 500; font-size: 12.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--text-secondary); text-decoration: none; white-space: nowrap; }
.nav-link svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.nav-link:hover { background: var(--surface-2); color: var(--text-primary); }
.nav-link[aria-current="page"] { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 0 10px; font-size: 13px; }
.content { min-width: 0; }

/* --- Sarlavha --- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; background: var(--surface-1); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5; min-height: 61px;
}
.page-title { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.page-sub { color: var(--text-muted); font-size: 12.5px; }
.topbar-right { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 13px; }
.link { color: var(--text-secondary); text-decoration: none; }
.link:hover { color: var(--text-primary); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; }

/* --- Filtrlar --- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px; }
.chip { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer;
  color: var(--text-secondary); white-space: nowrap; }
.chip:hover { color: var(--text-primary); background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--text-primary); color: var(--surface-1); }
.field { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.field input, .field select, .input {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-height: 34px;
}
.btn { border: 1px solid var(--border); background: var(--surface-1); border-radius: 8px; padding: 6px 12px;
  cursor: pointer; min-height: 34px; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: progress; }
.spacer { flex: 1; }
input[type="search"].input { min-width: 230px; }

.banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; background: var(--critical-bg);
  color: var(--text-primary); border: 1px solid var(--critical); }
.note { color: var(--text-muted); font-size: 12.5px; margin: -8px 0 16px; }

/* --- Kartalar --- */
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-bottom: 16px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px;
  box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 15px; font-weight: 620; margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; }
.card-sub { color: var(--text-muted); font-size: 12.5px; }

.kpi-label { color: var(--text-secondary); font-size: 13px; }
.kpi-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin: 4px 0 2px;
  font-variant-numeric: tabular-nums; }
.kpi-unit { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.delta { font-size: 12.5px; color: var(--text-muted); }
.delta b { font-weight: 600; }
.delta.up b { color: var(--good-text); }
.delta.down b { color: var(--critical); }

/* --- Jadvallar --- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
th { text-align: left; font-weight: 550; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
th.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tfoot td { font-weight: 620; border-top: 1px solid var(--border); border-bottom: 0; }
.sortable { cursor: pointer; user-select: none; }
.sortable[aria-sort="descending"]::after { content: " ↓"; }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px;
  vertical-align: -1px; }
.name-cell { min-width: 140px; }
.name-sub { display: block; color: var(--text-muted); font-size: 12px; }
.bar-cell { width: 24%; min-width: 60px; }
.bar { height: 10px; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-track { position: relative; }

.minus-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--critical); font-size: 12px;
  font-weight: 600; margin-left: 6px; white-space: nowrap; }
tr.minus td.qty { color: var(--critical); font-weight: 600; }

.chart-box { position: relative; height: 300px; }
.empty { color: var(--text-muted); padding: 36px 0; text-align: center; }

.stores { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 14px; gap: 10px; }
.store { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer;
  background: var(--surface-1); text-align: left; }
.store:hover { background: var(--surface-2); }
.store[aria-pressed="true"] { border-color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--text-primary); }
.store-name { font-weight: 600; font-size: 13px; }
.store-meta { color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
.more { margin-top: 10px; text-align: center; }

.loading { opacity: .5; transition: opacity .15s; }

@media (max-width: 1180px) {
  .two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 6px 12px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-brand span { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .sidebar-foot { margin-left: auto; padding: 0; }
  .sidebar-foot #rol { display: none; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  .wrap { padding: 14px 16px 40px; }
  .card { padding: 14px 12px; }
  .kpi-value { font-size: 21px; }
  .bar-cell { display: none; }
  .hide-sm { display: none; }
  table { font-size: 13px; }
  th, td { padding: 7px 4px; }
  .name-cell { min-width: 0; }
  .card-head .input { width: 100%; min-width: 0; }
  .card-head > .filters { width: 100%; }
}

/* --- Kirish sahifasi --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 360px; }
.login h1 { font-size: 18px; margin: 0 0 4px; }
.login p { margin: 0 0 16px; color: var(--text-secondary); }
.login .input { width: 100%; margin-bottom: 12px; }
.login .btn { width: 100%; background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); }
.login .err { color: var(--critical); margin-bottom: 12px; font-size: 13px; }

/* --- Mahsulotlar jadvali --- */
.wrap.wide { max-width: none; }
.grid-card { padding: 0; overflow: hidden; }
.grid-wrap { overflow: auto; max-height: calc(100vh - 190px); margin: 0; }
.grid-table { font-size: 13.5px; }
.grid-table thead { position: sticky; top: 0; z-index: 2; background: var(--surface-1); }
.grid-table thead th { background: var(--surface-1); }
.grid-table th, .grid-table td { padding: 7px 10px; }
.grid-table .head-row th { border-bottom: 0; padding-top: 10px; }
.grid-table .head-row th[data-sort] { cursor: pointer; user-select: none; }
.grid-table .head-row th[aria-sort="ascending"]::after { content: " ↑"; }
.grid-table .head-row th[aria-sort="descending"]::after { content: " ↓"; }
.filter-row th { padding-top: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-weight: 400; }
.filter-row input, .filter-row select {
  width: 100%; min-width: 70px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 7px; font-size: 12.5px; color: var(--text-primary); min-height: 28px;
}
.filter-row input:focus, .filter-row select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.col-name { min-width: 220px; }
.col-narx { min-width: 118px; text-align: right; }
.price-cell { position: relative; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-cell.editable { cursor: pointer; }
.price-cell.editable:hover { box-shadow: inset 0 0 0 1px var(--border); border-radius: 6px; }
.price-cell .src { display: block; font-size: 11px; color: var(--text-muted); }
.price-cell.off { color: var(--text-muted); }
.price-cell.changed { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.price-cell.changed .new { font-weight: 650; color: var(--text-primary); }
.price-cell .old { display: block; font-size: 11.5px; color: var(--text-muted); text-decoration: line-through; }
.price-cell .plan { display: block; font-size: 11px; color: var(--accent); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2);
  color: var(--text-secondary); white-space: nowrap; }
.table-foot { padding: 10px 14px; color: var(--text-muted); font-size: 12.5px; border-top: 1px solid var(--border); }

.editor { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); z-index: 3; width: 210px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); text-align: left; cursor: default; white-space: normal; }
.editor input[type="text"] { width: 100%; font-size: 15px; text-align: right; padding: 6px 8px; border-radius: 7px;
  border: 1px solid var(--accent); background: var(--surface-1); font-variant-numeric: tabular-nums; }
.editor label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-secondary); margin: 8px 0; }
.editor .row { display: flex; gap: 6px; justify-content: flex-end; }
.editor .btn { min-height: 28px; padding: 3px 10px; font-size: 13px; }
.btn.primary { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); }
.btn.primary:hover { opacity: .9; background: var(--text-primary); }

.savebar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 12px;
  background: var(--text-primary); color: var(--surface-1); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  max-width: calc(100vw - 32px); flex-wrap: wrap; }
.savebar .btn { background: transparent; color: var(--surface-1);
  border-color: color-mix(in srgb, var(--surface-1) 35%, transparent); }
.savebar .btn.primary { background: var(--surface-1); color: var(--text-primary); border-color: var(--surface-1); }

dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface-1);
  color: var(--text-primary); width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dlg-head, .dlg-foot { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dlg-head { border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; font-size: 16px; }
.dlg-body { padding: 14px 18px; overflow: auto; max-height: calc(100vh - 260px); }
.dlg-foot { border-top: 1px solid var(--border); flex-wrap: wrap; }
.dlg-fields { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0 4px; }
.dlg-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-secondary); }
.dlg-fields .grow { flex: 1; min-width: 200px; }
.warn { color: var(--critical); font-weight: 600; font-size: 12px; }
.ok-msg { color: var(--good-text); font-weight: 600; }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--surface-2); color: var(--text-secondary);
  margin-bottom: 14px; font-size: 13px; }
.history-item { border-bottom: 1px solid var(--grid); padding: 10px 0; }
.history-item:last-child { border-bottom: 0; }
.filter-row select { min-width: 118px; }
/* Yonga surganda mahsulot nomi ko'rinib tursin */
.grid-table td.col-name, .grid-table thead th:first-child { position: sticky; left: 0; background: var(--surface-1); z-index: 1; }
.grid-table thead th:first-child { z-index: 3; }
.grid-table tbody tr:hover td.col-name { background: var(--surface-2); }
@media (max-width: 560px) {
  .col-name { min-width: 150px; max-width: 170px; }
  .grid-wrap { max-height: calc(100vh - 150px); }
}

/* ============ Saytning o'z komponentlari (CLAUDE.md, 1-qoida) ============ */
:root { --border-strong: #c9c8c2; --scroll: #cfcec8; --hover: #ecebe7; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) { --border-strong: #4a4a46; --scroll: #3d3d3a; --hover: #2c2c2a; }
}
:root[data-theme="dark"] { --border-strong: #4a4a46; --scroll: #3d3d3a; --hover: #2c2c2a; }

.ui-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important;
  pointer-events: none !important; overflow: hidden; clip-path: inset(50%); margin: 0 !important; }
.ui-ikon { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }

.ui-select, .ui-date {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px;
  padding: 6px 10px; background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; text-align: left; max-width: 100%; font: inherit;
}
.ui-select:hover, .ui-date:hover { border-color: var(--border-strong); }
.ui-select[aria-expanded="true"], .ui-date[aria-expanded="true"] { border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.ui-select .ui-matn, .ui-date .ui-matn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-select .ui-ikon { color: var(--text-muted); transition: transform .15s; }
.ui-select[aria-expanded="true"] .ui-ikon { transform: rotate(180deg); }
.ui-date { justify-content: flex-start; font-variant-numeric: tabular-nums; }
.ui-date .ui-ikon { color: var(--text-muted); width: 15px; height: 15px; }
.ui-date.bosh .ui-matn { color: var(--text-muted); }
.ui-select:disabled { opacity: .55; cursor: not-allowed; }
.ui-select.kichik, .filter-row .ui-select { width: 100%; min-width: 110px; min-height: 28px; padding: 4px 8px;
  font-size: 12.5px; background: var(--surface-2); border-radius: 6px; }
.filter-row .ui-select.tanlangan { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.dlg-fields .ui-date, .dlg-fields .ui-select { min-width: 170px; }

.ui-pop { position: fixed; z-index: 1000; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 10px; padding: 4px; max-width: min(360px, calc(100vw - 16px));
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .08); }
.ui-royxat { max-height: 300px; overflow: auto; outline: none; }
.ui-qidiruv { width: 100%; margin: 2px 0 4px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface-2); color: var(--text-primary); font: inherit; font-size: 13px; outline: none; }
.ui-qidiruv:focus { border-color: var(--accent); }
.ui-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px;
  border-radius: 6px; cursor: pointer; font-size: 13.5px; white-space: nowrap; }
.ui-opt.faol { background: var(--hover); }
.ui-opt[aria-selected="true"] { font-weight: 600; }
.ui-opt[aria-selected="true"] .ui-ikon { color: var(--accent); }
.ui-opt[data-faol="0"] { opacity: .45; cursor: default; }

.ui-kalendar { padding: 6px; width: 260px; }
.ui-kal-bosh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ui-kal-bosh b { font-size: 14px; font-weight: 620; }
.ui-kal-oq { border: 0; background: transparent; color: var(--text-secondary); width: 30px; height: 30px;
  border-radius: 7px; display: grid; place-items: center; cursor: pointer; }
.ui-kal-oq:hover { background: var(--hover); color: var(--text-primary); }
.ui-kal-hafta, .ui-kal-kunlar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ui-kal-hafta span { text-align: center; font-size: 11.5px; color: var(--text-muted); padding: 4px 0; }
.ui-kun { border: 0; background: transparent; color: var(--text-primary); height: 32px; border-radius: 7px;
  cursor: pointer; font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }
.ui-kun:hover:not(:disabled) { background: var(--hover); }
.ui-kun.bugun { box-shadow: inset 0 0 0 1px var(--border-strong); font-weight: 600; }
.ui-kun.tanlangan { background: var(--accent); color: #fff; font-weight: 650; }
.ui-kun:disabled { color: var(--text-muted); opacity: .4; cursor: default; }
.ui-kal-oyoq { display: flex; justify-content: flex-end; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--grid); }
.ui-kal-bugun { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 13px;
  font-weight: 600; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.ui-kal-bugun:hover { background: var(--hover); }

.ui-tip { position: fixed; z-index: 1100; max-width: 300px; padding: 6px 9px; border-radius: 7px; font-size: 12.5px;
  line-height: 1.4; background: var(--text-primary); color: var(--surface-1); pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2); white-space: pre-line; }

/* Checkbox va radio - saytning o'z belgisi */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; width: 17px; height: 17px; margin: 0; flex: none; cursor: pointer;
  border: 1.5px solid var(--border-strong); background: var(--surface-1); border-radius: 5px;
  display: inline-grid; place-content: center; vertical-align: -3px; transition: background .12s, border-color .12s;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before { content: ""; width: 10px; height: 10px; background: #fff; transform: scale(0);
  transition: transform .12s; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
input[type="radio"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; transform: scale(0); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:hover:not(:checked) { border-color: var(--accent); }

/* Qidiruv "x", raqam strelkalari, autofill, fokus, belgilash */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--surface-1) inset; -webkit-text-fill-color: var(--text-primary);
  caret-color: var(--text-primary); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.input:focus, .filter-row input:focus, .editor input:focus { border-color: var(--accent); outline: none; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
::placeholder { color: var(--text-muted); opacity: 1; }

/* Aylantirish chizig'i */
* { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 2px solid transparent;
  background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--border-strong); }
::-webkit-scrollbar-corner { background: transparent; }

.btn.xavfli { background: var(--critical); border-color: var(--critical); color: #fff; }

/* Yon menyu: ichki guruh */
.nav-guruh-bosh { width: 100%; border: 0; background: transparent; font: inherit; cursor: pointer; text-align: left; }
.nav-guruh-bosh > span:first-of-type { flex: 1; }
.nav-strelka { display: inline-flex; }
.nav-strelka svg { width: 14px; height: 14px; transition: transform .15s; }
.nav-guruh.ochiq .nav-strelka svg { transform: rotate(90deg); }
.nav-ichki { display: none; flex-direction: column; gap: 1px; margin: 2px 0 4px 18px; padding-left: 10px;
  border-left: 1px solid var(--border); }
.nav-guruh.ochiq .nav-ichki { display: flex; }
.nav-sub { padding: 6px 10px; font-size: 13px; white-space: normal; line-height: 1.3; }
.sidebar { overflow-y: auto; }
@media (max-width: 860px) {
  .nav { flex-wrap: wrap; }
  .nav-guruh { position: relative; }
  .nav-guruh.ochiq .nav-ichki { position: absolute; top: 100%; left: 0; z-index: 30; margin: 4px 0 0; padding: 6px;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; min-width: 240px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
}
.ui-izoh { color: var(--text-muted); font-size: 11.5px; font-weight: 400; }
.ui-royxat .ui-opt { white-space: normal; }
.price-cell .cost { display: block; font-size: 11.5px; color: var(--text-muted); font-weight: 400; margin-top: 1px; }
.price-cell .cost.taxmin { color: var(--text-muted); font-style: italic; }
.th-sub { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-muted); letter-spacing: 0; }
.grid-table .head-row th[aria-sort] .th-sub::after { content: none; }

/* --- Nakladnoylar va hujjatlar --- */
.two-wide { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); align-items: start; }
@media (max-width: 1180px) { .two-wide { grid-template-columns: minmax(0, 1fr); } }
.card-head.pad { padding: 14px 16px 0; margin-bottom: 8px; }
.grid-card .table-wrap { margin: 0; padding: 0 8px 8px; }
.nowrap { white-space: nowrap; }
tr.bosiladi { cursor: pointer; }
tr.bosiladi:focus-visible td { background: var(--surface-2); }
tr.ochirilgan td { opacity: .5; text-decoration: line-through; }
.izoh-cell { max-width: 320px; color: var(--text-secondary); font-size: 12.5px; }
.tag.holat-processed { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }
.tag.holat-new { background: color-mix(in srgb, var(--series-4) 20%, transparent); color: var(--text-primary); }
.tag.holat-deleted { background: var(--critical-bg); color: var(--critical); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 16px; margin-bottom: 14px; }
.info-grid > div { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.info-grid .muted { font-size: 12px; }
dialog.keng { width: min(1080px, calc(100vw - 32px)); }
.form-jadval td { padding: 5px 4px; vertical-align: middle; }
.form-jadval tbody tr:hover td { background: transparent; }
.input.w100, .w100 { width: 100%; min-width: 0; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.ikon-btn { min-height: 32px; width: 32px; padding: 0; font-size: 18px; line-height: 1; color: var(--text-muted); }
.ikon-btn:hover { color: var(--critical); }
.check-qator { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 13.5px; cursor: pointer; }
.check-qator .muted { font-size: 12.5px; }
.dlg-fields .input { min-height: 34px; }
#n-jami { font-weight: 700; font-size: 15px; }
.ui-vaqt { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--grid); font-size: 13px; color: var(--text-secondary); }
.ui-vaqt > span { margin-right: auto; }
.ui-vaqt-son { width: 42px; text-align: center; padding: 5px 4px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text-primary); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; outline: none; }
.ui-vaqt-son:focus { border-color: var(--accent); }
.ui-date.vaqtli { min-width: 170px; }
