:root {
  --bg: #0d1118;
  --surface: #151b26;
  --surface-2: #1c2433;
  --border: #252f40;
  --border-soft: #1e2736;
  --text: #f0f4fa;
  --muted: #7d8899;
  --accent: #4d7cfe;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(77, 124, 254, 0.13);
  --green: #2dd4a0;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body { padding-top: var(--safe-top); }

.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

/* ── Ikonkalar ──────────────────────────────────────── */
.ico {
  width: 22px; height: 22px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle;
}
.ico.sm { width: 15px; height: 15px; stroke-width: 2.2; }

/* ── Splash ─────────────────────────────────────────── */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; background: var(--bg);
}
.splash-logo {
  font-size: 32px; font-weight: 800; letter-spacing: -1px;
  background: linear-gradient(135deg, #6f9bff, #a78bfa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.screen { animation: fade 0.26s cubic-bezier(.22,.9,.3,1); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.fail { text-align: center; padding: 90px 32px 40px; }
.fail-icon { width: 46px; height: 46px; color: var(--muted); margin-bottom: 16px; }
.fail-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.3px; }
.fail-text { color: var(--red); font-size: 14.5px; margin-bottom: 16px; }
.fail-hint { color: var(--muted); font-size: 13.5px; }

/* ── Ro'yxatdan o'tish ──────────────────────────────── */
.reg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 4px;
}
.brand {
  font-size: 20px; font-weight: 800; letter-spacing: -0.7px;
  background: linear-gradient(135deg, #6f9bff, #a78bfa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.reg-steps { display: flex; gap: 6px; align-items: center; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border); transition: all 0.3s cubic-bezier(.22,.9,.3,1);
}
.dot.active {
  width: 22px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.step { padding: 12px 20px 44px; }
.step-title {
  font-size: 28px; font-weight: 800; margin: 12px 0 8px;
  letter-spacing: -0.9px; line-height: 1.15;
}
.step-sub { color: var(--muted); margin: 0 0 26px; font-size: 14.5px; line-height: 1.55; }

.field { margin-bottom: 20px; }
.label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--muted); margin-bottom: 9px; letter-spacing: 0.1px;
}
.input {
  width: 100%; padding: 15px 16px; font-size: 16px; font-weight: 500;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 14px; color: var(--text);
  font-family: inherit; outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.input:focus {
  border-color: var(--accent); background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.input::placeholder { color: #4e5a6e; font-weight: 400; }
.hint {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); margin-top: 9px;
}
.hint b { color: var(--text); font-weight: 600; }

/* Kalendar input */
.date-wrap { position: relative; }
.date-input { padding-right: 46px; }
.date-input::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; margin: 0; padding: 0;
}
.date-input::-webkit-date-and-time-value { text-align: left; }
.date-input:invalid { color: #4e5a6e; }
.date-ico {
  position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}

/* Segment */
.seg { display: flex; gap: 9px; }
.seg-btn {
  flex: 1; padding: 14px; font-size: 15px; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 14px; color: var(--muted);
  font-family: inherit; cursor: pointer;
  transition: all 0.2s cubic-bezier(.22,.9,.3,1);
}
.seg-btn:active { transform: scale(0.97); }
.seg-btn.on {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 0 4px rgba(77,124,254,0.08);
}

/* Tugmalar */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 16px;
  font-size: 15.5px; font-weight: 650; font-family: inherit;
  border-radius: 14px; border: none; cursor: pointer;
  transition: transform 0.13s, opacity 0.2s, filter 0.2s;
}
.btn:active { transform: scale(0.982); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #5f6ffb);
  color: #fff; margin-top: 10px;
  box-shadow: 0 6px 20px -8px rgba(77,124,254,0.7);
}
.btn.primary:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.btn.ghost {
  background: transparent; color: var(--muted);
  margin-top: 8px; font-weight: 550; font-size: 14.5px;
}

/* Orqaga — ko'rinadigan pill */
.back-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px 9px 12px; margin-bottom: 16px;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 100px; color: var(--text);
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all 0.18s;
}
.back-pill:active { transform: scale(0.96); border-color: var(--accent); color: var(--accent); }

