/* ===== COMPONENTS: tugma, input, karta, badge, skeleton, sheet ===== */
.ic { width: 20px; height: 20px; flex: none; }
.screen { animation: screenIn .3s ease both; }

/* ---------- tugmalar ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--r-btn);
  font-weight: 600; font-size: 15px;
  transition: transform .12s, opacity .2s, box-shadow .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2f6bff, #4b8dff 55%, #6a7bff);
  box-shadow: 0 8px 22px rgba(47, 107, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-ghost { background: var(--surface-2); border: 1px solid var(--line); }
.btn-danger { background: rgba(255, 82, 119, .15); border: 1px solid rgba(255, 82, 119, .5); color: #ff9db1; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; box-shadow: none; filter: saturate(.6); }
.btn.loading { color: transparent; }
.btn.loading > * { visibility: hidden; }
.btn.loading::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
}

/* ---------- sarlavha ---------- */
.page-head { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 14px; }
.page-head h1 { flex: 1; font-size: 19px; font-weight: 700; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 2px 10px; }
.section-head h2 { font-size: 17px; font-weight: 700; }
.link-btn { color: var(--neon); font-size: 14px; font-weight: 600; min-height: 36px; padding: 0 4px; }

/* ---------- karta ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.card.p { padding: 16px; }

/* ---------- forma ---------- */
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field > label, .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px;
  background: rgba(8, 14, 38, .78); border: 1px solid var(--line); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: #5f6c9b; }
.input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(75, 141, 255, .18); }
.input.invalid { border-color: var(--danger); }
.input-wrap .input { padding-right: 52px; }
.input-btn {
  position: absolute; right: 4px; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; color: var(--neon);
}
select.input { appearance: none; -webkit-appearance: none; padding-right: 40px; }
.select-wrap { position: relative; }
.select-wrap > .ic { position: absolute; right: 14px; top: 14px; pointer-events: none; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.hint.err { color: var(--danger); } .hint.ok { color: var(--ok); }

/* ---------- key-value qatorlari ---------- */
.kv { display: grid; gap: 0; }
.kv-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid rgba(96, 132, 255, .12); }
.kv-row:last-child { border-bottom: 0; }
.kv-row span { color: var(--muted); }
.kv-row b { text-align: right; word-break: break-word; }
.kv-row.total b { font-size: 18px; color: #fff; }
.kv-row.disc b { color: var(--ok); }

/* ---------- badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .08); color: var(--text);
}
.badge.ok   { background: rgba(34, 211, 160, .15); color: var(--ok); }
.badge.warn { background: rgba(255, 176, 32, .15); color: var(--warn); }
.badge.bad  { background: rgba(255, 82, 119, .15); color: var(--danger); }
.badge.info { background: rgba(75, 141, 255, .18); color: var(--neon); }

/* ---------- skeleton ---------- */
.sk, .skeleton {
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(40, 56, 120, .35) 25%, rgba(80, 110, 220, .35) 37%, rgba(40, 56, 120, .35) 63%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.sk-head { height: 44px; width: 60%; margin-bottom: 16px; }
.sk-card { height: 120px; margin-bottom: 14px; }
.sk-card.short { height: 72px; }

/* ---------- empty / error ---------- */
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 48px 20px; }
.empty-ic { font-size: 48px; line-height: 1; margin-bottom: 4px; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 280px; }
.empty .btn { margin-top: 10px; }

/* ---------- sheet / modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: none; }
.modal-root.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 5, 18, .68); backdrop-filter: blur(4px); animation: screenIn .2s ease both; }
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 480px); max-height: 88dvh; overflow-y: auto;
  padding: 20px 18px calc(var(--safe-b) + 18px);
  background: linear-gradient(180deg, #111c4a, #0a1130);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
  animation: pop .25s ease both; outline: none;
}
.sheet-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.sheet-text { color: var(--muted); margin-bottom: 12px; }
.sheet-actions { display: grid; gap: 10px; margin-top: 16px; }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-radius: 24px; border-bottom: 1px solid var(--line); }
}
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 14px; margin-bottom: 10px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.choice-ic { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, #2f6bff, #6a3cff); }
.choice-ic .ic { width: 24px; height: 24px; }
.choice b { display: block; font-size: 15px; }
.choice small { color: var(--muted); font-size: 13px; }
.choice.on { border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon); }
.img-wrap { position: relative; overflow: hidden; background: linear-gradient(135deg, #1b2f8f, #5b34d6); }
.img-wrap > img { width: 100%; height: 100%; object-fit: cover; }
.img-wrap > img.is-broken { visibility: hidden; }