:root {
  --fon: #1d1712;
  --fon2: #2a211a;
  --chiziq: #3d3128;
  --matn: #f3ece2;
  --xira: #b3a595;
  --oltin: #d2a960;
  --oltin2: #b88d43;
  --xavf: #d9534f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  background: var(--fon); color: var(--matn);
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden; overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input { font: inherit; }

/* ---------- bosh qator ---------- */
.bosh {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--fon2); border-bottom: 1px solid var(--chiziq);
}
.bosh__uy {
  flex: none; padding: 8px 10px; border-radius: 10px; background: var(--fon); border: 1px solid var(--chiziq);
  color: var(--matn); text-decoration: none; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.bosh__logo { font-weight: 800; letter-spacing: .12em; font-size: 18px; color: var(--oltin); white-space: nowrap; }
.bosh__logo small { font-weight: 500; letter-spacing: .04em; font-size: 12px; color: var(--xira); }
.devor {
  display: flex; align-items: center; gap: 6px; margin-left: auto;
  font-size: 13px; color: var(--xira);
}
.devor input {
  width: 74px; padding: 7px 6px; text-align: center;
  background: var(--fon); color: var(--matn);
  border: 1px solid var(--chiziq); border-radius: 8px; font-weight: 600;
}
.smetaBtn {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 6px 12px; border-radius: 10px;
  background: linear-gradient(180deg, var(--oltin), var(--oltin2)); color: #1d1712;
}
.smetaBtn__n { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.smetaBtn__j { font-size: 14px; font-weight: 800; white-space: nowrap; }

/* ---------- kolleksiya ---------- */
.koll {
  display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto;
  background: var(--fon2); border-bottom: 1px solid var(--chiziq); scrollbar-width: none;
}
.koll::-webkit-scrollbar, .toifa::-webkit-scrollbar, .kartalar::-webkit-scrollbar { display: none; }
.koll button {
  display: flex; align-items: center; gap: 7px; flex: none;
  padding: 6px 12px 6px 7px; border-radius: 20px;
  border: 1px solid var(--chiziq); background: var(--fon); font-weight: 600; font-size: 13px;
}
.koll button.faol { border-color: var(--oltin); color: var(--oltin); }
.koll i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); flex: none; }

