/* =================================================================
   HolyKeys TF2 — Telegram Mini App
   Чистый, минималистичный iOS / Telegram стиль. Inter.
   Авто-адаптация под светлую/тёмную тему через Telegram-переменные.
   ================================================================= */

:root {
  --bg:           color-mix(in srgb, var(--tg-theme-bg-color, #f2f2f7) 82%, var(--tg-theme-secondary-bg-color, #ffffff) 18%);
  --section:      color-mix(in srgb, var(--tg-theme-secondary-bg-color, #ffffff) 96%, var(--tg-theme-text-color, #1c1c1e) 2%);
  --card:         color-mix(in srgb, var(--tg-theme-section-bg-color, #ffffff) 96%, var(--tg-theme-bg-color, #f2f2f7) 4%);
  --text:         var(--tg-theme-text-color, #1c1c1e);
  --hint:         var(--tg-theme-hint-color, #8e8e93);
  --link:         var(--tg-theme-link-color, #007aff);
  --accent:       var(--tg-theme-button-color, var(--tg-theme-link-color, #2ea6ff));
  --accent-text:  var(--tg-theme-button-text-color, #ffffff);
  --accent-soft:  color-mix(in srgb, var(--accent) 14%, var(--card) 86%);
  --accent-soft-fill: color-mix(in srgb, var(--accent) 12%, var(--fill) 88%);
  --accent-border: color-mix(in srgb, var(--accent) 26%, var(--separator) 74%);
  --accent-border-strong: color-mix(in srgb, var(--accent) 56%, var(--separator) 44%);
  --accent-ink:   color-mix(in srgb, var(--accent) 82%, var(--text) 18%);
  --separator:    color-mix(in srgb, var(--tg-theme-hint-color, #8e8e93) 24%, transparent);
  --fill:         color-mix(in srgb, var(--tg-theme-secondary-bg-color, #ffffff) 92%, var(--tg-theme-text-color, #1c1c1e) 6%);

  --blue:  var(--accent);
  --green: #34c759;
  --red:   #ff3b30;

  --r:  16px;   /* card radius */
  --r2: 12px;   /* control radius */
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);

  --gap: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 86px;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: contain;
}
#app {
  position: relative;
}
#app::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--safe-bottom) + 18px);
  pointer-events: none;
  z-index: 45;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,.10) 58%,
    rgba(0,0,0,.18) 100%
  );
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input  { font-family: inherit; }
code   { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }

.hint { color: var(--hint); }
.small { font-size: 13px; line-height: 1.4; }
.hidden { display: none !important; }

body.tg-only-mode {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, color-mix(in srgb, var(--accent) 18%, transparent), transparent 38%),
    linear-gradient(180deg, #0f1724 0%, #121c2b 100%);
  color: #f4f7fb;
}
body.tg-only-mode #app,
body.tg-only-mode .sheet-overlay,
body.tg-only-mode .toast,
body.tg-only-mode #netbar { display: none !important; }
.tg-only-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tg-only-card {
  width: min(100%, 460px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 22px;
  border-radius: 22px;
  background: rgba(18, 28, 43, .82);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 18px 44px rgba(0,0,0,.28);
  text-align: left;
}
.tg-only-badge {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: color-mix(in srgb, var(--accent) 82%, #ffffff 18%);
  font-size: 12px;
  font-weight: 700;
}
.tg-only-card h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
}
.tg-only-card p {
  margin: 0;
  color: rgba(244,247,251,.82);
  font-size: 15px;
  line-height: 1.55;
}
.tg-only-card small {
  color: rgba(244,247,251,.58);
  font-size: 13px;
}
.tg-only-meta {
  color: color-mix(in srgb, var(--accent) 78%, #ffffff 22%);
  font-size: 13px;
  font-weight: 700;
}
.tg-only-btn { margin-top: 4px; text-decoration: none; }

/* SVG icons: minimal stroke style */
.ic, .tab-ic {
  width: 22px; height: 22px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ===================== LAYOUT ===================== */
#views {
  max-width: 540px; margin: 0 auto;
  padding: 20px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}
.view { display: none; animation: fade .3s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-title { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 18px; }
.subtitle   { color: var(--hint); font-size: 14px; margin: -12px 0 18px; }

/* ===================== CARD ===================== */
.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

/* ===================== SEGMENTED ===================== */
.segmented {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: color-mix(in srgb, var(--fill) 82%, var(--bg) 18%); border-radius: var(--r2); padding: 3px;
  margin-bottom: 12px;
}
.seg-btn {
  position: relative; z-index: 2; padding: 9px 0;
  font-size: 15px; font-weight: 600; color: var(--hint);
  transition: color .25s;
}
.seg-btn.active { color: var(--text); }
.seg-thumb {
  position: absolute; z-index: 1; top: 3px; left: 3px;
  width: calc(50% - 3px); height: calc(100% - 6px);
  background: color-mix(in srgb, var(--card) 84%, var(--bg) 16%); border-radius: 9px;
  box-shadow: 0 1px 4px rgba(0,0,0,.10);
  transition: transform .3s cubic-bezier(.22,.61,.36,1);
}
.segmented[data-mode="sell"] .seg-thumb { transform: translateX(100%); }
.segmented[data-mode="per_link"] .seg-thumb { transform: translateX(100%); }
.segmented[data-status="completed"] .seg-thumb { transform: translateX(100%); }
.stats-segmented { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-segmented .seg-btn { font-size: 12px; padding: 9px 2px; }
.stats-segmented .seg-thumb { width: calc(25% - 3px); }
.stats-segmented[data-period="7d"] .seg-thumb { transform: translateX(100%); }
.stats-segmented[data-period="30d"] .seg-thumb { transform: translateX(200%); }
.stats-segmented[data-period="all"] .seg-thumb { transform: translateX(300%); }

/* ===================== RATE / STOCK ===================== */
.market-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 18px;
}
.market-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 5px;
  background: color-mix(in srgb, var(--section) 82%, var(--bg) 18%);
  border: 1px solid color-mix(in srgb, var(--separator) 86%, var(--text) 5%);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.market-stat {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
  justify-content: center;
  min-height: 68px;
  background: transparent;
  border: 0;
  border-radius: 20px;
  padding: 11px 10px 10px;
  box-shadow: none;
  position: relative;
}
.market-stat:not(:first-child)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: color-mix(in srgb, var(--separator) 80%, transparent);
}
.market-stat span {
  color: var(--hint);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}
.market-stat b {
  color: var(--text);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
}
.market-stat.buy b { color: color-mix(in srgb, var(--link) 84%, var(--text) 16%); }
.market-stat.sell b { color: color-mix(in srgb, var(--green) 82%, var(--text) 18%); }
.market-stat.stock b { font-size: 17px; }
.market-stat small {
  color: var(--hint);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}
.market-actions {
  display: flex;
  justify-content: stretch;
  width: 100%;
}
.shop-notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 12px 13px;
  border-radius: 14px;
  background: color-mix(in srgb, #d8941f 12%, var(--card) 88%);
  border: 1px solid color-mix(in srgb, #d8941f 28%, var(--separator) 72%);
  box-shadow: var(--shadow);
}
.shop-notice-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, #d8941f 22%, var(--card) 78%);
  color: color-mix(in srgb, #f6c862 72%, var(--text) 28%);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}
.shop-notice-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shop-notice-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.2;
}
.shop-notice-copy span {
  color: color-mix(in srgb, var(--text) 76%, var(--hint) 24%);
  font-size: 12px;
  line-height: 1.45;
}
.market-bots-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  width: 100%;
  padding: 0 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 84%, var(--bg) 16%);
  border: 1px solid color-mix(in srgb, var(--separator) 84%, var(--text) 5%);
  box-shadow: var(--shadow);
  color: color-mix(in srgb, var(--text) 82%, var(--link) 18%);
  font-size: 13px;
  font-weight: 700;
  transition: transform .22s ease, border-color .22s ease, background .22s ease;
}
.market-bots-btn .ic { width: 18px; height: 18px; }
.market-bots-btn:active { transform: scale(.97); }

.rate-line {
  display: flex; justify-content: center; gap: 8px;
  font-size: 14px; color: var(--hint); margin: 0 0 4px;
}
.rate-line b { color: var(--text); font-weight: 600; }
.rate-line .dot { color: var(--separator); }
.stock-line { text-align: center; font-size: 13px; color: var(--hint); margin: 0 0 22px; }
.stock-line b { color: var(--text); font-weight: 600; }

/* ===================== FORM ===================== */
.form { display: flex; flex-direction: column; gap: var(--gap); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--hint); padding-left: 4px; }
.field-label a { color: var(--link); font-weight: 750; text-decoration: none; }

.field input, .input-with-action input, .sub-body input {
  width: 100%;
  background: var(--card); color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--r2);
  padding: 13px 14px; font-size: 16px;
  box-shadow: var(--shadow);
  transition: border-color .2s;
}
input::placeholder { color: var(--hint); opacity: .6; }
input:focus { outline: none; border-color: var(--accent-border-strong); }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  background: var(--card);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--r2);
  padding: 13px 14px;
  font: inherit;
  font-size: 15px;
  box-shadow: var(--shadow);
  transition: border-color .2s;
}
textarea::placeholder { color: var(--hint); opacity: .6; }
textarea:focus { outline: none; border-color: var(--accent-border-strong); }

.paste-field { position: relative; min-width: 0; }
.paste-field input { padding-right: 98px; }
.paste-field textarea { padding-right: 98px; }
.paste-btn {
  position: absolute; top: 7px; right: 7px;
  min-width: 78px; min-height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--link) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--link) 20%, transparent);
  color: var(--link);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  white-space: nowrap;
}
.paste-btn:active { transform: scale(.96); }

.quick-fill {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center; gap: 10px;
  width: 100%; min-height: 42px;
  background: color-mix(in srgb, var(--link) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--link) 14%, var(--separator));
  color: var(--text);
  border-radius: 12px; padding: 10px 12px;
  text-align: left;
  transition: transform .14s ease, background .2s ease, border-color .2s ease;
}
.quick-fill:active { transform: scale(.98); }
.quick-fill-meta { min-width: 0; display: inline-flex; align-items: center; gap: 7px; }
.quick-fill-ic {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--link);
}
.quick-fill span { color: var(--link); font-size: 12px; font-weight: 700; white-space: nowrap; }
.quick-fill b { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

.mini-toggle {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: color-mix(in srgb, var(--fill) 82%, var(--bg) 18%);
  border-radius: var(--r2);
}
.mini-toggle::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  border-radius: 9px;
  background: color-mix(in srgb, var(--card) 84%, var(--bg) 16%);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  transition: transform .3s cubic-bezier(.22,.61,.36,1), background .2s ease, box-shadow .2s ease;
}
.mini-toggle[data-mode="multi"]::before,
.mini-toggle[data-mode="sell"]::before,
.mini-toggle[data-mode="per_link"]::before,
.mini-toggle[data-status="completed"]::before,
.mini-toggle[data-value="money"]::before,
.mini-toggle[data-value="bnb"]::before {
  transform: translateX(calc(100% + 4px));
}
.mini-toggle button {
  position: relative;
  z-index: 1;
  min-height: 36px;
  border-radius: 9px;
  background: transparent;
  color: var(--hint);
  font-size: 14px;
  font-weight: 650;
  transition: color .22s ease, transform .18s ease;
}
.mini-toggle button.active {
  color: var(--text);
}

.input-with-action { position: relative; }
.input-with-action input { padding-right: 70px; }
.max-btn {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  min-width: 70px; min-height: 34px;
  background: color-mix(in srgb, var(--link) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--link) 20%, transparent);
  color: var(--link);
  font-size: 12px; font-weight: 700; letter-spacing: 0;
  padding: 6px 10px; border-radius: 10px;
  transition: transform .1s, opacity .15s;
}
.max-btn:active { transform: translateY(-50%) scale(.92); }

/* ===================== PAY TILES (2x2) ===================== */
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.pay-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--card); border-radius: var(--r2);
  padding: 16px 8px; box-shadow: var(--shadow);
  border: 1.5px solid transparent;
  transition: border-color .18s, transform .1s, background .18s;
}
.pay-tile:active { transform: scale(.97); }
.pay-tile.active { border-color: var(--accent-border-strong); background: var(--accent-soft); }
.pay-ic { font-size: 22px; line-height: 1; }
.pay-name { font-size: 13px; font-weight: 500; }

/* ===================== TOTAL ===================== */
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px; }
.total-row span { color: var(--hint); font-size: 14px; }
.total-row strong { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.fee-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--hint);
  font-size: 13px;
  padding: 0 4px;
}
.fee-line b { color: var(--text); font-weight: 650; }

