/* =========================================================
   Milliy Pin — zamonaviy o'zbekona dizayn
   Ranglar: lojuvard (ko'k), firuza, oltin, anor; naqsh: girih (8 qirrali yulduz)
   Avto rejim Telegram'ning kunduzgi/tungi sxemasiga ergashadi, ranglar brendniki.
   ========================================================= */
:root {
  --p-bg: #f5f2ec;
  --p-card: #ffffff;
  --p-card-2: #eee9df;
  --p-text: #161a23;
  --p-hint: #7d8291;
  --p-accent: #1b5fc1;
  --p-accent-2: #0e9faf;
  --p-sep: rgba(22, 26, 35, 0.08);
  --p-field: #f2eee6;
  --shadow: 0 1px 2px rgba(60, 45, 20, 0.05), 0 8px 24px rgba(60, 45, 20, 0.06);
  --shadow-lg: 0 12px 32px rgba(27, 95, 193, 0.25);

  --green: #1f9d55;
  --orange: #e08a00;
  --red: #c7363f;
  --blue: #1b5fc1;
  --gold: #c8962e;

  --radius: 20px;
  --radius-sm: 14px;
  --tabbar-h: 64px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Girih naqshi — mask sifatida ishlatiladi, rangi elementdan olinadi */
  --girih: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.3'%3E%3Crect x='17' y='17' width='22' height='22'/%3E%3Crect x='17' y='17' width='22' height='22' transform='rotate(45 28 28)'/%3E%3Ccircle cx='28' cy='28' r='4'/%3E%3Cpath d='M28 0v12.4M28 43.6V56M0 28h12.4M43.6 28H56M0 0l17 17M56 0 39 17M0 56l17-17M56 56 39 39'/%3E%3C/g%3E%3C/svg%3E");
  /* Ikat uslubidagi romb lenta */
  --ikat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='8' viewBox='0 0 16 8'%3E%3Cpath d='M0 4 4 0l4 4-4 4zM8 4l4-4 4 4-4 4z' fill='%23000'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  --p-bg: #0b1120;
  --p-card: #141c2e;
  --p-card-2: #1b2540;
  --p-text: #eef1f7;
  --p-hint: #8c94a8;
  --p-accent: #4d8df7;
  --p-accent-2: #22c0cc;
  --p-sep: rgba(255, 255, 255, 0.08);
  --p-field: #1b2540;
  --shadow: none;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
  --green: #34c27a;
  --orange: #f2a33a;
  --red: #ef5a62;
  --blue: #4d8df7;
  --gold: #e3b451;
  color-scheme: dark;
}

