/* Euroluxe xarid — yorqin, ixcham, sotuvchi uchun */
:root {
  --mist: #EDF3F4;      /* fon: xrom-sovuq oq */
  --card: #FFFFFF;
  --ink: #0F2A35;       /* asosiy matn, chuqur suv rangi */
  --ink-2: #4E6670;     /* ikkinchi darajali matn */
  --ink-3: #8DA2AA;     /* izohlar */
  --line: #DCE6E9;
  --teal: #0B8A7D;      /* Euroluxe/iBox brand rangi */
  --rail-w: 88px;
  --nav-h: 62px;
  --teal-deep: #076B61;
  --teal-tint: #DDF1EE;
  --coral: #E0453A;     /* chegirma, o'chirish, xato */
  --coral-tint: #FDECEA;
  --brass: #B87D05;     /* kam qoldiq */
  --brass-tint: #FDF3DC;
  --leaf: #1E9A57;      /* ustama, qabul qilingan */
  --leaf-tint: #E1F4E9;
  --amber: #E8820C;     /* kutilmoqda */
  --amber-tint: #FDEBD6;
  --slate-tint: #E7ECEE;

  --r-section: 20px;
  --r-control: 12px;
  --r-pill: 999px;
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
svg { width: 20px; height: 20px; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--teal); outline-offset: 2px; }
.hidden { display: none !important; }
.num, .dock-total, .line-total, .receipt-total dd { font-variant-numeric: tabular-nums; }

.screen { max-width: 640px; margin: 0 auto; padding: calc(10px + var(--safe-top)) 14px 0; min-height: 100vh; }

/* ---------- Sarlavha ---------- */
.appbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 14px; }
.appbar h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.appbar-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-control); border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); display: grid; place-items: center;
}

/* ---------- Bosqichlar ---------- */
.step {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-section);
  padding: 16px; margin-bottom: 12px;
}
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-head h2 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; }
.step-meta { color: var(--ink-2); font-size: 13px; font-weight: 500; }
.step-no {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--slate-tint); color: var(--ink-2); font-size: 14px;
  transition: background .2s, color .2s;
}
.step-no svg { display: none; width: 16px; height: 16px; }
.step.done .step-no { background: var(--teal); color: #fff; }
.step.done .step-no b { display: none; }
.step.done .step-no svg { display: block; }

/* ---------- Maydonlar ---------- */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.step > .field + .field { margin-top: 14px; }
.field.wide { grid-column: 1 / -1; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.control {
  width: 100%; min-height: 46px; padding: 11px 12px; font-size: 16px;
  background: var(--mist); border: 1.5px solid transparent; border-radius: var(--r-control);
  outline: none; appearance: none; -webkit-appearance: none;
}
select.control {
  padding-right: 36px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%234E6670' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 20px;
}
.control:focus { border-color: var(--teal); background-color: var(--card); }
.control:disabled { color: var(--ink-3); }
textarea.control { resize: vertical; min-height: 64px; }

/* Qidiruv */
.search {
  min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 48px;
  background: var(--mist); border: 1.5px solid transparent; border-radius: var(--r-control); color: var(--ink-3);
}
.search:focus-within { border-color: var(--teal); background: var(--card); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--ink); padding: 12px 0; }
.search input::-webkit-search-cancel-button { display: none; }

/* Tanlash ro'yxatlari */
.pick-list { list-style: none; margin: 6px 0 0; padding: 0; }
.pick-list li {
  display: flex; align-items: center; gap: 12px; padding: 12px 6px; min-height: 52px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.pick-list li:last-child { border-bottom: 0; }
.pick-list li:active { background: var(--teal-tint); }
.pick-list .li-name { flex: 1; min-width: 0; }
.pick-list .empty { color: var(--ink-2); cursor: default; justify-content: center; text-align: center; border: 0; padding: 22px 6px; }
.pick-list .empty:active { background: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--teal-tint); color: var(--teal-deep); font-weight: 700; font-size: 14px;
}
.text-btn { border: 0; background: none; color: var(--teal); font-weight: 600; font-size: 14px; padding: 8px 4px; }
.more { display: block; margin: 4px auto 0; }

/* Tanlangan ta'minotchi */
.picked { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--teal-tint); border-radius: 14px; }
.picked-avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.picked-name { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; }

/* Valyuta */
.segmented { display: flex; gap: 4px; padding: 4px; background: var(--mist); border-radius: 14px; }
.segmented button {
  flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent;
  font-weight: 600; color: var(--ink-2);
}
.segmented button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 42, 53, .12), 0 0 0 1px var(--line); }