/* ---------- sahna ---------- */
.sahna { position: relative; flex: 1; min-height: 0; background: #cfc8bd; }
#c3d { width: 100%; height: 100%; display: block; touch-action: none; }
.holat {
  position: absolute; left: 10px; top: 10px; padding: 5px 10px; border-radius: 8px;
  background: rgba(29,23,18,.72); font-size: 12px; color: var(--matn); pointer-events: none;
  line-height: 1.45;
}
.sahna__tugma { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 8px; }
.sahna__tugma button {
  width: 40px; height: 40px; border-radius: 12px; font-size: 18px;
  background: rgba(29,23,18,.72); color: var(--matn);
}
.sahna__tugma button.faol { background: var(--oltin); color: #1d1712; }
.tanlov {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px;
  background: rgba(29,23,18,.9); border: 1px solid var(--oltin); border-radius: 14px;
}
.tanlov[hidden], .xabar[hidden], .oyna[hidden] { display: none; }
.tanlov__matn { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tanlov__matn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tanlov__matn span { font-size: 12px; color: var(--xira); }
.tanlov button { width: 42px; height: 42px; border-radius: 10px; background: var(--fon2); font-size: 17px; flex: none; }
.tanlov button.xavf { background: var(--xavf); color: #fff; }
.xabar {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  max-width: 86%; padding: 10px 16px; border-radius: 12px; text-align: center;
  background: rgba(29,23,18,.92); border: 1px solid var(--chiziq); font-weight: 600;
}

/* ---------- pastki panel ---------- */
.pastki { background: var(--fon2); border-top: 1px solid var(--chiziq); padding-bottom: env(safe-area-inset-bottom); }
.toifa { display: flex; gap: 4px; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: none; }
.toifa button {
  flex: none; padding: 7px 13px; border-radius: 10px 10px 0 0;
  color: var(--xira); font-weight: 600; font-size: 13px;
}
.toifa button.faol { color: var(--oltin); background: var(--fon); }
.kartalar {
  display: flex; gap: 8px; padding: 10px; overflow-x: auto; background: var(--fon);
  scrollbar-width: none; min-height: 132px;
}
.karta {
  flex: none; width: 112px; padding: 8px; border-radius: 12px; text-align: left;
  background: var(--fon2); border: 1px solid var(--chiziq);
  display: flex; flex-direction: column; gap: 3px;
}
.karta:active { border-color: var(--oltin); transform: scale(.97); }
.karta svg { width: 100%; height: 50px; }
.karta b { font-size: 12.5px; line-height: 1.2; }
.karta small { font-size: 11px; color: var(--xira); }
.karta em { font-style: normal; font-size: 12.5px; font-weight: 700; color: var(--oltin); margin-top: auto; }
.karta em.yoq { color: var(--xira); font-weight: 500; }

/* ---------- smeta oynasi ---------- */
.oyna {
  position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.oyna__ich {
  width: 100%; max-width: 640px; max-height: 92%;
  display: flex; flex-direction: column;
  background: var(--fon2); border-radius: 18px 18px 0 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.oyna__bosh { display: flex; align-items: center; padding: 14px 16px 8px; }
.oyna__bosh h2 { margin: 0; font-size: 18px; flex: 1; }
.yop { width: 36px; height: 36px; border-radius: 10px; background: var(--fon); }
.oyna__tana { overflow-y: auto; padding: 0 12px; }
.sm { width: 100%; border-collapse: collapse; }
.sm td { padding: 8px 4px; border-bottom: 1px solid var(--chiziq); vertical-align: middle; }
.sm .n b { display: block; font-size: 14px; }
.sm .n small { color: var(--xira); font-size: 11.5px; }
.sm .s { white-space: nowrap; text-align: center; color: var(--xira); width: 44px; }
.sm .p { width: 104px; }
.sm .p input {
  width: 100%; padding: 7px 6px; text-align: right;
  background: var(--fon); color: var(--matn);
  border: 1px solid var(--chiziq); border-radius: 8px; font-weight: 600;
}
.sm .p input.yoq { border-color: var(--xavf); }
.sm .p input.ozgargan { border-color: var(--oltin); color: var(--oltin); }
.sm .j { text-align: right; white-space: nowrap; font-weight: 700; width: 92px; }
.sm .sarlavha td { color: var(--oltin); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding-top: 14px; border-bottom: 0; }
.qadam { display: inline-flex; align-items: center; gap: 4px; }
.qadam button { width: 28px; height: 28px; border-radius: 8px; background: var(--fon); font-weight: 700; }
.qadam span { min-width: 16px; text-align: center; color: var(--matn); font-weight: 700; }
.bosh-xabar { padding: 26px 10px; text-align: center; color: var(--xira); }
.ogoh { margin: 10px 4px 0; padding: 8px 10px; border-radius: 8px; background: rgba(217,83,79,.14); color: #f0a8a5; font-size: 12.5px; }
.oyna__jami {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 16px; border-top: 1px solid var(--chiziq); font-size: 15px;
}
.oyna__jami b { font-size: 21px; color: var(--oltin); }
.oyna__tugma { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px; }
.oyna__tugma button { padding: 11px 6px; border-radius: 10px; background: var(--fon); border: 1px solid var(--chiziq); font-weight: 600; }
.havola { margin: 8px auto 0; color: var(--xira); font-size: 12.5px; text-decoration: underline; }

/* ---------- xona tugmasi va oynasi ---------- */
.xonaBtn {
  display: flex; flex-direction: column; align-items: flex-start; margin-left: auto;
  padding: 6px 12px; border-radius: 10px; background: var(--fon); border: 1px solid var(--chiziq);
}
.xonaBtn__n { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--xira); }
.xonaBtn__j { font-size: 13px; font-weight: 700; white-space: nowrap; }
.chapUst { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; }
.chapUst .holat { position: static; }
.devorSeg { display: flex; gap: 4px; pointer-events: auto; }
.devorSeg[hidden] { display: none; }
.devorSeg button {
  padding: 7px 11px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
  background: rgba(29,23,18,.72); color: var(--matn); border: 1px solid transparent;
}
.devorSeg button.faol { background: var(--oltin); color: #1d1712; }
.shakl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 14px; }
.shakl button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 12px; background: var(--fon); border: 1px solid var(--chiziq); font-size: 12.5px;
}
.shakl button.faol { border-color: var(--oltin); color: var(--oltin); }
.shakl svg { width: 54px; height: 40px; }
.shakl path { fill: none; stroke: currentColor; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.uzun { display: flex; align-items: center; gap: 8px; padding: 7px 4px; }
.uzun[hidden] { display: none; }
.uzun span { flex: 1; }
.uzun input {
  width: 96px; padding: 9px 8px; text-align: center; font-weight: 700; font-size: 16px;
  background: var(--fon); color: var(--matn); border: 1px solid var(--chiziq); border-radius: 9px;
}
.uzun em { font-style: normal; color: var(--xira); }
.eslatma { margin: 10px 4px 12px; font-size: 12px; color: var(--xira); }
.oyna__tugma.bitta { grid-template-columns: 1fr; }
.oyna__tugma .asosiy { background: linear-gradient(180deg, var(--oltin), var(--oltin2)); color: #1d1712; border: 0; font-weight: 800; padding: 13px; font-size: 16px; }
.yop[hidden], .tanlov button[hidden] { display: none; }

/* ---------- tor ekran (telefon) ---------- */
@media (max-width: 480px) {
  .bosh { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .bosh__logo { font-size: 16px; letter-spacing: .08em; }
  .bosh__logo small { display: none; }
  .devor span:first-child { display: none; }
  .devor input { width: 62px; }
  .smetaBtn { padding: 5px 9px; }
  .smetaBtn__j { font-size: 13px; }
}

/* ---------- keng ekran ---------- */
@media (min-width: 900px) {
  .karta { width: 128px; }
  .oyna { align-items: center; }
  .oyna__ich { border-radius: 18px; }
}

/* ---------- chop etish ---------- */
#chop { display: none; }
@media print {
  body { background: #fff; color: #000; overflow: visible; display: block; }
  body > *:not(#chop) { display: none !important; }
  #chop, body.varaq #chop { display: block !important; position: static !important; padding: 0 !important; background: #fff !important; overflow: visible !important; }
  #chop .varaqIch { zoom: 1 !important; width: auto !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; }
  @page { size: A4; margin: 8mm; }
}
/* hujjatni ekranda ko'rish (nakladnoy, omborchi ro'yxati) */
.varaqPanel {
  position: fixed; left: 0; right: 0; top: 0; z-index: 61; height: 52px; display: flex; align-items: center; gap: 8px;
  padding: 0 8px; background: var(--fon2); border-bottom: 1px solid var(--oltin);
}
.varaqPanel[hidden] { display: none; }
.varaqPanel span { flex: 1; text-align: center; font-size: 11.5px; color: var(--xira); }
.varaqPanel button { padding: 9px 12px; border-radius: 9px; background: var(--fon); border: 1px solid var(--chiziq); font-weight: 700; font-size: 13px; white-space: nowrap; }
.varaqPanel .asosiy { background: linear-gradient(180deg, var(--oltin), var(--oltin2)); color: #1d1712; border: 0; }
body.varaq #chop { display: block; position: fixed; left: 0; right: 0; top: 52px; bottom: 0; z-index: 60; background: #6f6a62; overflow: auto; padding: 8px; -webkit-overflow-scrolling: touch; }
#chop .varaqIch { width: 733px; padding: 20px; margin: 0 auto; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.35); box-sizing: content-box; }
/* varaq — INOK ERP nakladnoyi bilan bir xil qolip */
.sheet { background: #fff; color: #111; font-family: Arial, "Segoe UI", sans-serif; }
.sheet .org { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 14px; }
.sheet .org b { font-size: 19px; }
.sheet .org div { font-size: 11.5px; color: #444; line-height: 1.45; }
.sheet h2 { font-size: 17px; text-align: center; margin: 0 0 3px; }
.sheet .dt { text-align: center; font-size: 12.5px; color: #444; margin-bottom: 14px; }
.sheet .meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px 22px; font-size: 12.5px; margin-bottom: 14px; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sheet th, .sheet td { border: 1px solid #999; padding: 6px 8px; color: #111; text-align: left; }
.sheet th { background: #f1efe9; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: #333; }
.sheet td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet td.katta { font-size: 16px; font-weight: 700; }
.sheet .sub { font-size: 10.5px; color: #555; margin-top: 2px; }
.sheet tr.modul td { background: #f7f5f0; }
.sheet tr.qism td { padding-top: 4px; padding-bottom: 4px; color: #222; }
.sheet h3 { font-size: 13.5px; margin: 18px 0 6px; }
.sheet tfoot td { font-weight: 700; background: #f7f5f0; }
.sheet .words { margin-top: 12px; font-size: 12.5px; line-height: 1.6; }
.sheet .words i { font-style: normal; }
.sheet .words i::first-letter { text-transform: uppercase; }
.sheet .sign { display: flex; gap: 40px; margin-top: 34px; font-size: 12.5px; }
.sheet .sign div { flex: 1; }
.sheet .sign span { display: block; border-bottom: 1px solid #111; height: 26px; margin-bottom: 4px; }
.sheet .sign small { color: #555; }
#chop img.loyiha { display: block; width: 100%; object-fit: contain; margin-top: 14px; }
.sheet, .sheet tr { break-inside: avoid; }
.mijoz { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 2px 4px 4px; }
.mijoz input { padding: 9px 10px; background: var(--fon); color: var(--matn); border: 1px solid var(--chiziq); border-radius: 9px; min-width: 0; }
.oyna__tugma .keng { grid-column: 1 / -1; }
.sm .p.ro { text-align: right; white-space: nowrap; color: var(--xira); font-weight: 600; padding-right: 8px; }
.sm .p.ro.yoq { color: var(--xavf); }
.oyna__tugma button[hidden], .havola[hidden] { display: none; }
/* ko'rish rejimi (botdan ochilgan loyiha): tahrir vositalari yashirin */
body.korish .pastki, body.korish .koll, body.korish #xonaBtn, body.korish #taklifBtn, body.korish #yangiBtn,
body.korish .devorSeg, body.korish .mijoz, body.korish #smXodim { display: none !important; }
body.korish .qadam button, body.korish #usTur { visibility: hidden; }
body.korish #usQ { pointer-events: none; }
.ulangan, .ulanish { display: flex; flex-direction: column; gap: 2px; margin: 2px 4px 6px; padding: 10px 12px; border-radius: 10px; background: var(--fon); border: 1px solid var(--chiziq); color: var(--matn); text-decoration: none; }
.ulangan span, .ulanish span { font-size: 12px; color: var(--xira); }
.ulanish { border-color: var(--oltin); color: var(--oltin); font-weight: 700; }
.xodimIzoh { margin: 12px 4px 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--oltin); background: rgba(210,169,96,.1); font-size: 13px; line-height: 1.5; }
.usTur { min-width: 40px; padding: 6px 4px; border-radius: 8px; background: var(--fon); border: 1px solid var(--oltin); color: var(--oltin); font-weight: 700; font-size: 12.5px; }