:root {
  --bg: var(--p-bg);
  --card: var(--p-card);
  --card-2: var(--p-card-2);
  --text: var(--p-text);
  --hint: var(--p-hint);
  --accent: var(--p-accent);
  --accent-2: var(--p-accent-2);
  --accent-text: #ffffff;
  --sep: var(--p-sep);
  --field: var(--p-field);
  --grad-brand: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --grad-gold: linear-gradient(135deg, #e0b04b 0%, #c7363f 100%);
}

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

html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 500 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { opacity: 0.5; }
input { font: inherit; color: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }

.i {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.i-sm { width: 18px; height: 18px; }
.i-xs { width: 14px; height: 14px; stroke-width: 2.5; }

.view {
  min-height: 100vh;
  padding: 12px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 36px);
}
.view.no-tabbar { padding-bottom: calc(var(--safe-bottom) + 32px); }
.page { animation: page-in 0.25s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }

.hint { color: var(--hint); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pressable { transition: transform 0.12s ease, opacity 0.12s ease; }
.pressable:active { transform: scale(0.97); opacity: 0.9; }

/* Naqshli fon: ::before girih bilan, bolalar ustida */
.ornament { position: relative; overflow: hidden; isolation: isolate; }
.ornament::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--orn-color, #fff); opacity: var(--orn-opacity, 0.13);
  -webkit-mask: var(--girih) 0 0 / 56px 56px repeat;
  mask: var(--girih) 0 0 / 56px 56px repeat;
}
.ikat-band {
  height: 8px; margin: 0 -1px;
  background: var(--gold); opacity: 0.55;
  -webkit-mask: var(--ikat) 0 0 / 16px 8px repeat-x;
  mask: var(--ikat) 0 0 / 16px 8px repeat-x;
}

.section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 28px 4px 12px;
  font-size: 20px; font-weight: 800; letter-spacing: -0.4px;
}
.title-mark { color: var(--gold); display: inline-flex; }
.title-mark .i { width: 20px; height: 20px; }
.group-title {
  margin: 24px 16px 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--hint);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  color: var(--chip, var(--accent));
  background: color-mix(in srgb, var(--chip, var(--accent)) 14%, transparent);
}
.chip.solid { color: #fff; background: var(--chip, var(--accent)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border-radius: var(--radius-sm);
  background: var(--grad-brand); color: var(--accent-text);
  font-size: 16px; font-weight: 700;
}
.btn.block { width: 100%; }
.btn.soft { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.white { background: #fff; color: #161a23; }
.btn.success { background: var(--green); color: #fff; }
.btn.danger-soft { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }

/* ---------- Tab bar (suzuvchi) ---------- */
.tabbar {
  position: fixed; z-index: 20;
  left: 12px; right: 12px; bottom: calc(10px + var(--safe-bottom));
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 6px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 10px 30px rgba(20, 20, 40, 0.14), 0 0 0 0.5px var(--sep);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; border-radius: 18px; color: var(--hint);
  font-size: 11px; font-weight: 700;
  transition: color 0.2s ease, background 0.2s ease;
}
.tab .i { width: 24px; height: 24px; transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1); }
.tab[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); }
.tab[aria-current="page"] .i { transform: translateY(-1px) scale(1.08); }

/* ---------- Brend ---------- */
.brand-bar { display: flex; align-items: center; gap: 10px; padding: 2px 0 14px; }
.brand-mark {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 12px; color: #fff;
  background: var(--grad-brand); box-shadow: var(--shadow-lg);
}
.brand-mark .i { width: 24px; height: 24px; }
.brand-mark.sm { width: 32px; height: 32px; border-radius: 10px; box-shadow: none; }
.brand-mark.sm .i { width: 20px; height: 20px; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.1; }
.brand-name span { color: var(--gold); }
.brand-tag { font-size: 12px; color: var(--hint); font-weight: 600; }

.avatar {
  display: grid; place-items: center; flex: none; overflow: hidden;
  width: 46px; height: 46px; border-radius: 50%;
  color: #fff; font-weight: 800; font-size: 17px;
  background: linear-gradient(135deg, hsl(var(--hue) 70% 58%), hsl(calc(var(--hue) + 40) 65% 46%));
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xl { width: 76px; height: 76px; font-size: 30px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 12px; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 800;
}
.pill .i { color: var(--accent); }

/* ---------- Bosh sahifa ---------- */
.hero {
  padding: 20px 16px 16px; border-radius: var(--radius); color: #fff;
  background: var(--grad-brand); box-shadow: var(--shadow-lg);
}
.hero .avatar { border: 2.5px solid rgba(255, 255, 255, 0.5); }
.hero h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.hero p { font-size: 14px; opacity: 0.88; }
.search-fake {
  display: flex; align-items: center; gap: 10px; width: 100%;
  height: 48px; margin-top: 16px; padding: 0 14px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.96); color: #7d8291; text-align: left; font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}
.search-fake .i { color: #1b5fc1; }
:root[data-theme="dark"] .search-fake { background: rgba(11, 17, 32, 0.55); color: rgba(255, 255, 255, 0.75); }
:root[data-theme="dark"] .search-fake .i { color: #fff; }

.promo {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  margin-top: 14px; padding: 18px 16px; border-radius: var(--radius);
  color: #fff; background: var(--grad-gold);
}
.promo .row { width: 100%; }
.promo .bubble {
  display: grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: 14px; background: rgba(255, 255, 255, 0.22);
}
.promo h3 { font-size: 17px; font-weight: 800; }
.promo p { font-size: 13px; opacity: 0.92; margin-top: 2px; }
.promo .btn { margin-left: 62px; color: #a8323a; }

.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 28px; }
.trust-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px; text-align: center; font-size: 12px; font-weight: 600; color: var(--hint); line-height: 1.3;
}
.trust-item .i { color: var(--accent-2); }

/* ---------- Mahsulot sahifasi ---------- */
.product-hero {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin: -12px -16px 0; padding: 28px 24px 8px; text-align: center;
  --orn-color: var(--accent); --orn-opacity: 0.06;
}
.product-hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-top: 6px; }
.product-hero p { color: var(--hint); max-width: 320px; font-weight: 500; }

.packages { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.package {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 14px; min-height: 96px; text-align: left;
  border: 2px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.package .qty { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
.package .price { font-size: 14px; color: var(--hint); font-weight: 600; }
.package .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 6px; }
.package .tick {
  position: absolute; top: 12px; right: 12px;
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--sep); color: transparent;
  transition: all 0.15s ease;
}
.package[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.package[aria-checked="true"] .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.package[aria-checked="true"] .price { color: var(--text); }

.field { padding: 14px 16px; }
.field + .field { border-top: 1px solid var(--sep); }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--hint); margin-bottom: 8px; }
.input-wrap {
  display: flex; align-items: center; gap: 8px;
  height: 50px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--field); color: var(--hint);
  border: 1.5px solid transparent; transition: border-color 0.15s ease;
}
.input-wrap.sm { height: 40px; width: 130px; padding: 0 10px; border-radius: 10px; }
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; font-weight: 600; color: var(--text); }
.input-wrap.sm input { font-size: 15px; text-align: right; }
.input-wrap .prefix { color: var(--hint); font-size: 16px; }
.field.invalid .input-wrap { border-color: var(--red); }
.field .field-hint { margin-top: 6px; font-size: 12px; color: var(--hint); }
.field.invalid .field-hint { color: var(--red); }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; text-align: left; }
.toggle-row .title { font-weight: 700; }
.switch {
  position: relative; flex: none; width: 51px; height: 31px; border-radius: 999px;
  background: var(--sep); transition: background 0.2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.2s ease;
}
[aria-checked="true"] > .switch { background: var(--green); }
[aria-checked="true"] > .switch::after { transform: translateX(20px); }