/* ===================== BUTTONS ===================== */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 14px; border-radius: var(--r2);
  font-size: 16px; font-weight: 600; text-align: center;
  transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:disabled { opacity: .5; }
.btn-soft { background: var(--fill); color: var(--link); }

/* ===================== SCAN RESULT ===================== */
.scan-result {
  background: var(--card); border-radius: var(--r2);
  box-shadow: var(--shadow); padding: 14px; font-size: 14px; line-height: 1.55;
  animation: fade .3s ease;
}
.scan-result b { font-weight: 700; }
.sell-reveal { display: flex; flex-direction: column; gap: var(--gap); margin-top: var(--gap); animation: fade .3s ease; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-row .field-label { margin: 0; }
.total-row-compact { padding: 0; }
.sell-link-list { display: flex; flex-direction: column; gap: 8px; }
.sell-link-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 10px; align-items: end;
  background: var(--card); border-radius: var(--r2); box-shadow: var(--shadow); padding: 12px;
}
.sell-link-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sell-link-meta strong { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.sell-link-meta span, .sell-link-meta small { color: var(--hint); font-size: 12px; line-height: 1.35; }
.sell-link-input { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.sell-link-input input { min-width: 0; text-align: center; }
.sell-link-input .copy-btn { text-align: center; }
.scan-result-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.scan-result-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
  background: var(--fill); border-radius: 10px; padding: 10px 11px;
}
.scan-result-row strong { font-size: 13px; overflow-wrap: anywhere; }
.scan-result-row span { color: var(--hint); font-size: 12px; line-height: 1.3; }
.scan-result-row b { font-size: 13px; }
.scan-result-row.error b { color: var(--red); }
.scan-result-row.ok b { color: var(--green); }

/* ===================== BOTS ===================== */
.bots-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; margin-bottom: 12px;
}
.bots-total span { color: var(--hint); font-size: 13px; font-weight: 600; }
.bots-total strong { font-size: 22px; font-weight: 750; }
.bots-list { display: flex; flex-direction: column; gap: 12px; }
.bot-card { padding: 16px; }
.bot-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.bot-name { font-weight: 600; font-size: 15px; }
.bot-count { font-size: 14px; color: var(--hint); }
.bot-count b { color: var(--text); font-weight: 700; }
.progress { height: 7px; border-radius: 5px; background: var(--fill); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 5px; background: var(--accent); width: 0; transition: width .8s cubic-bezier(.22,.61,.36,1); }
.progress-bar.full { background: var(--red); }

/* ===================== PROFILE ===================== */
.balance-block { text-align: center; padding: 14px 0 4px; margin-bottom: 22px; }
.balance-label { display: block; font-size: 14px; color: var(--hint); margin-bottom: 4px; }
.balance-value { display: block; font-size: 46px; font-weight: 700; letter-spacing: -.03em; color: var(--green); margin-bottom: 20px; }
.balance-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.profile-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 22px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent) 78%, var(--card) 22%);
  color: var(--accent-text);
  font-size: 22px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-name { font-size: 17px; font-weight: 600; }
.profile-id-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.profile-id { font-size: 13px; color: var(--hint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy-id {
  flex-shrink: 0;
  color: var(--link);
  background: var(--fill);
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 700;
}

/* iOS List */
.ios-list { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.ios-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left; font-size: 16px; transition: background .15s; }
.ios-row:active { background: var(--fill); }
.ios-row + .ios-row { border-top: 1px solid var(--separator); }
.ios-ic { color: color-mix(in srgb, var(--text) 34%, var(--link) 16%); }
.ios-title { flex: 1; }
.ios-value { color: var(--hint); font-size: 14px; white-space: nowrap; }
.chevron { width: 18px; height: 18px; color: var(--hint); }
.lang-list { display: grid; gap: 8px; margin-top: 6px; }
.lang-option { justify-content: space-between; }
.lang-option.active { background: color-mix(in srgb, var(--accent) 16%, var(--card) 84%); color: var(--accent-ink); }
.profile-settings-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.profile-setting-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
}
.profile-setting-row + .profile-setting-row {
  border-top: 1px solid var(--separator);
}
.profile-setting-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-setting-copy strong {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}
.profile-setting-copy small {
  color: var(--hint);
  font-size: 12px;
  line-height: 1.45;
}
.profile-setting-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fill) 88%, var(--card) 12%);
  border: 1px solid color-mix(in srgb, var(--separator) 86%, transparent);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.profile-setting-toggle span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
  transition: transform .22s ease;
}
.profile-setting-toggle.active {
  background: color-mix(in srgb, var(--accent) 68%, var(--card) 32%);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--separator) 66%);
}
.profile-setting-toggle.active span {
  transform: translateX(20px);
}
.profile-settings-link {
  background: transparent;
  box-shadow: none;
}

