:root {
  --navy: #18233f;
  --navy-2: #24345c;
  --oltin: #c9a24a;
  --yashil: #1f8a4c;
  --sariq: #d48806;
  --qizil: #c62828;
  --fon: #f4f5f8;
  --oq: #fff;
  --matn: #1b1f2a;
  --kulrang: #6b7280;
  --chiziq: #dfe3ea;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px; line-height: 1.4; color: var(--matn); background: var(--fon);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--navy-2); }
header {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  background: var(--navy); color: #fff; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
}
.brend { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.brend img { width: 36px; height: 36px; border-radius: 8px; background: #fff; }
#menyu-tugma { background: none; border: 0; color: #fff; font-size: 26px; min-height: 44px; min-width: 44px; cursor: pointer; }
nav#menyu { background: var(--navy-2); display: flex; flex-direction: column; }
nav#menyu a { color: #fff; text-decoration: none; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
nav#menyu a.faol { background: rgba(255,255,255,.12); font-weight: 700; }
@media (min-width: 900px) {
  #menyu-tugma { display: none; }
  nav#menyu, nav#menyu[hidden] { display: flex !important; flex-direction: row; flex-wrap: wrap; padding: 0 8px; }
  body.kirmagan nav#menyu { display: none !important; }
  nav#menyu a { border: 0; padding: 12px 14px; }
}
#sinov-banner { background: #fff4d6; color: #7a5500; text-align: center; padding: 6px 12px; font-size: 14px; font-weight: 600; }
main { max-width: 980px; margin: 0 auto; padding: 16px; padding-bottom: 80px; }
h1 { font-size: 24px; margin: 4px 0 14px; }
h2 { font-size: 19px; margin: 22px 0 10px; }
.kichik { font-size: 14px; color: var(--kulrang); }
.karta { background: var(--oq); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
a.karta { display: block; color: inherit; text-decoration: none; }
a.karta:active { background: #eef1f7; }
.qator { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qator.oraliq { justify-content: space-between; }
.ustun { display: flex; flex-direction: column; gap: 10px; }
.osish { flex: 1 1 auto; min-width: 0; }

button, .tugma {
  font: inherit; border: 0; border-radius: 10px; min-height: 48px; padding: 10px 18px; cursor: pointer;
  background: var(--navy); color: #fff; font-weight: 600; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
}
button:disabled { opacity: .5; cursor: default; }
button.ikkinchi, .tugma.ikkinchi { background: #e7eaf1; color: var(--navy); }
button.xavfli { background: var(--qizil); }
button.kichik-t { min-height: 38px; padding: 6px 12px; font-size: 15px; }
input, select, textarea {
  font: inherit; border: 1px solid var(--chiziq); border-radius: 10px; padding: 10px 12px; min-height: 48px;
  background: #fff; width: 100%;
}
label { display: block; font-size: 14px; color: var(--kulrang); margin-bottom: 4px; }
.maydon { margin-bottom: 12px; }
.panjara { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.belgi { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #e7eaf1; color: var(--navy); white-space: nowrap; }
.belgi.yashil { background: #e2f4ea; color: var(--yashil); }
.belgi.qizil { background: #fde7e7; color: var(--qizil); }
.belgi.sariq { background: #fff1d6; color: #8a5a00; }
.belgi.kulrang { background: #eceef2; color: var(--kulrang); }

/* davomat */
.oquvchi-qator { background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.oquvchi-qator .ism { font-weight: 700; font-size: 18px; }
.holat-tugmalar { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.holat-tugmalar button { min-height: 58px; font-size: 17px; background: #eef0f4; color: var(--matn); border: 2px solid transparent; }
.holat-tugmalar button.tanlangan.keldi { background: var(--yashil); color: #fff; }
.holat-tugmalar button.tanlangan.kechikdi { background: var(--sariq); color: #fff; }
.holat-tugmalar button.tanlangan.kelmadi { background: var(--qizil); color: #fff; }
.oldingi { display: inline-block; margin-top: 4px; font-size: 13px; color: #0d6b52; background: #dff5ee; border-radius: 6px; padding: 2px 8px; }
.yopishqoq { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--fon) 30%); padding: 16px 0 8px; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--chiziq); font-size: 15px; vertical-align: top; }
th { background: #f0f2f6; font-size: 13px; color: var(--kulrang); }
.jadval-oram { overflow-x: auto; }

#xabar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 50; }
#xabar.korin { opacity: 1; }
#xabar.xato { background: var(--qizil); }

.kirish { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.kirish img { width: 260px; max-width: 80%; }
.kirish form { text-align: left; margin-top: 16px; }
details summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.qr { width: 200px; height: 200px; background: #fff; border-radius: 8px; }
.bosh-joy { text-align: center; color: var(--kulrang); padding: 30px 10px; }
.check-qator { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.check-qator input { width: 22px; min-height: 22px; height: 22px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: 26px; height: 26px; min-height: 26px; }

/* ---------- Oylik jadval ---------- */
.qalin { font-weight: 700; }
.oylik-oram { position: relative; left: 50%; transform: translateX(-50%); width: min(calc(100vw - 32px), 1400px);
  max-height: calc(100vh - 150px); overflow: auto; border-radius: var(--radius); background: #fff; }
table.oylik { width: auto; min-width: 100%; border-collapse: separate; border-spacing: 0; border-radius: 0; overflow: visible; }
table.oylik th, table.oylik td { padding: 7px 9px; font-size: 14px; white-space: nowrap; vertical-align: middle; }
table.oylik thead th { position: sticky; top: 0; z-index: 2; }
table.oylik .son { text-align: right; }
table.oylik .qotgan { position: sticky; left: 0; z-index: 1; background: #fff; border-right: 1px solid var(--chiziq);
  max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
table.oylik thead .qotgan { z-index: 3; background: #f0f2f6; }
table.oylik tfoot td { font-weight: 700; background: #f7f8fa; position: sticky; bottom: 0; }
table.oylik tfoot tr:first-child td { bottom: 33px; border-top: 2px solid var(--chiziq); }
table.oylik tfoot .qotgan { z-index: 3; background: #f7f8fa; }
td.oylik-katak { text-align: right; cursor: pointer; min-width: 84px; font-variant-numeric: tabular-nums; border-left: 2px solid #fff; }
.oylik-katak.yashil { background: #d9f2e3; color: #11502b; }
.oylik-katak.sariq { background: #ffecc2; color: #6b4600; }
.oylik-katak.qizil { background: #fbd5d5; color: #8a1414; }
.oylik-katak.kutilmoqda { background: #fff; color: var(--matn); box-shadow: inset 0 0 0 1px #cfd5df; }
.oylik-katak.kulrang { background: #eceef2; color: var(--kulrang); }
.oylik-katak.kok { background: #d3e6fa; color: #0b4a8a; }
table.oylik thead th.kelgusi { background: #e3eefb; color: #0b4a8a; }
td.oylik-katak:hover { filter: brightness(.94); }
.oylik-izoh { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 2px; font-size: 13px; color: var(--kulrang); }
.oylik-izoh span { display: inline-flex; align-items: center; gap: 6px; }
.oylik-izoh i { display: inline-block; width: 16px; height: 16px; border-radius: 4px; }
/* katak bosilganda chiqadigan to'lov oynasi */
.oyna-fon { position: fixed; inset: 0; z-index: 60; background: rgba(15, 20, 35, .45); display: flex;
  align-items: center; justify-content: center; padding: 12px; }
.oyna { width: min(460px, 100%); max-height: calc(100vh - 24px); overflow-y: auto; margin: 0;
  box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.oyna-raqamlar { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0 12px; padding: 10px 12px;
  background: #f4f5f8; border-radius: 8px; font-size: 15px; }
.oyna-raqamlar b { text-align: right; }
.oyna-summa { font-size: 22px; font-weight: 700; }
.oyna-tez { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.oyna-tez button { min-height: 46px; text-align: left; font-size: 16px; }
.oyna-tolovlar { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--chiziq); font-size: 15px; display: grid; gap: 4px; }
@media (max-width: 600px) {
  .oyna-fon { align-items: flex-end; padding: 0; }
  .oyna { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
