/* R-Kone WebApp — стили. Светлая/тёмная тема переключается по теме Telegram. */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --surface-3: #e8e9ee;
  --text: #0f1115;
  --text-2: #3b3f48;
  --muted: #6b7280;
  --border: rgba(15, 17, 21, 0.07);
  --border-strong: rgba(15, 17, 21, 0.14);
  --accent: #ffd60a;
  --accent-2: #ffc300;
  --accent-ink: #141414;
  --accent-soft: rgba(255, 214, 10, 0.18);
  --money: #15803d;
  --money-soft: rgba(22, 163, 74, 0.12);
  --chart: #16a34a;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --warn: #b45309;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.1);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.1);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --bg-grad: linear-gradient(165deg, #f7f8fa 0%, #e9ebef 42%, #d8dbe1 100%);
  --floater-opacity: 0.42;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0d0e11;
  --surface: #17181d;
  --surface-2: #1f2027;
  --surface-3: #2a2c35;
  --text: #f3f4f6;
  --text-2: #d1d5db;
  --muted: #9ca3af;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --accent-soft: rgba(255, 214, 10, 0.14);
  --money: #4ade80;
  --money-soft: rgba(74, 222, 128, 0.12);
  --chart: #16a34a;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --bg-grad: linear-gradient(165deg, #23252b 0%, #15171b 45%, #0a0b0d 100%);
  --floater-opacity: 0.3;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--info); text-decoration: none; }
img { display: block; max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.bold { font-weight: 700; }
.money { color: var(--money); font-weight: 700; }
.strike { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }
.pre { white-space: pre-line; }

/* ---------------------------------------------------------------- фон: серый градиент + летающие деньги и карты */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--bg-grad); }
.floaters { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.floaters span {
  position: absolute; left: var(--x); bottom: -70px; font-size: var(--s); line-height: 1;
  opacity: var(--floater-opacity); will-change: transform;
  animation: floatUp var(--d) linear var(--dl) infinite;
}
@keyframes floatUp {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); }
  25% { transform: translate3d(var(--dx), -30vh, 0) rotate(calc(var(--r) * 0.5)); }
  50% { transform: translate3d(0, -60vh, 0) rotate(var(--r)); }
  75% { transform: translate3d(calc(var(--dx) * -1), -90vh, 0) rotate(calc(var(--r) * 1.5)); }
  100% { transform: translate3d(0, calc(-100vh - 140px), 0) rotate(calc(var(--r) * 2)); }
}
@media (prefers-reduced-motion: reduce) {
  .floaters span { animation: none; bottom: auto; top: var(--y); }
}

/* ---------------------------------------------------------------- layout */
#app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; min-height: 100vh; }
#view { padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); animation: fadeIn 0.18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 10px; margin: 0 -16px 4px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: 18px;
  box-shadow: 0 2px 8px rgba(255, 196, 0, 0.45);
}
.logo-dash { color: var(--muted); font-weight: 600; }
.balance-chip {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  background: var(--surface); border-radius: 999px; padding: 7px 12px 7px 9px;
  font-weight: 700; box-shadow: var(--shadow);
}
.balance-chip .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--money-soft); color: var(--money); display: grid; place-items: center; }

.page-head { display: flex; align-items: center; gap: 8px; padding: 14px 0 6px; }
.page-head h1 { font-size: 24px; line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
.page-back { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); flex: none; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-title h2 { font-size: 18px; margin: 0; letter-spacing: -0.01em; }
.section-title .link { font-size: 14px; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; border: 1px solid var(--border); }
.card + .card { margin-top: 12px; }
.card-title { font-weight: 700; font-size: 16px; margin: 0 0 8px; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; position: relative; width: 100%; text-align: left; }
.list-item + .list-item::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--border); }
.list-item .chev { color: var(--muted); flex: none; }
.list-item:active { background: var(--surface-2); }

