:root {
  --bg: #08090b;
  --bg-2: #0d0f12;
  --surface: #121519;
  --surface-2: #171b20;
  --line: #222830;
  --line-2: #2c343e;
  --text: #e8edf2;
  --muted: #8a96a3;
  --dim: #5d6873;
  --accent: #34d399;
  --accent-2: #10b981;
  --accent-ink: #03140c;
  --accent-soft: rgba(52, 211, 153, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, .12);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 750; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.green { color: var(--accent); }
.amber { color: var(--warn); }
.red { color: var(--danger); }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.stack.sm { gap: 6px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .g2, .g3 { grid-template-columns: 1fr; } }
.split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.split.even { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 900px) { .split, .split.even { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; } .mt-lg { margin-top: 28px; } .mb { margin-bottom: 16px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; }
.btn:hover { border-color: #3a4450; background: #1c2128; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #4ee3ad; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: rgba(248,113,113,.4); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.field > span.hint { color: var(--dim); font-weight: 400; font-size: 12px; }
.input, select.input, textarea.input { width: 100%; height: 42px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font: inherit; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--dim); }
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% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.form-error { background: var(--danger-soft); color: #fecaca; border: 1px solid rgba(248,113,113,.35); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* ---------- chips (multi-select) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer; user-select: none; transition: all .15s; }
.chip:hover { border-color: #3a4450; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.choice { text-align: left; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface); cursor: pointer;
  color: var(--text); font: inherit; display: flex; gap: 12px; align-items: flex-start; transition: all .15s; }
.choice:hover { border-color: #3a4450; }
.choice.on { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), transparent); }
.choice .ico { font-size: 20px; line-height: 1; }
.choice b { display: block; font-size: 14px; margin-bottom: 2px; }
.choice small { color: var(--muted); font-size: 12.5px; line-height: 1.4; display: block; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.pad-lg { padding: 28px; }
.card.flat { background: var(--bg-2); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .sub { color: var(--dim); font-size: 12.5px; }
.hero-balance { background: radial-gradient(120% 140% at 0% 0%, rgba(52,211,153,.18), transparent 55%), var(--surface); border-color: rgba(52,211,153,.25); }
.hero-balance .value { font-size: 36px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-2); white-space: nowrap; }
.badge.green { background: var(--accent-soft); color: var(--accent); border-color: rgba(52,211,153,.3); }
.badge.amber { background: var(--warn-soft); color: var(--warn); border-color: rgba(251,191,36,.3); }
.badge.red { background: var(--danger-soft); color: var(--danger); border-color: rgba(248,113,113,.3); }
.badge.blue { background: var(--info-soft); color: var(--info); border-color: rgba(96,165,250,.3); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table td.r, .table th.r { text-align: right; }

/* ---------- copy field ---------- */
.copy { display: flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 4px 4px 4px 12px; min-width: 0; }
.copy code { flex: 1; font-family: var(--mono); font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- public layout ---------- */
.pub-nav { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); background: rgba(8,9,11,.75); border-bottom: 1px solid var(--line); }
.pub-nav .in { max-width: 1140px; margin: 0 auto; padding: 14px 22px; display: flex; align-items: center; gap: 18px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .08em; font-size: 14px; color: var(--text) !important; text-decoration: none !important; }
.logo .mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #0ea371); display: grid; place-items: center; color: var(--accent-ink); font-size: 14px; }
.logo small { color: var(--accent); font-weight: 700; }
.container { max-width: 1140px; margin: 0 auto; padding: 0 22px; }
.hero { padding-top: 80px; padding-bottom: 56px; }
.hero h1 { font-size: clamp(36px, 6vw, 60px); font-weight: 800; letter-spacing: -.035em; line-height: 1.03; max-width: 820px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 620px; margin-top: 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 40px; }
.kpis > div { background: var(--surface); padding: 20px; }
.kpis b { display: block; font-size: 28px; letter-spacing: -.02em; }
.kpis span { color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section h2 { font-size: 28px; letter-spacing: -.02em; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 26px; }
.steps .card b { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; font-size: 13px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }
.footer { border-top: 1px solid var(--line); padding: 30px 0 50px; color: var(--dim); font-size: 13px; }

/* ---------- product cards ---------- */
.store-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.store-head .sw { width: 10px; height: 10px; border-radius: 3px; }
.store-head h3 { font-size: 15px; }
.store-head a { color: var(--dim); font-size: 13px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.product { display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.product::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c, var(--accent)); opacity: .9; }
.product .earn { display: flex; align-items: baseline; gap: 8px; padding: 12px 14px; background: var(--bg-2); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.product .earn b { font-size: 22px; color: var(--accent); font-variant-numeric: tabular-nums; }
.product ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.product li { font-size: 13px; color: var(--muted); }
.product li::before { content: "✓ "; color: var(--accent); }
.campaign { border: 1px solid rgba(251,191,36,.3); background: linear-gradient(135deg, rgba(251,191,36,.10), transparent 60%), var(--surface); }

/* ---------- auth / wizard ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px;
  background: radial-gradient(60% 50% at 50% 0%, rgba(52,211,153,.10), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; }
.wizard { width: 100%; max-width: 760px; }
.stepper { display: flex; gap: 6px; margin: 18px 0 26px; }
.stepper div { flex: 1; height: 4px; border-radius: 4px; background: var(--line-2); transition: background .3s; }
.stepper div.done { background: var(--accent); }
.stepper div.now { background: linear-gradient(90deg, var(--accent), var(--line-2)); }
.step-label { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.wizard-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--bg-2); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.side .logo { padding: 4px 8px 18px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--muted); font-weight: 550; font-size: 14px; text-decoration: none !important; position: relative; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.on { color: var(--text); background: var(--surface-2); }
.nav-item.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .count { margin-left: auto; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 6px; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #1f2a33, #2c3a45); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--accent); flex-shrink: 0; }
.main { min-width: 0; }
.topbar { display: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 30px 30px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; }
.tabbar { display: none; }
.banner { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid rgba(251,191,36,.3); background: var(--warn-soft); color: #fde68a; font-size: 14px; margin-bottom: 18px; }
.banner.info { border-color: rgba(96,165,250,.3); background: var(--info-soft); color: #bfdbfe; }
.banner.ok { border-color: rgba(52,211,153,.3); background: var(--accent-soft); color: #a7f3d0; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; padding: 12px 16px; background: rgba(8,9,11,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .page { padding: 20px 16px 110px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(13,15,18,.95); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--dim); font-size: 11px; font-weight: 600; padding: 6px 0; text-decoration: none !important; }
  .tabbar a.on { color: var(--accent); }
  .tabbar svg { width: 20px; height: 20px; }
}

/* ---------- checklist ---------- */
.checklist { display: flex; flex-direction: column; gap: 2px; }
.checklist a { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 9px; color: var(--text); text-decoration: none !important; font-size: 14px; }
.checklist a:hover { background: var(--surface-2); }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }
.checklist .done .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.checklist .done span.t { color: var(--muted); text-decoration: line-through; }
.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s; }

/* ---------- chart ---------- */
.chart { width: 100%; height: 170px; display: block; }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .line { fill: none; stroke: var(--info); stroke-width: 2; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--dim); font-size: 10px; font-family: var(--font); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 18px; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 36px); overflow: auto; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); animation: pop .18s ease-out; }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
#toasts { position: fixed; z-index: 200; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1d232a; border: 1px solid var(--line-2); color: var(--text); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; font-weight: 550; animation: pop .2s; display: flex; gap: 8px; align-items: center; }
.toast.ok::before { content: "✓"; color: var(--accent); font-weight: 800; }
.toast.err { border-color: rgba(248,113,113,.4); }
.toast.err::before { content: "!"; color: var(--danger); font-weight: 800; }
@media (max-width: 900px) { #toasts { bottom: 90px; } }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 32px; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--accent); }
.code-block { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; color: #cbd5e1; }
.note { font-size: 13px; color: var(--muted); background: var(--bg-2); border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.channel-row { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.channel-ico { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.ann { padding: 14px 0; border-bottom: 1px solid var(--line); }
.ann:last-child { border-bottom: 0; }
.ann.unread h4::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 2px; }
.loading { display: grid; place-items: center; padding: 80px; color: var(--dim); }
.loading::after { content: ""; width: 22px; height: 22px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@media (max-width: 600px) {
  .stat .value { font-size: 22px; }
  .hero-balance .value { font-size: 28px; }
  .card { padding: 16px; }
  .card.pad-lg { padding: 20px; }
  h1 { font-size: 24px; }
}