.note { display: flex; gap: 10px; margin-top: 16px; padding: 0 4px; font-size: 13px; color: var(--hint); }
.note .i { color: var(--gold); }

/* ---------- Ro'yxatlar ---------- */
.list { overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px; text-align: left; position: relative;
}
.list-row + .list-row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 74px;
  border-top: 1px solid var(--sep);
}
.list-row.plain + .list-row.plain::before { left: 16px; }
.list-row .title { font-weight: 700; }
.list-row .sub { font-size: 13px; color: var(--hint); margin-top: 1px; }
.list-row .end, .order-card .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-row .chev { color: var(--hint); opacity: 0.6; }
button.list-row:active { background: var(--card-2); }

.seg {
  display: inline-grid; grid-auto-flow: column; gap: 2px;
  padding: 3px; border-radius: 11px; background: var(--field);
}
.seg button { padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--hint); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

/* ---------- Qidiruv ---------- */
.search-bar {
  position: sticky; top: 0; z-index: 5;
  margin: -12px -16px 0; padding: 12px 16px 10px; background: var(--bg);
}
.search-bar .input-wrap { background: var(--card); box-shadow: var(--shadow); }

/* ---------- Bo'sh holat ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px 24px; text-align: center; }
.empty .bubble {
  display: grid; place-items: center; width: 84px; height: 84px; margin-bottom: 8px;
  border-radius: 28px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  transform: rotate(45deg);
}
.empty .bubble .i { width: 38px; height: 38px; transform: rotate(-45deg); }
.empty h2 { font-size: 20px; font-weight: 800; }
.empty p { color: var(--hint); max-width: 280px; margin-bottom: 12px; }
.empty .btn + .btn { margin-top: 0; }

.success .bubble { color: #fff; background: var(--green); animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop { from { transform: rotate(45deg) scale(0.4); opacity: 0; } }

/* ---------- Profil ---------- */
.profile-card {
  padding: 20px 16px 18px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, var(--r1), var(--r2));
  box-shadow: 0 12px 30px color-mix(in srgb, var(--r2) 35%, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.profile-card .avatar { border: 3px solid rgba(255, 255, 255, 0.4); }
.profile-card h2 { font-size: 20px; font-weight: 800; }
.profile-card .meta { font-size: 14px; opacity: 0.88; font-weight: 600; }
.profile-card .id-btn { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 13px; opacity: 0.85; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.stat { padding: 14px; }
.stat .label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--hint); font-weight: 600; }
.stat .value { margin-top: 4px; font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.stat .btn { margin-top: 10px; width: 100%; }

.ref-link {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm); background: var(--field);
  font-size: 13px; font-weight: 600; text-align: left; width: 100%;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 35%, transparent);
}
.ref-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }
.ref-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.ref-head { display: flex; gap: 12px; }
.ref-head h3 { font-size: 17px; font-weight: 800; }