/* Chiplar */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 14px; border-radius: var(--r-pill); border: 1.5px solid var(--line);
  background: var(--card); font-weight: 600; font-size: 14px; color: var(--ink-2);
}
.chip[aria-checked="true"] { border-color: var(--teal); background: var(--teal-tint); color: var(--teal-deep); }
.chips.status .chip { display: inline-flex; align-items: center; gap: 8px; }
.chips.status .chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dot, var(--ink-3)); }
.chips.status .chip[data-tone="draft"] { --dot: #9AA9AF; }
.chips.status .chip[data-tone="wait"] { --dot: var(--amber); }
.chips.status .chip[data-tone="done"] { --dot: var(--leaf); }
.chips.status .chip[data-tone="draft"][aria-checked="true"] { border-color: #9AA9AF; background: var(--slate-tint); color: var(--ink); }
.chips.status .chip[data-tone="wait"][aria-checked="true"] { border-color: var(--amber); background: var(--amber-tint); color: #9A5300; }
.chips.status .chip[data-tone="done"][aria-checked="true"] { border-color: var(--leaf); background: var(--leaf-tint); color: #126B3B; }
.hint { margin: 2px 0 0; font-size: 13px; color: #126B3B; }

/* ---------- Mahsulot qatorlari ---------- */
.cart { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cart-empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 22px 12px; border: 1.5px dashed var(--line); border-radius: 16px; color: var(--ink-2);
}
.cart-empty svg { width: 30px; height: 30px; color: var(--ink-3); }
.line { border: 1px solid var(--line); border-radius: 16px; padding: 12px; background: var(--card); }
.line-top { display: flex; gap: 10px; align-items: flex-start; }
.line-idx { font-size: 13px; font-weight: 700; color: var(--ink-3); padding-top: 1px; min-width: 18px; }
.line-name { flex: 1; min-width: 0; font-weight: 600; line-height: 1.3; }
.line-del { border: 0; background: none; color: var(--ink-3); width: 34px; height: 34px; margin: -6px -6px 0 0; border-radius: 10px; display: grid; place-items: center; }
.line-del:active { color: var(--coral); background: var(--coral-tint); }
.stock { display: inline-block; margin: 6px 0 0 28px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-pill); background: var(--slate-tint); color: var(--ink-2); }
.stock.low { background: var(--brass-tint); color: var(--brass); }
.stock.none { background: var(--coral-tint); color: var(--coral); }

.line-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.mini { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.num {
  width: 100%; min-width: 0; min-height: 42px; padding: 9px 10px; font-size: 16px; font-weight: 600;
  background: var(--mist); border: 1.5px solid transparent; border-radius: 10px; outline: none;
}
.num:focus { border-color: var(--teal); background: var(--card); }
.num.edited { border-color: var(--brass); background: var(--brass-tint); }
.affix { display: flex; align-items: stretch; gap: 4px; }
.affix .num { flex: 1; }
.tog {
  min-width: 42px; border: 1.5px solid var(--line); background: var(--card); border-radius: 10px;
  font-weight: 700; font-size: 13px; color: var(--ink-2); padding: 0 6px;
}
.tog.dir { font-size: 18px; color: var(--coral); }
.tog.dir.markup { color: var(--leaf); }

.line-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.stepper { display: flex; align-items: center; background: var(--mist); border-radius: 12px; padding: 3px; }
.stepper button { width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--card); color: var(--ink); display: grid; place-items: center; box-shadow: 0 0 0 1px var(--line); }
.stepper button svg { width: 18px; height: 18px; }
.stepper input { width: 58px; border: 0; background: transparent; text-align: center; font-size: 17px; font-weight: 700; outline: none; }
.line-sum { text-align: right; }
.line-total { display: block; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.line-disc { display: block; font-size: 12px; font-weight: 600; color: var(--coral); }
.line-disc.markup { color: var(--leaf); }

.add-btn {
  width: 100%; margin-top: 12px; min-height: 50px; border-radius: 14px; border: 1.5px dashed var(--teal);
  background: var(--teal-tint); color: var(--teal-deep); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ---------- Pastki jami paneli (asosiy urg'u) ---------- */
.dock-space { height: calc(110px + var(--safe-bottom)); }
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: linear-gradient(to top, var(--mist) 60%, rgba(237, 243, 244, 0));
}
.dock-inner {
  max-width: 616px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; border-radius: 22px; padding: 10px 10px 10px 18px;
  box-shadow: 0 10px 30px rgba(15, 42, 53, .28);
}
.dock-sum { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dock-meta { font-size: 12px; color: #9DB8C1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-total { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cta {
  min-height: 52px; padding: 0 26px; border: 0; border-radius: 16px; background: var(--teal); color: #fff;
  font-weight: 700; font-size: 16px; transition: background .15s, opacity .15s;
}
.cta:active { background: var(--teal-deep); }
.cta:disabled { opacity: .45; cursor: default; }
.dock .cta { background: #14B3A2; color: #062B27; }
.dock .cta:active { background: #0E9A8B; }
.cta.wide { width: 100%; }

/* ---------- Mahsulot qidirish oynasi ---------- */
.sheet { position: fixed; inset: 0; z-index: 10; overflow-y: auto; max-width: none; background: var(--card); }
.sheet > * { max-width: 612px; margin-left: auto; margin-right: auto; }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; gap: 8px; padding: 12px 0 8px; background: var(--card); }
.sheet-head .search { flex: 1; }
.done-btn { flex: none; border: 0; border-radius: var(--r-control); background: var(--teal); color: #fff; font-weight: 700; padding: 0 18px; }
.sheet-note { margin: 0 0 4px; font-size: 13px; color: var(--ink-2); }
.products .add-dot {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--teal-tint); color: var(--teal-deep); font-weight: 700; font-size: 14px;
}
.products .add-dot.in { background: var(--teal); color: #fff; }
.products .li-unit { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); }

/* ---------- Holat ekranlari ---------- */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.state-text { color: var(--ink-2); max-width: 30ch; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--teal); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.receipt { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 28px 20px 20px; }
.receipt-mark { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; animation: pop .35s ease-out; }
.receipt-mark svg { width: 34px; height: 34px; }
.receipt h2 { margin: 0; font-size: 22px; font-weight: 800; }
.receipt-no { margin: 4px 0 18px; color: var(--ink-2); font-weight: 600; }
.receipt-rows { margin: 0 0 20px; padding: 14px 0 0; border-top: 1.5px dashed var(--line); text-align: left; }
.receipt-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.receipt-rows dt { color: var(--ink-2); }
.receipt-rows dd { margin: 0; font-weight: 600; text-align: right; }
.receipt-total { margin-top: 6px; padding-top: 12px !important; border-top: 1px solid var(--line); }
.receipt-total dt, .receipt-total dd { font-size: 18px; font-weight: 800 !important; color: var(--ink) !important; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Xabar ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom)); transform: translateX(-50%); z-index: 50;
  max-width: min(92vw, 480px); padding: 11px 16px; border-radius: 14px; background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 500; text-align: center; box-shadow: 0 8px 24px rgba(15, 42, 53, .25);
}
.toast.error { background: var(--coral); }

/* ---------- Kichik ekranlar ---------- */
@media (max-width: 420px) {
  .fields { grid-template-columns: 1fr; }
  .appbar h1 { font-size: 26px; }
  .dock-total { font-size: 20px; }
  .cta { padding: 0 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Ochiladigan ro'yxat (Ta'minotchi) ---------- */
.req { font-style: normal; color: var(--coral); }
.combo { position: relative; }
.combo-btn {
  display: flex; align-items: center; text-align: left; cursor: pointer;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%234E6670' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 20px;
}
.combo-btn > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-btn[aria-expanded="true"] { border-color: var(--teal); background-color: var(--card); }
.combo-btn.filled { font-weight: 600; }
.combo-placeholder { color: var(--ink-3); }
.combo-panel {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px;
  box-shadow: 0 14px 36px rgba(15, 42, 53, .18);
}
.combo-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: min(320px, 50vh); overflow-y: auto; overscroll-behavior: contain; }
.combo-list li { padding: 11px 10px; border-radius: 10px; cursor: pointer; line-height: 1.3; }
.combo-list li:hover, .combo-list li.active { background: var(--mist); }
.combo-list li[aria-selected="true"] { background: var(--teal-tint); color: var(--teal-deep); font-weight: 600; }
.combo-list .empty { color: var(--ink-2); cursor: default; text-align: center; padding: 18px 10px; }
.combo-list .empty:hover { background: none; }
.combo-list .loading { color: var(--ink-3); cursor: default; padding: 14px 10px; }

.step.plain .field-label { margin-bottom: 0; }
.note { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); }
.note b { color: var(--ink); font-weight: 600; }

/* ======================================================================
   Mahsulotlarni tanlash (iBox oynasi kabi)
   ====================================================================== */
.picker {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  background: var(--mist); padding-top: var(--safe-top);
}
.pk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.pk-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.pk-body { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 12px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* Chap panel */
.pk-side {
  width: 300px; flex: none; display: flex; flex-direction: column; gap: 10px; min-height: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px;
}
.pk-tabs { display: flex; gap: 3px; padding: 3px; background: var(--mist); border-radius: 12px; }
.pk-tabs button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 0 4px; }
.pk-tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.search.sm { min-height: 42px; }
.search.sm input { padding: 9px 0; font-size: 15px; }
.pk-filter-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.pk-filter-list li {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  font-size: 14px; line-height: 1.3;
}
.pk-filter-list li:hover { background: var(--mist); }
.pk-filter-list li[aria-selected="true"] { background: var(--teal-tint); color: var(--teal-deep); font-weight: 600; }
.pk-filter-list .ico { width: 16px; height: 16px; flex: none; border-radius: 4px; background:
  linear-gradient(var(--teal), var(--teal)) 0 0 / 7px 7px no-repeat,
  linear-gradient(var(--teal), var(--teal)) 9px 0 / 7px 7px no-repeat,
  linear-gradient(var(--teal), var(--teal)) 0 9px / 7px 7px no-repeat,
  linear-gradient(var(--teal), var(--teal)) 9px 9px / 7px 7px no-repeat; opacity: .85; }
.pk-filter-list .all { font-weight: 600; }
.pk-filter-list .empty { color: var(--ink-3); cursor: default; }

/* Asosiy qism */
.pk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.pk-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pk-toolbar .search { flex: 1 1 260px; min-height: 44px; }
.pk-filter-btn { display: none; }
.pk-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.pk-check input { width: 18px; height: 18px; accent-color: var(--teal); }

/* Jadval */
.pk-table-wrap { flex: 1; min-height: 0; overflow: auto; }
.pk-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pk-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--mist); color: var(--ink-2);
  font-weight: 600; font-size: 13px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.pk-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pk-table tbody tr:hover { background: #F6FAFA; }
.pk-table tr.is-picked { background: var(--teal-tint); }
.pk-table .c-price, .pk-table .c-stock { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pk-table .c-qty { width: 150px; }
.pk-table .c-unit { width: 96px; }
.pk-name { font-weight: 500; line-height: 1.3; }
.pk-sku { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.pk-cur { color: var(--ink-3); font-size: 12px; margin-left: 3px; }
.pk-stock-0 { color: var(--ink-3); }
.pk-stock-pos { color: var(--ink); font-weight: 600; }
.pk-step { display: flex; align-items: center; max-width: 160px; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); transition: border-color .15s, box-shadow .15s; }
.pk-step:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); }
.pk-step button { width: 38px; height: 38px; border: 0; background: var(--card); color: var(--teal); display: grid; place-items: center; cursor: pointer; transition: background .12s, color .12s; }
.pk-step button:hover:not(:disabled) { background: var(--teal-tint); }
.pk-step button:active:not(:disabled) { background: var(--teal); color: #fff; }
.pk-step button:disabled { color: var(--ink-3); cursor: default; }
.pk-step button svg { width: 16px; height: 16px; }
.pk-step input { flex: 1; min-width: 0; width: 100%; height: 38px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; padding: 0 2px; font-size: 15px; font-weight: 700; color: var(--ink); outline: none; font-variant-numeric: tabular-nums; }
.pk-step input:focus { background: var(--teal-tint); }
.pk-step input::placeholder { color: var(--ink-3); font-weight: 600; }
.pk-unit { width: 100%; min-height: 40px; padding: 0 28px 0 12px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; appearance: none; -webkit-appearance: none; transition: border-color .15s, box-shadow .15s;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%234E6670' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 6px center / 16px; }
.pk-unit:hover { border-color: #C4D3D7; }
.pk-unit:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); outline: none; }
.pk-unit-text { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink-3); font-weight: 600; }
.pk-msg td { text-align: center; color: var(--ink-2); padding: 36px 12px; }

/* Pastki qism */
.pk-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--line); flex-wrap: wrap; }
.pk-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pk-total { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.pk-pages { display: flex; align-items: center; gap: 2px; }
.pk-pages button { min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.pk-pages button:hover:not(:disabled) { background: var(--mist); }
.pk-pages button[aria-current="page"] { background: var(--teal); color: #fff; }
.pk-pages button:disabled { color: var(--line); }
.pk-pages .gap { color: var(--ink-3); padding: 0 4px; }
.pk-per-page { min-height: 36px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); font-size: 13px; }
.pk-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pk-picked { font-size: 13px; color: var(--teal-deep); font-weight: 600; white-space: nowrap; }
.btn-quiet { min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1.5px solid var(--teal); background: var(--card); color: var(--teal-deep); font-weight: 700; font-size: 15px; }
.btn-quiet:disabled { opacity: .45; cursor: default; }
.pk-actions .cta { min-height: 48px; padding: 0 20px; font-size: 15px; }

/* ---------- Telefon / tor ekran ---------- */
@media (max-width: 860px) {
  .pk-body { padding: 0; gap: 0; }
  .pk-main { border-radius: 0; border: 0; }
  .pk-side {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(86vw, 340px);
    border-radius: 0 18px 18px 0; padding-top: calc(12px + var(--safe-top));
    transform: translateX(-102%); transition: transform .22s ease-out;
  }
  .pk-side.open { transform: none; box-shadow: 12px 0 40px rgba(15, 42, 53, .25); }
  .pk-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(15, 42, 53, .35); }
  .pk-filter-btn {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
    min-height: 44px; max-width: 42%; padding: 4px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); text-align: left;
  }
  .pk-filter-k { font-size: 11px; color: var(--ink-3); font-weight: 600; }
  #pk-filter-label { font-size: 13px; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--teal-deep); }
  .pk-toolbar .search { flex: 1 1 0; }
  .pk-check { flex-basis: 100%; font-size: 13px; }

  /* Jadval kartaga aylanadi */
  .pk-table thead { display: none; }
  .pk-table, .pk-table tbody { display: block; }
  .pk-table tr {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name name" "meta meta" "qty unit";
    gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  }
  .pk-table td { display: block; padding: 0; border: 0; }
  .pk-table td.c-name { grid-area: name; }
  .pk-table td.c-price { grid-area: meta; text-align: left; justify-self: start; }
  .pk-table td.c-stock { grid-area: meta; justify-self: end; }
  .pk-table td.c-qty { grid-area: qty; width: auto; max-width: 190px; }
  .pk-table td.c-unit { grid-area: unit; width: 92px; align-self: center; }
  .pk-table td.c-price::before { content: "Narx: "; color: var(--ink-3); font-size: 12px; }
  .pk-table td.c-stock::before { content: "Qoldiq: "; color: var(--ink-3); font-size: 12px; font-weight: 400; }
  .pk-msg { display: block !important; }
  .pk-msg td { display: block; }

  .pk-foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .pk-nav { justify-content: space-between; }
  .pk-per-page { display: none; }
  .pk-actions { margin-left: 0; }
  .pk-actions .btn-quiet, .pk-actions .cta { flex: 1; padding: 0 10px; }
  .pk-picked { display: none; }
}

/* Jadval chiziqlari (gridline) — kompyuterda */
@media (min-width: 861px) {
  .pk-table { border-collapse: separate; border-spacing: 0; }
  .pk-table th, .pk-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .pk-table th:last-child, .pk-table td:last-child { border-right: 0; }
  .pk-table thead th { border-bottom: 1.5px solid #C9D7DB; }
  .pk-table tbody tr:nth-child(even) td { background: #FAFCFC; }
  .pk-table tbody tr:hover td { background: #F1F7F7; }
  .pk-table tr.is-picked td { background: var(--teal-tint); }
  .pk-msg td { border-right: 0 !important; }
}

/* Minimal (qizil) va tavsiya etilgan (yashil) qoldiq */
.pk-table .c-min, .pk-table .c-rec { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; width: 104px; }
.pk-table .c-min { color: var(--coral); }
.pk-table .c-rec { color: var(--leaf); }
.pk-table td.pk-below { color: var(--coral) !important; font-weight: 700; }
.pk-tags-m { display: none; }
@media (max-width: 860px) {
  .pk-table td.c-min, .pk-table td.c-rec { display: none; }
  .pk-tags-m { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: 1px; }
  .pk-min-m, .pk-rec-m { padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 700; }
  .pk-min-m { background: var(--coral-tint); color: var(--coral); }
  .pk-rec-m { background: var(--leaf-tint); color: var(--leaf); }
}

/* Saralash (asc / desc) */
.pk-table th[data-sort] { cursor: pointer; user-select: none; }
.pk-table th[data-sort]:hover { color: var(--ink); background: #E3ECEE; }
.pk-table th[data-sort]::after { content: "↕"; margin-left: 6px; font-size: 12px; opacity: .35; }
.pk-table th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
.pk-table th[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
.pk-table th[aria-sort="ascending"], .pk-table th[aria-sort="descending"] { color: var(--ink); background: #E3ECEE; }
.pk-table th.c-min[aria-sort="ascending"], .pk-table th.c-min[aria-sort="descending"] { color: var(--coral); }
.pk-table th.c-rec[aria-sort="ascending"], .pk-table th.c-rec[aria-sort="descending"] { color: var(--leaf); }

/* Telefonda saralash ro'yxati */
.pk-sort-m { display: none; }
@media (max-width: 860px) {
  .pk-sort-m { display: block; flex: 1 1 100%; min-height: 40px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); font-size: 14px; }
}

/* Tezkor filtrlar: "Minimaldan kam" (qizil) va "Tavsiyadan ko'p" (yashil) — ustma-ust */
/* Tezkor filtrlar: tepada ixcham gorizontal qator (kam joy oladi) */
.pk-quick { flex: 1 1 100%; order: -1; display: flex; flex-direction: row; gap: 8px; width: 100%; }
.pk-qf {
  --tone: var(--ink-3); --tone-bg: var(--card); --tone-ring: transparent;
  flex: 1 1 0; min-width: 0;
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 5px 10px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); text-align: left;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.pk-qf.tone-red { --on: var(--coral); --on-bg: var(--coral-tint); --on-ring: rgba(224, 69, 58, .14); --on-ink: #B4372E; }
.pk-qf.tone-green { --on: var(--leaf); --on-bg: var(--leaf-tint); --on-ring: rgba(30, 154, 87, .14); --on-ink: #126B3B; }
.pk-qf-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.pk-qf-text b { font-size: 14px; color: var(--ink-2); }
.pk-qf-text small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-qf-switch { width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.pk-qf-switch span { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.pk-qf-count { min-width: 28px; padding: 2px 8px; border-radius: 999px; background: var(--slate-tint); color: var(--ink-2); font-size: 12px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.pk-qf-count:empty { display: none; }
.pk-qf:hover { border-color: var(--on); }
.pk-qf[aria-checked="true"] { border-color: var(--on); background: var(--on-bg); box-shadow: 0 0 0 3px var(--on-ring); }
.pk-qf[aria-checked="true"] .pk-qf-switch { background: var(--on); }
.pk-qf[aria-checked="true"] .pk-qf-switch span { transform: translateX(14px); }
.pk-qf[aria-checked="true"] .pk-qf-text b { color: var(--on); }
.pk-qf[aria-checked="true"] .pk-qf-text small { color: var(--on-ink); }
.pk-qf[aria-checked="true"] .pk-qf-count { background: var(--on); color: #fff; }
.pk-toolbar { align-items: center; }
@media (max-width: 860px) {
  .pk-quick { width: 100%; flex: 1 1 100%; order: -1; flex-direction: column; }
}

/* Yuklanish skeleti */
.pk-table tr.pk-skel td { padding: 14px 12px; }
.pk-skel .sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #E7EEF0 25%, #F3F7F8 50%, #E7EEF0 75%); background-size: 200% 100%; animation: sk 1.1s linear infinite; }
.pk-skel td:first-child .sk { width: 70%; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (max-width: 860px) {
  .pk-table tr.pk-skel { display: block; padding: 14px; }
  .pk-table tr.pk-skel td { display: none; padding: 0; }
  .pk-table tr.pk-skel td:first-child { display: block; }
}

/* Qoldiqlar qachon yangilangani + yangilash tugmasi */
.pk-fresh { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.pk-refresh { width: 30px; height: 30px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--card); color: var(--teal); font-size: 16px; line-height: 1; }
.pk-refresh:disabled { opacity: .6; }
.pk-refresh.spin { animation: spin .8s linear infinite; }
@media (max-width: 860px) {
  .pk-fresh { justify-content: center; }
}

/* ---------- Brauzer orqali kirish ---------- */
.login { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 28px 22px 22px; text-align: left; display: flex; flex-direction: column; gap: 14px; }
.login h1 { margin: 0; font-size: 24px; font-weight: 800; text-align: center; letter-spacing: -0.02em; }
.login-sub { margin: -8px 0 6px; color: var(--ink-2); text-align: center; font-size: 14px; }
.login-mark { width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; background: var(--teal); color: #fff; display: grid; place-items: center; }
.login-mark svg { width: 30px; height: 30px; }
.login-mark.logo { background: linear-gradient(140deg, #14B3A2 0%, var(--teal) 55%, var(--teal-deep) 100%); box-shadow: 0 8px 18px -8px rgba(11, 138, 125, .8); }
.login-mark svg.logo-g { width: 40px; height: 40px; }
.login-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--coral-tint); color: var(--coral); font-size: 14px; font-weight: 600; }
.login .cta { margin-top: 4px; }

/* ======================================================================
   Yuqori panel: brend · filial · foydalanuvchi
   ====================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 25;
  padding-top: var(--safe-top);
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 42, 53, .02), 0 6px 18px -12px rgba(15, 42, 53, .18);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; padding: 0 24px; width: 100%; }
.topbar-right { margin-left: auto; }
.topbar:not(.hidden) ~ .screen { padding-top: 14px; }
.topbar:not(.hidden) ~ .screen.state { min-height: calc(100vh - 66px - var(--safe-top)); }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(140deg, #14B3A2 0%, var(--teal) 55%, var(--teal-deep) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 4px 10px -4px rgba(11, 138, 125, .7);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-mark svg.logo-g { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.brand-text small { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); margin-top: 3px; }

.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .icon-btn { width: 40px; height: 40px; border-radius: 11px; }
.topbar .icon-btn:hover { color: var(--ink); border-color: #C9D7DB; }
#logout:hover { color: var(--coral); border-color: #F3C2BE; background: var(--coral-tint); }

/* Filial */
.filial { position: relative; --fil: var(--teal); }
.filial-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--fil, var(--teal));
  box-shadow: 0 0 0 3px rgba(11, 138, 125, .14); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fil, var(--teal)) 18%, transparent);
}
.filial-btn {
  display: flex; align-items: center; gap: 10px; min-height: 44px; max-width: 240px; padding: 4px 10px 4px 12px;
  border: 1.5px solid var(--line); border-radius: 13px; background: var(--card); text-align: left;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.filial-btn:hover:not(:disabled), .filial-btn[aria-expanded="true"] {
  border-color: var(--fil); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fil) 14%, transparent);
}
.filial-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.filial-txt small { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.filial-txt b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filial-chev { width: 18px; height: 18px; color: var(--ink-2); transition: transform .15s; }
.filial-btn[aria-expanded="true"] .filial-chev { transform: rotate(180deg); }
.filial-lock { display: none; width: 15px; height: 15px; color: var(--ink-3); }
.filial-btn.locked { cursor: default; background: var(--mist); border-color: transparent; color: var(--ink); }
.filial-btn.locked .filial-chev { display: none; }
.filial-btn.locked .filial-lock { display: block; }

.filial-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 270px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 44px -10px rgba(15, 42, 53, .28); animation: menu-in .14s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.filial-menu-head { margin: 4px 10px 6px; font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.filial-menu ul { list-style: none; margin: 0; padding: 0; }
.filial-menu li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; cursor: pointer; outline: none; }
.filial-menu li:hover, .filial-menu li:focus-visible { background: var(--mist); }
.filial-menu li[aria-selected="true"] { background: color-mix(in srgb, var(--fil) 10%, #fff); }
.filial-menu .fm-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.filial-menu .fm-txt b { font-weight: 700; }
.filial-menu .fm-txt small { font-size: 12px; color: var(--ink-3); }
.filial-menu li svg { width: 18px; height: 18px; color: var(--fil); }

/* Foydalanuvchi */
.user { display: flex; align-items: center; gap: 10px; min-width: 0; padding-left: 12px; border-left: 1px solid var(--line); }
.user-av {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; letter-spacing: .02em;
}
.user-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.user-txt b { font-size: 14px; font-weight: 700; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-txt small { font-size: 12px; color: var(--ink-3); font-weight: 500; }

/* Sahifa sarlavhasi */
.appbar { padding: 4px 4px 14px; }
.appbar h1 { font-size: 26px; }
.appbar-sub { font-weight: 500; }

/* Tanlash oynasidagi filial belgisi */
.pk-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pk-filial {
  --fil: var(--teal); display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; border-radius: 999px;
  background: var(--mist); background: color-mix(in srgb, var(--fil) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--fil) 30%, transparent);
  font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--ink);
}
.pk-filial .filial-dot { width: 8px; height: 8px; }

@media (max-width: 720px) {
  .user-txt { display: none; }
  .user { padding-left: 10px; }
}
@media (max-width: 520px) {
  .topbar-in { height: 58px; padding: 0 12px; gap: 8px; }
  .brand-text { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .topbar-right { gap: 8px; }
  .filial-btn { max-width: 170px; min-height: 42px; padding: 3px 8px 3px 10px; gap: 8px; }
  .filial-txt b { font-size: 14px; }
  .user { border-left: 0; padding-left: 0; }
  .user-av { width: 36px; height: 36px; font-size: 13px; }
  .topbar .icon-btn { width: 38px; height: 38px; }
  .filial-menu { position: fixed; left: 12px; right: 12px; top: calc(62px + var(--safe-top)); width: auto; }
  .pk-head h2 { font-size: 17px; }
  .pk-filial { padding: 4px 10px 4px 8px; font-size: 12px; }
}

/* Yuqoridagi ingichka yuklanish chizig'i */
.topload { position: fixed; z-index: 100; left: 0; right: 0; top: 0; height: 3px; pointer-events: none; opacity: 0; transition: opacity .25s .1s; }
.topload.on { opacity: 1; transition-delay: 0s; }
.topload i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #14B3A2, #2DD4BF); box-shadow: 0 0 8px rgba(20, 179, 162, .6); border-radius: 0 2px 2px 0; transition: width .3s ease-out; }

/* ======================================================================
   Chap menyu (admin): Bosh panel / Xarid
   ====================================================================== */
.rail {
  position: fixed; z-index: 26; left: 0; top: 0; bottom: 0; width: var(--rail-w);
  display: flex; flex-direction: column; align-items: stretch;
  padding-top: var(--safe-top); background: var(--ink);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .04);
}
.rail-brand { height: 64px; display: grid; place-items: center; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.rail-items { display: flex; flex-direction: column; gap: 6px; padding: 12px 10px; }
.rail-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px 10px; border: 0; border-radius: 14px; background: transparent;
  color: #93AEB8; font-size: 12px; font-weight: 600; line-height: 1.15; text-align: center;
  transition: background .15s, color .15s;
}
.rail-item svg { width: 23px; height: 23px; }
.rail-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail-item[aria-current="page"] { background: rgba(45, 212, 191, .14); color: #fff; }
.rail-item[aria-current="page"] svg { color: #2DD4BF; }
.rail-item[aria-current="page"]::before {
  content: ""; position: absolute; left: -10px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: #2DD4BF;
}
body.has-rail { padding-left: var(--rail-w); }
body.has-rail .dock { left: var(--rail-w); }
body.has-rail .topbar .brand-mark { display: none; }

@media (max-width: 860px) {
  body.has-rail { padding-left: 0; }
  body.has-rail .topbar .brand-mark { display: grid; }
  .rail {
    top: auto; right: 0; width: auto; height: calc(var(--nav-h) + var(--safe-bottom));
    flex-direction: row; padding: 0 0 var(--safe-bottom); background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 18px -12px rgba(15, 42, 53, .2);
  }
  .rail-brand { display: none; }
  .rail-items { flex: 1; flex-direction: row; gap: 8px; padding: 6px 16px; justify-content: center; }
  .rail-item { flex: 1; max-width: 200px; padding: 6px 4px; gap: 3px; color: var(--ink-3); font-size: 11.5px; }
  .rail-item svg { width: 22px; height: 22px; }
  .rail-item:hover { background: transparent; color: var(--ink); }
  .rail-item[aria-current="page"] { background: var(--teal-tint); color: var(--teal-deep); }
  .rail-item[aria-current="page"] svg { color: var(--teal); }
  .rail-item[aria-current="page"]::before { display: none; }
  body.has-rail .dock { left: 0; bottom: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: 8px; }
  body.has-rail .dock-space { height: calc(110px + var(--nav-h) + var(--safe-bottom)); }
  body.has-rail .toast { bottom: calc(100px + var(--nav-h) + var(--safe-bottom)); }
  body.has-rail .screen.state { min-height: calc(100vh - 66px - var(--nav-h) - var(--safe-top) - var(--safe-bottom)); }
}

/* ======================================================================
   Bosh panel
   ====================================================================== */
.screen.dash { max-width: 1280px; padding-left: 24px; padding-right: 24px; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 6px 0 16px; flex-wrap: wrap; }
.dash-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.dash-tools { display: flex; align-items: center; gap: 8px; }
.dash-space { height: calc(24px + var(--safe-bottom)); }
.screen.dash.is-loading .dash-cards, .screen.dash.is-loading .chart { opacity: .55; transition: opacity .2s; }
.dash-empty { grid-column: 1 / -1; padding: 30px; text-align: center; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 18px; }

/* Segment tugmalar */
.seg { display: inline-flex; gap: 3px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.seg button:hover { color: var(--ink); background: var(--mist); }
.seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.seg button b { font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--slate-tint); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.seg button b:empty { display: none; }
.seg button[aria-checked="true"] b { background: rgba(255, 255, 255, .18); color: #fff; }
.fil-seg button .filial-dot { width: 8px; height: 8px; }
.fil-seg button[aria-checked="true"] { background: color-mix(in srgb, var(--fil) 12%, #fff); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--fil); }

/* Filial kartochkalari */
.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi {
  --fil: var(--teal); position: relative; display: flex; flex-direction: column; gap: 10px; text-align: left;
  padding: 18px 18px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--fil); }
.kpi:hover { border-color: color-mix(in srgb, var(--fil) 45%, var(--line)); box-shadow: 0 10px 28px -16px rgba(15, 42, 53, .35); }
.kpi[aria-pressed="true"] { border-color: var(--fil); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fil) 16%, transparent); }
.kpi-head { display: flex; align-items: center; gap: 8px; }
.kpi-head b { font-size: 16px; font-weight: 800; flex: 1; }
.kpi-tag { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--mist); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.kpi-main { display: flex; align-items: baseline; gap: 8px; }
.kpi-main strong { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-main span { color: var(--ink-2); font-weight: 600; font-size: 14px; }
.kpi-delta { font-size: 13px; font-weight: 600; margin-top: -4px; }
.kpi-delta.up { color: #11804A; }
.kpi-delta.down { color: #C2362C; }
.kpi-delta.flat, .kpi-delta.muted { color: var(--ink-3); }
.kpi-bar { height: 8px; border-radius: 999px; background: var(--slate-tint); overflow: hidden; }
.kpi-bar span { display: block; height: 100%; border-radius: 999px; background: var(--fil); transition: width .4s ease-out; }
.kpi-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.kpi-stats div { min-width: 0; }
.kpi-stats dt { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.kpi-stats dd { margin: 2px 0 0; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-stats dd.warn { color: #C2362C; }
.kpi-wait { color: var(--ink-2); font-size: 14px; padding: 18px 0 8px; }

/* Panellar */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; margin-bottom: 14px; min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 800; }
.panel-sub { margin: 3px 0 0; font-size: 13px; color: var(--ink-2); max-width: 70ch; }
.panel-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; }
.lg-item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.lg-key { width: 16px; height: 3px; border-radius: 2px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.chip-btn svg { width: 16px; height: 16px; }
.chip-btn:hover { color: var(--ink); border-color: #C9D7DB; }

/* Grafik */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .ax-grid { stroke: #E6EDEF; stroke-width: 1; }
.chart .ax-base { stroke: #C9D7DB; stroke-width: 1; }
.chart .ax-label { fill: var(--ink-3); font-size: 11.5px; font-family: inherit; font-variant-numeric: tabular-nums; }
.chart .ax-direct { fill: var(--ink-2); font-size: 12px; font-weight: 600; font-family: inherit; }
.chart .ax-cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart rect:focus { outline: none; }
.chart-tip {
  position: absolute; top: 8px; z-index: 2; min-width: 190px; padding: 10px 12px; pointer-events: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px -12px rgba(15, 42, 53, .35);
}
.tip-date { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 2px 0; }
.tip-row b { min-width: 52px; font-size: 14px; font-variant-numeric: tabular-nums; }
.tip-row span:last-child { color: var(--ink-2); }
.tip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.chart-note { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--mist); color: var(--ink-2); font-size: 13px; }
.chart-table-wrap { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }

/* Jadvallar */
.below-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.below-tools .search { flex: 1 1 240px; }
.below-tools .seg { overflow-x: auto; max-width: 100%; }
.dt-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.dt th { position: sticky; top: 0; background: var(--mist); color: var(--ink-2); font-size: 12.5px; font-weight: 700; text-align: left; padding: 10px 12px; border-bottom: 1px solid #C9D7DB; white-space: nowrap; }
.dt td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tbody tr:hover td { background: #F6FAFA; }
.dt .r { text-align: right; }
.dt .nowrap { white-space: nowrap; }
.dt .num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt .num-cell.strong { font-weight: 700; }
.dt .num-cell.min { color: var(--coral); font-weight: 700; }
.dt .num-cell.zero { color: var(--ink-3); }
.dt-name { min-width: 220px; }
.dt-name span { display: block; font-weight: 500; line-height: 1.3; }
.dt-name small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.dt-empty td { text-align: center; color: var(--ink-2); padding: 28px 12px; }
.dt.is-loading tbody { opacity: .5; }
.dt-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; flex-wrap: wrap; }

.age, .st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.age::before, .st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.age-ok { background: var(--slate-tint); color: var(--ink-2); }
.age-warn { background: var(--amber-tint); color: #9A5300; }
.age-bad { background: var(--coral-tint); color: #B4372E; }
.st-ok { background: var(--leaf-tint); color: #126B3B; }
.st-no { background: var(--slate-tint); color: var(--ink-2); }
.fil-chip { --fil: var(--teal); display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.fil-chip .filial-dot { width: 8px; height: 8px; }
.below-share { color: var(--coral); font-weight: 600; }

@media (max-width: 860px) {
  .screen.dash { padding-left: 12px; padding-right: 12px; }
  .dash-head { align-items: flex-start; }
  .dash-head h1 { font-size: 24px; }
  .panel { padding: 14px; border-radius: 18px; }
  .kpi-main strong { font-size: 34px; }
  .below-tools .pk-per-page { display: block; flex: 1 1 100%; min-height: 40px; }
  .fil-seg { width: 100%; }
  .fil-seg button { flex: 1; justify-content: center; }
  .dash-space { height: calc(24px + var(--nav-h) + var(--safe-bottom)); }
}

/* Telefonda jadval qatorlari kartaga aylanadi */
@media (max-width: 640px) {
  .dt-wrap:has(.dt.stack) { border: 0; border-radius: 0; overflow: visible; }
  .dt.stack thead { display: none; }
  .dt.stack, .dt.stack tbody { display: block; }
  .dt.stack tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px;
    padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  }
  .dt.stack tbody tr:hover td { background: transparent; }
  .dt.stack td { display: block; padding: 0; border: 0 !important; text-align: left !important; min-width: 0; }
  .dt.stack td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 600; color: var(--ink-3); margin-bottom: 1px; white-space: nowrap; }
  .dt.stack td.dt-name { grid-column: 1 / -1; min-width: 0; }
  .dt.stack td.c-value { grid-column: 1 / -1; }
  .dt.stack td.c-age { grid-column: 1 / 2; }
  .dt.stack td.c-status { grid-column: 2 / -1; justify-self: start; }
  .dt.stack .st { white-space: normal; }
  .dt.stack tr.dt-empty { display: block; }
  .dt.stack.recent tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dt.stack.recent td.c-fil { justify-self: end; }
  .dt.stack.recent td.c-time { color: var(--ink-2); font-size: 13px; font-weight: 600; }
}

/* ======================================================================
   KPI: minimal stock to'ldirilishi, zakupshik bonusi
   ====================================================================== */
:root { --k-ok: #15925A; --k-ok-tint: #E1F4E9; --k-low: #D98A06; --k-low-tint: #FDF0D5; --k-bad: #D9443A; --k-bad-tint: #FDECEA; }
.t-ok { --t: var(--k-ok); --tt: var(--k-ok-tint); --ti: #0F6B41; }
.t-low { --t: var(--k-low); --tt: var(--k-low-tint); --ti: #8F5A00; }
.t-bad { --t: var(--k-bad); --tt: var(--k-bad-tint); --ti: #B4372E; }
.t-none { --t: var(--ink-3); --tt: var(--slate-tint); --ti: var(--ink-2); }

.kpi-tools { flex-wrap: wrap; justify-content: flex-end; }
.datepick { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.datepick button { width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); display: grid; place-items: center; }
.datepick button:hover:not(:disabled) { background: var(--mist); color: var(--ink); }
.datepick button:disabled { color: var(--line); cursor: default; }
.datepick button svg { width: 18px; height: 18px; }
.datepick span { min-width: 136px; text-align: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.chip-btn:disabled { opacity: .6; cursor: default; }
.chip-btn.spin svg { animation: spin .9s linear infinite; }
.kpi-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 44px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; color: var(--ink-2); }
.kpi-state b { color: var(--ink); font-size: 17px; }
.kpi-state .cta { margin-top: 8px; }
.screen.dash.is-loading #kpi-cards, .screen.dash.is-loading #kpi-month { opacity: .55; transition: opacity .2s; }

.k-card { cursor: pointer; gap: 9px; }
.k-pill { margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--tt); color: var(--ti); white-space: nowrap; }
.k-note { margin: -4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.k-slots { display: flex; gap: 8px; flex-wrap: wrap; }
.k-slot { display: inline-flex; align-items: baseline; gap: 8px; min-height: 34px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.k-slot b { color: var(--ink); font-size: 14px; }
button.k-slot:hover { border-color: #C9D7DB; }
.k-slot[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #C9D7DB; }
.k-slot[aria-pressed="true"] b { color: #fff; }
.k-slot.missing { border-style: dashed; color: var(--ink-3); cursor: default; }
.k-slot.missing small { font-size: 12px; }
.k-meter { position: relative; height: 10px; border-radius: 999px; background: var(--slate-tint); margin-top: 4px; }
.k-meter.thin { height: 6px; margin-top: 8px; }
.k-meter i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--t); transition: width .4s ease-out; }
.k-meter b { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--ink); }
.k-meter-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: -4px; }
.k-stats dt { display: flex; align-items: center; gap: 6px; }
.k-stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sw { width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--t); display: inline-block; }
.k-bonus-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--k-ok-tint); }
.k-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--k-ok); color: #fff; font-weight: 800; }
.k-bonus-row > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.k-bonus-main { font-size: 13px; color: var(--ink-2); }
.k-bonus-main b { color: var(--ink); font-size: 15px; }
.k-bonus-row small { font-size: 12px; color: #2F6B4E; }
.k-cells-title { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); }
.k-cells { display: flex; flex-wrap: wrap; gap: 2px; }
.k-cells i { width: 7px; height: 7px; border-radius: 1.5px; background: var(--t); }

.k-prod { display: flex !important; align-items: flex-start; gap: 8px; }
.k-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin-top: 5px; background: var(--t); }
.k-prod + small { padding-left: 17px; }
.k-stale { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--k-low-tint); color: #8F5A00; font-size: 11px; font-weight: 700; }
.k-stale-cell { color: #8F5A00; font-weight: 600; }
.k-need { display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--tt); color: var(--ti); white-space: nowrap; font-variant-numeric: tabular-nums; }
#kpi-more { margin-top: 10px; }
.kpi-table .dt-name { min-width: 280px; }

/* Oylik */
.k-bonus-card { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.k-bonus-txt { flex: 1 1 320px; }
.k-bonus-txt h2 { margin: 0; font-size: 17px; font-weight: 800; }
.k-bonus-split { display: flex; gap: 10px; flex-wrap: wrap; }
.k-bonus-stat { --fil: var(--teal); display: flex; flex-direction: column; gap: 2px; min-width: 130px; padding: 10px 14px; border-radius: 14px; background: var(--mist); }
.k-bonus-stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.k-bonus-stat > span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.k-bonus-stat .filial-dot { width: 8px; height: 8px; }
.k-bonus-total { display: flex; align-items: baseline; gap: 8px; }
.k-bonus-total strong { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; color: var(--k-ok); font-variant-numeric: tabular-nums; }
.k-bonus-total span { color: var(--ink-3); font-weight: 600; }
.k-month-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; }
.k-mcard { --fil: var(--teal); display: flex; flex-direction: column; gap: 12px; margin-bottom: 0; position: relative; overflow: hidden; }
.k-mcard::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--fil); }
.k-bonus-box { padding: 12px 14px; border-radius: 14px; background: var(--mist); }
.k-bonus-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
.k-bonus-top b { font-size: 20px; color: var(--k-ok); font-variant-numeric: tabular-nums; }
.k-bonus-box small { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.k-chart svg { display: block; width: 100%; height: auto; }
.k-chart .ax-grid { stroke: #E6EDEF; }
.k-chart .ax-base { stroke: #C9D7DB; }
.k-chart .ax-label { fill: var(--ink-3); font-size: 11px; font-family: inherit; }
.k-chart .k-target-label { fill: var(--k-ok); font-weight: 700; }
.k-chart .k-target { stroke: var(--k-ok); stroke-dasharray: 4 4; stroke-width: 1.5; }
.k-chart .k-avg { stroke: var(--ink); stroke-width: 1; opacity: .4; }
.k-chart .v { fill: var(--t); }
.k-bar { cursor: pointer; outline: none; }
.k-bar:hover .v, .k-bar:focus .v { filter: brightness(1.12); stroke: var(--ink); stroke-width: 1.5; }
.k-chart-info { min-height: 20px; margin-top: 4px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.k-chart-info.on { color: var(--ink); font-weight: 600; }
.k-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.k-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.k-key-dash { width: 16px; height: 0; border-top: 2px dashed var(--k-ok); }
.k-key-avg { width: 16px; height: 0; border-top: 1.5px solid rgba(15, 42, 53, .45); }
.k-top h3 { margin: 0; font-size: 15px; font-weight: 800; }
.k-top .panel-sub { margin-bottom: 8px; }
.k-trow { display: grid; grid-template-columns: minmax(0, 1fr) 90px 56px; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.k-tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-daysbar { height: 6px; border-radius: 999px; background: var(--slate-tint); overflow: hidden; }
.k-daysbar i { display: block; height: 100%; border-radius: 999px; background: var(--k-bad); }
.k-tdays { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; font-weight: 600; }

@media (max-width: 860px) {
  .kpi-tools { width: 100%; justify-content: flex-start; }
  .datepick { flex: 1; justify-content: space-between; }
  .k-month-grid { grid-template-columns: 1fr; }
  .k-stats.four { grid-template-columns: 1fr 1fr; }
  .k-bonus-total strong { font-size: 28px; }
}
@media (max-width: 640px) {
  .dt.stack.kpi-table tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dt.stack.kpi-table td:nth-child(5) { grid-column: 1 / -1; }
  .k-prod + small { padding-left: 17px; }
}
.fil-seg button[aria-checked="true"] b { background: var(--fil); color: #fff; }
.dt-name span.k-stale { display: inline-block; }

/* ======================================================================
   Xarid formasi — keng ekranda gorizontal, ixcham va jadvalsimon
   ====================================================================== */
.step-head { flex-wrap: wrap; }
.wh-inline { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.wh-inline .field-label { white-space: nowrap; }
.wh-inline .control { min-width: 230px; min-height: 40px; padding-top: 8px; padding-bottom: 8px; font-size: 15px; }
.cart-head { display: none; }
@media (max-width: 640px) {
  .wh-inline { flex-basis: 100%; margin-left: 0; flex-direction: column; align-items: stretch; gap: 6px; }
  .wh-inline .control { min-width: 0; font-size: 16px; min-height: 46px; }
}

@media (min-width: 900px) {
  .screen.wide-form { max-width: 1180px; padding-left: 24px; padding-right: 24px; }
  .wide-form .appbar h1 { font-size: 24px; }
  .wide-form .appbar-sub { font-size: 13.5px; }
  .wide-form .step { padding: 18px 20px; border-radius: 18px; }
  .wide-form .step-head { margin-bottom: 14px; }
  .wide-form .step-head h2 { font-size: 16px; flex: 0 1 auto; }
  .wide-form .field-label { font-size: 12.5px; }
  .wide-form .control { font-size: 15px; min-height: 44px; padding: 10px 12px; }
  .wide-form select.control { padding-right: 34px; }
  .wide-form .segmented { padding: 3px; }
  .wide-form .segmented button { min-height: 38px; font-size: 14px; }
  .doc-fields { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.7fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
  .doc-fields .field.wide { grid-column: auto; }
  .wide-form .dock-inner { max-width: 1132px; padding: 8px 8px 8px 20px; border-radius: 18px; }
  .wide-form .dock-total { font-size: 20px; }
  .wide-form .dock .cta { min-height: 46px; padding: 0 30px; font-size: 15px; }
  .wide-form .dock-space { height: calc(92px + var(--safe-bottom)); }
  .wide-form textarea.control { min-height: 52px; }

  /* Mahsulot qatorlari — jadval */
  .wide-form .cart { gap: 6px; margin-top: 4px; }
  .wide-form .cart-head, .wide-form .line {
    display: grid; column-gap: 14px; align-items: center;
    grid-template-columns: 26px minmax(220px, 1fr) 150px 220px 140px 150px 34px;
  }
  .wide-form .cart-head { padding: 0 12px 2px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
  .wide-form .cart-head .r { text-align: right; }
  .wide-form .line {
    grid-template-areas: "idx name price disc qty sum del" "idx stock price disc qty sum del";
    row-gap: 2px; padding: 10px 12px; border-radius: 12px;
  }
  .wide-form .line:hover { border-color: #C9D7DB; }
  .wide-form .line-top, .wide-form .line-grid, .wide-form .line-foot { display: contents; }
  .wide-form .line-idx { grid-area: idx; align-self: start; padding-top: 2px; }
  .wide-form .line-name { grid-area: name; font-size: 14px; }
  .wide-form .stock { grid-area: stock; margin: 0; justify-self: start; font-size: 11.5px; padding: 2px 8px; }
  .wide-form .line-grid > .mini:first-child { grid-area: price; }
  .wide-form .line-grid > .mini:nth-child(2) { grid-area: disc; }
  .wide-form .line .mini-label { display: none; }
  .wide-form .stepper { grid-area: qty; padding: 2px; border-radius: 10px; }
  .wide-form .stepper button { width: 34px; height: 34px; border-radius: 8px; }
  .wide-form .stepper input { width: 100%; min-width: 0; font-size: 15px; }
  .wide-form .line-sum { grid-area: sum; }
  .wide-form .line-total { font-size: 15px; }
  .wide-form .line-disc { font-size: 11.5px; }
  .wide-form .line-del { grid-area: del; margin: 0; width: 32px; height: 32px; }
  .wide-form .num { min-height: 38px; padding: 7px 10px; font-size: 14px; }
  .wide-form .tog { min-width: 38px; font-size: 13px; }
  .wide-form .tog.dir { font-size: 16px; }
  .wide-form .add-btn { min-height: 44px; font-size: 14px; }
  .wide-form .cart-empty { padding: 16px 12px; flex-direction: row; justify-content: center; gap: 10px; }
  .wide-form .cart-empty svg { width: 22px; height: 22px; }
}
@media (min-width: 1600px) {
  .screen.wide-form { max-width: 1360px; }
  .wide-form .dock-inner { max-width: 1312px; }
  .wide-form .cart-head, .wide-form .line { grid-template-columns: 26px minmax(280px, 1fr) 170px 240px 150px 170px 34px; }
}

/* ======================================================================
   Mahsulotlarni tanlash — butun ekran kengligi, bir qatorli nomlar, aqlli qidiruv
   ====================================================================== */
.pk-body { max-width: none; padding: 12px 16px; }
.pk-side { width: 268px; }
.pk-name { display: block; font-weight: 500; font-size: 14px; line-height: 1.35; }
.pk-name mark, .pk-meta mark { background: #FFE9A8; color: inherit; border-radius: 3px; padding: 0 1px; }
.pk-meta { display: flex; align-items: baseline; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pk-meta em { font-style: normal; color: var(--ink-3); opacity: .8; }
.pk-meta > span { color: var(--ink-2); }
.pk-meta > span.hit { color: var(--teal-deep); font-weight: 700; }
.pk-meta > span.hit em { color: var(--teal-deep); }
.pk-dot { font-style: normal; color: var(--line); }

@media (min-width: 861px) {
  .pk-table { table-layout: fixed; }
  .pk-table th.c-price { width: 128px; }
  .pk-table th.c-stock { width: 138px; }
  .pk-table th.c-min { width: 90px; }
  .pk-table th.c-rec { width: 124px; }
  .pk-table th.c-qty { width: 176px; }
  .pk-table th.c-unit { width: 112px; }
  .pk-table td { padding: 11px 14px; }
  .pk-table td.c-name { overflow: hidden; }
  /* Nomi bitta qatorda; to'liq nomi sichqoncha ustida turganda ko'rinadi */
  .pk-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pk-table th.c-stock span { display: inline-block; max-width: calc(100% - 18px); overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
  /* Miqdor va birlik boshqaruvi - normal o'lcham */
  .pk-step button { height: 36px; width: 38px; }
  .pk-step input { height: 36px; font-size: 14px; }
  .pk-unit { min-height: 38px; }
  /* Qatorlar - mayin o'tish va tanlangan qatorga chap chiziq */
  .pk-table tbody tr { transition: background .12s; }
  .pk-table tr.is-picked td.c-name { box-shadow: inset 3px 0 0 var(--teal); }
}
@media (min-width: 861px) and (max-width: 1180px) {
  .pk-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pk-table th.c-rec { width: 104px; }
  .pk-table th.c-min { width: 96px; }
}

/* Qidiruv maydoni + "qayerdan qidirish" kartochkasi */
.pk-search { position: relative; padding-right: 4px; }
.pk-sclear, .pk-sin-btn { flex: none; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-3); border-radius: 9px; }
.pk-sclear { width: 30px; height: 30px; }
.pk-sclear svg { width: 16px; height: 16px; }
.pk-sclear:hover { background: var(--slate-tint); color: var(--ink); }
.pk-sin-btn { position: relative; width: 38px; height: 36px; border-left: 1px solid var(--line); border-radius: 0 9px 9px 0; }
.pk-sin-btn svg { width: 20px; height: 20px; }
.pk-sin-btn:hover, .pk-sin-btn[aria-expanded="true"] { color: var(--teal); background: var(--teal-tint); }
.pk-sin-btn.on { color: var(--teal); }
.pk-sin-btn b { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--teal); color: #fff; font-size: 10.5px; line-height: 16px; text-align: center; }
.pk-sin-menu {
  position: absolute; z-index: 40; right: 0; top: calc(100% + 8px); width: 320px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: var(--ink);
  box-shadow: 0 18px 44px -10px rgba(15, 42, 53, .3); animation: menu-in .14s ease-out;
}
.pk-sin-head { margin: 4px 10px 6px; font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.pk-sin-opt { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 11px; cursor: pointer; }
.pk-sin-opt:hover { background: var(--mist); }
.pk-sin-opt input { position: absolute; opacity: 0; pointer-events: none; }
.pk-sin-box { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border: 1.5px solid #B8C9CE; border-radius: 6px; background: var(--card); color: #fff; transition: background .12s, border-color .12s; }
.pk-sin-box svg { width: 14px; height: 14px; opacity: 0; }
.pk-sin-opt input:checked + .pk-sin-box { background: var(--teal); border-color: var(--teal); }
.pk-sin-opt input:checked + .pk-sin-box svg { opacity: 1; }
.pk-sin-opt input:focus-visible + .pk-sin-box { outline: 2.5px solid var(--teal); outline-offset: 2px; }
.pk-sin-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pk-sin-txt b { font-size: 14px; font-weight: 600; }
.pk-sin-txt small { font-size: 12px; color: var(--ink-3); }
.pk-sin-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.pk-sin-foot .text-btn { padding: 4px 0; font-size: 13px; }
.pk-sin-foot .text-btn:disabled { color: var(--ink-3); opacity: .6; cursor: default; }
.pk-sin-foot kbd { font: inherit; font-weight: 700; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--mist); color: var(--ink-2); }
@media (max-width: 860px) {
  .pk-sin-menu { left: -8px; right: -8px; width: auto; }
  .pk-meta { font-size: 11.5px; }
}
/* O'rta kenglikdagi ekranlar (1180–1599): ixchamroq ustunlar, nomi 2 qatorgacha */
@media (min-width: 861px) and (max-width: 1599px) {
  .pk-side { width: 244px; }
  .pk-table th { font-size: 12.5px; }
  .pk-table th.c-price { width: 108px; }
  .pk-table th.c-stock { width: 132px; }
  .pk-table th.c-min { width: 102px; }
  .pk-table th.c-rec { width: 120px; }
  .pk-table th.c-qty { width: 140px; }
  .pk-table th.c-unit { width: 88px; }
  .pk-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
.pk-table thead th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-sin-foot { flex-direction: column; align-items: flex-start; gap: 6px; }
.pk-sin-foot .text-btn { white-space: nowrap; }
.pk-sin-foot .text-btn:disabled { display: none; }
@media (max-width: 860px) {
  .pk-toolbar .pk-search { flex: 1 1 100%; order: 0; }
  .pk-quick { order: -1; }
  .pk-filter-btn { order: 1; flex: 1 1 0; max-width: none; }
  .pk-sort-m { order: 2; flex: 1 1 0; min-height: 44px; min-width: 0; }
  .pk-check { order: 3; }
}
@media (min-width: 861px) and (max-width: 1599px) {
  .pk-table thead th { padding-left: 10px; padding-right: 10px; }
  .pk-table th[data-sort]::after { margin-left: 4px; }
  .pk-table th.c-price { width: 118px; }
  .pk-table th.c-stock { width: 148px; }
  .pk-table th.c-min { width: 114px; }
  .pk-table th.c-rec { width: 134px; }
  .pk-table th.c-qty { width: 140px; }
  .pk-table th.c-unit { width: 84px; }
  .pk-table td { padding-left: 10px; padding-right: 10px; }
}
.pk-meta { display: block; }
.pk-meta > span, .pk-meta > .pk-dot { margin-right: 5px; }

.pk-fresh.night { color: #5B5FC7; }
.pk-fresh.night span { font-weight: 600; }

/* Qidiruv izohi (klaviatura tili / xato yozilgan) */
.pk-note { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 7px 14px; border-bottom: 1px solid var(--line); background: #F4F3FF; color: #3F3D9C; font-size: 13px; }
.pk-note-row::before { content: "✦ "; color: #6D6AE8; }
.pk-note b { font-weight: 700; }

/* Ixcham ustunlar: raqamlar uchun yetarli, qolgan joy — mahsulot nomiga */
@media (min-width: 861px) {
  .pk-table thead th { font-size: 12px; padding: 9px 10px; letter-spacing: .01em; }
  .pk-table th[data-sort]::after { margin-left: 4px; }
  .pk-table td { padding: 7px 10px; }
  .pk-table th.c-price { width: 106px; }
  .pk-table th.c-stock { width: 112px; }
  .pk-table th.c-min { width: 64px; }
  .pk-table th.c-rec { width: 74px; }
  .pk-table th.c-qty { width: 136px; }
  .pk-table th.c-unit { width: 70px; }
  .pk-table .c-price, .pk-table .c-stock { font-size: 13.5px; }
  .pk-cur { font-size: 11px; }
  .pk-step button { width: 30px; height: 32px; }
  .pk-step input { height: 32px; font-size: 14px; }
  .pk-unit { min-height: 32px; padding: 0 20px 0 8px; font-size: 13px; background-position: right 4px center; }
  .pk-unit-text { font-size: 13px; }
}
@media (min-width: 861px) and (max-width: 1599px) {
  .pk-table th.c-price { width: 100px; }
  .pk-table th.c-stock { width: 104px; }
  .pk-table th.c-min { width: 62px; }
  .pk-table th.c-rec { width: 72px; }
  .pk-table th.c-qty { width: 136px; }
  .pk-table th.c-unit { width: 68px; }
}
@media (min-width: 1600px) {
  .pk-name { white-space: nowrap; display: block; }
}
@media (min-width: 861px) {
  .pk-table th.c-price { width: 116px; }
  .pk-table th.c-stock { width: 104px; }
  .pk-table th.c-min { width: 70px; }
  .pk-table th.c-rec { width: 92px; }
  .pk-table th.c-qty { width: 136px; }
  .pk-table th.c-unit { width: 68px; }
  .pk-table thead th { text-overflow: clip; }
}

/* ======================================================================
   Xodimlar, rollar, parol, amallar jurnali
   ====================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
body.no-scroll { overflow: hidden; }

/* Rol ranglari */
.role-super_admin { --rc: #6D28D9; --rct: #EFE7FD; }
.role-admin { --rc: var(--teal-deep); --rct: var(--teal-tint); }
.role-seller { --rc: #0369A1; --rct: #E0F0FA; }
.role-viewer { --rc: #9A6400; --rct: var(--brass-tint); }
.role-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--rct, var(--slate-tint)); color: var(--rc, var(--ink-2)); }

/* Profil tugmasi va menyusi */
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 3px 6px 3px 3px; border: 0; border-radius: 999px; background: transparent; text-align: left; }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--mist); }
.user-chev { width: 16px; height: 16px; color: var(--ink-3); transition: transform .15s; }
.user-btn[aria-expanded="true"] .user-chev { transform: rotate(180deg); }
.user-av.lg { width: 44px; height: 44px; font-size: 16px; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 30; width: 270px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 44px -10px rgba(15, 42, 53, .28); animation: menu-in .14s ease-out;
  display: flex; flex-direction: column; gap: 2px;
}
.um-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 6px; }
.um-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.um-txt b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um-txt small { font-size: 12.5px; color: var(--ink-3); }
.user-menu .role-chip { align-self: flex-start; margin: 0 8px 8px 64px; }
.user-menu button, .row-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 10px; border: 0; border-radius: 10px;
  background: transparent; font-size: 14.5px; font-weight: 600; text-align: left; color: var(--ink);
}
.user-menu button svg, .row-menu button svg { width: 18px; height: 18px; color: var(--ink-2); }
.user-menu button:hover, .row-menu button:hover, .row-menu button:focus-visible { background: var(--mist); outline: none; }
.user-menu button:first-of-type { border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; margin-top: 2px; padding-top: 12px; }
.user-menu button.danger, .row-menu button.danger { color: var(--coral); }
.user-menu button.danger svg, .row-menu button.danger svg { color: var(--coral); }
.row-menu button.good svg { color: var(--leaf); }
@media (max-width: 520px) {
  .user-menu { position: fixed; left: 12px; right: 12px; top: calc(62px + var(--safe-top)); width: auto; }
  .user-chev { display: none; }
  .user-btn { padding: 0; }
}

/* Parolni almashtirish */
.pw-card { max-width: 420px; }
.login-mark.sm { width: 48px; height: 48px; border-radius: 14px; }
.login-mark.sm svg { width: 26px; height: 26px; }
.pw-input { position: relative; display: block; }
.pw-input .control { padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-3); display: grid; place-items: center; }
.pw-eye[aria-pressed="true"] { color: var(--teal); }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: -6px; }
.pw-meter i { height: 5px; border-radius: 3px; background: var(--line); transition: background .2s; }
.pw-meter[data-level="1"] i:nth-child(-n+1) { background: var(--coral); }
.pw-meter[data-level="2"] i:nth-child(-n+2) { background: var(--amber); }
.pw-meter[data-level="3"] i:nth-child(-n+3) { background: #4AA36C; }
.pw-meter[data-level="4"] i { background: var(--leaf); }
.pw-rules { list-style: none; margin: -4px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 13px; color: var(--ink-3); }
.pw-rules li { display: flex; align-items: center; gap: 7px; }
.pw-rules li::before { content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; }
.pw-rules li.ok { color: var(--leaf); font-weight: 600; }
.pw-rules li.ok::before { border: 0; background: var(--leaf) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4L18 8' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/11px no-repeat; }
.login .text-btn { align-self: center; margin-top: -6px; }
.text-btn.muted { color: var(--ink-2); font-weight: 500; font-size: 13.5px; }

/* Tugmalar */
.cta.sm { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: 14.5px; display: inline-flex; align-items: center; gap: 7px; }
.cta.sm svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 9px; border-color: transparent; background: transparent; }
.icon-btn.sm:hover { background: var(--mist); border-color: var(--line); color: var(--ink); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; justify-content: center; }
.st-bad { background: var(--coral-tint); color: #B4372E; }
.st-warn { background: var(--amber-tint); color: #9A5300; }

/* Ko'rsatkichlar */
.us-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.us-stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; position: relative; overflow: hidden; }
.us-stat b { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--t, var(--ink)); }
.us-stat span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.us-stat::after { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--t, var(--ink)); }

/* Xodimlar jadvali */
.us-table td { padding-top: 11px; padding-bottom: 11px; }
.us-cell { display: flex; align-items: center; gap: 12px; }
.us-av {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--rct); color: var(--rc); font-size: 14px; font-weight: 800; letter-spacing: .02em;
}
.us-who { display: flex; flex-direction: column; min-width: 0; }
.us-name { display: flex; align-items: center; gap: 8px; }
.us-name b { font-weight: 700; }
.us-who small { font-size: 12.5px; color: var(--ink-3); }
.dt-name .us-cell span.us-name { display: flex; }
.dt-name .us-who small { display: block; }
.me-tag { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--ink); color: #fff; }
.us-fils { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.us-all { font-weight: 600; color: #6D28D9; white-space: nowrap; }
.us-via { display: flex; flex-wrap: wrap; gap: 6px; }
.via { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 8px; background: var(--mist); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.via svg { width: 14px; height: 14px; }
.via.tg { background: #E3F2FC; color: #1A7AB8; }
.us-table tr.is-blocked td:not(.c-act) { opacity: .62; }
.us-table tr.is-blocked .st { opacity: 1; }
.c-act { width: 46px; }
.screen.dash.is-loading .us-table tbody, .au-list.is-loading { opacity: .55; transition: opacity .2s; }

/* Qator menyusi */
.row-menu {
  position: fixed; z-index: 40; min-width: 220px; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px -10px rgba(15, 42, 53, .3); animation: menu-in .12s ease-out; display: flex; flex-direction: column;
}

/* O'ng tomondan chiqadigan oyna (xodim qo'shish/tahrirlash) */
.drawer-back { position: fixed; inset: 0; z-index: 44; background: rgba(15, 42, 53, .38); animation: fade-in .15s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; z-index: 45; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: var(--card); box-shadow: -20px 0 50px -20px rgba(15, 42, 53, .35);
  transform: translateX(24px); opacity: 0; transition: transform .2s ease-out, opacity .2s ease-out;
}
.drawer.open { transform: none; opacity: 1; }
.drawer form { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: calc(18px + var(--safe-top)) 22px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 22px 18px; overscroll-behavior: contain; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--card); }
.drawer-foot .btn-quiet, .drawer-foot .cta { min-height: 46px; border-radius: 13px; }
.drawer-foot .cta { min-width: 150px; }
.ud-sec { border: 0; margin: 0; padding: 16px 0 4px; min-width: 0; }
.ud-sec + .ud-sec { border-top: 1px dashed var(--line); }
.ud-sec legend { padding: 0; margin-bottom: 10px; font-size: 12px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; }
.ud-sec .field-label i { font-style: normal; font-weight: 500; color: var(--ink-3); }
.ud-hint { font-size: 12px; color: var(--ink-3); }
.ud-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.ud-err { font-size: 12.5px; font-weight: 600; color: var(--coral); }
.ud-err:empty { display: none; }
.field.has-err .control { border-color: var(--coral); background-color: var(--coral-tint); }
.ud-sec.has-err .role-cards, .ud-sec.has-err .fil-checks { outline: 1.5px solid var(--coral); outline-offset: 4px; border-radius: 12px; }
#ud-pass-wrap { margin-top: 10px; }
#ud-pass { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; }

.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-card {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1.5px solid var(--line); border-radius: 13px;
  background: var(--card); text-align: left; transition: border-color .15s, background .15s, box-shadow .15s;
}
.role-card:hover:not(:disabled) { border-color: color-mix(in srgb, var(--rc) 45%, var(--line)); }
.role-card[aria-checked="true"] { border-color: var(--rc); background: var(--rct); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rc) 14%, transparent); }
.role-card:disabled { cursor: default; opacity: .55; }
.role-card[aria-checked="true"]:disabled { opacity: 1; }
.rc-dot { width: 18px; height: 18px; flex: none; margin-top: 1px; border-radius: 50%; border: 2px solid #B7C7CC; box-sizing: border-box; }
.role-card[aria-checked="true"] .rc-dot { border: 5px solid var(--rc); background: #fff; }
.rc-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-txt b { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.rc-txt small { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }

.fil-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.fil-check {
  --fil: var(--teal); display: inline-flex; align-items: center; gap: 9px; padding: 9px 14px 9px 10px; border: 1.5px solid var(--line);
  border-radius: 12px; cursor: pointer; font-weight: 600; user-select: none; transition: border-color .15s, background .15s;
}
.fil-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--fil); }
.fil-check:has(input:checked) { border-color: var(--fil); background: color-mix(in srgb, var(--fil) 9%, #fff); }
.fil-check:has(input:disabled) { cursor: default; opacity: .7; }

/* Bir martalik parol oynasi */
.modal-back { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(15, 42, 53, .45); animation: fade-in .15s; }
.modal { width: 100%; max-width: 400px; background: var(--card); border-radius: 22px; padding: 24px 22px 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 60px -20px rgba(15, 42, 53, .45); animation: menu-in .16s ease-out; }
.modal h2 { margin: 0; text-align: center; font-size: 20px; font-weight: 800; }
.modal .login-sub { margin: -6px 0 2px; }
.modal .ud-note { margin: 0; text-align: center; font-size: 12.5px; }
.tp-box { margin: 0; padding: 4px 14px; background: var(--mist); border-radius: 14px; }
.tp-box > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; }
.tp-box > div + div { border-top: 1px solid var(--line); }
.tp-box dt { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.tp-box dd { margin: 0; font-weight: 700; text-align: right; word-break: break-all; }
.tp-pass { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 18px; letter-spacing: .06em; color: var(--teal-deep); user-select: all; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.modal-actions .btn-quiet, .modal-actions .cta { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; }
.modal-actions svg { width: 18px; height: 18px; }

/* Amallar jurnali */
.au-filter { margin-bottom: 10px; }
.au-filter .chip-btn svg { width: 14px; height: 14px; }
.au-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.au-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.au-row + .au-row { border-top: 1px solid var(--line); }
.au-row:hover { background: #F6FAFA; }
.au-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--at); color: var(--ac); }
.au-ic svg { width: 17px; height: 17px; }
.a-teal { --at: var(--teal-tint); --ac: var(--teal-deep); }
.a-slate { --at: var(--slate-tint); --ac: var(--ink-2); }
.a-coral { --at: var(--coral-tint); --ac: var(--coral); }
.a-leaf { --at: var(--leaf-tint); --ac: var(--leaf); }
.a-amber { --at: var(--amber-tint); --ac: #B4620A; }
.au-body { flex: 1; min-width: 0; }
.au-text { margin: 0; font-size: 14.5px; line-height: 1.35; }
.au-text b { font-weight: 700; }
.au-det { margin: 3px 0 0; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.au-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; font-size: 13px; color: var(--ink-2); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.au-meta small { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.au-empty { padding: 28px 12px; text-align: center; color: var(--ink-2); }

@media (max-width: 1100px) {
  .us-table th:nth-child(4), .us-table td.c-crm { display: none; }
}
@media (max-width: 860px) {
  .us-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .us-stat { padding: 12px 14px; }
  .us-stat b { font-size: 22px; }
  #screen-users .dash-tools { width: 100%; }
  #us-tab { flex: 1; }
  #us-tab button { flex: 1; justify-content: center; }
  .below-tools .pk-per-page#us-role, .below-tools .pk-per-page#us-filial { flex: 1 1 140px; }
  .role-cards { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .drawer-foot .btn-quiet, .drawer-foot .cta { flex: 1; min-width: 0; }
}
@media (max-width: 640px) {
  .dt.stack.us-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); position: relative; }
  .dt.stack.us-table td.dt-name { padding-right: 40px; }
  .dt.stack.us-table td.c-fils { grid-column: 1 / -1; }
  .dt.stack.us-table td.c-crm { display: block; }
  .dt.stack.us-table td.c-act { position: absolute; top: 10px; right: 8px; width: auto; }
  .au-row { flex-wrap: wrap; padding: 12px; }
  .au-meta { flex-direction: row; gap: 8px; width: 100%; padding-left: 46px; align-items: baseline; }
  .pw-rules { grid-template-columns: 1fr; }
}
.dt-name .us-cell .us-av { display: grid; margin: 0; }
.dt-name .us-cell .us-who > small { margin-top: 1px; }
.dt-name .us-cell .me-tag { display: inline-block; }
.ud-sec { padding-top: 18px; }
.ud-sec legend { float: left; width: 100%; }
.ud-sec legend + * { clear: both; }
#us-add { white-space: nowrap; }
@media (max-width: 860px) {
  #screen-users .dash-tools { flex-wrap: wrap; }
  #us-add { flex: 1 1 100%; justify-content: center; min-height: 44px; }
}

/* KPI: vazifa → oraliq → natija */
.t-wait { --t: #2563EB; --tt: #E3ECFD; --ti: #1D4ED8; }
.k-slot { align-items: center; }
.k-slot small { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.k-slot.r-result:not(.missing) { border-color: color-mix(in srgb, var(--fil, var(--teal)) 45%, var(--line)); }
.k-slot.r-result small { color: var(--fil, var(--teal)); }
.k-slot[aria-pressed="true"] small { color: #9DB8C1; }
.k-slot.missing i { font-style: normal; font-size: 12px; }
.k-card.is-pending .kpi-main strong { color: var(--ink-2); }

/* Parol maydoni (xodim oynasi) */
.pass-row { display: flex; gap: 8px; }
.pass-row .control { flex: 1; min-width: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 17px; letter-spacing: .03em; }
.pass-row .control::placeholder { font-family: "Onest", system-ui, sans-serif; font-size: 14px; letter-spacing: 0; }
.btn-quiet.sm { min-height: 46px; padding: 0 14px; border-radius: 12px; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; white-space: nowrap; }
.btn-quiet.sm svg { width: 17px; height: 17px; }
.ud-check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.ud-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--teal); flex: none; }
#ud-pass { letter-spacing: .03em; }

/* iBox kunlik so'rov limiti (bosh panel) */
.crm-panel { padding: 16px 18px; }
.crm-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.crm-top h2 { margin: 0; font-size: 16px; font-weight: 800; }
.crm-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.crm-num b { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.crm-num span { color: var(--ink-3); font-weight: 600; }
.crm-bar { position: relative; display: flex; height: 12px; border-radius: 999px; background: var(--slate-tint); overflow: hidden; }
.crm-bar i { display: block; height: 100%; }
.k-bg { background: #0EA5A4; }
.k-user { background: #2563EB; }
.k-post { background: #E8820C; }
.crm-pace { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: var(--ink); }
.crm-live { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.crm-live-i { display: inline-flex; flex-direction: column; gap: 1px; padding: 6px 12px; border-radius: var(--r-control); background: var(--slate-tint); min-width: 92px; }
.crm-live-i small { font-size: 11.5px; color: var(--ink-2); }
.crm-live-i b { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink); }
.crm-live-i.is-ok { background: var(--leaf-tint); }
.crm-live-i.is-ok b { color: #13723F; }
.crm-live-i.is-warn { background: var(--amber-tint); }
.crm-live-i.is-warn b { color: #9A5300; }
.crm-live-i.is-bad { background: var(--coral-tint); }
.crm-live-i.is-bad b { color: var(--coral); }
.crm-live-i.muted { background: transparent; border: 1px dashed var(--line); }
.crm-live-i.muted b { color: var(--ink-2); font-weight: 500; }
.crm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.crm-k { display: inline-flex; align-items: center; gap: 6px; }
.crm-k i { width: 10px; height: 10px; border-radius: 3px; }
.crm-pace-ic { display: inline-block; width: 2px; height: 12px; background: var(--ink); border-radius: 2px; }
.crm-hist { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); }
.crm-empty { padding: 8px 2px; }
.crm-by { flex-basis: 100%; font-size: 12.5px; color: var(--ink-3); }
.crm-panel[data-state="low"] .crm-num b, .crm-panel[data-state="exhausted"] .crm-num b { color: var(--coral); }
.crm-panel[data-state="paced"] .crm-num b { color: #B4620A; }
.crm-note { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 6px; }
.crm-eps { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.crm-ep { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) auto; align-items: center; gap: 14px; padding: 7px 0; }
.crm-ep + .crm-ep { border-top: 1px dashed var(--line); }
.crm-ep-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.crm-ep-name b { font-size: 14px; font-weight: 600; }
.crm-ep-name small { font-size: 11.5px; color: var(--ink-3); font-family: ui-monospace, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-ep-bar { height: 8px; border-radius: 999px; background: var(--slate-tint); overflow: hidden; }
.crm-ep-bar i { display: block; height: 100%; background: #0EA5A4; border-radius: 999px; }
.crm-ep.ep-low .crm-ep-bar i { background: var(--amber); }
.crm-ep.ep-exhausted .crm-ep-bar i { background: var(--coral); }
.crm-ep-num { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
@media (max-width: 640px) {
  .crm-ep { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .crm-ep-bar { grid-column: 1 / -1; grid-row: 2; }
}
.crm-panel[data-state="ibox_exhausted"] .crm-num b { color: var(--coral); }
.crm-panel[data-state="ibox_exhausted"] { border-color: #F3C2BE; background: linear-gradient(0deg, var(--card), var(--card)), var(--coral-tint); box-shadow: inset 4px 0 0 var(--coral); }

/* ---------- Tavsiya ---------- */
.pk-qf.tone-teal { --on: var(--teal); --on-bg: var(--teal-tint); --on-ring: rgba(11, 138, 125, .14); --on-ink: var(--teal-deep); }
.pk-rec-sub { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.pk-rec-sub .ord { color: var(--teal-deep); font-weight: 800; }
.pk-rec-sub .inc { color: var(--amber); }
.pk-pick-rec { white-space: nowrap; }
.add-btn.auto { border-style: solid; border-color: var(--teal); background: var(--card); color: var(--teal-deep); }
.add-btn.auto[disabled] { opacity: .6; }
.auto-note { margin: 8px 2px 0; font-size: 13px; color: var(--ink-2); }
.auto-note.warn { color: #9A5300; }

.tv-alert { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: var(--amber-tint); color: #8A4B00; font-size: 14px; font-weight: 600; border: 1px solid #F3C894; }
.tv-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tv-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.tv-card span { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.tv-card strong { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tv-card small { font-size: 12px; color: var(--ink-2); }
.tv-card.accent strong { color: var(--teal-deep); }
.tv-sups { display: flex; flex-wrap: wrap; gap: 8px; }
.tv-sup { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 13.5px; font-weight: 600; color: var(--ink); }
.tv-sup b { font-variant-numeric: tabular-nums; color: var(--teal-deep); }
.tv-sup small { color: var(--ink-3); font-weight: 600; }
.tv-sup[aria-pressed="true"] { border-color: var(--teal); box-shadow: inset 0 0 0 1.5px var(--teal); background: var(--teal-tint); }
.tv-table td { font-size: 13.5px; }
.tv-table .dt-name { min-width: 260px; }
.tv-table .dt-name small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.tv-table .c-order { font-weight: 800; color: var(--teal-deep); }
.tv-table .c-note { min-width: 220px; max-width: 380px; font-size: 12.5px; color: var(--ink-2); }
.tv-table .c-note.warn { color: #9A5300; }
.tv-table .speed { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tv-table .speed.s-tez-tez { background: var(--leaf-tint); color: #126B3B; }
.tv-table .speed.s-o-rtacha { background: var(--brass-tint); color: var(--brass); }
.tv-table .speed.s-kam-kam { background: var(--slate-tint); color: var(--ink-2); }
.tv-table tr.is-stop td { color: var(--ink-3); }
@media (max-width: 640px) {
  .tv-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tv-card { padding: 12px 13px; border-radius: 16px; }
  .tv-card strong { font-size: 23px; }
  .tv-card small { font-size: 11.5px; }
}

/* ---------- Tavsiya: Excel uslubidagi jadval (guruhli sarlavha, to'r chiziqlar, yopishqoq ustunlar) ---------- */
.tvg-wrap { --grid: #E1E8EB; --grid-strong: #C3D1D6; position: relative; overflow: auto; max-height: calc(100vh - 210px); min-height: 280px;
  border: 1px solid var(--grid-strong); border-radius: 12px; background: var(--card); overscroll-behavior: contain; }
.tvg { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; line-height: 1.3; color: var(--ink); font-variant-numeric: tabular-nums; }
.tvg th, .tvg td { padding: 6px 9px; border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); white-space: nowrap; text-align: left; vertical-align: middle; }
.tvg th:last-child, .tvg td:last-child { border-right: 0; }
.tvg .r { text-align: right; }
/* guruhlar orasida qalinroq chiziq */
.tvg .c-min, .tvg .c-s7, .tvg .c-point, .tvg .c-supplier, .tvg-bands th + th { border-left: 1.5px solid var(--grid-strong); }

/* sarlavha: 1-qator guruhlar, 2-qator ustunlar — ikkalasi ham yopishqoq */
.tvg thead th { position: sticky; z-index: 2; }
.tvg-bands th { top: 0; height: 30px; padding: 0 10px; color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-align: center; border-bottom: 0; }
.tvg-cols th { top: 30px; height: 38px; padding: 0; font-size: 12px; font-weight: 700; color: var(--ink-2); border-bottom: 1.5px solid var(--grid-strong); }
.tvg-bands .g-prod { background: #3B5865; } .tvg-cols .g-prod { background: #EEF2F4; }
.tvg-bands .g-stock { background: #2C7656; } .tvg-cols .g-stock { background: #E7F3EC; }
.tvg-bands .g-sales { background: #4D5D8C; } .tvg-cols .g-sales { background: #ECEFF7; }
.tvg-bands .g-rec { background: #0A6B5F; } .tvg-cols .g-rec { background: #E0F1ED; }
.tvg-bands .g-info { background: #687A82; } .tvg-cols .g-info { background: #F0F3F4; }
.tvg-bands .g-auto { background: #8A5A0B; } .tvg-cols .g-auto { background: #F7EFE2; }
.tvg-badge.conf-hi { background: var(--leaf-tint); color: #126B3B; }
.tvg-badge.conf-mid { background: #FBF0CF; color: #8A6D0B; }
.tvg-badge.conf-lo { background: #F3E5E3; color: #A23B31; }
.tvg-badge.conf-na { background: #EDEFF0; color: #6A777C; }
.tvg-sort { display: flex; align-items: center; gap: 5px; width: 100%; height: 100%; padding: 0 9px; border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.tvg-cols th.r .tvg-sort { justify-content: flex-end; }
.tvg-sort i { font-style: normal; font-size: 11px; color: #A9B9BF; }
.tvg-sort i.on { color: var(--teal-deep); }
.tvg-sort:hover { color: var(--ink); background: rgba(15, 42, 53, .04); }
.tvg-sort:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.tvg-cols th[aria-sort] { color: var(--ink); }

/* yopishqoq chap ustunlar: ID va Mahsulot */
.tvg .c-id { position: sticky; left: 0; z-index: 1; min-width: 64px; width: 64px; }
.tvg .c-name { position: sticky; left: 64px; z-index: 1; width: 290px; min-width: 290px; max-width: 290px; box-shadow: 6px 0 8px -6px rgba(15, 42, 53, .18); }
.tvg thead .c-id, .tvg thead .c-name { z-index: 3; }
.tvg tfoot .c-id, .tvg tfoot .c-name { z-index: 3; }

/* qatorlar */
.tvg tbody td { background: var(--card); }
.tvg tbody tr:nth-child(even) td { background: #F8FBFB; }
.tvg tbody tr:hover td { background: #EAF4F2; }
.tvg tbody td.c-order { background: #F1F9F7; }
.tvg tbody tr:nth-child(even) td.c-order { background: #EAF5F2; }
.tvg tbody tr:hover td.c-order { background: #DDF0EB; }
.tvg td.c-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.tvg-nm { display: block; max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tvg td.c-name small { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; max-width: 270px; }
.tvg td.c-name:not(:has(small)) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvg td.c-supplier, .tvg td.c-group { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.tvg td.c-note { max-width: 340px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--ink-2); }
.tvg td.c-order, .tvg td.c-sum, .tvg td.c-rec { font-size: 13.5px; }

/* qiymat ranglari */
.tvg .v-muted { color: #A3B3B9; }
.tvg .v-bad { color: var(--coral); font-weight: 700; }
.tvg .v-warn { color: #B26B00; font-weight: 700; }
.tvg .v-info { color: #2C5FA0; font-weight: 600; }
.tvg .v-calc { color: #2C5FA0; }
.tvg .v-strong { font-weight: 700; }
.tvg .v-order { font-weight: 800; color: var(--teal-deep); }
.tvg .v-note.v-warn { color: #9A5300; font-weight: 500; }
.tvg tr.is-stop td { color: var(--ink-3); }
.tvg tr.is-stop td.c-name .tvg-nm { font-weight: 400; }

.tvg-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; line-height: 1.35; }
.tvg-badge.s-tez-tez { background: var(--leaf-tint); color: #126B3B; }
.tvg-badge.s-o-rtacha { background: var(--brass-tint); color: #8A5D00; }
.tvg-badge.s-kam-kam { background: var(--slate-tint); color: var(--ink-2); }
.tvg-badge.b-stop { background: #F3E5E3; color: #A23B31; }

/* jami qatori — pastda yopishqoq */
.tvg tfoot td { position: sticky; bottom: 0; background: #EEF3F4; font-weight: 700; color: var(--ink); border-top: 1.5px solid var(--grid-strong); border-bottom: 0; }
.tvg tfoot td.c-sum { color: var(--teal-deep); font-size: 14px; }
.tvg-empty td { padding: 28px 12px; text-align: center; color: var(--ink-3); white-space: normal; }

@media (max-width: 860px) {
  .tvg-wrap { max-height: calc(100vh - 170px); border-radius: 10px; }
  .tvg { font-size: 12.5px; }
  .tvg .c-name { width: 210px; min-width: 210px; max-width: 210px; }
  .tvg-nm { max-width: 190px; }
  .tvg .c-id { min-width: 56px; width: 56px; }
  .tvg .c-name { left: 56px; }
  .tvg-bands th > span { left: 276px; }
  .tvg td.c-name small { max-width: 190px; }
}
.tvg-bands th.b-stick { position: sticky; left: 0; z-index: 4; text-align: left; padding-left: 12px; }
.tvg-bands th.b-cont { border-left: 1px solid rgba(255, 255, 255, .18); color: rgba(255, 255, 255, .8); }
@media (max-width: 860px) { .tvg-bands th.b-stick { padding-left: 10px; } }

.tvg-bands th > span { display: inline-block; position: sticky; left: 366px; right: 10px; }
.tvg-bands th.b-stick > span { position: static; }
@media (max-width: 640px) {
  .tvg .c-id { position: static; }
  .tvg .c-name { left: 0; width: 160px; min-width: 160px; max-width: 160px; }
  .tvg-nm, .tvg td.c-name small { max-width: 150px; }
  .tvg-bands th.b-stick { position: static; }
  .tvg-bands th > span { left: 170px; }
}

/* Tavsiya sahifasi keng ekranda butun kenglikdan foydalanadi (jadval keng) */
@media (min-width: 1400px) { #screen-tavsiya.screen.dash { max-width: 1840px; } }

/* ---------- Tavsiya: ixcham sarlavha + bitta panel ---------- */
#screen-tavsiya .tv-head { display: grid; grid-template-columns: minmax(220px, auto) 1fr auto; align-items: center; gap: 12px 18px; padding: 2px 0 12px; }
.tv-head-txt { min-width: 0; }
.tv-head h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.tv-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-head-tools { display: flex; align-items: center; gap: 8px; }
.tv-head-tools .seg button { min-height: 32px; padding: 0 11px; }
.tv-head-tools .icon-btn { width: 40px; height: 40px; }

.tv-stats { justify-self: center; display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 1px 2px rgba(15, 42, 53, .04); }
.tv-stat { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px; row-gap: 1px; min-width: 128px; padding: 7px 16px 8px;
  border: 0; border-left: 1px solid var(--line); background: transparent; color: inherit; font: inherit; text-align: left; }
.tv-stat:first-child { border-left: 0; }
.tv-stat span { grid-column: 1 / -1; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.tv-stat strong { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tv-stat small { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.tv-stat.accent strong { color: var(--teal-deep); }
button.tv-stat { cursor: pointer; transition: background .15s; }
button.tv-stat:hover { background: var(--mist); }
button.tv-stat.on { background: var(--teal-tint); box-shadow: inset 0 -2px 0 var(--teal); }
button.tv-stat:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }

#screen-tavsiya .tv-alert { margin: 0 0 10px; padding: 9px 12px; font-size: 13px; border-radius: 12px; }

.tv-panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-width: 0; }
.tv-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tv-search { flex: 1 1 240px; min-width: 200px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #F7FAFA; transition: border-color .15s, background .15s; }
.tv-search:focus-within { border-color: var(--teal); background: var(--card); box-shadow: 0 0 0 3px var(--teal-tint); }
.tv-search svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.tv-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--ink); outline: none; }
.tv-scope { padding: 2px; border-radius: 11px; }
.tv-scope button { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
.tv-select { height: 38px; max-width: 250px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 10px; background-color: var(--card); color: var(--ink); font: inherit; font-size: 13px; }
.tv-select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); }
.tv-per { max-width: 130px; }
.tv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tv-btn svg { width: 16px; height: 16px; }
.tv-btn:hover { color: var(--ink); border-color: #C3D1D6; background: #F7FAFA; }
.tv-btn.tv-help { width: 38px; padding: 0; font-weight: 800; font-size: 14px; }
.tv-btn.tv-help[aria-expanded="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.tv-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: -2px 0 10px; padding: 8px 12px; border: 1px dashed #C9D6DA; border-radius: 10px; background: #F7FAFA; font-size: 12px; color: var(--ink-2); }
.tv-legend b { color: var(--ink); }
.tv-legend .lg { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.tv-legend .lg-bad { background: var(--coral); }
.tv-legend .lg-warn { background: #E39A2D; }
.tv-legend .lg-calc { background: #2C5FA0; }
.tv-legend .lg-order { background: #DDF0EB; box-shadow: inset 0 0 0 1.5px var(--teal); }

#screen-tavsiya .tv-sups { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
#screen-tavsiya .tv-sup { flex: none; min-height: 30px; gap: 6px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
#screen-tavsiya .tv-sup small { padding: 0 6px; border-radius: 999px; background: var(--slate-tint); color: var(--ink-2); font-size: 11px; line-height: 17px; }
#screen-tavsiya .tv-sup b { font-size: 12.5px; }
#screen-tavsiya .tv-sup:hover { border-color: #C3D1D6; }
#screen-tavsiya .tv-sup[aria-pressed="true"] small { background: var(--teal); color: #fff; }

#screen-tavsiya .tvg-wrap { max-height: calc(100vh - 290px); min-height: 360px; border-radius: 10px; }
.tv-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 10px; }
.tv-count { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

@media (max-width: 1180px) {
  #screen-tavsiya .tv-head { grid-template-columns: 1fr auto; }
  .tv-stats { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .tv-stat { flex: 1; }
}
@media (max-width: 860px) {
  #screen-tavsiya .tv-head { grid-template-columns: 1fr; }
  .tv-head-tools { grid-row: 2; }
  .tv-head-tools .fil-seg { flex: 1; }
  .tv-stats { grid-row: 3; display: grid; grid-template-columns: 1fr 1fr; }
  .tv-stat { min-width: 0; padding: 7px 12px; }
  .tv-stat:nth-child(3) { border-left: 0; }
  .tv-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .tv-head p { white-space: normal; }
  .tv-panel { padding: 10px; border-radius: 14px; }
  .tv-scope { width: 100%; overflow-x: auto; }
  .tv-select { flex: 1; max-width: none; }
  #screen-tavsiya .tvg-wrap { max-height: calc(100vh - 180px); }
}

/* Rasxod: 5 ta kartochka (Просрочено) bitta qatorga sig'adi */
#screen-expenses .us-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
@media (max-width: 700px) { #screen-expenses .us-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
