/* =====================================================================
   Bulochka CRM — uslublar
   Konsepsiya: qog'oz daftar. Raqamlar o'ngga tekislangan, bir xil
   kenglikda; yakun ostida ingichka kobalt chiziq. Qolgan hamma narsa jim.
   ===================================================================== */

:root {
  --fon:        #FBFAF7;
  --sirt:       #FFFFFF;
  --siyoh:      #16232B;
  --siyoh-2:    #5D6E78;
  --siyoh-3:    #93A1A9;
  --chiziq:     #E5E3DC;
  --chiziq-2:   #F0EEE8;
  --kobalt:     #1E5BA8;
  --kobalt-och: #ECF2FA;
  --firuza:     #12796B;
  --firuza-och: #E8F4F1;
  --qizil:      #B3261E;
  --qizil-och:  #FBEDEC;
  --sariq:      #8A6100;
  --sariq-och:  #FBF2DE;
  --r:          10px;
  --nav-h:      64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fon);
  color: var(--siyoh);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--kobalt); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--kobalt); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }

/* --- Karkas ---------------------------------------------------------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 28px); }

.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(251, 250, 247, .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--chiziq);
}
.top-in {
  max-width: 720px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.top h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .kim { font-size: .8rem; color: var(--siyoh-2); text-align: right; line-height: 1.25; }
.top .kim b { display: block; color: var(--siyoh); font-weight: 600; }

.orqa {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-left: -6px;
  border: 1px solid var(--chiziq); border-radius: 50%;
  color: var(--siyoh); background: var(--sirt); flex: none;
}
.orqa:hover { text-decoration: none; border-color: var(--kobalt); color: var(--kobalt); }

/* --- Navigatsiya: pastda (telefon), chapda (kompyuter) ---------------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--sirt);
  border-top: 1px solid var(--chiziq);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; padding: 9px 2px 10px; text-align: center;
  color: var(--siyoh-2); font-size: .68rem; font-weight: 600;
  border-top: 2px solid transparent; margin-top: -1px;
}
.nav a:hover { text-decoration: none; color: var(--siyoh); }
.nav a.faol { color: var(--kobalt); border-top-color: var(--kobalt); }
.nav svg { display: block; margin: 0 auto 3px; width: 21px; height: 21px; }

/* --- Daftar: asosiy raqamlar ----------------------------------------- */
.daftar {
  background: var(--sirt); border: 1px solid var(--chiziq);
  border-radius: var(--r); padding: 18px 18px 16px;
}
.daftar .sarlavha {
  font-size: .82rem; color: var(--siyoh-2); font-weight: 600;
  margin-bottom: 14px;
}
.qator-d {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 0; font-size: .95rem;
}
.qator-d .nom { color: var(--siyoh-2); white-space: nowrap; }
.qator-d .nuqta {
  flex: 1; height: 1px; margin-bottom: 4px;
  border-bottom: 1px dotted var(--chiziq);
}
.qator-d .son {
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  font-weight: 600; white-space: nowrap;
}
.qator-d.yakun {
  margin-top: 10px; padding-top: 12px;
  border-top: 1.5px solid var(--kobalt);
}
.qator-d.yakun .nom { color: var(--siyoh); font-weight: 700; }
.qator-d.yakun .son { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.qator-d.yakun .son.musbat { color: var(--firuza); }
.qator-d.yakun .son.manfiy { color: var(--qizil); }
.birlik { font-size: .72rem; color: var(--siyoh-3); font-weight: 500; margin-left: 3px; }

/* --- Kartochkalar va ro'yxat ----------------------------------------- */
.karta {
  background: var(--sirt); border: 1px solid var(--chiziq);
  border-radius: var(--r); overflow: hidden;
}
.karta + .karta, .daftar + .karta, .karta + .daftar, .bolim + * { margin-top: 14px; }

.bolim {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 26px 0 10px;
}
.bolim h2 { font-size: .95rem; }
.bolim .yon { font-size: .82rem; color: var(--siyoh-2); }

.qator {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--chiziq-2);
  color: inherit;
}
.qator:last-child { border-bottom: 0; }
a.qator:hover { background: var(--kobalt-och); text-decoration: none; }
.qator .asos { flex: 1; min-width: 0; }
.qator .nomi { font-weight: 600; }
.qator .tag { font-size: .78rem; color: var(--siyoh-2); margin-top: 1px; }
.qator .ong {
  text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
.qator .ong .katta { font-weight: 600; }
.qator .ong .kichik { font-size: .78rem; color: var(--siyoh-2); }

.bosh {
  padding: 16px; border-bottom: 1px solid var(--chiziq-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

/* --- Belgilar --------------------------------------------------------- */
.belgi {
  display: inline-block; padding: 2px 9px; border-radius: 100px;
  font-size: .74rem; font-weight: 600; white-space: nowrap;
}
.belgi.jarayonda { background: var(--sariq-och); color: var(--sariq); }
.belgi.tayyor    { background: var(--firuza-och); color: var(--firuza); }
.belgi.bekor     { background: var(--chiziq-2);  color: var(--siyoh-2); }
.belgi.qarz      { background: var(--qizil-och);  color: var(--qizil); }
.belgi.kam       { background: var(--qizil-och);  color: var(--qizil); }

/* --- Tugmalar --------------------------------------------------------- */
.tugma {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 16px; min-height: 44px;
  border: 1px solid var(--chiziq); border-radius: var(--r);
  background: var(--sirt); color: var(--siyoh);
  font: inherit; font-size: .92rem; font-weight: 600;
  cursor: pointer;
}
.tugma:hover { text-decoration: none; border-color: var(--siyoh-3); }
.tugma.asos { background: var(--kobalt); border-color: var(--kobalt); color: #fff; }
.tugma.asos:hover { background: #17498A; border-color: #17498A; }
.tugma.xavf { color: var(--qizil); border-color: #E7CFCD; }
.tugma.xavf:hover { background: var(--qizil-och); }
.tugma.keng { width: 100%; }
.tugma.kichik { min-height: 36px; padding: 7px 12px; font-size: .84rem; }
.tugma[disabled] { opacity: .5; cursor: not-allowed; }
.tugmalar { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.tugmalar .tugma { flex: 1 1 auto; }

/* --- Forma ------------------------------------------------------------ */
.forma { padding: 16px; }
.maydon { margin-bottom: 14px; }
.maydon > label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--siyoh-2); margin-bottom: 5px;
}
input[type=text], input[type=number], input[type=password], input[type=date],
input[type=month], input[type=tel], select, textarea {
  width: 100%; padding: 11px 12px; min-height: 46px;
  border: 1px solid var(--chiziq); border-radius: var(--r);
  background: var(--sirt); color: var(--siyoh);
  font: inherit; font-size: 1rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--kobalt); outline: none; box-shadow: 0 0 0 3px var(--kobalt-och); }
input[type=number] { font-variant-numeric: tabular-nums; }
textarea { min-height: 80px; resize: vertical; }
.juft { display: flex; gap: 10px; }
.juft > * { flex: 1; min-width: 0; }
.juft .tor { flex: 0 0 120px; }
.izohcha { font-size: .78rem; color: var(--siyoh-2); margin-top: 5px; }

/* --- Jadval ----------------------------------------------------------- */
.jadval-o { overflow-x: auto; }
table.jadval { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.jadval th {
  text-align: left; font-weight: 600; color: var(--siyoh-2);
  padding: 10px 12px; border-bottom: 1px solid var(--chiziq); white-space: nowrap;
}
table.jadval td { padding: 11px 12px; border-bottom: 1px solid var(--chiziq-2); }
table.jadval tr:last-child td { border-bottom: 0; }
table.jadval .r {
  text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

/* --- Xabarlar va bo'sh holat ------------------------------------------ */
.xabar {
  padding: 12px 14px; border-radius: var(--r); margin-bottom: 14px;
  font-size: .9rem; border: 1px solid;
}
.xabar.ok  { background: var(--firuza-och); border-color: #C9E5DF; color: #0C5A4F; }
.xabar.xato { background: var(--qizil-och); border-color: #EFD2CF; color: #8E1D17; }
.xabar.ogoh { background: var(--sariq-och); border-color: #EADFC0; color: #6B4B00; }

.bosh-holat { padding: 34px 20px; text-align: center; color: var(--siyoh-2); }
.bosh-holat p { margin: 0 0 16px; font-size: .92rem; }

.mayda { font-size: .8rem; color: var(--siyoh-2); }
.son { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.musbat { color: var(--firuza); }
.manfiy { color: var(--qizil); }

/* --- Kirish sahifasi --------------------------------------------------- */
.kirish { max-width: 380px; margin: 8vh auto; padding: 0 18px; }
.kirish .logo { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; }
.kirish .logo span { color: var(--kobalt); }
.kirish .shior { color: var(--siyoh-2); font-size: .9rem; margin: 4px 0 22px; }

/* --- Kompyuter ekrani -------------------------------------------------- */
@media (min-width: 900px) {
  .nav {
    top: 0; right: auto; bottom: 0; width: 196px;
    flex-direction: column; padding: 14px 10px;
    border-top: 0; border-right: 1px solid var(--chiziq);
  }
  .nav a {
    flex: none; display: flex; align-items: center; gap: 10px;
    text-align: left; padding: 10px 12px; font-size: .9rem;
    border-top: 0; border-radius: 8px; margin-top: 0;
  }
  .nav a.faol { background: var(--kobalt-och); }
  .nav svg { margin: 0; }
  .nav .brend {
    padding: 6px 12px 18px; font-weight: 700; font-size: 1rem;
    color: var(--siyoh); letter-spacing: -.02em;
  }
  .top { padding-left: 196px; }
  .top-in, .wrap { max-width: 840px; }
  body { padding-left: 196px; }
  .wrap { padding-bottom: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .nav, .top, .tugmalar { display: none; }
  body { background: #fff; padding: 0; }
}