/* ===================== TAB BAR ===================== */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + var(--safe-bottom));
  z-index: 50;
  transform: translateX(-50%);
  width: min(calc(100vw - 18px), calc(var(--tab-count, 4) * 78px + 18px));
  max-width: 498px;
  display: grid;
  grid-template-columns: repeat(var(--tab-count, 4), minmax(0, 1fr));
  gap: 2px;
  padding: 7px;
  border-radius: 36px;
  background: color-mix(in srgb, var(--section) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--separator) 78%, var(--text) 8%);
  box-shadow: 0 14px 38px rgba(0,0,0,.18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  transition: width .3s ease, max-width .3s ease, bottom .3s ease, padding .3s ease, border-radius .3s ease, box-shadow .3s ease;
}
.tabbar-pill {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 0;
  width: 60px;
  height: calc(100% - 12px);
  border-radius: 32px;
  background: color-mix(in srgb, var(--card) 90%, var(--link) 10%);
  border: 1px solid color-mix(in srgb, var(--separator) 26%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 8px 24px rgba(0,0,0,.12);
  transition: left .32s cubic-bezier(.22,.61,.36,1), width .32s cubic-bezier(.22,.61,.36,1), height .28s ease, top .28s ease, border-radius .28s ease;
}
.tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 60px;
  gap: 5px;
  padding: 8px 8px 10px;
  border-radius: 24px;
  color: var(--hint);
  transition: color .25s ease, transform .22s ease, padding .25s ease, gap .25s ease, min-height .25s ease;
}
.tab:active { transform: scale(.96); }
.tab-ic-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}
.tab-label {
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform .25s ease, opacity .25s ease, font-size .25s ease;
}
.tab.active { color: var(--link); }
.tab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--card) 86%, transparent);
}
.tabbar.compact {
  bottom: calc(8px + var(--safe-bottom));
  width: min(calc(100vw - 34px), calc(var(--tab-count, 4) * 74px + 10px));
  max-width: 466px;
  padding: 5px;
  border-radius: 32px;
}
.tabbar.compact .tabbar-pill {
  top: 4px;
  height: calc(100% - 8px);
  border-radius: 28px;
}
.tabbar.compact .tab {
  min-height: 48px;
  gap: 3px;
  padding: 6px 7px 7px;
}
.tabbar.compact .tab-label {
  font-size: 8px;
}
.tabbar.compact .tab-badge {
  top: -3px;
  right: -3px;
}

/* ===================== SUB-PAGES ===================== */
.subpage {
  position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--bg) 84%, var(--section) 16%);
  transform: translateX(100%); transition: transform .33s cubic-bezier(.22,.61,.36,1);
  display: flex; flex-direction: column; overflow: hidden;
}
.subpage.active { transform: translateX(0); }
.sub-head {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 12px; border-bottom: 1px solid var(--separator);
  background: color-mix(in srgb, var(--card) 94%, var(--section) 6%); position: sticky; top: 0; z-index: 2;
  min-height: 52px;
}
.sub-head h2 { font-size: 17px; font-weight: 600; margin: 0; text-align: center; width: 100%; }
.sub-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 20px 16px calc(40px + var(--safe-bottom));
  max-width: 540px; width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: var(--gap);
}

.info-box { display: flex; flex-direction: column; gap: 10px; }
.copy-field { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: var(--r2); padding: 12px; box-shadow: var(--shadow); }
.copy-field code { flex: 1; font-size: 13px; word-break: break-all; }
.copy-btn { color: var(--link); font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }

.mini-balance { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; }
.mini-balance strong { font-size: 18px; font-weight: 700; }

.ref-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.ref-stat { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; padding: 14px 8px; }
.ref-stat strong { font-size: 16px; font-weight: 700; }
.profile-stats-body { display: flex; flex-direction: column; gap: 12px; }
.stats-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 16px;
}
.stats-hero span, .stats-hero small { color: var(--hint); font-size: 12px; font-weight: 700; }
.stats-hero strong { display: block; margin-top: 3px; font-size: 25px; font-weight: 800; }
.stats-hero small { align-self: end; text-align: right; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-card {
  min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: center;
  padding: 12px;
}
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--fill) 88%, var(--card) 12%);
  color: color-mix(in srgb, var(--text) 38%, var(--link) 18%);
  font-size: 16px; font-weight: 850;
}
.stat-card div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stat-card small { color: var(--hint); font-size: 11px; font-weight: 700; }
.stat-card b { font-size: 15px; overflow-wrap: anywhere; }
.stat-card em { color: var(--hint); font-size: 11px; font-style: normal; overflow-wrap: anywhere; }
.stats-balance-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stats-balance-row span {
  flex: 1 1 160px; background: var(--card); border-radius: 10px; box-shadow: var(--shadow);
  padding: 11px 12px; color: var(--hint); font-size: 12px; font-weight: 700;
}
.stats-balance-row b { color: var(--text); }
.referrals-panel { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-row .field-label { margin: 0; }
.referrals-list { display: flex; flex-direction: column; gap: 8px; }
.referral-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 11px 12px;
}
.ref-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--fill) 88%, var(--card) 12%);
  color: color-mix(in srgb, var(--text) 38%, var(--link) 18%);
  font-weight: 800; overflow: hidden;
}
.ref-avatar img { width: 100%; height: 100%; object-fit: cover; }
.referral-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.referral-main strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.referral-main span, .referral-main small { color: var(--hint); font-size: 11px; line-height: 1.3; }
.referral-row b { font-size: 14px; color: var(--green); white-space: nowrap; }

