/* Тёмная тема. Все цвета — в переменных ниже: чтобы сменить акцент, достаточно поправить --accent. */
:root {
  color-scheme: dark;
  --bg: #0a0c10;
  --panel: #12151c;
  --panel-2: #191d26;
  --line: #242a36;
  --text: #eef0f5;
  --muted: #8a93a8;
  --accent: #b8f53d;          /* основной акцент */
  --accent-ink: #0a0c10;      /* текст на акценте */
  --accent-soft: rgba(184, 245, 61, .12);
  --pos: #3ddc84;
  --neg: #ff5d6c;
  --warn: #ffc24b;
  --info: #5ab0ff;
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--text);
  font: 14px/1.5 Inter, "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(184, 245, 61, .08), transparent 60%),
    radial-gradient(700px 400px at -10% 10%, rgba(90, 176, 255, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; letter-spacing: -.01em; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; color: var(--accent); }
main { max-width: 1400px; padding: 28px; }
body.guest main { margin: 0 auto; }

/* ---------- Каркас админки: боковое меню + верхняя строка ---------- */
body.app { display: block; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 248px; z-index: 30;
  display: flex; flex-direction: column;
  background: #0d0f14; border-right: 1px solid var(--line);
  padding: 18px 14px;
}
.brand { color: var(--text); font-weight: 800; font-size: 16px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand:hover { text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); box-shadow: 0 0 20px rgba(184, 245, 61, .45); flex: none; }
.sidebar nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #5d6679; font-weight: 600; padding: 16px 12px 6px; }
.nav-group:first-child { padding-top: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; transition: .15s; position: relative;
}
.sidebar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.sidebar nav a.on { color: var(--text); background: linear-gradient(90deg, var(--accent-soft), transparent); }
.sidebar nav a.on::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sidebar nav a.on .ic { color: var(--accent); }
.ic { width: 19px; height: 19px; flex: none; }
.side-user { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.side-user .who { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; padding: 4px; border-radius: var(--radius-sm); }
.side-user .who:hover { background: var(--panel-2); text-decoration: none; }
.side-user .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who small { display: block; font-size: 11px; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), #6fd13a); color: var(--accent-ink); font-weight: 800; font-size: 13px;
}
.avatar.sm { width: 32px; height: 32px; border-radius: 50%; font-size: 12px; }
.avatar.sm:hover { text-decoration: none; filter: brightness(1.08); }
.icon-btn { background: transparent; border: 1px solid transparent; padding: 7px; color: var(--muted); display: inline-flex; border-radius: var(--radius-sm); }
.icon-btn:hover { color: var(--text); background: var(--panel-2); border-color: var(--line); }

.shell { margin-left: 248px; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px;
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: rgba(10, 12, 16, .8); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.crumbs { flex: 1; display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 500; }
.crumbs .sep { color: #3d4554; }
.top-right { display: flex; align-items: center; gap: 14px; }
.today { color: var(--muted); font-size: 13px; }
.burger { display: none; }
.backdrop { display: none; }

/* ---------- Панели ---------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent 40%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px; overflow-x: auto;
}
.card.narrow { max-width: 480px; margin: 48px auto; }
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.pagehead h1 { margin: 0; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.kpi span { display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin-bottom: 6px; }
.kpi b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpis .kpi:first-child { background: linear-gradient(135deg, rgba(184, 245, 61, .16), rgba(184, 245, 61, .02) 60%), var(--panel); border-color: rgba(184, 245, 61, .3); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 18px; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); gap: 18px; }

/* ---------- Таблицы ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 10px 9px; text-align: left; white-space: nowrap; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: var(--panel-2); border-bottom: none; }
th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: rgba(255, 255, 255, .025); }
tbody tr:last-child td { border-bottom: none; }
td.wrap { white-space: normal; min-width: 120px; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: none; padding-top: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
tr.muted td { color: var(--muted); }
td.actions { text-align: right; }
td.actions a { color: var(--muted); margin-right: 8px; }
td.actions a:hover { color: var(--text); }

/* ---------- Формы ---------- */
form.inline { display: inline; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.formrow { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.formrow label, .stack label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; min-width: 150px; }
.formrow label.short { min-width: 90px; width: 120px; }
.formrow label.wide { flex: 1; min-width: 220px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
input, select, textarea {
  font: inherit; color: var(--text);
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #566074; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=file] { padding: 7px; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; padding: 0; }
textarea { font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; width: 100%; min-height: 140px; }
button {
  font: inherit; font-weight: 600; color: var(--text);
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; transition: .15s;
}
button:hover { border-color: #3a4252; background: #20252f; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.07); box-shadow: 0 6px 24px rgba(184, 245, 61, .28); }
button.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 500; }
button.link:hover { box-shadow: none; text-decoration: underline; }
button.link.danger { color: var(--neg); }
select.mini { padding: 4px 8px; font-size: 12px; border-radius: 999px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.end { align-self: end; }
.mt { margin-top: 24px; }
details { margin-top: 12px; }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; }
pre { background: var(--panel-2); border: 1px solid var(--line); color: #c9d1e0; padding: 12px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.bigLink { word-break: break-all; font-weight: 600; }

/* ---------- Сообщения, чипы, статусы ---------- */
.alert { background: rgba(255, 93, 108, .1); color: #ff9aa4; border: 1px solid rgba(255, 93, 108, .3); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; }
.ok { background: rgba(61, 220, 132, .1); color: #7ee8ad; border: 1px solid rgba(61, 220, 132, .3); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted); }
.chip b { color: var(--text); }
.chip.total { border-color: rgba(184, 245, 61, .35); }
.pill { border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.st-pending, .st-warmup { background: rgba(255, 194, 75, .12); color: var(--warn); border-color: rgba(255, 194, 75, .25); }
.st-hold { background: rgba(255, 145, 77, .12); color: #ff9d5c; border-color: rgba(255, 145, 77, .25); }
.st-received, .st-active { background: rgba(61, 220, 132, .12); color: var(--pos); border-color: rgba(61, 220, 132, .25); }
.st-rejected, .st-banned { background: rgba(255, 93, 108, .12); color: var(--neg); border-color: rgba(255, 93, 108, .25); }
.st-spent { background: rgba(138, 147, 168, .12); color: var(--muted); border-color: rgba(138, 147, 168, .25); }

/* ---------- Карты: в виде банковских карт ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin-bottom: 18px; }
.cardbox {
  position: relative; overflow: hidden; aspect-ratio: 1.586; min-height: 160px;
  display: flex; flex-direction: column; padding: 18px 20px; border-radius: 18px;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(184, 245, 61, .35), transparent 55%),
    linear-gradient(135deg, #1d2330 0%, #0f1219 100%);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
}
.cardbox:nth-child(3n+2) { background: radial-gradient(120% 90% at 100% 0%, rgba(90, 176, 255, .38), transparent 55%), linear-gradient(135deg, #1b2233 0%, #0e1119 100%); }
.cardbox:nth-child(3n+3) { background: radial-gradient(120% 90% at 100% 0%, rgba(178, 120, 255, .36), transparent 55%), linear-gradient(135deg, #211d30 0%, #100e18 100%); }
.cardbox::after { /* «чип» карты */
  content: ''; position: absolute; right: 20px; top: 20px; width: 38px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, #e9d48a, #b8994a); opacity: .85;
}
.cardbox.off { opacity: .5; filter: grayscale(.6); }
.cardbox .name { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.cardbox .bal { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: auto; font-variant-numeric: tabular-nums; }
.cardbox .meta { font-size: 12px; color: rgba(238, 240, 245, .6); }
.cardbox .meta a { color: rgba(238, 240, 245, .8); }

/* ---------- Вход ---------- */
.login { margin-top: 12vh !important; padding: 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.login h1 { text-align: center; display: flex; align-items: center; justify-content: center; gap: 10px; }
.login h1::before { content: ''; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); box-shadow: 0 0 22px rgba(184, 245, 61, .5); }
.login button.primary { width: 100%; padding: 11px; }

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 60px rgba(0, 0, 0, .5); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .5); }
  .shell { margin-left: 0; }
  .burger { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .today { display: none; }
  main { padding: 16px; }
  .grid3, .section-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 18px; }
  h1 { font-size: 22px; }
}
a.btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted); font-weight: 600; font-size: 13px; }
a.btn-ghost:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }

/* --- Аналитика: графики, дельты, планы --- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); gap: 18px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cardhead h2 { margin: 0; }
.cmp { margin: -8px 0 18px; }
.delta { display: inline-block; margin-left: 8px; font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 7px; border-radius: 999px; background: var(--panel-2); vertical-align: 3px; }
.delta.up { color: var(--pos); background: rgba(61, 220, 132, .1); }
.delta.down { color: var(--neg); background: rgba(255, 93, 108, .1); }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { font-family: inherit; }
svg.chart .ax { fill: #7d869a; font-size: 11px; }
svg.chart .lbl { fill: #c9d1e0; font-size: 12px; }
svg.chart .val { fill: #eef0f5; font-size: 12px; font-weight: 600; }
svg.chart .hit { fill: transparent; }
svg.chart .hit:hover { fill: rgba(255, 255, 255, .04); }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; margin: -4px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-spend { background: #3d8ef0; } .sw-revenue, .sw-pos { background: #6aad1f; } .sw-neg { background: #e5534b; }
.buyerchart { max-width: 640px; margin-bottom: 14px; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px 24px; }
.plan-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.meter { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter i.done { background: var(--pos); }
.meter i.w0 { width: 0%; }
.meter i.w5 { width: 5%; }
.meter i.w10 { width: 10%; }
.meter i.w15 { width: 15%; }
.meter i.w20 { width: 20%; }
.meter i.w25 { width: 25%; }
.meter i.w30 { width: 30%; }
.meter i.w35 { width: 35%; }
.meter i.w40 { width: 40%; }
.meter i.w45 { width: 45%; }
.meter i.w50 { width: 50%; }
.meter i.w55 { width: 55%; }
.meter i.w60 { width: 60%; }
.meter i.w65 { width: 65%; }
.meter i.w70 { width: 70%; }
.meter i.w75 { width: 75%; }
.meter i.w80 { width: 80%; }
.meter i.w85 { width: 85%; }
.meter i.w90 { width: 90%; }
.meter i.w95 { width: 95%; }
.meter i.w100 { width: 100%; }
.place { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--panel-2); font-weight: 700; font-size: 12px; color: var(--muted); }
.place.p1 { background: var(--accent); color: #0a0c10; }
.place.p2, .place.p3 { background: rgba(184, 245, 61, .14); color: var(--accent); }
.nav-badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; background: var(--accent); color: #0a0c10; border-radius: 999px; padding: 1px 7px; }
.st-approved { background: rgba(61, 220, 132, .12); color: var(--pos); border-color: rgba(61, 220, 132, .25); }
.st-finished { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.launch-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.launch-head .pill { margin-right: 8px; }
.launch-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.launch-meta b { color: var(--text); }
.launch-meta.result { background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 10px; }
.launch-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.launch-actions .decide { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.launch-actions .decide input { flex: 1; min-width: 200px; }
button.danger-btn { color: var(--neg); border-color: rgba(255, 93, 108, .35); }
button.danger-btn:hover { background: rgba(255, 93, 108, .1); }
.qr { width: 200px; background: #fff; padding: 10px; border-radius: 12px; margin: 8px 0 12px; }
.qr svg { display: block; width: 100%; height: auto; }
details summary { cursor: pointer; color: var(--muted); }
.buyerchart { max-width: 560px; }
.kpi .delta { display: table; margin: 8px 0 0; vertical-align: 0; }
.pagehead > .btn-ghost { margin-left: auto; }