/* Topildi */
.found-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 100px;
  background: rgba(45, 212, 160, 0.13); color: var(--green);
  font-size: 13px; font-weight: 650; margin-bottom: 8px;
}

/* Xira karta */
.readonly-card {
  background: var(--surface); border: 1.5px solid var(--border-soft);
  border-radius: var(--radius); padding: 3px 17px; margin-bottom: 15px;
  opacity: 0.72;
}
.ro-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border-soft);
}
.ro-row:last-child { border-bottom: none; }
.ro-label { color: var(--muted); font-size: 13.5px; flex-shrink: 0; }
.ro-value { font-weight: 650; text-align: right; word-break: break-word; }

/* Telefon karta */
.phone-card {
  background: linear-gradient(140deg, rgba(77,124,254,0.13), rgba(139,92,246,0.08));
  border: 1.5px solid rgba(77,124,254,0.26);
  border-radius: var(--radius); padding: 17px; margin-bottom: 22px;
}
.phone-card-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 9px;
}
.phone-model { font-size: 19px; font-weight: 750; margin-bottom: 11px; letter-spacing: -0.4px; }
.phone-specs { display: flex; flex-wrap: wrap; gap: 7px; }
.spec {
  padding: 6px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  background: rgba(255,255,255,0.07); color: var(--text);
}

.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 13px 15px; border-radius: 13px; font-size: 14px;
  margin-bottom: 15px; font-weight: 500;
}
.alert.error { background: rgba(248,113,113,0.12); color: var(--red); }

/* ── Asosiy ilova ───────────────────────────────────── */
.tab { padding: 18px 18px 100px; }
.tab-sub { color: var(--muted); font-size: 14px; margin: -6px 0 18px; }
.tab-sub b { color: var(--text); font-weight: 650; }