/* ===================== HISTORY ===================== */
.tx-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card); border-radius: var(--r2); padding: 13px 14px; box-shadow: var(--shadow); transition: transform .1s, background .15s; }
.tx-row:active { transform: scale(.98); }
.tx-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; flex-shrink: 0; }
.tx-dot.in  { background: rgba(52,199,89,.15);  color: var(--green); }
.tx-dot.out { background: rgba(255,59,48,.15);  color: var(--red); }
.tx-dot.cancel { background: var(--fill); color: var(--hint); }
.tx-mid { flex: 1; min-width: 0; }
.tx-desc { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-date { font-size: 12px; color: var(--hint); }
.tx-amount { font-weight: 700; font-size: 15px; white-space: nowrap; }
.tx-amount.in  { color: var(--green); }
.tx-amount.out { color: var(--red); }
.tx-amount.cancel { color: var(--hint); text-decoration: line-through; }
.empty-state { text-align: center; color: var(--hint); padding: 56px 0; font-size: 15px; }
.empty-state.compact { padding: 18px 0; font-size: 13px; }

/* ===================== ORDERS ===================== */
.orders-list { display: flex; flex-direction: column; gap: 10px; }
.order-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border-radius: var(--r2); padding: 14px;
  box-shadow: var(--shadow);
}
.order-card:active { transform: scale(.99); }
.order-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.order-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.order-title strong { font-size: 16px; font-weight: 700; }
.order-title span { color: var(--hint); font-size: 12px; }
.order-status {
  flex-shrink: 0; padding: 5px 8px; border-radius: 8px;
  background: var(--fill); color: var(--hint);
  font-size: 12px; font-weight: 700;
}
.order-status.active { background: var(--accent-soft-fill); color: var(--accent-ink); }
.order-status.done { background: rgba(52,199,89,.14); color: var(--green); }
.order-status.fail { background: rgba(255,59,48,.12); color: var(--red); }
.order-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.order-meta-item { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.order-meta-item span { color: var(--hint); font-size: 11px; }
.order-meta-item b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-message { color: var(--hint); font-size: 13px; line-height: 1.35; }
.order-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.order-actions .btn { min-height: 38px; padding: 10px 8px; font-size: 13px; }
.order-actions .btn:only-child { grid-column: 1 / -1; }
.btn.danger { color: var(--red); background: rgba(255,59,48,.10); }

/* ===================== GIVEAWAYS ===================== */
.giveaways-list, .admin-giveaways-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.giveaway-card {
  display: flex; flex-direction: column; gap: 11px;
  background: color-mix(in srgb, var(--card) 94%, var(--section) 6%); border-radius: var(--r2); padding: 14px;
  border: 1px solid color-mix(in srgb, var(--separator) 75%, transparent);
  box-shadow: var(--shadow);
}
.giveaway-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.giveaway-head div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.giveaway-head strong { font-size: 16px; font-weight: 750; overflow-wrap: anywhere; }
.giveaway-head span { color: var(--hint); font-size: 12px; }
.giveaway-badge {
  flex-shrink: 0; padding: 5px 8px; border-radius: 8px;
  background: var(--accent-soft-fill); color: var(--accent-ink);
  font-size: 11px; font-weight: 750;
}
.giveaway-badge.completed { background: rgba(52,199,89,.14); color: var(--green); }
.giveaway-badge.scheduled { background: var(--fill); color: var(--hint); }
.giveaway-badge.finishing, .giveaway-badge.drawing { background: rgba(255,149,0,.14); color: #b86400; }
.giveaway-desc { color: var(--text); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.giveaway-lines { display: flex; flex-direction: column; gap: 4px; background: color-mix(in srgb, var(--fill) 76%, var(--text) 10%); border-radius: 10px; padding: 10px 11px; }
.giveaway-lines b { font-size: 12px; color: var(--hint); text-transform: uppercase; letter-spacing: 0; }
.giveaway-lines span { font-size: 13px; line-height: 1.35; }
.giveaway-prize-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.giveaway-prize-card {
  min-width: 0; display: flex; flex-direction: column; gap: 4px;
  background: color-mix(in srgb, var(--card) 88%, var(--fill) 12%); border-radius: 10px; padding: 12px;
  border: 1px solid var(--separator);
  min-height: 100%;
}
.giveaway-prize-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.giveaway-place-range {
  color: var(--hint);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}
.giveaway-prize-card.grouped .giveaway-place-range { color: var(--link); }
.giveaway-prize-card b { color: var(--text); text-transform: none; font-size: 14px; font-weight: 740; line-height: 1.4; overflow-wrap: anywhere; }
.giveaway-prize-card small { color: var(--hint); font-size: 11px; }
.giveaway-place {
  display: inline-flex; align-items: center; justify-content: center;
  width: fit-content; min-width: 34px; height: 22px; padding: 0 7px;
  border-radius: 7px; background: rgba(255,149,0,.14); color: #b86400;
  font-size: 11px; font-weight: 800;
}
.giveaway-condition-list { display: flex; flex-direction: column; gap: 7px; }
.giveaway-condition-row {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center;
  gap: 8px; background: color-mix(in srgb, var(--card) 88%, var(--fill) 12%); border: 1px solid var(--separator);
  border-radius: 9px; padding: 9px 10px;
}
.giveaway-condition-row i {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 13px; font-weight: 850;
}
.giveaway-condition-row.ok i { background: rgba(52,199,89,.16); color: var(--green); }
.giveaway-condition-row.miss i { background: rgba(255,59,48,.13); color: var(--red); }
.giveaway-condition-row.neutral i { background: var(--fill); color: var(--hint); }
.giveaway-condition-row span { min-width: 0; overflow-wrap: anywhere; }
.giveaway-condition-row small { color: var(--hint); font-size: 12px; font-weight: 700; }
.condition-link {
  grid-column: 2 / -1; justify-self: start;
  padding: 7px 10px; border-radius: 8px; background: var(--accent-soft-fill);
  color: var(--accent-ink); font-size: 12px; font-weight: 750;
}
.giveaway-winner-list { display: flex; flex-direction: column; gap: 7px; }
.giveaway-winner-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; align-items: center;
  background: var(--card); border: 1px solid var(--separator); border-radius: 9px; padding: 9px 10px;
}
.giveaway-winner-row div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.giveaway-winner-row b { color: var(--text); font-size: 13px; text-transform: none; overflow-wrap: anywhere; }
.giveaway-winner-row small { color: var(--hint); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.giveaway-card.compact { gap: 9px; padding: 12px; cursor: pointer; }
.giveaway-card.compact .copy-btn { width: 100%; }
.giveaway-card.compact .giveaway-head strong { font-size: 15px; }
.giveaway-compact-line {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px;
  align-items: center; background: color-mix(in srgb, var(--fill) 76%, var(--text) 10%); border-radius: 9px; padding: 9px 10px;
}
.giveaway-compact-line span { color: var(--hint); font-size: 12px; font-weight: 700; }
.giveaway-compact-line b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.giveaway-compact-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
.giveaway-compact-actions .btn, .giveaway-compact-actions .copy-btn { width: 100%; min-width: 0; }
.giveaway-foot { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.giveaway-foot span { color: var(--hint); font-size: 13px; }
.giveaway-foot .btn { width: auto; min-width: 132px; min-height: 38px; padding: 10px 12px; font-size: 13px; }
.giveaway-card.compact { overflow: hidden; }
.giveaway-card.compact .giveaway-foot .btn,
.giveaway-card.compact .giveaway-foot .copy-btn { width: 100%; min-width: 0; }
.giveaway-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.giveaway-compact-line.giveaway-participants-line {
  grid-template-columns: minmax(0, 1fr) auto;
}
.giveaway-compact-line.giveaway-participants-line span { min-width: 0; }
.giveaway-compact-line.giveaway-participants-line .copy-btn,
.giveaway-compact-line.giveaway-participants-line .btn {
  width: auto;
  min-width: 0;
  padding: 9px 12px;
}
.giveaway-admin-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.giveaway-admin-meta .btn {
  min-height: 36px;
  padding: 9px 12px;
  font-size: 13px;
}
.giveaway-admin-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.giveaway-admin-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}
.giveaway-admin-actions .btn-danger {
  background: rgba(255,59,48,.14);
  color: var(--red);
}
.giveaway-admin-actions .btn-warning {
  background: rgba(255,149,0,.14);
  color: #ff9500;
}
.giveaway-admin-actions .btn:disabled,
.giveaway-compact-line .copy-btn:disabled,
.giveaway-admin-meta .btn:disabled {
  opacity: .55;
}
.danger-text { color: var(--red); }

.giveaway-card.user {
  background: var(--card);
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--separator) 78%, transparent);
  box-shadow: var(--shadow);
  padding: 14px;
  gap: 10px;
  overflow: hidden;
}
.giveaway-card.user .giveaway-head {
  gap: 10px;
}
.giveaway-card.user .giveaway-head strong {
  font-size: 15px;
  font-weight: 700;
}
.giveaway-card.user .giveaway-head span {
  color: var(--hint);
  font-size: 12px;
  line-height: 1.35;
}
.giveaway-card.user .giveaway-badge {
  border-radius: 999px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--link) 10%, var(--fill) 90%);
  color: var(--link);
  font-size: 11px;
  font-weight: 750;
}
.giveaway-card.user .giveaway-badge.completed {
  background: color-mix(in srgb, var(--green) 12%, var(--fill) 88%);
  color: var(--green);
}
.giveaway-card.user .giveaway-badge.scheduled,
.giveaway-card.user .giveaway-badge.finishing,
.giveaway-card.user .giveaway-badge.drawing {
  background: color-mix(in srgb, var(--fill) 88%, var(--card) 12%);
  color: var(--hint);
}
.giveaway-card.user .giveaway-desc {
  color: var(--hint);
  font-size: 13px;
  line-height: 1.45;
}
.giveaway-card.user .giveaway-compact-line {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--fill) 72%, var(--card) 28%);
  border: 1px solid color-mix(in srgb, var(--separator) 72%, transparent);
  border-radius: 12px;
  padding: 10px 12px;
}
.giveaway-card.user .giveaway-compact-line span {
  color: var(--hint);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  align-self: center;
}
.giveaway-card.user .giveaway-compact-line b {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  min-width: 0;
  text-align: left;
  white-space: normal;
  align-self: center;
}
.giveaway-card.user .giveaway-lines {
  gap: 8px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
}
.giveaway-card.user .giveaway-lines > b {
  color: var(--hint);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
  padding: 0 2px;
}
.giveaway-card.user .giveaway-prize-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.giveaway-card.user .giveaway-prize-card,
.giveaway-card.user .giveaway-condition-row,
.giveaway-card.user .giveaway-winner-row {
  background: color-mix(in srgb, var(--card) 92%, var(--fill) 8%);
  border: 1px solid color-mix(in srgb, var(--separator) 78%, transparent);
  border-radius: 12px;
}
.giveaway-card.user .giveaway-prize-card {
  gap: 7px;
  padding: 11px 12px;
  background: color-mix(in srgb, var(--card) 94%, var(--fill) 6%);
  border-radius: 12px;
}
.giveaway-card.user .giveaway-prize-card.grouped {
  background: color-mix(in srgb, var(--card) 91%, var(--fill) 9%);
}
.giveaway-card.user .giveaway-prize-head {
  padding-bottom: 0;
  border-bottom: 0;
}
.giveaway-card.user .giveaway-place-range {
  color: color-mix(in srgb, var(--link) 86%, var(--text) 14%);
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0;
}
.giveaway-card.user .giveaway-prize-card b {
  font-size: 14px;
  font-weight: 740;
  line-height: 1.35;
}
.giveaway-card.user .giveaway-place {
  border-radius: 999px;
  background: color-mix(in srgb, var(--link) 12%, var(--fill) 88%);
  color: var(--link);
}
.giveaway-card.user .giveaway-condition-row {
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--card) 94%, var(--fill) 6%);
  border-radius: 12px;
}
.giveaway-card.user .giveaway-condition-row i {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--fill) 90%, var(--card) 10%);
  color: var(--hint);
  font-size: 12px;
}
.giveaway-card.user .giveaway-condition-row.ok {
  border-color: color-mix(in srgb, var(--green) 20%, var(--separator) 80%);
}
.giveaway-card.user .giveaway-condition-row.ok i {
  background: color-mix(in srgb, var(--green) 12%, var(--fill) 88%);
  color: var(--green);
}
.giveaway-card.user .giveaway-condition-row.miss {
  border-color: color-mix(in srgb, var(--red) 18%, var(--separator) 82%);
}
.giveaway-card.user .giveaway-condition-row.miss i {
  background: color-mix(in srgb, var(--red) 10%, var(--fill) 90%);
  color: var(--red);
}
.giveaway-card.user .giveaway-condition-row span {
  font-size: 13px;
  font-weight: 580;
  line-height: 1.35;
}
.giveaway-card.user .giveaway-condition-row small {
  color: var(--hint);
  font-size: 12px;
  font-weight: 650;
}
.giveaway-card.user .condition-link {
  background: color-mix(in srgb, var(--link) 11%, var(--fill) 89%);
  color: var(--link);
  border-radius: 9px;
}
.giveaway-card.user .giveaway-winner-row {
  gap: 10px;
  padding: 11px 12px;
  background: color-mix(in srgb, var(--card) 94%, var(--fill) 6%);
  border-radius: 12px;
}
.giveaway-card.user .giveaway-winner-row .giveaway-place {
  background: color-mix(in srgb, var(--fill) 88%, var(--card) 12%);
  color: var(--hint);
  border-radius: 999px;
}
.giveaway-card.user .giveaway-winner-row b {
  font-size: 13px;
  font-weight: 700;
}
.giveaway-card.user .giveaway-winner-row small {
  color: var(--hint);
  font-size: 12px;
}
.giveaway-card.user.completed .giveaway-winner-list {
  gap: 8px;
}
.giveaway-card.user.completed .giveaway-badge.completed {
  background: color-mix(in srgb, var(--green) 10%, var(--fill) 90%);
  border: 1px solid color-mix(in srgb, var(--green) 18%, transparent);
}
.giveaway-card.user.completed .giveaway-compact-line,
.giveaway-card.user.completed .giveaway-lines > b,
.giveaway-card.user.completed .giveaway-foot > span {
  opacity: .98;
}
.giveaway-card.user.completed .giveaway-winner-row {
  gap: 12px;
  align-items: center;
  padding: 12px 13px;
  background: color-mix(in srgb, var(--card) 95%, var(--fill) 5%);
  border-color: color-mix(in srgb, var(--separator) 74%, transparent);
}
.giveaway-card.user.completed .giveaway-winner-row .giveaway-place {
  min-width: 58px;
  height: auto;
  padding: 6px 9px;
  align-self: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--fill) 90%);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--separator) 82%);
  color: color-mix(in srgb, var(--accent) 82%, var(--text) 18%);
  font-size: 10px;
  font-weight: 760;
  line-height: 1.1;
}
.giveaway-card.user.completed .giveaway-winner-row div {
  gap: 3px;
}
.giveaway-card.user.completed .giveaway-winner-row b {
  line-height: 1.3;
}
.giveaway-card.user.completed .giveaway-winner-row small {
  line-height: 1.35;
}
.giveaway-card.user.completed .giveaway-foot {
  gap: 8px;
}
.giveaway-card.user .giveaway-foot {
  gap: 10px;
}
.giveaway-card.user .giveaway-foot span {
  color: var(--hint);
  font-size: 12px;
}
.giveaway-card.user.compact .giveaway-foot .btn,
.giveaway-card.user.compact .giveaway-foot .copy-btn {
  width: 100%;
  min-width: 0;
}
.giveaway-card.user.expanded > .copy-btn {
  align-self: center;
  color: var(--link);
  font-size: 13px;
  font-weight: 650;
  padding: 2px 4px 0;
}