/* ---------- Admin panel ---------- */
.admin-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; }
.admin-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.admin-tabs {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  padding: 4px; margin-bottom: 14px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow);
}
.admin-tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px; border-radius: 12px; font-size: 10.5px; font-weight: 700; color: var(--hint);
  min-width: 0;
}
.admin-tabs span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-tabs button[aria-selected="true"] { background: var(--grad-brand); color: #fff; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi { padding: 16px; }
.kpi.wide { grid-column: 1 / -1; }
.kpi-label { font-size: 13px; color: var(--hint); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--hint); font-weight: 600; margin-top: 2px; }

.filter-row { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter {
  flex: none; padding: 8px 14px; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow); font-size: 13px; font-weight: 700; color: var(--hint);
}
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.order-card { padding: 14px; margin-bottom: 10px; }
.order-card .title { font-weight: 800; }
.kv { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--field); }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 13px; }
.kv dt { color: var(--hint); font-weight: 600; }
.kv dd button { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--accent); text-align: right; }
.order-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

.admin-product { margin-bottom: 12px; overflow: hidden; }
.price-row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; font-weight: 700; border-top: 1px solid var(--sep); }
.price-save { padding: 10px 16px 14px; }

/* ---------- Fon: aurora + naqsh ---------- */
body::before, body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
}
body::before {
  background:
    radial-gradient(110% 55% at 100% -5%, color-mix(in srgb, var(--accent-2) 24%, transparent), transparent 62%),
    radial-gradient(90% 50% at -10% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(90% 45% at 50% 105%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 70%);
}
body::after {
  background: var(--accent); opacity: 0.07;
  -webkit-mask: var(--girih) 0 0 / 56px 56px, linear-gradient(#000 0%, transparent 55%);
  -webkit-mask-composite: source-in;
  mask: var(--girih) 0 0 / 56px 56px, linear-gradient(#000 0%, transparent 55%);
  mask-composite: intersect;
}
:root[data-theme="dark"] body::after { opacity: 0.09; }

.page-title { margin: 8px 4px 16px; font-size: 28px; font-weight: 800; letter-spacing: -0.6px; }

/* ---------- Ilova uslubidagi mahsulotlar ---------- */
.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 12px; }
.app-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.app-img {
  position: relative; display: block; width: 100%; aspect-ratio: 1;
  border-radius: 26%; overflow: hidden; background: var(--card);
  box-shadow: 0 8px 20px rgba(30, 30, 60, 0.12), 0 0 0 0.5px var(--sep);
}
.p-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.p-img.thumb { flex: none; width: 48px; height: 48px; border-radius: 14px; box-shadow: 0 0 0 0.5px var(--sep); }
.app-badge {
  position: absolute; left: 6px; bottom: 6px;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(10, 14, 28, 0.62); color: #fff; font-size: 10px; font-weight: 800;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.app-name {
  width: 100%; font-size: 13.5px; font-weight: 800; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.app-price { margin-top: -3px; font-size: 11.5px; font-weight: 700; color: var(--hint); }

.hero-img {
  display: block; width: 120px; height: 120px; border-radius: 32px; overflow: hidden; flex: none;
  box-shadow: 0 18px 36px rgba(20, 30, 70, 0.25), 0 0 0 0.5px var(--sep);
}
.hero-img.sm { width: 84px; height: 84px; border-radius: 24px; box-shadow: 0 8px 20px rgba(20, 30, 70, 0.18); }

.mini-icon {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 11px;
  color: var(--k); background: color-mix(in srgb, var(--k) 15%, transparent);
}
.mini-icon.lg { width: 46px; height: 46px; border-radius: 14px; }
.kpi .mini-icon { margin-bottom: 10px; }

/* ---------- Darajalar ---------- */
.emblem { flex: none; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.22)); }
.emblem.locked { filter: grayscale(1); opacity: 0.45; }

.bar { display: block; height: 6px; margin: 7px 0 5px; border-radius: 999px; background: var(--field); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--r1), var(--r2)); transition: width 0.6s ease; }
.bar.light { background: rgba(255, 255, 255, 0.28); }
.bar.light > span { background: #fff; }

.rank-strip { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 12px 14px; text-align: left; }
.rank-strip b { font-size: 15px; font-weight: 800; }
.rank-strip .chev { color: var(--hint); }

.rank-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin-top: 16px; padding: 10px 12px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.16); color: #fff; text-align: left;
}
.rank-title { display: block; font-size: 14px; font-weight: 800; }
.rank-row .small { display: block; opacity: 0.92; }

