:root {
  --bg: #0a0a0a;
  --card: #141414;
  --card-2: #1c1c1c;
  --line: #2a2a2a;
  --text: #f5f5f0;
  --muted: #8c8c86;
  --accent: #f5f5f0;
  --accent-ink: #0a0a0a;
  --accent-2: #3a3a38; /* серые акценты: бейджи, плашки */
  --danger: #ff3b30;
  --ok: #8ee000;
  --radius: 10px;
  --head: "Anton", Impact, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 "Manrope", system-ui, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  /* зерно поверх фона */
  background-image: radial-gradient(rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 3px 3px;
}
button, input, textarea { font: inherit; color: inherit; }
main { padding: 16px; max-width: 560px; margin: 0 auto; }

.loading { font-family: var(--head); font-size: 64px; line-height: .9; color: var(--text); text-align: center; margin-top: 30vh; }

/* Шапка */
.top { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 18px; }
.pill { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 14px; font-weight: 800; }

h2 { font-family: var(--head); font-weight: 400; text-transform: uppercase; font-size: 13px; letter-spacing: 2px; color: var(--muted); margin: 22px 0 10px; }
.back { background: none; border: 0; color: var(--muted); padding: 0; margin-bottom: 12px; font-weight: 600; }

/* Карточки */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0 0 12px; color: var(--muted); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid .card { margin: 0; }
.tile small { color: var(--muted); display: block; }
.tile b { font-size: 20px; display: block; margin-top: 4px; }
.tile i { font-style: normal; color: var(--muted); font-size: 12px; }

.hero { background: var(--accent); color: var(--accent-ink); border: 0; position: relative; overflow: hidden; padding: 20px; }
.hero.dead { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.hero h1 { font-family: var(--head); font-weight: 400; font-size: 40px; line-height: 1; margin: 10px 0 6px; text-transform: uppercase; }
.hero p { color: inherit; opacity: .8; margin-bottom: 16px; }
.hero .sticker { position: absolute; right: -8px; top: 14px; transform: rotate(8deg); background: var(--accent-ink); color: var(--accent); font-family: var(--head); padding: 4px 14px; font-size: 14px; letter-spacing: 1px; }
.hero.dead .sticker { background: var(--accent); color: var(--accent-ink); }
.chip { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: rgba(0,0,0,.18); text-transform: uppercase; letter-spacing: .5px; }
.hero.dead .chip { background: var(--line); }

/* Кнопки */
.btn { display: block; width: 100%; border: 0; border-radius: 8px; padding: 14px; font-family: var(--head); font-size: 17px; letter-spacing: 1px; text-transform: uppercase; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.btn.ink { background: var(--accent-ink); color: var(--accent); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.small { padding: 10px; font-size: 14px; }
.btn:disabled { opacity: .4; }
.btn + .btn { margin-top: 10px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.steps span { background: var(--card-2); border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.flags { display: flex; gap: 8px; flex-wrap: wrap; }
.flags span { border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; }

/* Переключатели */
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; gap: 4px; margin-bottom: 10px; }
.seg button { flex: 1; background: none; border: 0; padding: 10px 4px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.seg em { font-style: normal; font-size: 10px; font-weight: 800; background: var(--accent-2); color: var(--text); border-radius: 4px; padding: 1px 4px; margin-left: 3px; }
.seg button.on em { background: var(--accent-ink); color: var(--accent); }

.plan .tag { display: inline-block; background: var(--accent-2); color: var(--text); font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }
.plan h3 { font-family: var(--head); font-weight: 400; font-size: 34px; text-transform: uppercase; margin: 8px 0; }
.plan ul { list-style: none; padding: 0; margin: 0 0 16px; }
.plan li { padding: 3px 0; }
.plan li::before { content: "✓"; color: var(--muted); font-weight: 800; margin-right: 8px; }
.price { font-family: var(--head); font-size: 44px; line-height: 1; }
.price s { font-family: "Manrope"; font-size: 16px; color: var(--muted); margin-left: 8px; }
.save { color: var(--muted); margin: 6px 0 16px; }

details.card summary { list-style: none; font-weight: 800; cursor: pointer; display: flex; justify-content: space-between; }
details.card summary::after { content: "+"; color: var(--muted); }
details[open].card summary::after { content: "−"; }
details.card > *:not(summary) { margin-top: 12px; }

input, textarea { width: 100%; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
td, th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }

/* Списки */
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.list button, .list .item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 15px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.list > :last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow small { display: block; color: var(--muted); font-size: 12px; }
.list .arrow { color: var(--muted); }
.ico { width: 38px; height: 38px; border-radius: 8px; background: var(--card-2); display: grid; place-items: center; font-size: 18px; flex: none; }
.del { background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; width: 40px; height: 40px; color: var(--danger); cursor: pointer; }
.empty { color: var(--muted); }

.doc { white-space: pre-line; }
.doc b { color: var(--text); }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 90px; margin-top: 14px; }
.bars div { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
.bars i { display: block; background: var(--muted); border-radius: 3px 3px 0 0; margin-bottom: 4px; min-height: 3px; }

/* Дашборд админки */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; margin-top: 16px; }
.chart > div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.chart .cols { display: flex; align-items: flex-end; gap: 1px; width: 100%; height: 115px; }
.chart i, .legend i { display: block; flex: 1; background: var(--text); border-radius: 2px 2px 0 0; }
.chart i.p, .legend i.p { background: var(--muted); }
.chart small { font-size: 9px; color: var(--muted); height: 14px; margin-top: 4px; white-space: nowrap; }
.legend { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.paid-tag { font-size: 10px; font-weight: 800; background: var(--text); color: var(--bg); border-radius: 4px; padding: 1px 6px; vertical-align: middle; }

/* Нагрузка серверов */
.node-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.node-row:first-child { padding-top: 0; }
.node-row.off { opacity: .5; }
.node-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.meter { height: 6px; background: var(--card-2); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.meter i { display: block; height: 100%; background: var(--text); border-radius: 3px; }

/* Нижнее меню */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(10,10,10,.96); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); backdrop-filter: blur(8px); }
.tabbar button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 8px; cursor: pointer; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tabbar button.on { color: var(--accent); background: var(--card); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); background: var(--accent); color: var(--accent-ink); font-weight: 800; padding: 12px 16px; border-radius: 8px; text-align: center; z-index: 10; }

.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 20; display: flex; align-items: flex-end; }
.sheet { background: var(--card); border-top: 2px solid var(--accent-2); width: 100%; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0; }
.sheet h3 { font-family: var(--head); font-weight: 400; text-transform: uppercase; font-size: 24px; margin: 0 0 14px; }