/* ===================== ADMIN ===================== */
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.admin-section-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: var(--fill);
  border-radius: var(--r2);
  padding: 4px;
  margin-bottom: 12px;
}
.admin-section-tabs button {
  min-height: 34px;
  border-radius: 9px;
  color: var(--hint);
  font-size: 12px;
  font-weight: 750;
}
.admin-section-tabs button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.admin-stat {
  background: var(--card); border-radius: var(--r2); padding: 13px 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
}
.admin-stat span { color: var(--hint); font-size: 12px; font-weight: 600; }
.admin-stat b { font-size: 20px; font-weight: 750; }
.admin-panel {
  background: var(--card); border-radius: var(--r2); padding: 14px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.admin-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.admin-panel h2 { font-size: 16px; margin: 0; }
.admin-dashboard-periods { margin-bottom: 12px; }
.admin-dashboard-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-dashboard-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.admin-dashboard-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  background: color-mix(in srgb, var(--card) 94%, var(--fill) 6%);
  border: 1px solid color-mix(in srgb, var(--separator) 86%, transparent);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.admin-dashboard-stat span {
  color: var(--hint);
  font-size: 12px;
  font-weight: 650;
}
.admin-dashboard-stat b {
  font-size: 19px;
  font-weight: 760;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.admin-dashboard-stat small {
  color: var(--hint);
  font-size: 11px;
  line-height: 1.35;
}
.admin-dashboard-chart-grid,
.admin-dashboard-breakdowns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.admin-dashboard-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: color-mix(in srgb, var(--card) 94%, var(--fill) 6%);
  border: 1px solid color-mix(in srgb, var(--separator) 86%, transparent);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.admin-dashboard-card h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
  color: var(--hint);
}
.admin-line-chart-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-chart-legend-btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--fill);
  border: 1px solid color-mix(in srgb, var(--separator) 88%, transparent);
  color: var(--hint);
  font-size: 12px;
  font-weight: 700;
}
.admin-chart-legend-btn i,
.admin-chart-tooltip i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--legend);
  display: inline-flex;
  flex: 0 0 9px;
}
.admin-chart-legend-btn.active {
  background: color-mix(in srgb, var(--card) 92%, var(--fill) 8%);
  color: var(--text);
  box-shadow: var(--shadow);
}
.admin-line-chart-wrap {
  position: relative;
  min-height: 290px;
  padding: 44px 6px 12px 0;
  border-radius: 16px;
  background:
    radial-gradient(circle at top, rgba(91,140,255,.09), transparent 52%),
    linear-gradient(180deg, color-mix(in srgb, var(--card) 92%, #101a33 8%) 0%, color-mix(in srgb, var(--card) 96%, #0c1222 4%) 100%);
  border: 1px solid color-mix(in srgb, var(--separator) 84%, transparent);
  overflow: hidden;
}
.admin-chart-tooltip {
  position: absolute;
  top: 10px;
  z-index: 2;
  min-width: 132px;
  max-width: calc(100% - 20px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(11,18,31,.82);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  backdrop-filter: blur(14px);
}
.admin-chart-tooltip.left { transform: translateX(0); }
.admin-chart-tooltip.center { transform: translateX(-50%); }
.admin-chart-tooltip.right { transform: translateX(-100%); }
.admin-chart-tooltip strong {
  font-size: 12px;
  font-weight: 760;
  color: #fff;
}
.admin-chart-tooltip span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,.82);
  font-size: 11px;
  line-height: 1.35;
}
.admin-chart-tooltip span b {
  color: #fff;
  font-size: 11px;
}
.admin-line-chart-svg {
  width: 100%;
  height: clamp(210px, 32vw, 300px);
  max-height: none;
  display: block;
}
.admin-line-chart-grid line {
  stroke: rgba(255,255,255,.08);
  stroke-width: .8;
}
.admin-line-chart-grid line.admin-line-chart-zero {
  stroke: rgba(255,255,255,.2);
  stroke-width: 1.25;
}
.admin-line-chart-ylabels text {
  fill: var(--hint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.admin-line-chart-guide {
  stroke: rgba(255,255,255,.16);
  stroke-width: .8;
  stroke-dasharray: 2 3;
}
.admin-chart-axis {
  display: grid;
  grid-template-columns: repeat(var(--chart-cols, 1), minmax(0, 1fr));
  gap: 0;
  padding: 0 var(--chart-right, 8px) 0 var(--chart-left, 50px);
}
.admin-chart-axis span {
  color: var(--hint);
  font-size: 10px;
  text-align: center;
  min-height: 14px;
  font-variant-numeric: tabular-nums;
}
.admin-chart-axis span.first {
  text-align: left;
  justify-self: start;
}
.admin-chart-axis span.last {
  text-align: right;
  justify-self: end;
}
.admin-overview-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-overview-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 92%, var(--fill) 8%);
  border: 1px solid color-mix(in srgb, var(--separator) 84%, transparent);
}
.admin-overview-card h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
  color: var(--hint);
}
.admin-overview-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.admin-overview-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--fill);
}
.admin-overview-row span {
  min-width: 0;
  color: var(--hint);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.admin-overview-row b {
  flex-shrink: 0;
  text-align: right;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}
.admin-chart-controls { display: grid; grid-template-columns: 104px 1fr; gap: 8px; margin-bottom: 10px; }
.admin-chart-controls select,
.admin-settings input:not([type="checkbox"]),
.admin-settings select,
.admin-users-toolbar input,
.admin-users-toolbar select,
.admin-bot-edit input,
.admin-bot-form input,
.admin-giveaway-form input,
.admin-prize-controls input,
.admin-giveaway-form textarea {
  width: 100%;
  min-width: 0;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--separator);
  border-radius: var(--r2);
  padding: 12px 14px;
  font: inherit;
  box-shadow: var(--shadow);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.admin-chart-controls select,
.admin-settings select,
.admin-users-toolbar select {
  min-height: 46px;
  padding-top: 0;
  padding-bottom: 0;
}
.admin-settings input:not([type="checkbox"])::placeholder,
.admin-users-toolbar input::placeholder,
.admin-bot-edit input::placeholder,
.admin-bot-form input::placeholder,
.admin-giveaway-form input::placeholder,
.admin-prize-controls input::placeholder,
.admin-giveaway-form textarea::placeholder {
  color: var(--hint);
  opacity: .7;
}
.admin-chart-controls select:focus,
.admin-settings input:not([type="checkbox"]):focus,
.admin-settings select:focus,
.admin-users-toolbar input:focus,
.admin-users-toolbar select:focus,
.admin-bot-edit input:focus,
.admin-bot-form input:focus,
.admin-giveaway-form input:focus,
.admin-prize-controls input:focus,
.admin-giveaway-form textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--link) 55%, var(--separator));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--link) 18%, transparent), var(--shadow);
}
.admin-metric-tabs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(82px, 1fr)); gap: 4px;
  background: var(--fill); border-radius: 9px; padding: 3px;
}
.admin-metric-tabs button {
  border-radius: 7px; padding: 7px 4px; color: var(--hint);
  font-size: 11px; font-weight: 700; min-width: 0;
}
.admin-metric-tabs button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.admin-chart { display: grid; grid-template-columns: repeat(var(--admin-chart-cols, 14), minmax(6px, 1fr)); align-items: end; gap: 5px; height: 142px; padding-top: 8px; }
.admin-bar { display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 5px; height: 100%; }
.admin-bar i { width: 100%; min-height: 3px; border-radius: 5px 5px 2px 2px; background: var(--accent); display: block; }
.admin-bar.profit i { background: var(--green); }
.admin-bar.buyKeys i { background: #5856d6; }
.admin-bar.sellKeys i { background: #ff9500; }
.admin-bar.newUsers i { background: #00a8a8; }
.admin-bar.txCount i { background: #8e8e93; }
.admin-bar.negative i { background: var(--red); }
.admin-bar small { color: var(--hint); font-size: 9px; }
.admin-settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.admin-settings label, .admin-users-toolbar { min-width: 0; }
.admin-settings label { display: flex; flex-direction: column; gap: 5px; }
.admin-settings span { color: var(--hint); font-size: 11px; font-weight: 650; }
.admin-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--fill); border-radius: 10px; padding: 11px 12px; margin-bottom: 12px;
  font-size: 13px; font-weight: 650;
}
.admin-toggle-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-toggle-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.admin-toggle-copy small {
  color: var(--hint);
  font-size: 11px;
  line-height: 1.3;
}
.admin-toggle-row .copy-btn {
  flex-shrink: 0;
}
.admin-toggle-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.admin-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.admin-panel-actions .copy-btn.active {
  background: var(--fill);
  color: var(--text);
  border-color: var(--separator);
}
.admin-giveaway-composer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 88%, var(--fill) 12%);
  border: 1px solid var(--separator);
  box-shadow: var(--shadow);
}
.admin-giveaway-form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.admin-giveaway-form label { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.admin-giveaway-form .wide { grid-column: 1 / -1; }
.admin-giveaway-form span { color: var(--hint); font-size: 11px; font-weight: 650; }
.admin-giveaway-form textarea {
  resize: vertical; min-height: 92px;
}
.admin-giveaway-field { gap: 6px; }
.admin-giveaway-field-title,
.admin-giveaway-field-description,
.admin-giveaway-field-chats,
.admin-giveaway-field-prizes {
  grid-column: 1 / -1;
}
.admin-giveaway-field-start,
.admin-giveaway-field-end {
  grid-column: span 3;
}
.admin-giveaway-field-min-bought,
.admin-giveaway-field-min-sold,
.admin-giveaway-field-min-activity {
  grid-column: span 2;
}
.admin-prize-builder {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--fill);
  overflow: hidden;
}
.admin-prize-title {
  color: var(--hint);
  font-size: 11px;
  font-weight: 650;
}
.admin-prize-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px;
  align-items: stretch;
  width: 100%;
}
.admin-prize-controls label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.admin-prize-type-wrap { min-width: 0; }
.admin-prize-type-toggle { width: 100%; }
.admin-prize-type-toggle button { font-size: 13px; }
.admin-prize-add-btn {
  min-width: 0;
  width: 100%;
  min-height: 46px;
  align-self: stretch;
}
.admin-prize-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 7px;
  width: 100%;
}
.admin-prize-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: var(--fill);
  border-radius: 10px;
  padding: 9px 10px;
  min-height: 100%;
}
.admin-prize-row div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-prize-row strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.admin-prize-row span {
  color: var(--hint);
  font-size: 11px;
}
.admin-giveaway-participants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-giveaway-participant-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--fill);
}
.admin-giveaway-participant-index {
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft-fill);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 800;
}
.admin-giveaway-participant-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.admin-giveaway-participant-main b,
.admin-giveaway-participant-main span,
.admin-giveaway-participant-main small {
  overflow-wrap: anywhere;
}
.admin-giveaway-participant-main span {
  color: var(--hint);
  font-size: 12px;
}
.admin-giveaway-participant-main small {
  color: var(--hint);
  font-size: 11px;
}
.admin-giveaway-participant-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.admin-giveaway-sheet-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  margin-top: -4px;
}
.admin-giveaway-sheet-meta b {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.admin-giveaway-sheet-meta span {
  color: var(--hint);
  font-size: 12px;
}
.admin-users-toolbar { display: grid; grid-template-columns: 1fr 132px; gap: 8px; margin-bottom: 10px; }
.admin-total { color: var(--hint); font-size: 12px; font-weight: 700; white-space: nowrap; }
.admin-users-list, .admin-bots-list, .admin-orders-list, .admin-transactions-list { display: flex; flex-direction: column; gap: 8px; }
.admin-user-row, .admin-bot-row, .admin-order-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  background: var(--card); border-radius: 12px; padding: 12px 13px;
  border: 1px solid var(--separator); box-shadow: var(--shadow);
  text-align: left;
}
.admin-user-row strong, .admin-bot-row strong, .admin-order-row strong { font-size: 15px; }
.admin-user-row span, .admin-bot-row span, .admin-order-row span { color: var(--hint); font-size: 12px; }
.admin-user-row b, .admin-bot-row b, .admin-order-row b { font-size: 18px; line-height: 1.1; }
.admin-user-row:active, .admin-order-row:active { transform: scale(.99); }
.admin-user-main, .admin-user-side, .admin-profile-title { min-width: 0; display: flex; flex-direction: column; }
.admin-user-main { gap: 5px; justify-content: center; }
.admin-user-main span { line-height: 1.35; }
.admin-user-side { align-items: flex-end; justify-content: center; gap: 5px; text-align: right; }
.admin-user-side small { color: var(--hint); font-size: 11px; }
.admin-order-card {
  border: 1px solid color-mix(in srgb, var(--separator) 86%, transparent);
}
.admin-order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.admin-order-head-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.admin-order-user {
  font-size: 15px;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.admin-order-user-meta,
.admin-order-updated {
  color: var(--hint);
  font-size: 12px;
  line-height: 1.35;
}
.admin-order-head-side {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
}
.admin-order-volume {
  font-size: 15px;
  font-weight: 750;
}
.admin-order-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--hint);
  font-size: 11px;
  font-weight: 750;
}
.admin-order-chip.active { background: var(--accent-soft-fill); color: var(--accent-ink); }
.admin-order-chip.done { background: rgba(52,199,89,.14); color: var(--green); }
.admin-order-chip.fail { background: rgba(255,59,48,.12); color: var(--red); }
.admin-order-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.admin-order-cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--fill);
}
.admin-order-cell span {
  color: var(--hint);
  font-size: 11px;
  font-weight: 650;
}
.admin-order-cell b {
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.admin-order-message {
  color: var(--hint);
  font-size: 13px;
  line-height: 1.4;
}
.admin-order-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.admin-order-actions .btn,
.admin-order-actions .btn-soft {
  min-height: 38px;
  padding: 10px 8px;
  font-size: 13px;
}
.admin-order-actions .btn.danger {
  background: rgba(255,59,48,.10);
  color: var(--red);
}
.admin-user-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-inline-chip {
  padding: 4px 7px; border-radius: 999px; background: var(--fill);
  border: 1px solid color-mix(in srgb, var(--separator) 92%, transparent);
  color: var(--hint); font-size: 11px; font-weight: 700;
}
.admin-inline-chip.danger { color: var(--red); background: rgba(255,59,48,.1); border-color: rgba(255,59,48,.15); }
.admin-profile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.admin-profile-head strong { font-size: 18px; }
.admin-profile-link {
  width: fit-content; max-width: 100%; padding: 0; margin: 0; border: 0; background: none;
  color: var(--text); text-align: left; font: inherit;
}
.admin-profile-link strong { display: block; max-width: 100%; overflow-wrap: anywhere; }
.admin-profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-profile-actions .copy-btn { min-height: 36px; }
.admin-profile-section {
  display: flex; flex-direction: column; gap: 10px;
  background: color-mix(in srgb, var(--card) 94%, var(--fill) 6%);
  border: 1px solid var(--separator);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.admin-profile-section .admin-panel-head { margin-bottom: 0; }
.admin-profile-referrals { display: flex; flex-direction: column; gap: 8px; }
.admin-profile-periods { margin-bottom: 10px; }
.admin-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-chip { padding: 6px 8px; border-radius: 8px; background: var(--fill); color: var(--hint); font-size: 12px; font-weight: 700; }
.admin-chip.on { background: rgba(255,59,48,.13); color: var(--red); }
.admin-ban-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.admin-ban-grid button { min-height: 38px; font-size: 13px; }
.admin-ban-grid button.active { background: rgba(255,59,48,.13); color: var(--red); }
.admin-bot-row { grid-template-columns: 1fr; }
.admin-bot-row.openable { cursor: pointer; }
.admin-bot-main { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.admin-bot-edit { display: grid; grid-template-columns: 92px 1fr auto auto; gap: 8px; align-items: center; }
.admin-bot-edit .copy-btn { padding: 8px 4px; }
.admin-bot-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.admin-bot-actions .btn { min-height: 38px; padding: 10px 8px; font-size: 13px; }
.admin-bot-form { display: grid; grid-template-columns: 1fr 92px; gap: 8px; align-items: end; }
.admin-bot-form.wide { grid-template-columns: 1fr; }
.admin-offer-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  background: var(--fill); border-radius: 9px; padding: 9px 10px;
}
.admin-offer-row strong { font-size: 13px; }
.admin-offer-row span { color: var(--hint); font-size: 12px; }
.admin-audit-list { display: flex; flex-direction: column; gap: 8px; }
.admin-audit-row {
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--fill); border-radius: 9px; padding: 10px 11px;
}
.admin-audit-row span { color: var(--hint); font-size: 12px; }
.admin-audit-row b { font-size: 13px; text-align: right; }
.admin-audit-actions {
  display: flex;
  margin-top: 12px;
}
.admin-audit-actions .btn {
  width: 100%;
}

@media (max-width: 390px) {
  .admin-settings { grid-template-columns: 1fr; }
  .admin-users-toolbar { grid-template-columns: 1fr; }
  .admin-chart-controls { grid-template-columns: 1fr; }
  .admin-metric-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-dashboard-stat { padding: 11px 12px; }
  .admin-dashboard-stat b { font-size: 16px; }
  .admin-dashboard-stat small { font-size: 10px; }
  .admin-line-chart-wrap { min-height: 238px; padding-top: 52px; }
  .admin-line-chart-ylabels text { font-size: 9px; }
  .admin-line-chart-svg { height: 182px; }
  .admin-chart-tooltip { min-width: 118px; max-width: calc(100% - 16px); padding: 8px 9px; }
  .admin-chart-tooltip strong { font-size: 11px; }
  .admin-chart-tooltip span { font-size: 10px; }
  .admin-chart-axis span { font-size: 9px; }
  .admin-user-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 11px; align-items: flex-start; }
  .admin-user-row strong { font-size: 13px; }
  .admin-user-row span { font-size: 10px; }
  .admin-user-row b { font-size: 15px; }
  .admin-user-main { align-items: flex-start; text-align: left; gap: 4px; }
  .admin-user-main span { line-height: 1.25; }
  .admin-user-side { align-items: flex-start; justify-content: flex-start; text-align: left; gap: 3px; min-width: 72px; }
  .admin-user-side small { font-size: 10px; }
  .admin-overview-row { flex-direction: column; gap: 4px; }
  .admin-overview-row b { text-align: left; }
  .admin-order-grid { grid-template-columns: 1fr; }
  .admin-order-actions { grid-template-columns: 1fr; }
  .admin-order-head { flex-direction: column; }
  .admin-order-head-side { align-items: flex-start; text-align: left; }
  .admin-bot-edit { grid-template-columns: 1fr; }
  .admin-bot-actions { grid-template-columns: 1fr; }
  .admin-bot-form { grid-template-columns: 1fr; }
  .admin-prize-controls { grid-template-columns: 1fr; }
  .admin-prize-row { grid-template-columns: 1fr; }
  .admin-prize-row .copy-btn { width: 100%; }
  .giveaway-admin-actions { grid-template-columns: 1fr; }
}

