/* uCard AI mini app. Ranglar va o'lchamlar — Figma "uCard AI" faylidagi "uCard Mini App" to'plami. */
@font-face { font-family: "Inter"; src: url("/fonts/Inter.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #F3F6F5; --surface: #FFFFFF; --text: #10201D; --muted: #6B7672; --border: #E2E8E6;
  --primary: #0F4F47; --primary-soft: #E2F1ED; --on-primary: #FFFFFF;
  --accent: #F5B301; --accent-soft: #FFF3CC; --danger: #D14343; --danger-soft: #FDECEC;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 "Inter", -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.boot { margin: auto; font-weight: 700; font-size: 22px; color: var(--primary); }

/* --- yuqori panel (faqat brauzerda; Telegram ichida o'z sarlavhasi bor) */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar .back { color: var(--primary); font-weight: 500; min-width: 72px; text-align: left; }
.topbar .ttl { font-weight: 600; font-size: 16px; }
.topbar .right { min-width: 72px; text-align: right; }
body.in-tg .topbar { display: none; }

.body { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.footer { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.footer .sum { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.footer .sum b { color: var(--text); font-weight: 500; }

.h1 { font-size: 24px; font-weight: 700; line-height: 1.25; }
.h2 { font-size: 20px; font-weight: 700; line-height: 1.3; }
.h3 { font-size: 17px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; border-radius: var(--r-md); font-weight: 600; font-size: 16px; background: var(--primary); color: var(--on-primary); }
a.btn { text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--primary); border: 1px solid var(--border); }
.btn:disabled { opacity: .45; }
.link { color: var(--primary); font-weight: 500; font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; }
.notice { display: flex; gap: 10px; padding: 14px; border-radius: var(--r-md); font-size: 13px; line-height: 1.4; }
.notice.accent { background: var(--accent-soft); }
.notice.soft { background: var(--primary-soft); color: var(--primary); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }

/* --- qadamlar */
.steps { display: flex; flex-direction: column; gap: 10px; }
.steps .bar { display: flex; gap: 6px; }
.steps .bar i { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.steps .bar i.on { background: var(--primary); }
.steps span { font-size: 13px; font-weight: 500; color: var(--muted); }

/* --- bosh sahifa */
.balance { background: var(--primary); color: var(--on-primary); border-radius: var(--r-lg); padding: 18px; display: flex; align-items: center; justify-content: space-between; }
.balance .num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.balance .lbl { font-size: 13px; opacity: .75; }
.balance .top { background: var(--accent); color: var(--text); font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: 12px; }
.cta { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-align: left; width: 100%; }
.cta .ic { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 26px; font-weight: 400; flex: none; }
.cta .chev { color: var(--muted); font-size: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.thumb { width: 100%; aspect-ratio: 3 / 4; border-radius: var(--r-md); background: var(--border) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }
.lang { display: flex; background: var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.lang button { padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lang button.on { background: var(--surface); color: var(--text); }

/* --- ro'yxatlar */
.search { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 48px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.search input { flex: 1; border: 0; outline: 0; background: none; font-size: 15px; min-width: 0; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.list button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 15px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.list button:last-child { border-bottom: 0; }
.list button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.list .chev { color: var(--muted); }
.crumb { align-self: flex-start; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 500; padding: 7px 12px; border-radius: 999px; }

/* --- dizaynlar */
.design { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); text-align: left; }
.design.on { border: 2px solid var(--primary); padding: 7px; }
.design .pic { width: 100%; aspect-ratio: 4 / 5; border-radius: 12px; background: var(--border) center / cover no-repeat; }
.design .nm { font-weight: 600; padding: 0 4px; }
.design.on .nm { color: var(--primary); }
.design .ds { font-size: 12px; color: var(--muted); padding: 0 4px 6px; line-height: 1.3; }
.drow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; width: 100%; text-align: left; border-bottom: 1px solid var(--border); }
.drow:last-child { border-bottom: 0; }
.drow .pic { width: 48px; height: 64px; border-radius: 8px; background: var(--border) center / cover no-repeat; flex: none; }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: grid; place-items: center; }
.on > .radio, .radio.on { border-color: var(--primary); }
.on > .radio::after, .radio.on::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

/* --- shakl */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-weight: 600; }
.field > label em { color: var(--danger); font-style: normal; margin-left: 3px; }
.field .hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.field .err { font-size: 12px; color: var(--danger); }
.input { width: 100%; padding: 13px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); outline: 0; font-size: 15px; }
.input:focus { border-color: var(--primary); }
.field.bad .input, .field.bad .uploads .add { border-color: var(--danger); }
textarea.input { min-height: 92px; resize: vertical; line-height: 1.4; }
.unit { display: flex; align-items: center; gap: 8px; }
.unit span { color: var(--muted); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.chip .x { margin-left: 6px; opacity: .6; }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dims .input { text-align: center; padding: 13px 6px; }
.dims small { display: block; text-align: center; color: var(--muted); font-size: 11px; margin-top: 4px; }
.uploads { display: flex; gap: 10px; flex-wrap: wrap; }
.uploads .ph { position: relative; width: 96px; height: 128px; border-radius: 12px; background: var(--border) center / cover no-repeat; }
.uploads .ph button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(16, 32, 29, .7); color: #fff; font-size: 14px; line-height: 1; }
.uploads .ph.busy { opacity: .5; }
.uploads .add { width: 96px; height: 128px; border-radius: 12px; border: 1.5px dashed var(--primary); background: var(--surface); color: var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 500; }
.uploads .add b { font-size: 24px; font-weight: 400; line-height: 1; }
.context { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: var(--r-md); background: var(--primary-soft); color: var(--primary); }

/* --- reja */
.prow { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.prow:last-child { border-bottom: 0; }
.prow label { font-size: 11px; font-weight: 500; color: var(--muted); }
.prow input { border: 0; outline: 0; background: none; font-size: 15px; font-weight: 500; padding: 2px 0; width: 100%; }
.prow input.sub { font-size: 13px; font-weight: 400; color: var(--muted); }

/* --- jarayon */
.pstep { display: flex; align-items: center; gap: 12px; }
.pstep .dot { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); flex: none; display: grid; place-items: center; color: #fff; font-size: 13px; }
.pstep.done .dot { background: var(--primary); border-color: var(--primary); }
.pstep.active .dot { background: var(--accent); border-color: var(--accent); }
.pstep.active .nm { font-weight: 600; }
.pstep.todo .nm { color: var(--muted); }
.pbar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 6px; }
.pbar i { display: block; height: 100%; width: 40%; background: var(--primary); border-radius: 3px; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* --- natija */
.seg { display: flex; background: var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 0; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; }
.result { width: 100%; aspect-ratio: 3 / 4; border-radius: 16px; background: var(--border) center / cover no-repeat; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 500; padding: 7px 10px; border-radius: 999px; white-space: nowrap; }
.copy { background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 500; padding: 7px 11px; border-radius: 999px; white-space: nowrap; }
.pre { white-space: pre-wrap; line-height: 1.45; font-size: 14px; }
.acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.acts button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); color: var(--primary); }
.acts button b { font-size: 14px; font-weight: 600; }
.acts button small { font-size: 12px; color: var(--muted); }
.vote { display: flex; gap: 8px; }
.vote button { padding: 8px 14px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 500; }
.vote button.on { background: var(--primary); color: var(--on-primary); }

/* --- balans */
.pack { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); width: 100%; text-align: left; }
.pack.on { background: var(--primary-soft); border: 2px solid var(--primary); padding: 13px; }
.pack .price { text-align: right; font-weight: 700; font-size: 17px; }
.pack .price small { display: block; font-weight: 400; font-size: 11px; color: var(--muted); }
.tag { background: var(--accent); font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }

.tabbar { position: sticky; bottom: 0; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); }
.tabbar button { font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 18px; }
.tabbar button.on { color: var(--primary); font-weight: 600; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 13px; z-index: 20; max-width: 86vw; text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; font-size: 13px; }

/* to'lov */
.payrow { display: flex; align-items: center; gap: 10px; }
.st { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--accent-soft); }
.st.paid { background: var(--primary-soft); color: var(--primary); }
.st.rejected { background: var(--danger-soft); color: var(--danger); }
.qrbox { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr { width: 220px; max-width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px; background: #fff; }
.cardno { font-size: 18px; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.done { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 8px; }
.done .mark { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 30px; font-weight: 700; }
