:root {
  --bg: #f4f6f9; --panel: #fff; --chiziq: #e2e7ee; --matn: #1c2430; --xira: #667085;
  --asosiy: #17603f; --asosiy-och: #e6f3ec; --yashil: #13795b; --yashil-och: #e6f4ee;
  --qizil: #b42318; --qizil-och: #fdecea; --sariq: #a15c07; --sariq-och: #fef4e4;
  --r: 10px; --soya: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--matn); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--asosiy); text-decoration: none; }
a:hover { text-decoration: underline; }

.tuzilma { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.yon { background: #0f3d29; color: #dbefe4; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.yon .logo { font-weight: 700; font-size: 18px; color: #fff; padding: 4px 10px 16px; }
.yon .logo small { display: block; font-weight: 400; font-size: 12px; color: #9fcab5; }
.yon a { color: #dbefe4; padding: 9px 12px; border-radius: 8px; display: block; }
.yon a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.yon a.faol { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; }
.yon .pastki { margin-top: auto; font-size: 13px; color: #9fcab5; padding: 10px; border-top: 1px solid rgba(255, 255, 255, .12); }
.yon .pastki button { margin-top: 6px; background: none; border: 1px solid rgba(255, 255, 255, .25); color: #dbefe4; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.asosiy { padding: 22px 28px 60px; min-width: 0; }

.sarlavha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.sarlavha h1 { font-size: 22px; margin: 0; margin-right: auto; }
.sarlavha .orqaga { color: var(--xira); font-size: 13px; display: block; margin-bottom: 2px; }
h2 { font-size: 16px; margin: 24px 0 10px; }

.tugma { border: 1px solid var(--chiziq); background: #fff; border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.tugma:hover { background: #f7f9fc; }
.tugma.asosiy-t { background: var(--asosiy); border-color: var(--asosiy); color: #fff; }
.tugma.asosiy-t:hover { background: #193f63; }
.tugma.yashil-t { background: var(--yashil); border-color: var(--yashil); color: #fff; }
.tugma.qizil-t { color: var(--qizil); border-color: #f3c4bf; }
.tugma.kichik { padding: 4px 10px; font-size: 13px; }
.tugma:disabled { opacity: .5; cursor: default; }

.kartalar { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.karta { background: var(--panel); border: 1px solid var(--chiziq); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--soya); }
.karta .n { color: var(--xira); font-size: 13px; }
.karta .q { font-size: 21px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.karta .q small { font-size: 14px; font-weight: 500; color: var(--xira); }
.karta .i { font-size: 12.5px; color: var(--xira); margin-top: 4px; }
.karta.qizil .q { color: var(--qizil); }
.karta.yashil .q { color: var(--yashil); }

.panel { background: var(--panel); border: 1px solid var(--chiziq); border-radius: var(--r); box-shadow: var(--soya); overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--chiziq); vertical-align: top; }
th { font-size: 12.5px; color: var(--xira); font-weight: 600; background: #fafbfc; position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.son, th.son { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.bosiladi { cursor: pointer; }
tr.bosiladi:hover td { background: #f7f9fc; }
tr.bekor td { color: #98a2b3; text-decoration: line-through; }
tr.bekor td.izohli { text-decoration: none; }
tfoot td { font-weight: 650; background: #fafbfc; }
.bosh { padding: 28px; text-align: center; color: var(--xira); }

.belgi { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.belgi.oqiyapti { background: var(--yashil-och); color: var(--yashil); }
.belgi.kutmoqda { background: var(--sariq-och); color: var(--sariq); }
.belgi.bitirgan { background: var(--asosiy-och); color: var(--asosiy); }
.belgi.ketgan { background: #f2f4f7; color: #475467; }
.belgi.qizil { background: var(--qizil-och); color: var(--qizil); }
.belgi.depozit { background: var(--sariq-och); color: var(--sariq); }
.qizil-m { color: var(--qizil); }
.yashil-m { color: var(--yashil); }
.xira { color: var(--xira); }

.filtr { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
input:not([type]), input[type=text], input[type=search], input[type=date], input[type=month], input[type=password], input[type=number], select, textarea {
  border: 1px solid #cfd6e0; border-radius: 8px; padding: 7px 10px; background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0e4; outline-offset: 0; border-color: #6d9ccc; }
textarea { width: 100%; min-height: 60px; resize: vertical; }

.yorliqlar { display: flex; gap: 4px; border-bottom: 1px solid var(--chiziq); margin: 18px 0 12px; flex-wrap: wrap; }
.yorliqlar button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--xira); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.yorliqlar button.faol { color: var(--asosiy); border-bottom-color: var(--asosiy); font-weight: 600; }
.yorliqlar .son-b { background: #eef2f6; border-radius: 99px; padding: 0 7px; font-size: 12px; margin-left: 4px; }

#modal-qatlam { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 20; }
#modal-qatlam[hidden] { display: none; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal.keng { max-width: 820px; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--chiziq); display: flex; align-items: center; }
.modal header h3 { margin: 0; font-size: 17px; flex: 1; }
.modal header button { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--xira); line-height: 1; }
.modal .ichi { padding: 16px 20px; }
.modal footer { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; }

.forma { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.forma label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #344054; }
.forma label > span { font-weight: 550; }
.forma .toliq { grid-column: 1 / -1; }
.forma .izoh-m { font-size: 12px; color: var(--xira); }
.forma input, .forma select { width: 100%; }
.xato-m { background: var(--qizil-och); color: var(--qizil); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.ogoh-m { background: var(--sariq-och); color: var(--sariq); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.info-m { background: var(--asosiy-och); color: #1d3f61; padding: 10px 12px; border-radius: 8px; }

.almash { display: inline-flex; border: 1px solid #cfd6e0; border-radius: 8px; overflow: hidden; }
.almash button { border: 0; background: #fff; padding: 7px 14px; cursor: pointer; }
.almash button.faol { background: var(--asosiy); color: #fff; }

.tanlov { position: relative; }
.tanlov .royxat { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--chiziq); border-radius: 8px; box-shadow: 0 8px 20px rgba(0, 0, 0, .12); max-height: 260px; overflow: auto; margin-top: 2px; }
.tanlov .royxat div { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f0f2f5; }
.tanlov .royxat div:hover { background: #f4f8fc; }
.tanlangan { border: 1px solid #b9d0e8; background: var(--asosiy-och); border-radius: 8px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; }
.tanlangan b { flex: 1; }

.ikki-ustun { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.malumot { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; padding: 14px 16px; }
.malumot div:nth-child(odd) { color: var(--xira); }

#xabar { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #14324f; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 30; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); }
#xabar.xato { background: var(--qizil); }

.kirish-oyna { max-width: 380px; margin: 12vh auto; background: #fff; border-radius: 14px; padding: 28px; box-shadow: var(--soya); border: 1px solid var(--chiziq); }
.kirish-oyna h1 { margin: 0 0 4px; font-size: 22px; }
.kirish-oyna p { color: var(--xira); margin: 0 0 18px; }
.kirish-oyna .forma { grid-template-columns: 1fr; }
.kirish-oyna .tugma { width: 100%; margin-top: 8px; padding: 10px; }

@media (max-width: 860px) {
  .tuzilma { grid-template-columns: 1fr; }
  .yon { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .yon .logo { width: 100%; padding-bottom: 6px; }
  .yon .pastki { width: 100%; margin-top: 6px; }
  .asosiy { padding: 16px; }
  .forma, .ikki-ustun { grid-template-columns: 1fr; }
  .malumot { grid-template-columns: 130px 1fr; }
}
@media print {
  .yon, .sarlavha .tugma, .filtr { display: none !important; }
  .tuzilma { display: block; }
}