/* ===================== SHEET ===================== */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .28s;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-overlay.active { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 540px; background: var(--card);
  border-radius: 20px 20px 0 0; padding: 10px 20px calc(24px + var(--safe-bottom));
  transform: translateY(100%); transition: transform .32s cubic-bezier(.22,.61,.36,1);
  max-height: 88vh; overflow-y: auto;
}
.sheet-overlay.active .sheet { transform: translateY(0); }
.sheet-handle { width: 36px; height: 5px; border-radius: 3px; background: var(--separator); margin: 4px auto 16px; }
.sheet-content { display: flex; flex-direction: column; gap: 14px; }
.sheet-emoji { font-size: 44px; text-align: center; }
.sheet-title { font-size: 19px; font-weight: 700; text-align: center; }
.sheet-text { font-size: 15px; text-align: center; line-height: 1.5; color: var(--text); }
.sheet-text b { font-weight: 700; }
.sheet-detail-grid { display: flex; flex-direction: column; }
.sheet-detail { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; font-size: 15px; }
.sheet-detail + .sheet-detail { border-top: 1px solid var(--separator); }
.sheet-detail span { color: var(--hint); }
.sheet-detail b { text-align: right; word-break: break-all; }
.sheet-links-block { display: flex; flex-direction: column; gap: 8px; }
.sheet-links-list { display: flex; flex-direction: column; gap: 8px; }
.sheet-link-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%;
  padding: 11px 12px; text-align: left; background: var(--fill); color: var(--text);
  border: 1px solid var(--separator); border-radius: 12px;
}
.sheet-link-row span { font-size: 13px; font-weight: 700; color: var(--link); }
.sheet-link-row small { color: var(--hint); font-size: 11px; line-height: 1.35; word-break: break-all; }
.admin-login-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.admin-login-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--fill);
  font-size: 28px;
}
.admin-login-input {
  width: 100%;
  min-height: 48px;
  background: var(--fill);
  color: var(--text);
  border: 1px solid var(--separator);
  border-radius: var(--r2);
  padding: 0 14px;
  font: inherit;
  font-size: 16px;
}
.timer-ring { font-size: 30px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.timer-ring.warn { color: var(--red); }
.timer-ring.compact { font-size: 24px; }
.order-status-stack { display: flex; flex-direction: column; gap: 12px; }
.order-status-stack > .sheet-text { margin: 0; }
.order-status-actions { display: flex; flex-direction: column; gap: 10px; }
.order-status-actions .btn { margin: 0; }
.trade-deadline {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  background: var(--fill); border-radius: 10px; padding: 12px 13px; text-align: left;
}
.trade-deadline span { color: var(--hint); font-size: 13px; }
.trade-deadline small { grid-column: 1 / -1; color: var(--hint); font-size: 12px; line-height: 1.35; }
.trade-result-list { display: flex; flex-direction: column; gap: 8px; }
.trade-result {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  align-items: center; background: var(--fill); border-radius: 10px; padding: 11px 12px;
  border-left: 3px solid var(--separator);
}
.trade-result.done { border-left-color: var(--green); }
.trade-result.fail { border-left-color: var(--red); }
.trade-result.active { border-left-color: var(--accent); }
.trade-result-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.trade-result-main strong { font-size: 14px; }
.trade-result-main span, .trade-result-reason, .trade-result-refund { color: var(--hint); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.trade-result-refund { color: var(--green); }
.trade-result-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; text-align: right; }
.trade-result-side b { font-size: 12px; max-width: 128px; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .admin-giveaway-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-giveaway-field-start,
  .admin-giveaway-field-end { grid-column: span 1; }
  .admin-giveaway-field-min-bought,
  .admin-giveaway-field-min-sold { grid-column: span 1; }
  .admin-giveaway-field-min-activity { grid-column: 1 / -1; }
}

/* ===================== TOAST ===================== */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 26px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.85); color: #fff; padding: 11px 18px; border-radius: 12px;
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== SKELETON / SPINNER ===================== */
.skeleton, .skeleton-text {
  background: linear-gradient(90deg, var(--fill) 25%, rgba(120,120,128,.04) 37%, var(--fill) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
  color: transparent !important; border-radius: 6px;
}
.skeleton-text { display: inline-block; min-width: 120px; height: 13px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.bot-skel { padding: 16px; }
.bot-skel .sk-line { height: 13px; border-radius: 6px; margin-bottom: 12px; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; border-top-color: transparent; display: inline-block; vertical-align: middle; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== ДОРАБОТКИ ===================== */

@media (max-width: 360px) {
  .market-head { gap: 6px; }
  .shop-notice { padding: 11px 12px; gap: 10px; }
  .shop-notice-copy strong { font-size: 12px; }
  .shop-notice-copy span { font-size: 11px; }
  .market-stat { min-height: 60px; padding: 9px 8px 8px; }
  .market-stat span { font-size: 10px; }
  .market-stat b { font-size: 15px; }
  .market-stat.stock b { font-size: 15px; }
  .market-stat small { font-size: 9px; }
  .tab-label { font-size: 9px; }
  .tab { padding-left: 3px; padding-right: 3px; }
  .giveaway-foot .btn { width: 100%; }
  .admin-giveaway-form { grid-template-columns: 1fr; }
  .admin-giveaway-form .wide,
  .admin-giveaway-field-start,
  .admin-giveaway-field-end,
  .admin-giveaway-field-min-bought,
  .admin-giveaway-field-min-sold,
  .admin-giveaway-field-min-activity { grid-column: auto; }
  .admin-panel-actions { width: 100%; justify-content: stretch; }
  .admin-panel-actions .copy-btn { width: 100%; }
  .admin-prize-list { grid-template-columns: 1fr; }
  .admin-giveaway-participant-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .admin-giveaway-participant-actions { grid-column: 2; justify-content: flex-start; }
  .giveaway-prize-grid { grid-template-columns: 1fr; }
  .giveaway-condition-row { grid-template-columns: 24px minmax(0, 1fr); }
  .giveaway-condition-row small { grid-column: 2; }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-hero { grid-template-columns: 1fr; }
  .stats-hero small { text-align: left; }
  .referral-row { grid-template-columns: 36px minmax(0, 1fr); }
  .referral-row b { grid-column: 2; }
  .giveaway-compact-actions { justify-content: stretch; flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
  .admin-dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-dashboard-chart-grid,
  .admin-dashboard-breakdowns { grid-template-columns: 1fr; }
  .admin-dashboard-card { padding: 11px; }
  .admin-chart-legend-btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
  .market-actions { justify-content: stretch; }
  .market-bots-btn { width: 100%; }
  .admin-giveaway-form { grid-template-columns: 1fr; }
  .admin-giveaway-form .wide,
  .admin-giveaway-field-start,
  .admin-giveaway-field-end,
  .admin-giveaway-field-min-bought,
  .admin-giveaway-field-min-sold,
  .admin-giveaway-field-min-activity { grid-column: auto; }
  .admin-prize-controls { grid-template-columns: 1fr; }
  .admin-prize-row { grid-template-columns: 1fr; }
  .admin-prize-row .copy-btn { width: 100%; }
  .giveaway-foot .btn { width: 100%; }
  .giveaway-prize-grid { grid-template-columns: 1fr; }
  .giveaway-compact-actions { width: 100%; }
  .giveaway-compact-actions .btn, .giveaway-compact-actions .copy-btn { width: 100%; }
  .sell-link-row, .scan-result-row { grid-template-columns: 1fr; align-items: stretch; }
  .sell-link-input { width: 100%; }
  .sell-link-input .copy-btn { width: 100%; }
}

/* Иконки оплаты (картинки + вектор для баланса) */
.pay-img { width: 26px; height: 26px; object-fit: contain; display: block; }
.pay-ic-svg-wrap { display: flex; align-items: center; justify-content: center; height: 26px; }
.pay-ic-svg { width: 24px; height: 24px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Отступ между полем суммы и кнопкой "Создать счёт" (CryptoBot) */
#topupCbBox { display: flex; flex-direction: column; gap: var(--gap); }

/* История: список + пагинация */
.tx-list { display: flex; flex-direction: column; gap: 10px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; }
.pager-btn {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--text);
  border-radius: 9px; box-shadow: var(--shadow);
  font-size: 14px; font-weight: 600;
  transition: transform .1s, background .15s;
}
button.pager-btn:active { transform: scale(.94); }
.pager-btn.current { background: var(--accent); color: var(--accent-text); box-shadow: none; }
.pager-btn.pager-arrow { color: var(--link); font-weight: 700; }
.pager-ellipsis { min-width: 20px; text-align: center; color: var(--hint); font-weight: 600; }

/* Кнопки в окне подтверждения (Отмена / Подтвердить) */
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { margin: 0; }

/* ===================== UI POLISH FIXES ===================== */
.segmented:not(.stats-segmented) {
  padding: 4px;
}
.segmented:not(.stats-segmented) .seg-thumb {
  top: 4px;
  left: 4px;
  width: calc(50% - 6px);
  height: calc(100% - 8px);
  border-radius: 10px;
  background: color-mix(in srgb, var(--card) 84%, var(--bg) 16%);
}
.segmented[data-mode="sell"] .seg-thumb,
.segmented[data-mode="per_link"] .seg-thumb,
.segmented[data-status="completed"] .seg-thumb {
  transform: translateX(calc(100% + 4px));
}

.mini-toggle::before {
  width: calc(50% - 6px);
  border-radius: 10px;
}
.mini-toggle[data-mode="multi"]::before,
.mini-toggle[data-mode="sell"]::before,
.mini-toggle[data-mode="per_link"]::before,
.mini-toggle[data-status="completed"]::before,
.mini-toggle[data-value="money"]::before,
.mini-toggle[data-value="bnb"]::before {
  transform: translateX(calc(100% + 4px));
}

.field input,
.field textarea,
.field select,
.input-with-action input,
.sub-body input,
.sub-body textarea,
.sub-body select,
.admin-login-input,
.scan-box,
.trade-link-box,
.topup-box {
  background: color-mix(in srgb, var(--card) 92%, var(--text) 4%);
  /*border-color: color-mix(in srgb, var(--separator) 66%, var(--text) 9%);*/
  box-shadow: inset 0 1px 0 rgba(255,255,255,.02), var(--shadow);
}

.field input::placeholder,
.field textarea::placeholder,
.input-with-action input::placeholder,
.sub-body input::placeholder,
.sub-body textarea::placeholder,
.admin-login-input::placeholder {
  color: color-mix(in srgb, var(--hint) 88%, var(--text) 12%);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.input-with-action input:focus,
.sub-body input:focus,
.sub-body textarea:focus,
.sub-body select:focus,
.admin-login-input:focus {
  background: color-mix(in srgb, var(--card) 89%, var(--text) 5%);
  border-color: var(--accent-border-strong);
}

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
