/* ============ KITOB ERP dizayni ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --fon: #f4f5fa;
  --karta: #ffffff;
  --chiziq: #e6e8f0;
  --ink: #171a26;
  --ink2: #6b7080;
  --asosiy: #4f46e5;
  --asosiy-q: #4338ca;
  --asosiy-t: #eef0ff;
  --yashil: #0c8a4c;
  --yashil-t: #e7f6ee;
  --qizil: #d43a4f;
  --qizil-t: #fdecee;
  --kok: #0b7dc2;
  --kok-t: #e8f4fc;
  --sariq-t: #fff3d6;
  --sariq-ink: #8a6100;
}

/* ---------- tungi rejim ---------- */
:root[data-tema="tun"] {
  --fon: #12141c;
  --karta: #1c1f2b;
  --chiziq: #2b2f40;
  --ink: #e8eaf2;
  --ink2: #98a0b6;
  --asosiy: #7b73f2;
  --asosiy-q: #948df5;
  --asosiy-t: #272b47;
  --yashil: #3dc47e;
  --yashil-t: #16301f;
  --qizil: #f2637a;
  --qizil-t: #3a2026;
  --kok: #58b0e8;
  --kok-t: #182c3d;
  --sariq-t: #383116;
  --sariq-ink: #e2c05a;
}
:root[data-tema="tun"] .jadval tbody tr:hover { background: #232838; }
:root[data-tema="tun"] .tolov-karta { border-color: #245239; background: #16281f; }
:root[data-tema="tun"] .tolov-qatori { background: #17211b; }
:root[data-tema="tun"] .xabarcha { background: #eef0f8; color: #14161f; }
:root[data-tema="tun"] .xabarcha.xato-x { background: var(--qizil); color: #fff; }
:root[data-tema="tun"] .mini-bosh, :root[data-tema="tun"] .kk-bosh { background: #262b3b; }

.tema-btn {
  margin: 8px 4px 0; padding: 9px 12px; border: 1px solid var(--chiziq);
  background: var(--fon); color: var(--ink); border-radius: 10px;
  font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; text-align: left;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fon);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--asosiy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

/* ---------- joylashuv ---------- */
.yon {
  position: fixed; top: 0; left: 0; bottom: 0; width: 220px;
  background: var(--karta); border-right: 1px solid var(--chiziq);
  padding: 18px 12px; z-index: 20;
}
.logo { font-size: 20px; font-weight: 800; padding: 6px 10px 18px; }
.logo span { color: var(--asosiy); }
.yon nav { display: flex; flex-direction: column; gap: 2px; }
.yon nav a {
  padding: 10px 12px; border-radius: 10px; color: var(--ink);
  font-weight: 600; font-size: 14.5px;
}
.yon nav a:hover { background: var(--fon); text-decoration: none; }
.yon nav a.faol { background: var(--asosiy-t); color: var(--asosiy-q); }

.asosiy { margin-left: 220px; padding: 24px 28px 60px; max-width: 1200px; }

.yon { display: flex; flex-direction: column; }
.hodim-chip {
  margin-top: auto; padding: 10px 12px; border-top: 1px solid var(--chiziq);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 700;
}
.hodim-chip a { font-size: 12.5px; }

.kirish-fon {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.kirish-karta { width: 100%; max-width: 360px; }

/* ---------- umumiy bloklar ---------- */
.karta {
  background: var(--karta); border: 1px solid var(--chiziq);
  border-radius: 14px; padding: 18px;
}
.kartalar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.stat-nom { font-size: 13px; color: var(--ink2); font-weight: 600; margin-bottom: 6px; }
.stat-qiymat { font-size: 22px; font-weight: 800; }
.stat-qiymat.stat-kichikroq { font-size: 17px; }
.stat-izoh { font-size: 12.5px; color: var(--ink2); margin-top: 4px; }

.sarlavha-qator {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.sarlavha { margin-bottom: 18px; }
.tugmalar { display: flex; gap: 8px; flex-wrap: wrap; }

.ikki-ustun { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; align-items: start; }
.ustun-ichi { display: flex; flex-direction: column; gap: 14px; }

.yashil-matn { color: var(--yashil); }
.qizil-matn { color: var(--qizil); }
.kok-matn { color: var(--kok); }
.kichik { font-size: 12.5px; color: var(--ink2); }
.ong { text-align: right; }

.bosh-holat { text-align: center; color: var(--ink2); padding: 26px 10px; }
.hamma-havola { display: inline-block; margin-top: 10px; font-size: 13.5px; font-weight: 600; }

/* ---------- tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  padding: 9px 16px; font-size: 14px; font-weight: 700;
  font-family: inherit; transition: 0.15s;
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn-asosiy { background: var(--asosiy); color: #fff; }
.btn-asosiy:hover { background: var(--asosiy-q); color: #fff; }
.btn-yashil { background: var(--yashil); color: #fff; }
.btn-oq { background: var(--karta); border-color: var(--chiziq); color: var(--ink); }
.btn-oq.faol { background: var(--sariq-t); border-color: #e0c060; color: var(--sariq-ink); }
input.maydon:disabled { background: var(--fon); color: var(--ink2); }
.btn-xavf { background: var(--qizil-t); color: var(--qizil); }
.btn-kichik { padding: 6px 10px; font-size: 13px; }
.btn-katta { width: 100%; padding: 13px; font-size: 16px; margin-top: 10px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-belgi {
  border: none; background: none; color: var(--ink2); cursor: pointer;
  font-size: 14px; padding: 4px 7px; border-radius: 7px;
}
.btn-belgi:hover { background: var(--qizil-t); color: var(--qizil); }
a.btn-belgi { text-decoration: none; }
a.btn-belgi:hover { background: var(--asosiy-t); }
.amal-katak { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.ochirish-shakl { margin-top: 12px; max-width: 620px; text-align: right; }

/* ---------- shakllar ---------- */
.maydon {
  width: 100%; padding: 10px 12px; border: 1px solid var(--chiziq);
  border-radius: 10px; font-size: 14.5px; font-family: inherit;
  background: var(--karta); color: var(--ink);
}
.maydon:focus { outline: 2px solid var(--asosiy); outline-offset: -1px; }
textarea.maydon { resize: vertical; }
.shakl { max-width: 620px; }
.shakl-qator { margin-bottom: 14px; }
.shakl-qator label {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--ink2); margin-bottom: 5px;
}
.ikki-maydon { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shakl-tugmalar { display: flex; gap: 8px; margin-top: 16px; }
.qidiruv-shakl {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: end;
}
.qidiruv-shakl .maydon { max-width: 320px; }
.filtr-label { font-size: 12.5px; color: var(--ink2); font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.filtr-label .maydon { max-width: 170px; }
.oldindan {
  display: block; margin-top: 10px; max-width: 140px; max-height: 190px;
  border-radius: 10px; border: 1px solid var(--chiziq);
}
.yashirin { display: none; }
input[type="file"] { font-size: 13.5px; }
.rasm-zona {
  border: 2px dashed var(--chiziq); border-radius: 12px; padding: 18px 14px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  text-align: center; color: var(--ink2); font-size: 13.5px; transition: 0.15s;
}
.rasm-zona.surilmoqda {
  border-color: var(--asosiy); background: var(--asosiy-t); color: var(--asosiy-q);
}
.rz-tugmalar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- jadval ---------- */
.jadval-orab { overflow-x: auto; padding: 6px 0; }
.jadval { width: 100%; border-collapse: collapse; }
.jadval th {
  text-align: left; font-size: 12px; color: var(--ink2);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 8px 10px; border-bottom: 1px solid var(--chiziq);
}
.jadval th.ong { text-align: right; }
.jadval td { padding: 10px; border-bottom: 1px solid var(--chiziq); vertical-align: middle; }
.jadval tbody tr:last-child td { border-bottom: none; }
.jadval tbody tr:hover { background: #fafafd; }
.mijoz-havola { font-weight: 800; color: var(--ink); }
.mijoz-havola:hover { color: var(--asosiy); text-decoration: none; }
.rasm-katak { width: 54px; }
.mini-rasm {
  width: 44px; height: 58px; object-fit: cover; border-radius: 7px;
  border: 1px solid var(--chiziq); display: block;
}
.mini-bosh {
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; background: var(--fon);
}

/* ---------- belgilar ---------- */
.belgi {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.b-qizil { background: var(--qizil-t); color: var(--qizil); }
.b-yashil { background: var(--yashil-t); color: var(--yashil); }
.b-kok { background: var(--kok-t); color: var(--kok); }
.b-kul { background: var(--fon); color: var(--ink2); }
.b-sariq { background: var(--sariq-t); color: var(--sariq-ink); }

/* ---------- flash ---------- */
.flash {
  padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600;
}
.flash.ok { background: var(--yashil-t); color: var(--yashil); }
.flash.xato { background: var(--qizil-t); color: var(--qizil); }

/* ---------- sotuv (POS) ---------- */
.pos { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.pos-yangi {
  max-width: 640px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px;
}
.qidiruv-blok { position: relative; }
.qidiruv-blok .qidiruv-maydon { margin-bottom: 0; }
.qidiruv-natija { top: 54px; max-height: 360px; }
.qn-qator {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--chiziq);
}
.qn-qator:last-child { border-bottom: none; }
.qn-qator:hover, .qn-qator.tanlangan { background: var(--asosiy-t); }
.qn-rasm {
  width: 38px; height: 50px; object-fit: cover; border-radius: 6px;
  background: var(--fon); flex-shrink: 0;
}
.qn-bosh-rasm { display: flex; align-items: center; justify-content: center; font-size: 20px; }
.qn-info { flex: 1; min-width: 0; }
.qn-nomi { font-weight: 700; font-size: 13.5px; }
.qn-narx { font-size: 12.5px; color: var(--ink2); }
.qn-bosh { padding: 14px; text-align: center; color: var(--ink2); font-size: 13.5px; }
.qidiruv-maydon { margin-bottom: 12px; padding: 12px 14px; font-size: 15.5px; }
.kgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 10px;
}
.kk {
  background: var(--karta); border: 1px solid var(--chiziq); border-radius: 12px;
  padding: 8px; cursor: pointer; transition: 0.12s; user-select: none;
}
.kk:hover { border-color: var(--asosiy); box-shadow: 0 2px 10px rgba(79, 70, 229, 0.12); }
.kk:active { transform: scale(0.97); }
.kk-bor { border-color: var(--yashil); box-shadow: inset 0 0 0 1px var(--yashil); }
.kk-yoq { border-color: var(--qizil); box-shadow: inset 0 0 0 1px var(--qizil); }
.kk-rasm {
  position: relative; height: 130px; border-radius: 8px; overflow: hidden;
  background: var(--fon); margin-bottom: 7px;
}
.kk-rasm img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kk-bosh { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 38px; }
.kk-soni {
  position: absolute; top: 6px; right: 6px; background: rgba(23, 26, 38, 0.75);
  color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
}
.kk-soni.bor { background: var(--yashil); }
.kk-soni.bozordan { background: var(--qizil); letter-spacing: 0.5px; }
.kk-nomi {
  font-size: 13px; font-weight: 700; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 32px;
}
.kk-narx { font-size: 13px; color: var(--asosiy-q); font-weight: 800; margin-top: 3px; }

.pos-ong { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--fon); padding: 5px; border-radius: 11px; }
.seg button {
  border: none; background: none; padding: 9px; border-radius: 8px;
  font-family: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; color: var(--ink2);
}
.seg button.faol { background: var(--karta); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.09); }
.seg a {
  padding: 9px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 700;
  color: var(--ink2); text-align: center; white-space: nowrap;
}
.seg a:hover { text-decoration: none; }
.seg a.faol { background: var(--karta); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.09); }
.seg-satr { display: inline-grid; align-self: center; }

.savat { display: flex; flex-direction: column; gap: 8px; }
.savat-bosh { text-align: center; color: var(--ink2); padding: 18px 6px; font-size: 13.5px; }
.savat-qator {
  border: 1px solid var(--chiziq); border-radius: 10px; padding: 8px 10px;
}
.sq-yuqori { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sq-rasm {
  width: 34px; height: 44px; object-fit: cover; border-radius: 6px;
  background: var(--fon); flex-shrink: 0;
}
.sq-bosh-rasm { display: flex; align-items: center; justify-content: center; font-size: 17px; }
.sq-kirishlar { display: flex; gap: 8px; align-items: flex-end; }
.sq-kirish { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.sq-kirish span {
  font-size: 10.5px; color: var(--ink2); font-weight: 700; white-space: nowrap;
}
.pochka-inp {
  width: 62px; text-align: center; border: 1px solid var(--chiziq);
  border-radius: 8px; padding: 9px 4px; font-weight: 700; font-family: inherit;
  font-size: 15px; background: var(--karta); color: var(--ink);
}
.sq-ochir { align-self: center; }
.kk-pochka { font-size: 11px; color: var(--ink2); margin-top: 2px; font-weight: 600; }
.sq-info { flex: 1; min-width: 0; }
.sq-nomi { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sq-narx { font-size: 12px; color: var(--ink2); }
.sq-summa { font-size: 13px; font-weight: 800; white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button {
  width: 26px; height: 26px; border: 1px solid var(--chiziq); background: var(--karta);
  border-radius: 7px; cursor: pointer; font-size: 15px; font-weight: 700; line-height: 1;
}
.stepper span { min-width: 26px; text-align: center; font-weight: 800; font-size: 14px; }
.soni-inp {
  width: 68px; text-align: center; font-weight: 800; font-size: 16px;
  border: 1px solid var(--chiziq); border-radius: 8px; padding: 9px 4px;
  font-family: inherit; background: var(--karta); color: var(--ink);
}

.jami-qator {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 16px; padding: 10px 2px 0; border-top: 1px solid var(--chiziq);
}
.jami-qator b { font-size: 20px; }

.mijoz-blok label, .pos-ong .shakl-qator label {
  display: block; font-size: 12.5px; font-weight: 700; color: var(--ink2); margin-bottom: 5px;
}
.mijoz-blok.majbur .maydon { border-color: var(--qizil); }
.mijoz-qidiruv { position: relative; display: flex; gap: 6px; }
.ochiq-royxat {
  position: absolute; top: 44px; left: 0; right: 0; z-index: 30;
  background: var(--karta); border: 1px solid var(--chiziq); border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.12); max-height: 230px; overflow-y: auto;
}
.or-qator { padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.or-qator:hover { background: var(--asosiy-t); }
.or-ism { font-weight: 700; font-size: 13.5px; }
.or-tel { font-size: 12px; color: var(--ink2); }
.mijoz-chip {
  display: flex; align-items: center; gap: 8px; background: var(--asosiy-t);
  border-radius: 10px; padding: 9px 12px;
}
.mijoz-chip span:first-child { font-weight: 800; flex: 1; }
.chip-yopish { border: none; background: none; cursor: pointer; font-size: 14px; color: var(--ink2); }

.tolov-qator { display: flex; gap: 6px; }
.qarz-qator {
  background: var(--qizil-t); color: var(--qizil); font-weight: 700;
  padding: 10px 12px; border-radius: 10px; font-size: 14px;
  display: flex; justify-content: space-between;
}

.tolov-karta { border: 1px solid #bfe3cf; background: #f4fbf7; }
.tolov-shakl { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.tolov-qatori { background: #fbfefc; }

/* ---------- modal / xabarcha ---------- */
.modal-fon {
  display: none; position: fixed; inset: 0; background: rgba(15, 17, 26, 0.5);
  z-index: 50; align-items: center; justify-content: center; padding: 16px;
}
.modal-fon.ochiq { display: flex; }
.modal {
  background: var(--karta); border-radius: 16px; padding: 24px;
  width: 100%; max-width: 380px; box-shadow: 0 18px 50px rgba(0,0,0,0.25);
}
.modal-markaz { text-align: center; }
.modal h2 { margin-bottom: 12px; }
.modal-satr { font-size: 15px; margin-top: 6px; }

.xabarcha {
  display: none; position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-weight: 700; font-size: 14px; z-index: 60; max-width: 90vw; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
}
.xabarcha.korin { display: block; }
.xabarcha.xato-x { background: var(--qizil); }

/* ---------- mobil savat paneli ---------- */
.mobil-panel { display: none; }

/* ---------- moslashuvchan ---------- */
@media (max-width: 980px) {
  .mobil-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--karta); border-top: 1px solid var(--chiziq);
    padding: 10px 14px; align-items: center; justify-content: space-between; gap: 10px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  }
  .mobil-panel.korin { display: flex; }
  .mp-info b { display: block; font-size: 17px; }
  .mp-info span { font-size: 12px; color: var(--ink2); }
  .soni-inp { width: 72px; padding: 10px 4px; font-size: 17px; }
  .pochka-inp { width: 66px; padding: 10px 4px; font-size: 16px; }
  .btn-belgi { font-size: 16px; padding: 8px 10px; }
  .yon {
    position: static; width: auto; display: flex; align-items: center;
    padding: 8px 10px; gap: 8px; border-right: none; border-bottom: 1px solid var(--chiziq);
    overflow-x: auto;
  }
  .logo { padding: 0 8px 0 4px; font-size: 17px; white-space: nowrap; }
  .yon nav { flex-direction: row; }
  .yon nav a { white-space: nowrap; padding: 8px 10px; font-size: 13.5px; }
  .asosiy { margin-left: 0; padding: 16px 14px 100px; }
  .ikki-ustun { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; }
  .pos-ong { position: static; }
  .savat { max-height: none; }
  .ikki-maydon { grid-template-columns: 1fr; }
}