.quote {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: 10px 12px; border-radius: 4px 12px 12px 4px; font-weight: 600;
}
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.notice.warn { background: var(--warn-soft); }
.notice.info { background: var(--info-soft); }
.notice.danger { background: var(--danger-soft); }
.notice.ok { background: var(--money-soft); }
.notice .ico { flex: none; font-size: 18px; line-height: 1.2; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 16px;
  background: var(--accent); color: var(--accent-ink); width: 100%;
  transition: transform 0.08s ease, opacity 0.15s;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn.disabled { opacity: 0.45; pointer-events: none; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.dark { background: var(--text); color: var(--bg); }
.btn.ghost { background: transparent; color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.success { background: #16a34a; color: #fff; }
.btn.outline { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text); }
.btn.sm { height: 38px; font-size: 14px; border-radius: 11px; padding: 0 12px; width: auto; }
.btn.xs { height: 30px; font-size: 13px; border-radius: 9px; padding: 0 10px; width: auto; font-weight: 600; }
.btn.auto { width: auto; }
.btn-row { display: flex; gap: 8px; }
.btn-row > .btn { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); flex: none; position: relative; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; box-shadow: none; background: var(--surface-2); }
.link-btn { color: var(--info); font-weight: 600; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- chips, badges */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; box-shadow: var(--shadow); white-space: nowrap;
}
.chip.active { background: var(--text); color: var(--bg); }
.chip.sm { height: 30px; font-size: 13px; padding: 0 11px; box-shadow: none; background: var(--surface-2); }
.chip.sm.active { background: var(--text); color: var(--bg); }
.chip .count { font-size: 12px; opacity: 0.6; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.accent { background: var(--accent); color: var(--accent-ink); }
.badge.ok { background: var(--money-soft); color: var(--money); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.dot-badge { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--surface); }

/* ---------------------------------------------------------------- search */
.search { display: flex; gap: 8px; margin: 4px 0 12px; }
.search-box { flex: 1; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; font-size: 15px; }
.search .icon-btn { width: 44px; height: 44px; border-radius: 14px; }

/* ---------------------------------------------------------------- promo */
.promo {
  position: relative; overflow: hidden; border-radius: 22px; padding: 18px 18px 18px;
  background: linear-gradient(135deg, #ffe14d 0%, #ffc300 100%); color: #141414; margin-bottom: 14px;
  min-height: 112px; display: flex; flex-direction: column; justify-content: center;
}
.promo h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.02em; max-width: 72%; }
.promo p { margin: 0; font-weight: 600; opacity: 0.8; max-width: 70%; font-size: 14px; }
.promo .coin { position: absolute; right: -10px; bottom: -14px; font-size: 84px; transform: rotate(-12deg); opacity: 0.95; }
.promo.has-img { padding: 0; min-height: 0; background: var(--surface); }
.promo.has-img img { width: 100%; }

/* ---------------------------------------------------------------- categories */
.cats { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 6px; padding: 2px 16px 6px; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; width: 132px; min-height: 104px; border-radius: 18px; padding: 12px; text-align: left; position: relative; overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between;
}
.cat .emoji { font-size: 26px; line-height: 1; }
.cat .t { font-weight: 700; font-size: 14px; line-height: 1.2; margin-top: 8px; }
.cat .s { font-size: 12px; color: var(--money); font-weight: 700; margin-top: 2px; }
.cat .lock { position: absolute; top: 10px; right: 10px; color: var(--muted); }
.cat::after { content: ''; position: absolute; right: -24px; top: -24px; width: 70px; height: 70px; border-radius: 50%; background: var(--cat-color, var(--accent)); opacity: 0.18; }
.cat.big { width: 100%; min-height: 0; flex-direction: row; align-items: center; gap: 14px; padding: 16px; margin-bottom: 14px; }
.cat.big .emoji { font-size: 34px; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.cat.big .t { margin: 0; font-size: 16px; }

/* ---------------------------------------------------------------- toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; margin: 10px 0 10px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { height: 32px; padding: 0 12px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; }
.select-pill { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: 10px; background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--text-2); }

/* ---------------------------------------------------------------- offer card */
.offers { display: flex; flex-direction: column; gap: 10px; }
.offer {
  display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow);
  text-align: left; width: 100%; position: relative;
}
.offer:active { transform: scale(0.99); }
.offer .body { flex: 1; min-width: 0; }
.offer .title { font-weight: 700; font-size: 15px; line-height: 1.25; }
.offer .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.offer .tags { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.offer .reward { text-align: right; flex: none; }
.offer .reward .amount { font-size: 17px; font-weight: 800; color: var(--money); white-space: nowrap; letter-spacing: -0.01em; }
.offer .reward .old { font-size: 12px; }
.offer.locked { opacity: 0.55; }
.offer.done .reward .amount { color: var(--muted); }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.tag.hot { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.tag.new { background: var(--info-soft); color: var(--info); }

.cover {
  width: 56px; height: 56px; border-radius: 15px; flex: none; position: relative; overflow: hidden;
  display: grid; place-items: center; font-weight: 900; font-size: 15px; letter-spacing: -0.02em;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.lg { width: 72px; height: 72px; border-radius: 20px; font-size: 19px; }
.cover.sm { width: 42px; height: 42px; border-radius: 12px; font-size: 12px; }
.cover.xs { width: 32px; height: 32px; border-radius: 9px; font-size: 10px; }

/* hero cover — по мотивам «Бот с заданиями / Пополнения / +1000 ₽» */
.hero {
  position: relative; border-radius: 24px; overflow: hidden; background: #1c1c1e; color: #fff; margin: 6px 0 14px;
  aspect-ratio: 16 / 10; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 18px;
}
.hero.img { background: var(--surface-2); padding: 0; }
.hero.img img { width: 100%; height: 100%; object-fit: cover; }
.hero .band { position: absolute; left: 0; right: 0; top: 0; height: 30%; }
.hero .avatar {
  position: absolute; top: 12%; left: 50%; transform: translateX(-50%);
  width: 30%; aspect-ratio: 1; max-width: 120px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: clamp(18px, 6vw, 32px); border: 5px solid #1c1c1e;
}
.hero .h-title { font-size: clamp(15px, 4.4vw, 20px); font-weight: 600; opacity: 0.92; }
.hero .h-sub { font-size: clamp(12px, 3.6vw, 16px); opacity: 0.55; margin-top: 2px; }
.hero .h-sum { font-size: clamp(30px, 10vw, 48px); font-weight: 800; color: #4ade80; letter-spacing: -0.02em; margin-top: 6px; line-height: 1; }

.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.kv > div { background: var(--surface); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow); }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-weight: 700; margin-top: 2px; font-size: 14px; }

.steps { counter-reset: s; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 10px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.conds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.conds li { display: flex; gap: 8px; }
.conds li::before { content: '•'; color: var(--danger); font-weight: 900; }

.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.cta-bar .inner { max-width: 608px; margin: 0 auto; display: flex; gap: 8px; }
.has-cta #view { padding-bottom: calc(96px + var(--safe-b)); }
.has-cta .tabbar { display: none; }

/* ---------------------------------------------------------------- tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border); display: flex; justify-content: center;
}
.tabbar .inner { display: flex; width: 100%; max-width: 640px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.tab.active { color: var(--text); }
.tab .ic { position: relative; height: 24px; }
.tab.active .ic::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent-2); transform: translateX(-50%); }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--muted); padding-left: 2px; }
.field .hint { font-size: 12px; color: var(--muted); padding-left: 2px; line-height: 1.35; }
.input, .textarea, .select {
  width: 100%; border: 1.5px solid transparent; outline: 0; background: var(--surface-2); color: var(--text);
  border-radius: 13px; padding: 12px 14px; font-size: 16px; transition: border-color 0.15s, background 0.15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent-2); background: var(--surface); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input.lg { font-size: 22px; font-weight: 700; padding: 12px 14px; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }
.form-card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.form-card h3 { margin: 0; font-size: 16px; }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle .tl { flex: 1; min-width: 0; }
.toggle .tl b { display: block; font-weight: 600; font-size: 15px; }
.toggle .tl span { font-size: 12.5px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 15px; background: var(--surface-3); transition: background 0.2s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s; }
.switch input:checked + .track { background: #22c55e; }
.switch input:checked + .track::after { transform: translateX(20px); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; line-height: 1.4; }
.check input { width: 22px; height: 22px; accent-color: #16a34a; flex: none; margin: 0; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); }
.swatch.active { box-shadow: 0 0 0 2px var(--text); }
input[type='color'] { width: 40px; height: 34px; border: 0; padding: 0; background: none; }

/* ---------------------------------------------------------------- uploads */
.uploads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.upl { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.upl img { width: 100%; height: 100%; object-fit: cover; }
.upl .rm { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; display: grid; place-items: center; }
.upl.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600; border: 2px dashed var(--border-strong); background: transparent; cursor: pointer; }
.upl.add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: var(--chart); border-radius: 3px; transition: width 0.2s; }
.img-field { display: flex; gap: 12px; align-items: center; }
.img-field .pv { width: 84px; height: 84px; border-radius: 16px; background: var(--surface-2) center/cover no-repeat; flex: none; display: grid; place-items: center; color: var(--muted); }

/* ---------------------------------------------------------------- sheets & overlays */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.45); animation: ovIn 0.2s ease; display: flex; align-items: flex-end; justify-content: center; }
@keyframes ovIn { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(20px + var(--safe-b)); animation: sheetIn 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
  overscroll-behavior: contain;
}
@keyframes sheetIn { from { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 10px; }
.sheet h2 { margin: 4px 0 12px; font-size: 21px; letter-spacing: -0.02em; }
.sheet .close { position: absolute; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-icon { width: 64px; height: 64px; border-radius: 20px; margin: 6px auto 12px; display: grid; place-items: center; font-size: 34px; background: var(--accent-soft); }

.viewer { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.94); display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .vbtn { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.14); color: #fff; display: grid; place-items: center; }
.viewer .vclose { top: 16px; right: 16px; }
.viewer .vprev { left: 12px; top: 50%; transform: translateY(-50%); }
.viewer .vnext { right: 12px; top: 50%; transform: translateY(-50%); }
.viewer .vcount { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; color: #fff; font-weight: 600; opacity: 0.8; }

.toast-wrap { position: fixed; left: 0; right: 0; top: 12px; z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: calc(100% - 32px); background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn 0.25s ease; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: #16a34a; color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* ---------------------------------------------------------------- states */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .e-ico { font-size: 46px; margin-bottom: 8px; }
.empty h3 { color: var(--text); margin: 0 0 4px; font-size: 17px; }
.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .logo-mark { width: 56px; height: 56px; border-radius: 18px; font-size: 30px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.7; } }

/* ---------------------------------------------------------------- statuses & timeline */
.status-hero { border-radius: 20px; padding: 18px; display: flex; gap: 14px; align-items: center; margin: 6px 0 12px; }
.status-hero .s-ico { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: rgba(255,255,255,0.5); flex: none; }
:root[data-theme='dark'] .status-hero .s-ico { background: rgba(0,0,0,0.25); }
.status-hero h3 { margin: 0; font-size: 18px; }
.status-hero p { margin: 2px 0 0; font-size: 13.5px; opacity: 0.85; }
.st-active { background: var(--info-soft); }
.st-pending { background: var(--warn-soft); }
.st-revision { background: var(--violet-soft); }
.st-approved { background: var(--money-soft); }
.st-rejected, .st-cancelled { background: var(--danger-soft); }
.timeline { display: flex; align-items: flex-start; margin: 4px 0 2px; }
.timeline .tl-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); text-align: center; position: relative; font-weight: 600; }
.timeline .tl-step .d { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; z-index: 1; font-size: 12px; color: var(--muted); }
.timeline .tl-step.done .d { background: #16a34a; color: #fff; }
.timeline .tl-step.cur .d { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline .tl-step.fail .d { background: var(--danger); color: #fff; }
.timeline .tl-step.done, .timeline .tl-step.cur { color: var(--text); }
.timeline .tl-step:not(:first-child)::before { content: ''; position: absolute; top: 12px; right: 50%; width: 100%; height: 2px; background: var(--surface-3); }
.timeline .tl-step.done::before, .timeline .tl-step.cur::before { background: #16a34a !important; }

/* ---------------------------------------------------------------- profile */
.wallet {
  border-radius: 24px; padding: 20px; color: #141414; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, #fff3a3 0%, #ffd60a 45%, #ffbf00 100%);
  box-shadow: 0 10px 30px rgba(255, 191, 0, 0.3);
}
.wallet .w-label { font-weight: 600; opacity: 0.7; font-size: 14px; }
.wallet .w-sum { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0 14px; }
.wallet .btn { background: #141414; color: #fff; }
.wallet .btn.secondary { background: rgba(255,255,255,0.55); color: #141414; }
.wallet .w-deco { position: absolute; right: -30px; top: -30px; width: 140px; height: 140px; border-radius: 50%; border: 22px solid rgba(255,255,255,0.25); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.stat .s-k { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .s-v { font-size: 21px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: 22px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 38px; height: 38px; font-size: 15px; }
.ref-link { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 13px; padding: 4px 4px 4px 12px; font-size: 13.5px; font-weight: 600; }
.ref-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row .bl { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 4px; }
.bar-row .bt { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-row .bt > div { height: 100%; border-radius: 4px; background: var(--chart); }

/* chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 150px; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .bar { fill: var(--chart); }
.chart .bar.dim { opacity: 0.35; }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart-tip { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--muted); margin-bottom: 8px; min-height: 20px; }
.chart-tip b { color: var(--text); font-size: 15px; }

/* ---------------------------------------------------------------- reviews */
.rv-summary { display: flex; gap: 18px; align-items: center; }
.rv-big { font-size: 46px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stars { color: #f5b301; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: var(--surface-3); }
.dist { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.dist .dr { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dist .dt { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.dist .dt > div { height: 100%; background: #f5b301; border-radius: 3px; }
.review { background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.review + .review { margin-top: 10px; }
.review .rv-text { margin: 8px 0 0; line-height: 1.5; white-space: pre-line; }
.review .rv-photos { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; }
.review .rv-photos img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex: none; }
.star-input { display: flex; gap: 6px; justify-content: center; margin: 4px 0; }
.star-input button { font-size: 40px; line-height: 1; color: var(--surface-3); transition: transform 0.1s; }
.star-input button.on { color: #f5b301; }
.star-input button:active { transform: scale(0.88); }

/* ---------------------------------------------------------------- gates (ИП) */
.gate { text-align: center; padding: 24px 18px; }
.gate .g-ico { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 38px; background: var(--accent-soft); }
.gate h2 { margin: 0 0 8px; font-size: 21px; letter-spacing: -0.02em; }
.gate p { margin: 0 0 16px; color: var(--text-2); line-height: 1.5; }
.choice { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); width: 100%; text-align: left; }
.choice .c-ico { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; flex: none; }
.choice b { display: block; font-size: 16px; }
.choice span { color: var(--muted); font-size: 13px; }
.step-label { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-weight: 800; font-size: 15px; }
.step-label .n { width: 26px; height: 26px; border-radius: 9px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 13px; }
.step-label.off { color: var(--muted); }
.step-label.off .n { background: var(--surface-3); color: var(--muted); }

/* ---------------------------------------------------------------- admin */
.adm-nav { position: sticky; top: 0; z-index: 15; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 10px 0 8px; margin: 0 -16px; }
.adm-nav .chips { margin: 0; }
.adm-nav .chip { position: relative; }
.adm-nav .chip .dot-badge { top: -5px; right: -5px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 20px; font-weight: 800; margin-top: 2px; letter-spacing: -0.02em; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mod-card { background: var(--surface); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.mod-card + .mod-card { margin-top: 12px; }
.mod-photos { display: flex; gap: 6px; overflow-x: auto; margin: 10px -2px 0; padding: 0 2px; }
.mod-photos img { width: 92px; height: 120px; object-fit: cover; border-radius: 12px; flex: none; background: var(--surface-2); }
.kv-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13.5px; margin-top: 10px; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; font-weight: 600; word-break: break-word; }
.adm-offer { display: flex; gap: 10px; align-items: center; padding: 10px 12px; }
.adm-offer .stats-line { font-size: 12px; color: var(--muted); margin-top: 3px; }
.reorder { display: flex; flex-direction: column; gap: 2px; }
.reorder button { width: 28px; height: 22px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.field-builder .fb-row { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.field-builder .fb-row + .fb-row { margin-top: 8px; }
.preview-box { background: var(--surface-2); border-radius: 18px; padding: 10px; }
.sticky-save { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(10px + var(--safe-b)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
.sticky-save .inner { max-width: 608px; margin: 0 auto; display: flex; gap: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 4px; font-size: 12px; }
.table td { padding: 8px 4px; border-top: 1px solid var(--border); }
.table td.r, .table th.r { text-align: right; }

@media (min-width: 520px) {
  .uploads { grid-template-columns: repeat(4, 1fr); }
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
