:root {
  --red: #d7141a;
  --red-dark: #a80f14;
  --brand: #3b9a14;          /* CIBOS yashil (logotipdan) */
  --brand-dark: #2c7a0c;
  --accent: #ffe600;         /* CIBOS sariq */
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #e3e3e6;
  --bg: #f4f4f6;
  --card: #ffffff;
  --green: #148a3c;
  --orange: #e07b00;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-size: 16px; user-select: none; }
input, textarea, select { user-select: text; font: inherit; }
button { font: inherit; cursor: pointer; border: none; border-radius: var(--radius); }
button:disabled { opacity: .45; cursor: default; }

.btn { padding: 12px 18px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.green { background: var(--green); color: #fff; border-color: var(--green); }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn.big { padding: 18px 22px; font-size: 20px; }
.btn.sm { padding: 6px 10px; font-size: 14px; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--brand); color: #fff; height: 58px; }
.topbar .brand { font-weight: 800; font-size: 22px; letter-spacing: .3px; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.topbar .logo { height: 46px; width: 46px; flex-shrink: 0; }
.pin-logo { width: 110px; height: 110px; display: block; margin: 0 auto 8px; }
.topbar .spacer { flex: 1; }
.topbar .btn { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); padding: 9px 14px; }
.topbar .info { font-size: 14px; opacity: .95; line-height: 1.2; }

.input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 18px; }
.input:focus { outline: 2px solid var(--brand); border-color: transparent; }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(20,20,22,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 94vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(980px, 100%); }
.modal h2 { margin: 0; padding: 16px 20px; font-size: 20px; border-bottom: 1px solid var(--line); }
.modal .body { padding: 16px 20px; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 18px; flex-wrap: wrap; }
/* to'liq ekranli oyna (hisobot ichiga kirish): sarlavha va tugmalar joyida, o'rtasi suriladi */
.overlay.full .modal { display: flex; flex-direction: column; overflow: hidden; }
.overlay.full .modal .body { flex: 1; overflow: auto; overscroll-behavior: contain; }
.overlay.full .modal h2 { display: flex; align-items: center; gap: 8px; }
.modal h2 .back { background: none; border: 0; font-size: 28px; line-height: 1; padding: 2px 10px 6px 0; color: var(--ink); cursor: pointer; }
@media (max-width: 700px) {
  .overlay.full { padding: 0; align-items: stretch; }
  .overlay.full .modal { width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; }
  .overlay.full .modal h2 { background: var(--brand); color: #fff; padding: 12px 14px; font-size: 18px; border: 0; }
  .overlay.full .modal h2 .back { color: #fff; }
  .overlay.full .modal .body { padding: 12px 14px; }
  .overlay.full .modal .foot { padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
}

/* PIN */
.pin-wrap { position: fixed; inset: 0; background: var(--brand); display: flex; align-items: center; justify-content: center; z-index: 60; }
.pin-box { background: #fff; border-radius: 22px; padding: 26px; width: 340px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.pin-box h1 { margin: 0 0 4px; font-size: 26px; color: var(--brand); }
.pin-box .sub { color: var(--muted); margin-bottom: 14px; }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 10px 0 18px; height: 20px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots span.on { background: var(--ink); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-pad button { height: 64px; font-size: 26px; font-weight: 600; background: var(--bg); }
.pin-pad button:active { background: var(--line); }
.pin-err { color: var(--red); min-height: 22px; margin-top: 10px; font-weight: 600; }

/* toast */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; max-width: 420px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-weight: 500; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
.toast .act { margin-left: 12px; background: #fff; color: var(--ink); padding: 4px 10px; border-radius: 8px; font-weight: 700; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg); color: var(--muted); }
.tag.red { background: #fde8e8; color: var(--red); }
.tag.green { background: #e3f5ea; color: var(--green); }
.tag.orange { background: #fff1de; color: var(--orange); }
.muted { color: var(--muted); }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }

table.grid { width: 100%; border-collapse: collapse; background: #fff; }
table.grid th, table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 15px; }
table.grid th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #fafafa; }
/* raqam ustunlari (miqdor, summa) — o'ng tomonga tiziladi; yuqoridagi "text-align: left" dan kuchliroq bo'lishi kerak */
table.grid th.right, table.grid td.right { text-align: right; }
table.grid tr.click { cursor: pointer; }
table.grid tr.click:hover { background: #fafafa; }

/* qidiruvli tanlash (select[data-search]) */
.ss-input { cursor: text; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat right 10px center; padding-right: 32px !important; }
.ss-list { position: fixed; z-index: 1000; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); overflow: auto; font-size: 16px; }
.ss-list .ss-group { padding: 6px 12px 2px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.ss-list .ss-opt { padding: 9px 12px; cursor: pointer; }
.ss-list .ss-opt.cur { font-weight: 700; }
.ss-list .ss-opt.on { background: #fde8e8; }
.ss-list .ss-none { padding: 12px; color: var(--muted); }
.ss-list .ss-new { color: var(--brand); font-weight: 700; border-top: 1px solid var(--line); }
.warn-box { margin-top: 10px; padding: 10px 12px; background: #fff8ec; border: 1px solid #f3d9a8; border-radius: 10px; font-size: 15px; color: #7a4a00; }
/* SI hujjat o'qish: chapda rasm, o'ngda qoralama */
.ai-wrap { display: grid; grid-template-columns: minmax(280px, 38%) minmax(0, 1fr); gap: 16px; align-items: start; }
.ai-form { min-width: 0; overflow-x: auto; }
.ai-doc { position: sticky; top: 0; max-height: 78vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.ai-img { width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }
.ai-img.zoom { width: 250%; max-width: none; cursor: zoom-out; }
@media (max-width: 900px) { .ai-wrap { grid-template-columns: minmax(0, 1fr); } .ai-doc { position: static; max-height: 50vh; } }

/* Qo'llanma — dastur ichida to'liq ekran (iframe) */
.guide-wrap { position: fixed; inset: 0; z-index: 90; background: #fff; }
.guide-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 700px) { #bGuide .gl { display: none; } }

/* ekrandagi harf klaviaturasi (dostavka: ism, manzil) */
.osk-keys { margin-top: 10px; display: grid; gap: 6px; }
.osk-row { display: flex; gap: 6px; }
.osk-row button { flex: 1; min-width: 0; height: 54px; font-size: 22px; font-weight: 700; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.osk-row button:active { background: var(--bg); }
.osk-row .w2 { flex: 2; font-size: 17px; } .osk-row .w5 { flex: 5; font-size: 17px; } .osk-row .w1 { flex: 1; }
.chipsel { display: flex; gap: 6px; flex-wrap: wrap; }
.chipsel button { padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 700; }
.chipsel button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; color: inherit; }
