/* ==================================================================
   Kassa — operator ilovasi
   ================================================================== */

:root {
  --bg:      #0B0E13;
  --card:    #141922;
  --card-2:  #1B222D;
  --raise:   #232B38;

  --line:    rgba(255,255,255,.055);
  --line-2:  rgba(255,255,255,.10);

  --text:    #EDF1F7;
  --muted:   #8A94A6;
  --faint:   #5B6577;

  --pos:     #35C08A;
  --neg:     #FF6F60;
  --accent:  #4C8DFF;
  --warn:    #F2B544;

  --tape:      #F4F1E9;
  --tape-ink:  #101319;

  --r-card:  18px;
  --r-ctl:   13px;
  --pad:     18px;

  --ui:  'Manrope', system-ui, -apple-system, sans-serif;
  --num: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* MUHIM: sinfdagi `display` qiymati HTML dagi `hidden` atributini bekor
   qiladi. Shu sabab `.boot` va `.gate` yashirilmay qolgan edi. Bu qoida
   `hidden` ni har doim ustun qiladi. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.mono {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -.015em;
}

/* ---------- Yuklanish ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 90; }
.boot-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent);
  animation: breathe 1.5s ease-in-out infinite;
}
@keyframes breathe {
  0%,100% { transform: scale(.62); opacity: .3 }
  50%     { transform: scale(1);   opacity: 1  }
}

/* ---------- Sarlavha ---------- */
.top {
  display: flex; align-items: center; gap: 14px;
  padding: 22px var(--pad) 4px;
}
.hello { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hello-date {
  font-size: 12.5px; font-weight: 500; color: var(--faint);
  letter-spacing: .01em;
}
.hello-name {
  font-size: 25px; font-weight: 700; letter-spacing: -.025em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avatar {
  flex: 0 0 auto; margin-left: auto;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--raise);
  font-size: 16px; font-weight: 700; color: var(--muted);
}

/* ---------- Qarz ---------- */
.debt {
  display: flex; align-items: center; gap: 12px;
  margin: 16px var(--pad) 0;
  padding: 13px 16px;
  border-radius: var(--r-ctl);
  background: rgba(242,181,68,.10);
}
.debt-l { display: flex; flex-direction: column; gap: 1px; }
.debt-cap { font-size: 11px; font-weight: 600; color: rgba(242,181,68,.72); letter-spacing: .04em; }
.debt-sum { font-size: 17px; font-weight: 500; color: var(--warn); }
.debt-note {
  margin-left: auto; text-align: right;
  font-size: 11.5px; line-height: 1.35; color: var(--muted); max-width: 42%;
}

/* ---------- Segment ---------- */
.seg {
  position: relative;
  display: flex; gap: 0;
  margin: 20px var(--pad) 0;
  padding: 4px;
  border-radius: var(--r-ctl);
  background: var(--card);
}
.seg-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 4);
  border-radius: 10px;
  background: var(--raise);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
}
.seg-b[hidden] { display: none; }
.seg-b {
  position: relative; z-index: 1;
  flex: 1 1 0; min-width: 0;
  padding: 9px 2px;
  border: 0; background: transparent;
  color: var(--faint);
  font-family: var(--ui); font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: color .2s;
}
.seg-b.is-on { color: var(--text); }
.seg-b:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }

/* ---------- Sahna ---------- */
.stage { padding: 24px var(--pad) 0; }
.view { display: none; padding-bottom: 170px; }
.view.is-on { display: block; }