.rank-hero {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 24px 20px 20px; border-radius: var(--radius); color: #fff; text-align: center;
  background: linear-gradient(135deg, var(--r1), var(--r2));
  box-shadow: 0 14px 32px color-mix(in srgb, var(--r2) 35%, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.rank-hero h1 { margin-top: 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.rank-hero .bar { width: 100%; max-width: 280px; }

.how-xp { display: flex; gap: 12px; margin-top: 12px; }
.how-xp h3 { font-size: 15px; font-weight: 800; }

.ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ladder-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid transparent; }
.ladder-item.current { border-color: var(--r2); box-shadow: 0 8px 24px color-mix(in srgb, var(--r2) 25%, transparent); }
.ladder-item.locked { opacity: 0.8; }
.ladder-item b { font-size: 16px; font-weight: 800; }
.perk { margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--green); }
.ladder-item.locked .perk { color: var(--hint); }
.state { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--field); color: var(--hint); }
.state.ok { background: var(--green); color: #fff; }

/* ---------- Admin: formalar ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 4px 10px; }
.section-head h3 { font-size: 17px; font-weight: 800; }
.filter.off { opacity: 0.5; }
.filter .i { vertical-align: -2px; }
.gold-kpi { background: var(--grad-gold); color: #fff; }
.gold-kpi .kpi-label, .gold-kpi .kpi-sub { color: rgba(255, 255, 255, 0.88); }
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }

.form { display: grid; gap: 12px; }
.card + .card.form, .card.form + .card { margin-top: 12px; }
.form-label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--hint); }
.form input:not([type="color"]), .form select, .form textarea, .package-row input, .package-row select, .grid-3 input:not([type="color"]) {
  width: 100%; min-width: 0; height: 46px; padding: 0 12px; border-radius: 12px;
  border: 1.5px solid transparent; outline: 0; background: var(--field); color: var(--text);
  font: 600 15px var(--font);
}
.form textarea { height: auto; padding: 10px 12px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus, .package-row input:focus, .grid-3 input:focus { border-color: var(--accent); }
input[readonly] { opacity: 0.6; }
input[type="color"] { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: none; }

.i18n-input { display: flex; align-items: center; gap: 8px; }
.lang-tag {
  flex: none; padding: 4px 6px; border-radius: 6px; font-size: 11px; font-weight: 800;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.lang-seg { justify-self: start; }
.lang-pane { display: grid; gap: 12px; }
.chip-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle { padding: 8px 12px; border-radius: 999px; background: var(--field); color: var(--hint); font-size: 13px; font-weight: 700; }
.chip-toggle[aria-pressed="true"] { background: var(--accent); color: #fff; }
.toggle-row.flush { padding: 4px 0; }

.image-editor { display: flex; align-items: center; gap: 14px; }
label.btn { cursor: pointer; }

.package-row {
  display: grid; grid-template-columns: 0.9fr 1.2fr 1.3fr auto; gap: 8px; align-items: end;
  padding: 12px 14px;
}
.package-row + .package-row { border-top: 1px solid var(--sep); }
.package-row label span { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 700; color: var(--hint); }
.package-row input, .package-row select { height: 42px; padding: 0 10px; font-size: 14px; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 42px; border-radius: 12px; background: var(--field); color: var(--hint); }

.editor-actions {
  position: sticky; bottom: calc(12px + var(--safe-bottom)); z-index: 5;
  display: flex; gap: 10px; margin-top: 20px;
}
.editor-actions .btn { box-shadow: var(--shadow-lg); }
.btn.grow { flex: 1; }

.rank-editor { margin-bottom: 10px; }
.rank-editor .form { margin-top: 12px; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-top: 12px; }

/* ---------- Sheet va toast ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(5, 10, 25, 0.45); animation: fade-in 0.2s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  padding: 8px 16px calc(16px + var(--safe-bottom));
  border-radius: 24px 24px 0 0; background: var(--bg);
  animation: sheet-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet .grabber { width: 36px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: var(--sep); }
.sheet h3 { margin: 0 4px 12px; font-size: 17px; font-weight: 800; text-align: center; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(100%); } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 28px); z-index: 50;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 11px 16px; border-radius: 14px;
  background: rgba(16, 22, 38, 0.94); color: #fff; font-size: 14px; font-weight: 600;
  animation: fade-in 0.2s ease;
}

/* ---------- Skeleton ---------- */
.skeleton-screen { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.sk { border-radius: 14px; background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.sk-line { height: 18px; }
.w60 { width: 60%; } .w40 { width: 40%; }
.sk-block { height: 96px; border-radius: var(--radius); }
.sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sk-tile { height: 120px; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }

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