/* Atom_Numbers — общая тема Mini App и админ-панели: «жидкое стекло» на тёмно-фиолетовом.
   Цвета бренда подставляются из настроек магазина (shared/ui.js → applyTheme).

   Как устроено стекло:
   1. Под интерфейсом медленно плывут цветные световые пятна (body::before/::after) — им есть что преломлять.
   2. Плавающие слои (шапка, нижнее меню, панель покупки, шторки, модалки) размывают то, что под ними, — backdrop-filter.
   3. Карточки — полупрозрачная заливка + блик по верхней кромке + мягкая тень. Без blur: на длинных списках он дорогой,
      а на плавном фоне ничего не добавляет. */
:root {
  --accent: #7c4dff;
  --accent-2: #b388ff;
  --accent-rgb: 124, 77, 255;
  --accent-deep: #5a2fe0;
  --bg: #07040f;
  --bg-2: #0d0818;
  --card: #120b22;
  --card-2: #1a1030;
  --line: rgba(205, 188, 255, 0.12);
  --line-strong: rgba(205, 188, 255, 0.24);
  --text: #f6f2ff;
  --muted: #a99ecb;
  --faint: #75699a;
  --ok: #3ddc97;
  --warn: #ffb74d;
  --bad: #ff5c7a;
  --info: #5ec8ff;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 18px 50px -12px rgba(2, 0, 10, 0.75), 0 2px 10px rgba(2, 0, 10, 0.3);
  --font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* стекло */
  --glass-fill: linear-gradient(152deg, rgba(255, 255, 255, 0.125) 0%, rgba(255, 255, 255, 0.04) 46%, rgba(255, 255, 255, 0.07) 100%);
  --glass-tint: rgba(var(--accent-rgb), 0.075);
  --glass-edge: rgba(255, 255, 255, 0.13);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.27), inset 0 -1px 0 rgba(255, 255, 255, 0.04), inset 1px 0 0 rgba(255, 255, 255, 0.05);
  --glass-drop: 0 16px 36px -14px rgba(2, 0, 10, 0.7), 0 2px 8px rgba(2, 0, 10, 0.25);
  --float-fill: linear-gradient(152deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.05) 50%, rgba(255, 255, 255, 0.09) 100%);
  --float-tint: rgba(16, 9, 34, 0.5);
  --float-blur: blur(24px) saturate(180%);
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.06) 46%, rgba(255, 255, 255, 0) 52%);
  color-scheme: dark;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root { --accent-deep: color-mix(in srgb, var(--accent) 62%, #1a0a4a); }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Световые пятна за стеклом. Двигаются только transform'ом — это дёшево для GPU. */
body::before, body::after {
  content: ''; position: fixed; inset: -18%; pointer-events: none; will-change: transform;
}
body::before {
  z-index: -2;
  background:
    radial-gradient(40% 34% at 80% 10%, rgba(var(--accent-rgb), 0.66), transparent 72%),
    radial-gradient(36% 32% at 6% 82%, rgba(255, 64, 200, 0.38), transparent 72%),
    radial-gradient(30% 26% at 70% 48%, rgba(var(--accent-rgb), 0.3), transparent 72%);
  animation: drift-a 42s ease-in-out infinite alternate;
}
body::after {
  z-index: -1;
  background:
    radial-gradient(24% 22% at 16% 20%, rgba(70, 175, 255, 0.24), transparent 72%),
    radial-gradient(28% 26% at 90% 78%, rgba(var(--accent-rgb), 0.34), transparent 72%),
    radial-gradient(18% 16% at 52% 54%, rgba(255, 110, 220, 0.1), transparent 72%);
  animation: drift-b 54s ease-in-out infinite alternate;
}
@keyframes drift-a { from { transform: translate3d(-3%, 2%, 0) rotate(0deg) scale(1); } to { transform: translate3d(4%, -4%, 0) rotate(8deg) scale(1.1); } }
@keyframes drift-b { from { transform: translate3d(3%, -2%, 0) rotate(0deg) scale(1.05); } to { transform: translate3d(-5%, 4%, 0) rotate(-9deg) scale(0.96); } }

a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.flag { display: inline-block; flex: none; height: 1em; width: 1.3333em; object-fit: cover; border-radius: 0.16em; vertical-align: -0.14em; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 2px 6px rgba(0, 0, 0, 0.35); background: rgba(255, 255, 255, 0.06); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.gap-lg { gap: 18px; }
.center { text-align: center; }
.right { text-align: right; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Карточки ---------- */
.card {
  background: var(--glass-fill);
  background-color: var(--glass-tint);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  box-shadow: var(--glass-hi), var(--glass-drop);
  padding: 16px;
}
.card.flat { background: rgba(255, 255, 255, 0.045); box-shadow: var(--glass-hi); }
.card.glow { border-color: rgba(var(--accent-rgb), 0.5); box-shadow: var(--glass-hi), 0 0 0 1px rgba(var(--accent-rgb), 0.12), 0 18px 46px -10px rgba(var(--accent-rgb), 0.38); }
.card-title { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 8px; font-weight: 700; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border-radius: 16px; border: 1px solid var(--glass-edge);
  background: var(--glass-fill); background-color: rgba(255, 255, 255, 0.03); color: var(--text);
  box-shadow: var(--glass-hi), 0 6px 16px -8px rgba(2, 0, 10, 0.7);
  font-weight: 650; cursor: pointer; user-select: none;
  transition: transform 0.14s ease, background-color 0.18s ease, border-color 0.18s ease, opacity 0.15s ease, box-shadow 0.22s ease, filter 0.18s ease;
}
.btn:hover { background-color: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--gloss), linear-gradient(135deg, var(--accent), var(--accent-deep));
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.28); color: #fff;
  text-shadow: 0 1px 2px rgba(20, 5, 70, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 6px rgba(20, 5, 70, 0.35), 0 10px 26px -6px rgba(var(--accent-rgb), 0.65);
}
.btn.primary:hover { filter: brightness(1.12) saturate(1.1); background-color: transparent; border-color: rgba(255, 255, 255, 0.4); }
.btn.danger { background: linear-gradient(152deg, rgba(255, 92, 122, 0.22), rgba(255, 92, 122, 0.08)); background-color: transparent; border-color: rgba(255, 92, 122, 0.42); color: #ffa9b9; }
.btn.danger:hover { background-color: rgba(255, 92, 122, 0.12); }
.btn.ghost { background: transparent; background-color: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background-color: rgba(255, 255, 255, 0.07); color: var(--text); }
.btn.sm { min-height: 34px; padding: 0 13px; border-radius: 12px; font-size: 13px; }
.btn.lg { min-height: 52px; font-size: 16px; border-radius: 18px; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 40px; min-height: 40px; }
.btn .spin { width: 16px; height: 16px; border-width: 2px; }
:focus-visible { outline: 2px solid rgba(var(--accent-rgb), 0.9); outline-offset: 2px; }
.input:focus-visible { outline: none; }

/* ---------- Формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.hint { font-size: 12px; color: var(--faint); }
/* поле — «вдавленное» стекло: тёмная заливка, тень сверху, светлая кромка снизу */
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 15px;
  background: rgba(6, 3, 16, 0.38); border: 1px solid var(--line); border-radius: 15px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.07);
  outline: none; transition: border-color 0.18s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.4; }
.input:focus { border-color: rgba(var(--accent-rgb), 0.95); background-color: rgba(6, 3, 16, 0.5); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(var(--accent-rgb), 0.28), 0 0 24px -4px rgba(var(--accent-rgb), 0.5); }
.input::placeholder { color: var(--faint); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
select.input option { background: #130b25; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--glass-edge); border-radius: 99px; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35); transition: background 0.22s, box-shadow 0.22s; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(180deg, #fff, #dcd2ff); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 -1px 2px rgba(90, 47, 224, 0.25); transition: transform 0.26s cubic-bezier(0.3, 1.5, 0.5, 1); }
.switch input:checked + i { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); border-color: rgba(255, 255, 255, 0.3); box-shadow: inset 0 1px 3px rgba(20, 5, 70, 0.45), 0 0 16px -2px rgba(var(--accent-rgb), 0.7); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.4); }

/* ---------- Чипы, бейджи ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 15px;
  border-radius: 99px; border: 1px solid var(--glass-edge);
  background: var(--glass-fill); background-color: rgba(255, 255, 255, 0.02); box-shadow: var(--glass-hi);
  color: var(--muted); font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: all 0.18s ease;
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--gloss), linear-gradient(135deg, var(--accent), var(--accent-deep)); background-color: transparent;
  color: #fff; border-color: rgba(255, 255, 255, 0.3); text-shadow: 0 1px 2px rgba(20, 5, 70, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 20px -6px rgba(var(--accent-rgb), 0.65);
}
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.08); color: var(--muted); white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.badge.ok { background: rgba(61, 220, 151, 0.15); color: var(--ok); }
.badge.warn { background: rgba(255, 183, 77, 0.15); color: var(--warn); }
.badge.bad { background: rgba(255, 92, 122, 0.15); color: var(--bad); }
.badge.info { background: rgba(94, 200, 255, 0.15); color: var(--info); }
.badge.accent { background: rgba(var(--accent-rgb), 0.24); color: var(--accent-2); }

/* ---------- Загрузка ---------- */
.spin {
  width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent-2);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { position: relative; overflow: hidden; background: rgba(255, 255, 255, 0.055); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 14px; min-height: 16px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.11), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.fade-in { animation: fadeIn 0.34s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  body::before, body::after { animation: none !important; }
}

/* ---------- Тосты и модалки ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: 104px; z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 440px; padding: 12px 18px; border-radius: 18px;
  background: var(--float-fill); background-color: var(--float-tint);
  -webkit-backdrop-filter: var(--float-blur); backdrop-filter: var(--float-blur);
  border: 1px solid var(--glass-edge); box-shadow: var(--glass-hi), var(--shadow);
  font-size: 14px; animation: fadeIn 0.24s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.toast.ok { border-color: rgba(61, 220, 151, 0.55); box-shadow: var(--glass-hi), var(--shadow), 0 0 22px -6px rgba(61, 220, 151, 0.5); }
.toast.bad { border-color: rgba(255, 92, 122, 0.6); box-shadow: var(--glass-hi), var(--shadow), 0 0 22px -6px rgba(255, 92, 122, 0.5); }
.overlay { position: fixed; inset: 0; z-index: 900; background: rgba(4, 2, 12, 0.55); -webkit-backdrop-filter: blur(10px) saturate(120%); backdrop-filter: blur(10px) saturate(120%); display: flex; align-items: flex-end; justify-content: center; animation: fadeOnly 0.22s ease both; }
@keyframes fadeOnly { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  background: var(--float-fill); background-color: rgba(18, 10, 38, 0.62);
  -webkit-backdrop-filter: var(--float-blur); backdrop-filter: var(--float-blur);
  border: 1px solid var(--glass-edge); border-bottom: none; border-radius: 28px 28px 0 0;
  box-shadow: var(--glass-hi), 0 -20px 60px -20px rgba(var(--accent-rgb), 0.35);
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.34s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
@keyframes sheetUp { from { transform: translateY(48px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { font-size: 19px; margin-bottom: 12px; }
.sheet .grabber { width: 42px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.28); margin: -8px auto 14px; }

/* ---------- Прочее ---------- */
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); margin: 12px 0; border: 0; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 8px; filter: drop-shadow(0 6px 18px rgba(var(--accent-rgb), 0.55)); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; word-break: break-word; }
.copy-box { display: flex; align-items: center; gap: 8px; background: rgba(6, 3, 16, 0.4); border: 1px solid var(--line); border-radius: 14px; box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.35); padding: 8px 8px 8px 14px; }
.copy-box .v { flex: 1; min-width: 0; word-break: break-all; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(205, 188, 255, 0.22); border-radius: 8px; }