/* ---------- Eslatmalar ---------- */
.warn, .note {
  margin: 0 0 24px;
  padding: 14px 16px;
  border-radius: var(--r-ctl);
  font-size: 13px; line-height: 1.55;
}
.warn { background: rgba(255,111,96,.09);  color: #FFA79C; }
.note { background: var(--card);           color: var(--muted); }
.note b { color: var(--text); font-weight: 600; }

/* ---------- Maydonlar ---------- */
.f { margin-bottom: 20px; }
.f > label {
  display: block; margin: 0 0 8px 3px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.opt { color: var(--faint); font-weight: 500; }
.req { color: var(--warn); font-weight: 600; font-size: 11px; }

.f input, .f textarea {
  width: 100%;
  padding: 15px 16px;
  background: var(--card);
  border: 1.5px solid transparent;
  border-radius: var(--r-ctl);
  color: var(--text);
  font-family: var(--ui); font-size: 16px;
  transition: border-color .18s, background .18s;
}
.f textarea { resize: vertical; line-height: 1.5; }
.f input.mono { font-family: var(--num); }
.f input.xl { font-size: 26px; font-weight: 500; padding: 16px; }

.f input:focus, .f textarea:focus {
  outline: none;
  background: var(--card-2);
  border-color: var(--accent);
}
.f input::placeholder, .f textarea::placeholder { color: var(--faint); }
.f input.is-bad { border-color: var(--neg); }

.hint { display: block; margin: 8px 0 0 3px; font-size: 12px; color: var(--faint); }
.hint.is-bad { color: var(--neg); }
.hint.is-ok  { color: var(--pos); }

/* ---------- 3% ---------- */
.calc {
  margin-top: 12px;
  padding: 15px 16px;
  background: var(--card);
  border-radius: var(--r-ctl);
}
.calc-top { display: flex; align-items: baseline; gap: 10px; }
.calc-cap { font-size: 12px; color: var(--muted); }
.calc-val { margin-left: auto; font-size: 21px; font-weight: 500; color: var(--pos); }
.calc-words { margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.calc-words.is-big  { color: var(--warn); font-weight: 600; }
.calc-words.is-huge { color: var(--neg);  font-weight: 700; }

/* ---------- Tugma ---------- */
.go {
  width: 100%; margin-top: 6px;
  padding: 17px;
  border: 0; border-radius: var(--r-ctl);
  background: var(--pos);
  color: #04231A;
  font-family: var(--ui); font-size: 15.5px; font-weight: 700;
  cursor: pointer;
  transition: transform .12s, opacity .18s;
}
.go:active { transform: scale(.985); }
.go:disabled { opacity: .35; }
.go:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* ---------- Hisobot varaqlari ---------- */
.sheet {
  margin-bottom: 14px;
  padding: 4px 0;
  background: var(--card);
  border-radius: var(--r-card);
}
.ln {
  display: grid;
  grid-template-columns: 1fr 45%;
  align-items: center; gap: 12px;
  padding: 9px 14px 9px 18px;
}
.ln > label {
  font-size: 14px; font-weight: 500; color: var(--text);
  display: flex; flex-direction: column; gap: 2px;
}
.ln > label em {
  font-style: normal;
  font-size: 11px; font-weight: 500; color: var(--faint);
}
.ln.is-lock > label { color: var(--muted); }
.ln.is-off { opacity: .38; }

.cell {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 11px;
  color: var(--text);
  font-size: 16px; font-weight: 500;
  text-align: right;
  transition: border-color .18s;
}
.cell:focus { outline: none; border-color: var(--accent); }
.cell.is-bad { border-color: var(--neg); }
output.cell { display: block; background: transparent; color: var(--muted); }

/* ---------- Ro'yxatlar ---------- */
.lh {
  margin: 34px 0 12px 3px;
  font-size: 12px; font-weight: 600; color: var(--faint);
}
.list { display: flex; flex-direction: column; gap: 8px; }

.item {
  display: grid; grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--r-ctl);
}
.item-main { font-family: var(--num); font-size: 17px; font-weight: 500; }
.item-sub  { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.item-side { text-align: right; font-size: 11.5px; color: var(--faint); }
.item-badge {
  display: inline-block; margin-bottom: 4px;
  padding: 3px 9px; border-radius: 7px;
  font-size: 11px; font-weight: 600;
}
.item[data-s="tasdiqlandi"] .item-badge { background: rgba(53,192,138,.14); color: var(--pos); }
.item[data-s="bekor"]       .item-badge { background: rgba(255,111,96,.14); color: var(--neg); }
.item[data-s="kutilmoqda"]  .item-badge { background: rgba(242,181,68,.14); color: var(--warn); }

.empty {
  padding: 26px 16px;
  background: var(--card);
  border-radius: var(--r-ctl);
  color: var(--faint); font-size: 13px; text-align: center;
}

/* ---------- Katta hisoblagich ---------- */
.big {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 24px;
  padding: 22px;
  background: var(--card);
  border-radius: var(--r-card);
}
.big-cap { font-size: 12.5px; color: var(--muted); }
.big-num { font-size: 46px; font-weight: 500; color: var(--accent); line-height: 1.05; }

/* ---------- Kassa lentasi ---------- */
.tape {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 30; pointer-events: none;
  filter: drop-shadow(0 -12px 30px rgba(0,0,0,.66));
}
.tape-edge {
  height: 9px; background: var(--tape);
  -webkit-mask-image: repeating-radial-gradient(circle at 5px 9px, transparent 0 5px, #000 5.4px 10px);
  mask-image: repeating-radial-gradient(circle at 5px 9px, transparent 0 5px, #000 5.4px 10px);
  -webkit-mask-size: 10px 9px; mask-size: 10px 9px;
}
.tape-body {
  display: flex; align-items: baseline; gap: 12px;
  background: var(--tape); color: var(--tape-ink);
  padding: 16px var(--pad) calc(18px + env(safe-area-inset-bottom));
}
.tape-cap {
  font-size: 12px; font-weight: 600;
  color: rgba(16,19,25,.55);
}
.tape-sum {
  margin-left: auto;
  font-size: 30px; font-weight: 500; line-height: 1;
}
.tape-sum.is-neg { color: #B3402F; }
.tape-sum.tick { animation: tick .18s ease-out; }
@keyframes tick {
  from { transform: translateY(-4px); opacity: .4 }
  to   { transform: none;             opacity: 1  }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: var(--pad); right: var(--pad); bottom: 118px;
  z-index: 60;
  padding: 15px 17px;
  border-radius: var(--r-ctl);
  background: var(--raise);
  font-size: 13.5px; line-height: 1.5;
  animation: rise .22s cubic-bezier(.32,.72,0,1);
}
.toast.is-ok  { color: #9BE8C6; }
.toast.is-bad { color: #FFA79C; }
@keyframes rise {
  from { transform: translateY(12px); opacity: 0 }
  to   { transform: none;             opacity: 1 }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ==================================================================
   Nazorat bo'limi
   ================================================================== */

.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 8px;
}
.tile {
  display: flex; flex-direction: column; gap: 5px;
  padding: 16px;
  background: var(--card);
  border-radius: var(--r-card);
}
.tile-cap { font-size: 11.5px; color: var(--muted); }
.tile-num { font-size: 22px; font-weight: 500; line-height: 1.1; }

.sheet.pad { padding: 18px; }
.sheet.pad .f:last-of-type { margin-bottom: 18px; }

select {
  width: 100%;
  padding: 15px 16px;
  background: var(--card-2);
  border: 1.5px solid transparent;
  border-radius: var(--r-ctl);
  color: var(--text);
  font-family: var(--ui); font-size: 16px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 24px, calc(100% - 14px) 24px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
select:focus { outline: none; border-color: var(--accent); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair .go { margin-top: 0; font-size: 14px; padding: 15px 8px; }
.go-neg { background: var(--neg); color: #2E0A05; }

.back {
  margin-bottom: 18px; padding: 10px 16px;
  border: 0; border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--muted);
  font-family: var(--ui); font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.back:active { background: var(--card-2); }

.staff {
  display: grid; grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--r-ctl);
  cursor: pointer;
}
.staff:active { background: var(--card-2); }
.staff-n { font-size: 15px; font-weight: 600; }
.staff-s { grid-column: 1; font-size: 12px; color: var(--muted); }
.staff-k { text-align: right; font-family: var(--num); font-size: 15px; font-weight: 500; }
.staff-q { text-align: right; font-size: 11.5px; color: var(--warn); }
.staff-w { text-align: right; font-size: 11.5px; color: var(--faint); }

.frow {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--r-ctl);
}
.frow-n { font-size: 14px; font-weight: 600; }
.frow-s { font-size: 12px; color: var(--muted); }
.frow-b {
  margin-left: auto; padding: 7px 13px;
  border: 0; border-radius: 9px;
  background: var(--card-2); color: var(--muted);
  font-family: var(--ui); font-size: 12px; font-weight: 600;
  cursor: pointer;
}
.frow.is-off .frow-n, .frow.is-off .frow-s { opacity: .4; }

/* ==================================================================
   Kirish darvozasi
   ================================================================== */
.gate {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: var(--pad);
  background: var(--bg);
  overflow-y: auto;
}
.gate-box { width: 100%; max-width: 360px; }

.gate-lock {
  width: 46px; height: 46px;
  margin: 0 auto 22px;
  border-radius: 14px;
  background: var(--card);
  position: relative;
}
.gate-lock::before {
  content: ''; position: absolute;
  left: 50%; top: 11px; transform: translateX(-50%);
  width: 17px; height: 13px;
  border: 2.5px solid var(--accent);
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
}
.gate-lock::after {
  content: ''; position: absolute;
  left: 50%; top: 22px; transform: translateX(-50%);
  width: 24px; height: 15px;
  border-radius: 4px;
  background: var(--accent);
}

.gate-h {
  margin: 0 0 6px;
  font-size: 24px; font-weight: 700; letter-spacing: -.02em;
  text-align: center;
}
.gate-p {
  margin: 0 0 26px;
  font-size: 13.5px; line-height: 1.55; color: var(--muted);
  text-align: center;
}
.gate-err {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: var(--r-ctl);
  background: rgba(255,111,96,.10);
  color: #FFA79C;
  font-size: 13px; line-height: 1.5;
  text-align: center;
}

.ghost {
  width: 100%; margin-bottom: 12px;
  padding: 15px;
  border: 0; border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--accent);
  font-family: var(--ui); font-size: 14.5px; font-weight: 600;
  cursor: pointer;
}
.ghost:active { background: var(--card-2); }
.ghost.is-done { color: var(--pos); }

.gate input {
  font-family: var(--ui);
  letter-spacing: .06em;
}
.gate input.mono { font-family: var(--num); letter-spacing: .12em; text-transform: uppercase; }

/* Taklifnoma kodi */
.kodbox {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 14px; padding: 24px 18px;
  background: var(--card);
  border-radius: var(--r-card);
}
.kodbox-cap { font-size: 11.5px; color: var(--muted); }
.kodbox-kod {
  font-size: 30px; font-weight: 500; letter-spacing: .1em; color: var(--pos);
}
.kodbox-sub { font-size: 11.5px; color: var(--faint); margin-bottom: 6px; }
.kodbox .ghost { width: auto; padding: 11px 24px; margin: 0; }

button.avatar { border: 0; cursor: pointer; font-family: var(--ui); }
button.avatar:active { background: var(--card-2); }

/* Sana paneli */
.datebar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding: 13px 16px;
  background: var(--card); border-radius: var(--r-ctl);
}
.datebar label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.datebar input[type="date"] {
  flex: 1; min-width: 0;
  padding: 8px 10px;
  background: var(--bg); border: 1.5px solid transparent; border-radius: 9px;
  color: var(--text); font-family: var(--ui); font-size: 14px;
}
.datebar input:focus { outline: none; border-color: var(--accent); }
.datebar-x { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* Nazorat qatorlari */
.nz {
  display: grid; grid-template-columns: 1fr repeat(3, auto);
  gap: 4px 14px; align-items: baseline;
  padding: 13px 16px;
  background: var(--card); border-radius: var(--r-ctl);
}
.nz-k { font-size: 14px; font-weight: 600; }
.nz-v { font-family: var(--num); font-size: 14px; text-align: right; }
.nz-c { grid-column: 1 / -1; font-size: 11px; color: var(--faint); }
.nz-v.pos { color: var(--pos); }
.nz-v.mut { color: var(--muted); }

.farq-neg { color: var(--neg); }
.farq-pos { color: var(--pos); }
