/* UPG Team — usta telefonida, mashinalar orasida ishlatiladi.
   Qoida: katta nishon, bosilgan zahoti javob, ortiqcha bezak yo'q. */

:root {
  --bg:        #0f1218;
  --bg-2:      #151a22;
  --card:      #1a2029;
  --card-2:    #212936;
  --line:      #2a3340;
  --text:      #eef2f7;
  --dim:       #8b98a9;
  --dimmer:    #5d6979;
  --accent:    #3d8bff;
  --accent-in: #ffffff;
  --good:      #34c759;
  --warn:      #ff9f0a;
  --bad:       #ff453a;
  --r:         16px;
  --r-lg:      22px;
  --pad:       16px;
  --tap:       56px;
  --safe-b:    env(safe-area-inset-bottom, 0px);
  --ease:      cubic-bezier(0.32, 0.72, 0, 1);
}

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

/* MAJBURIY. `hidden` atributi brauzerning o'z uslubidagi `[hidden]{display:none}` orqali
   ishlaydi, lekin bizning HAR QANDAY `display` qoidamiz undan kuchliroq. `.boot{display:grid}`
   tufayli spinner `hidden` bo'lgandan keyin ham ekranni to'sib turgan — ilova ishlayotgan
   bo'lsa ham foydalanuvchi faqat aylanayotgan doirani ko'rgan. Bu qatorni o'chirmang. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  overscroll-behavior-y: none;
}

body { padding-bottom: calc(72px + var(--safe-b)); }

/* --- Yuklanish --- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 90; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--accent);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Ekran --- */
.screen { padding: 0 var(--pad); animation: screen-in 260ms var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }

.hd { padding: 18px 0 14px; }
.hd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hd-title { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -0.021em; }
.hd-sub { color: var(--dim); font-size: 14px; }

/* Katta summa: yirik matn zich tersiladi (optik tuzatish) */
.big-sum {
  font-size: clamp(38px, 12vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 2px;
}
.big-sum::after { content: " so'm"; font-size: 0.4em; font-weight: 500; color: var(--dim); letter-spacing: 0; }

.pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 9px 15px; font: inherit; font-size: 15px;
  font-variant-numeric: tabular-nums;
  transition: transform 100ms ease-out, background 120ms ease-out;
}
.pill-label { color: var(--dim); font-size: 13px; }
.pill:active { transform: scale(0.96); background: var(--card-2); }

/* --- Asosiy amal --- */
.cta {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 74px; padding: 0 20px; margin: 4px 0 20px;
  background: var(--accent); color: var(--accent-in);
  border: 0; border-radius: var(--r-lg);
  font: inherit; text-align: left;
  box-shadow: 0 10px 26px -12px rgba(61, 139, 255, 0.9);
  transition: transform 110ms ease-out, filter 110ms ease-out;
}
.cta:active { transform: scale(0.975); filter: brightness(0.94); }
.cta-plus { font-size: 30px; font-weight: 300; line-height: 1; opacity: 0.9; }
.cta-text { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.cta-text small { display: block; font-size: 13px; font-weight: 400; opacity: 0.78; letter-spacing: 0; }

/* --- Ro'yxat --- */
.section-title { color: var(--dim); font-size: 13px; font-weight: 600; text-transform: uppercase;
                 letter-spacing: 0.04em; margin: 22px 4px 10px; }
.list { display: flex; flex-direction: column; gap: 10px; }

.item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: var(--tap); padding: 13px 15px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); font: inherit; text-align: left;
  transition: transform 100ms ease-out, background 120ms ease-out;
}
.item:active { transform: scale(0.985); background: var(--card-2); }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 16px; font-weight: 600; letter-spacing: -0.005em; }
.item-sub { color: var(--dim); font-size: 13.5px; margin-top: 2px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-sum { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.item.is-open { border-color: rgba(255, 159, 10, 0.35); }

.tag { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em;
       padding: 3px 8px; border-radius: 7px; text-transform: uppercase; }
.tag-open { background: rgba(255, 159, 10, 0.16); color: var(--warn); }
.tag-cash { background: rgba(52, 199, 89, 0.15);  color: var(--good); }
.tag-card { background: rgba(61, 139, 255, 0.16); color: var(--accent); }

.empty { color: var(--dimmer); text-align: center; padding: 28px 16px; font-size: 15px; }

/* --- Kartochka --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px;
      padding: 13px 15px; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv-k { color: var(--dim); font-size: 15px; }
.kv-v { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kv-v.minus { color: var(--bad); }
.kv-v.plus  { color: var(--good); }
.kv.total { background: var(--card-2); }
.kv.total .kv-k, .kv.total .kv-v { font-size: 17px; font-weight: 700; }

/* --- Tugmalar qatori --- */
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 84px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  transition: transform 100ms ease-out, background 120ms ease-out;
}
.tile span { font-size: 22px; }
.tile:active { transform: scale(0.96); background: var(--card-2); }
.tile-key { background: rgba(61, 139, 255, 0.12); border-color: rgba(61, 139, 255, 0.4); color: #cfe0ff; }

/* --- Segment --- */
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--dim);
  font: inherit; font-size: 14px; font-weight: 600; padding: 7px 13px; border-radius: 8px;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.seg button.on { background: var(--card-2); color: var(--text); }

/* --- Pastki tablar: kontent ostidan o'tadi --- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 8px 6px calc(8px + var(--safe-b));
  background: rgba(15, 18, 24, 0.72);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: 0; color: var(--dimmer);
  font: inherit; font-size: 11px; font-weight: 600; padding: 5px 0;
  transition: color 140ms ease-out, transform 100ms ease-out;
}
.tabs button span { font-size: 21px; line-height: 1; filter: grayscale(1); opacity: 0.55; transition: all 140ms ease-out; }
.tabs button.on { color: var(--text); }
.tabs button.on span { filter: none; opacity: 1; }
.tabs button:active { transform: scale(0.92); }

/* --- Sheet: chaqirilgan joydan chiqadi, o'sha yo'l bilan qaytadi --- */
.scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  animation: fade-in 220ms var(--ease);
}
.scrim.out { animation: fade-out 200ms var(--ease) forwards; }
@keyframes fade-in  { from { opacity: 0; } }
@keyframes fade-out { to   { opacity: 0; } }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg-2);
  border-radius: 26px 26px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding: 8px var(--pad) calc(22px + var(--safe-b));
  box-shadow: 0 -18px 50px -12px rgba(0, 0, 0, 0.6);
  animation: sheet-in 380ms var(--ease);
}
.sheet.out { animation: sheet-out 260ms var(--ease) forwards; }
@keyframes sheet-in  { from { transform: translateY(100%); } }
@keyframes sheet-out { to   { transform: translateY(100%); } }