.hero { text-align: center; padding: 10px 0 2px; }
.avatar {
  width: 74px; height: 74px; margin: 0 auto 14px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 29px; font-weight: 750; color: #fff;
  background: linear-gradient(140deg, #4d7cfe, #8b5cf6);
  box-shadow: 0 10px 28px -12px rgba(77,124,254,0.8);
}
.hero-name { font-size: 23px; font-weight: 750; letter-spacing: -0.6px; }
.hero-id { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

.balance-card {
  background: linear-gradient(145deg, var(--surface), #192132);
  border: 1.5px solid var(--border);
  border-radius: 20px; padding: 22px; margin: 20px 0 0;
}
.balance-label {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.9px;
}
.balance-amount {
  font-size: 36px; font-weight: 800; margin: 8px 0 16px;
  letter-spacing: -1.6px; color: var(--green);
  font-variant-numeric: tabular-nums;
}
.balance-amount small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.balance-btn { margin-top: 0; }

.stats { display: flex; gap: 10px; margin: 14px 0 4px; }
.stat {
  flex: 1; background: var(--surface); border: 1.5px solid var(--border-soft);
  border-radius: 16px; padding: 15px 12px; text-align: center;
}
.stat-ico { color: var(--muted); margin-bottom: 7px; }
.stat-ico.ok { color: var(--green); }
.stat-value { font-size: 19px; font-weight: 750; letter-spacing: -0.4px; }
.stat-value.ok { color: var(--green); font-size: 17px; }
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.section-label {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.9px;
  margin: 26px 0 11px;
}

.info-card {
  background: var(--surface); border: 1.5px solid var(--border-soft);
  border-radius: var(--radius); padding: 3px 17px;
}
.info-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border-soft);
}
.info-row:last-child { border-bottom: none; }
.info-ico {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.info-k { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.info-v { font-weight: 650; margin-top: 1px; }

/* Kartalar */
.card {
  background: var(--surface); border: 1.5px solid var(--border-soft);
  border-radius: 16px; padding: 16px; margin-bottom: 10px;
}
.card.tappable { cursor: pointer; transition: transform 0.14s, border-color 0.2s, background 0.2s; }
.card.tappable:active { transform: scale(0.988); border-color: var(--accent); background: var(--surface-2); }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-title { font-weight: 650; letter-spacing: -0.2px; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.amount { font-weight: 750; font-size: 15.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount.plus { color: var(--green); }
.amount.minus { color: var(--red); }

.badge {
  display: inline-block; padding: 5px 11px; border-radius: 8px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.badge.pending { background: rgba(251,191,36,0.14); color: var(--amber); }
.badge.done { background: rgba(45,212,160,0.14); color: var(--green); }

.empty { text-align: center; color: var(--muted); padding: 44px 20px; font-size: 14.5px; }
.chev { color: var(--muted); width: 18px; height: 18px; flex-shrink: 0; }

/* Tabbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: rgba(21,27,38,0.93);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bot);
}
.tabbtn {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 11px 4px 10px; background: none; border: none;
  color: var(--muted); font-size: 10.5px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: color 0.2s;
}
.tabbtn .ico { width: 21px; height: 21px; transition: transform 0.2s; }
.tabbtn.active { color: var(--accent); }
.tabbtn.active .ico { transform: translateY(-1px); }
.tabbtn.active::before {
  content: ""; position: absolute; top: 0; left: 50%;
  transform: translateX(-50%); width: 26px; height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 26px;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  animation: fade 0.2s ease;
}
.modal-box {
  width: 100%; max-width: 340px; background: var(--surface-2);
  border: 1.5px solid var(--border); border-radius: 22px;
  padding: 28px 22px 20px; text-align: center;
}
.modal-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.modal-icon .ico { width: 28px; height: 28px; stroke-width: 2.4; }
.modal-icon.ok { background: rgba(45,212,160,0.14); color: var(--green); }
.modal-icon.warn { background: rgba(251,191,36,0.14); color: var(--amber); }
.modal-icon.err { background: rgba(248,113,113,0.14); color: var(--red); }
.modal-icon.info { background: var(--accent-soft); color: var(--accent); }
.modal-title { font-size: 19px; font-weight: 750; margin-bottom: 8px; letter-spacing: -0.4px; }
.modal-text { color: var(--muted); font-size: 14.5px; margin-bottom: 22px; white-space: pre-line; }
.modal-actions { display: flex; flex-direction: column; gap: 2px; }
.modal-actions .btn { margin-top: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-bot));
  transform: translateX(-50%); z-index: 300;
  background: var(--surface-2); border: 1.5px solid var(--border);
  padding: 13px 20px; border-radius: 100px;
  font-size: 14px; font-weight: 600; max-width: 85vw; text-align: center;
  box-shadow: 0 12px 32px -12px rgba(0,0,0,0.7);
  animation: toastIn 0.26s cubic-bezier(.22,.9,.3,1);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Yorug' mavzu */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8fafd;
    --border: #e3e8f0;
    --border-soft: #eceff5;
    --text: #0f1724;
    --muted: #68748a;
    --accent: #3568f0;
    --accent-soft: rgba(53, 104, 240, 0.09);
    --green: #0ea574;
    --red: #dc2626;
  }
  :root:not([data-theme="dark"]) .spec { background: rgba(0,0,0,0.05); }
  :root:not([data-theme="dark"]) .modal { background: rgba(0,0,0,0.38); }
  :root:not([data-theme="dark"]) .tabbar { background: rgba(255,255,255,0.93); }
  :root:not([data-theme="dark"]) .balance-card { background: linear-gradient(145deg, #fff, #f6f8fc); }
  :root:not([data-theme="dark"]) .input::placeholder { color: #9aa5b6; }
}


/* Kafolat taloni kartasi */
.warranty-card { padding: 16px; }
.war-top { display: flex; align-items: center; gap: 13px; }
.war-ico {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(45, 212, 160, 0.14); color: var(--green);
}
.war-text { min-width: 0; }
.war-title { font-weight: 650; font-size: 15px; }
.war-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.war-btn { margin-top: 14px; }