.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 6px auto 14px; }
.sheet h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; letter-spacing: -0.018em; }
.sheet .hint { color: var(--dim); font-size: 14px; margin: 0 0 16px; }

/* --- Chiplar: rusum, model, xizmat --- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 6px; }
.chip {
  min-height: 48px; padding: 11px 17px;
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  color: var(--text); font: inherit; font-size: 16px; font-weight: 600;
  transition: transform 100ms ease-out, background 120ms ease-out, border-color 120ms ease-out;
}
.chip:active { transform: scale(0.95); }
.chip.on { background: rgba(61, 139, 255, 0.16); border-color: var(--accent); color: #dbe9ff; }

/* Kichik chiplar: bir qatorga ko'p usta sig'ishi uchun (birgalikda bajarish). */
.chips-sm { gap: 7px; }
.chip-sm { min-height: 40px; padding: 8px 13px; font-size: 14.5px; border-radius: 11px; }

/* --- Maydonlar --- */
.field { margin: 14px 0; }
.field label { display: block; color: var(--dim); font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.input {
  width: 100%; min-height: var(--tap); padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  color: var(--text); font: inherit; font-size: 17px;
  transition: border-color 140ms ease-out;
}
.input:focus { outline: 0; border-color: var(--accent); }
/* Maydon + kamera tugmasi bir qatorda. */
.with-cam { display: flex; gap: 8px; align-items: stretch; }
.with-cam .input { flex: 1; min-width: 0; }
.cam {
  flex: 0 0 auto; width: 56px; min-height: var(--tap);
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  font-size: 22px; line-height: 1; color: var(--text);
  transition: transform 100ms ease-out, background 120ms ease-out;
}
.cam:active { transform: scale(0.94); background: var(--card-2); }

/* Bazadagi mos mashinalar — takroriy mijoz uchun eng tez yo'l. */
.suggest { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sug {
  text-align: left; padding: 11px 13px; font: inherit; font-size: 15px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; color: var(--text);
}
.sug:active { transform: scale(0.985); }
.sug b { font-variant-numeric: tabular-nums; }

.input.sum { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.input::placeholder { color: var(--dimmer); }

.btn {
  width: 100%; min-height: var(--tap); border: 0; border-radius: 15px;
  background: var(--accent); color: var(--accent-in);
  font: inherit; font-size: 17px; font-weight: 600;
  transition: transform 110ms ease-out, filter 110ms ease-out;
  margin-top: 8px;
}
.btn:active { transform: scale(0.98); filter: brightness(0.94); }
.btn[disabled] { opacity: 0.4; }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn-good { background: var(--good); color: #06240f; }
.btn-bad  { background: rgba(255, 69, 58, 0.14); color: var(--bad); border: 1px solid rgba(255, 69, 58, 0.35); }

.svc {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 14px; margin-bottom: 10px;
}
.svc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
/* Xizmat turini shu yerdan almashtiriladi — qatorni o'chirib qayta qo'shish shart emas. */
.svc-pick { flex: 1; min-width: 0; min-height: 46px; padding: 11px 13px; font-size: 16px; font-weight: 600; }
.svc-name { font-weight: 600; font-size: 16px; }
.svc-master { color: var(--dim); font-size: 13px; }
.pays { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 9px; }
.pays button {
  min-height: 44px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px;
  color: var(--dim); font: inherit; font-size: 14px; font-weight: 600;
  transition: transform 100ms ease-out, background 120ms ease-out;
}
.pays button:active { transform: scale(0.95); }
.pays button.on { background: rgba(61, 139, 255, 0.16); border-color: var(--accent); color: #dbe9ff; }

.x { background: transparent; border: 0; color: var(--dimmer); font-size: 20px; padding: 4px 8px; }

/* --- Toast --- */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translateX(-50%);
  z-index: 70; max-width: calc(100vw - 32px);
  background: var(--card-2); border: 1px solid var(--line); border-radius: 13px;
  padding: 13px 18px; font-size: 15px; font-weight: 500;
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.75);
  animation: toast-in 320ms var(--ease);
}
.toast.bad  { border-color: rgba(255, 69, 58, 0.5);  color: #ffd5d2; }
.toast.good { border-color: rgba(52, 199, 89, 0.45); color: #cdf3d8; }
.toast.out  { animation: toast-out 200ms var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translate(-50%, 14px) scale(0.96); } }
@keyframes toast-out { to   { opacity: 0; transform: translate(-50%, 8px)  scale(0.98); } }

/* --- Harakat kamaytirilgan bo'lsa: siljish emas, oddiy o'tish --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
  .screen, .sheet, .toast, .scrim { animation: fade-in 140ms ease-out; }
  .cta:active, .item:active, .chip:active, .tile:active, .btn:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .tabs { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
