/* ───────────────────────── Токены ───────────────────────── */
html, body { background: #06070a; }
:root {
  --bg: #06070a;
  --bg-2: #0b0d12;
  --surface: rgba(20, 22, 29, 0.72);
  --surface-solid: #14161d;
  --surface-2: rgba(255, 255, 255, 0.04);
  --surface-3: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --fg: #f4f5f8;
  --fg-2: rgba(235, 238, 245, 0.66);
  --fg-3: rgba(235, 238, 245, 0.42);
  --accent: #3d8bff;
  --accent-2: #74aaff;
  --accent-soft: rgba(61, 139, 255, 0.14);
  --accent-ink: #ffffff;
  --good: #30d158;
  --warn: #ff9f0a;
  --bad: #ff453a;
  --info: #64d2ff;
  --good-soft: rgba(48, 209, 88, 0.14);
  --warn-soft: rgba(255, 159, 10, 0.14);
  --bad-soft: rgba(255, 69, 58, 0.14);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 18px 50px rgba(0,0,0,.35);
  --radius-s: 10px;
  --radius: 14px;
  --radius-l: 22px;
  --radius-xl: 28px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-display: "Unbounded", "Manrope", system-ui, sans-serif;
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar: 252px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f2f3f7;
  --bg-2: #e9ebf1;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-2: rgba(10, 20, 40, 0.035);
  --surface-3: rgba(10, 20, 40, 0.06);
  --line: rgba(20, 30, 60, 0.09);
  --line-2: rgba(20, 30, 60, 0.16);
  --fg: #0d1017;
  --fg-2: rgba(25, 30, 45, 0.68);
  --fg-3: rgba(25, 30, 45, 0.46);
  --accent: #1f6fff;
  --accent-2: #1f6fff;
  --accent-soft: rgba(31, 111, 255, 0.1);
  --good: #1f9d46;
  --warn: #c86a00;
  --bad: #d92d20;
  --info: #0a7ea4;
  --good-soft: rgba(31, 157, 70, 0.12);
  --warn-soft: rgba(200, 106, 0, 0.12);
  --bad-soft: rgba(217, 45, 32, 0.1);
  --shadow: 0 1px 2px rgba(10,20,40,.06), 0 10px 30px rgba(10,20,40,.08);
  color-scheme: light;
}
:root[data-theme="light"], :root[data-theme="light"] body { background: var(--bg); }

/* ───────────────────────── База ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font: 400 15px/1.5 var(--font); color: var(--fg); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
::selection { background: var(--accent); color: #fff; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.label {
  font: 500 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .16em; color: var(--fg-3);
}
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 24px; height: 24px; }

/* ───────────────────────── Экран входа ───────────────────────── */
.login {
  position: fixed; inset: 0; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--bg); overflow: hidden;
}
.login-stage { position: relative; overflow: hidden; }
.login-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.login-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent 60%, var(--bg) 100%), linear-gradient(0deg, var(--bg) 0%, transparent 30%);
}
.login-copy { position: absolute; left: clamp(28px, 5vw, 72px); bottom: clamp(32px, 7vh, 80px); z-index: 2; max-width: 560px; }
.login-copy h1 {
  font: 500 clamp(36px, 3.9vw, 60px)/1 var(--font-display); letter-spacing: -0.045em; margin: 18px 0 18px;
  text-shadow: 0 16px 38px rgba(0,0,0,.4);
}
.login-copy h1 em { font-style: normal; color: var(--fg-3); }
.login-copy p { color: var(--fg-2); max-width: 440px; margin: 0; font-size: 16px; text-shadow: 0 2px 18px rgba(0,0,0,.42); }
.login-side { display: grid; place-items: center; padding: 32px; position: relative; z-index: 2; }
.login-card {
  width: min(400px, 100%); padding: 36px 32px 30px; border-radius: var(--radius-xl);
  background: var(--surface); border: 1px solid var(--line);
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--shadow);
}
.login-card h2 { font: 500 26px/1.1 var(--font-display); letter-spacing: -0.03em; margin: 18px 0 6px; }
.login-card .sub { color: var(--fg-2); margin: 0 0 26px; font-size: 14px; }
.login-card .field + .field { margin-top: 14px; }
.login-card .btn { width: 100%; margin-top: 22px; height: 50px; }
.login-foot { margin-top: 18px; color: var(--fg-3); font-size: 12px; text-align: center; }

/* ───────────────────────── Каркас ───────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; min-height: 100dvh; }
.backdrop-scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5; }
.backdrop-scene canvas { width: 100%; height: 100%; display: block; }
.backdrop-scene::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 80% 0%, transparent 0%, var(--bg) 62%);
}
:root[data-theme="light"] .backdrop-scene { opacity: .35; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 20;
  display: flex; flex-direction: column; gap: 6px; padding: 22px 14px 16px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-name { font: 600 15px/1.1 var(--font-display); letter-spacing: -0.02em; }
.brand-name small { display: block; font: 500 10px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 10px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px;
  color: var(--fg-2); font-weight: 500; text-decoration: none; transition: color .2s, background .2s;
}
.nav a:hover { color: var(--fg); background: var(--surface-2); }
.nav a.active { color: var(--fg); background: var(--surface-3); }
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 11px; bottom: 11px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav a .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me-chip {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: transparent; color: var(--fg); cursor: pointer; text-align: left; transition: background .2s;
}
.me-chip:hover { background: var(--surface-2); }
.me-chip > span:not(.avatar) { flex: 1; min-width: 0; }
.me-chip b { display: block; font-size: 13px; }
.me-chip small { display: block; font-size: 11px; color: var(--fg-3); }
.me-chip .icon { color: var(--fg-3); }
.engine-card {
  padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line);
}
.engine-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); position: relative; flex: none; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--good); opacity: 0; animation: ping 2.4s var(--ease) infinite; }
.pulse.off { background: var(--fg-3); } .pulse.off::after { display: none; }
.pulse.warn { background: var(--warn); } .pulse.warn::after { border-color: var(--warn); }
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 80%, 100% { transform: scale(1.8); opacity: 0; } }

.main { position: relative; z-index: 1; min-width: 0; padding: 0 clamp(16px, 3vw, 40px) 80px; }
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 14px;
  padding: 18px 0 16px; margin-bottom: 8px;
  background: linear-gradient(var(--bg) 55%, transparent);
}
.page-title { min-width: 0; }
.page-title .label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title h1 { font: 500 clamp(22px, 2.4vw, 30px)/1.1 var(--font-display); letter-spacing: -0.035em; margin: 4px 0 0; }
.topbar .spacer { flex: 1; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.view { animation: viewIn .55s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.reveal { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

/* ───────────────────────── Кнопки ───────────────────────── */
.btn {
  --b: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--b); color: var(--fg);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform .12s var(--spring), background .2s, border-color .2s, opacity .2s, box-shadow .25s;
}
.btn:hover { background: color-mix(in srgb, var(--b) 80%, var(--fg) 8%); border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.primary { --b: var(--accent); background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff 12%); }
.btn.tinted { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.btn.danger { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.btn.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon-only { width: 40px; padding: 0; }
.btn.sm.icon-only { width: 32px; }
.btn .arrow { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.18); margin-right: -8px; transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(2px) rotate(-45deg); }
.btn.loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--fg) transparent var(--fg) transparent; animation: spin .8s linear infinite;
}
.btn.primary.loading::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-panic { --b: var(--bad-soft); color: var(--bad); border-color: transparent; }
.btn-panic.on { background: var(--bad); color: #fff; animation: panic 1.6s ease-in-out infinite; }
@keyframes panic { 50% { box-shadow: 0 0 0 6px var(--bad-soft); } }

/* ───────────────────────── Поля ───────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.field .hint { font-size: 12px; color: var(--fg-3); line-height: 1.4; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
.input:focus { border-color: color-mix(in srgb, var(--accent) 70%, transparent); background: var(--surface-3); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder { color: var(--fg-3); }
select.input { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
select.input option { background: var(--surface-solid); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.row + .row, .row + .field, .field + .row, .field + .field { margin-top: 14px; }
.row > .field + .field, .row > .field { margin-top: 0; }
.code-input { font: 600 26px/1 var(--mono); letter-spacing: .4em; text-align: center; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 10px 0; cursor: pointer; }
.toggle + .toggle { border-top: 1px solid var(--line); }
.toggle .t-text b { display: block; font-weight: 600; font-size: 14px; }
.toggle .t-text small { display: block; color: var(--fg-3); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: transform .3s var(--spring); }
.switch input:checked + i { background: var(--good); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-row output { min-width: 56px; text-align: right; font: 600 13px var(--mono); color: var(--fg); }

.segmented {
  display: inline-flex; position: relative; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  position: relative; z-index: 1; height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--fg-2);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: color .2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.segmented button.on { color: var(--fg); }
.segmented .thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 9px; background: var(--surface-solid); box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .35s var(--spring), width .35s var(--spring); }
:root[data-theme="dark"] .segmented .thumb, :root:not([data-theme]) .segmented .thumb { background: rgba(255,255,255,.12); }
.segmented.lg button { height: 42px; padding: 0 18px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .2s, border-color .2s, transform .12s;
}
.chip:active { transform: scale(.97); }
.chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--fg); }
.chip .x { opacity: .5; }

/* ───────────────────────── Карточки ───────────────────────── */
.card {
  position: relative; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card-head .spacer { flex: 1; }
.card h3.section { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.card .section-sub { margin: 0 0 18px; color: var(--fg-3); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.dash { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.tilt { transform-style: preserve-3d; transition: transform .5s var(--ease); will-change: transform; }
.tilt .tilt-in { transform: translateZ(24px); }
.tilt::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.08), transparent 60%);
}
.tilt:hover::before { opacity: 1; }

.stat { padding: 20px 20px 18px; min-height: 148px; display: flex; flex-direction: column; overflow: hidden; }
.stat .label { display: flex; align-items: center; gap: 8px; }
.stat .value { font: 400 clamp(32px, 3vw, 42px)/1 var(--font-display); letter-spacing: -0.05em; margin: auto 0 6px; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 13px; color: var(--fg-3); }
.stat .ico { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--fg-2); }
.stat.alert .ico { background: var(--warn-soft); color: var(--warn); }
.stat.alert-bad .ico { background: var(--bad-soft); color: var(--bad); }

/* Герой-карточка дашборда */
.hero {
  position: relative; overflow: hidden; min-height: 360px; padding: 28px; display: flex; flex-direction: column;
  border-radius: var(--radius-xl);
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--surface-solid) 94%, transparent) 0%, color-mix(in srgb, var(--surface-solid) 55%, transparent) 45%, transparent 70%); }
@media (max-width: 640px) { .hero::after { background: linear-gradient(180deg, color-mix(in srgb, var(--surface-solid) 55%, transparent) 0%, color-mix(in srgb, var(--surface-solid) 20%, transparent) 100%); } }
.hero > * { position: relative; z-index: 1; }
.hero .big { font: 300 clamp(64px, 8vw, 112px)/0.9 var(--font-display); letter-spacing: -0.06em; margin: auto 0 10px; font-variant-numeric: tabular-nums; }
.hero .big small { font-size: .28em; letter-spacing: -0.02em; color: var(--fg-3); font-weight: 400; margin-left: 10px; }
.hero p { margin: 0; color: var(--fg-2); max-width: 380px; }
.hero .hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* Онбординг-чеклист */
.setup { display: flex; flex-direction: column; }
.setup-step { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-top: 1px solid var(--line); }
.setup-step:first-of-type { border-top: 0; }
.setup-step .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--mono); border: 1.5px solid var(--line-2); color: var(--fg-2); flex: none; }
.setup-step.done .n { background: var(--good); border-color: transparent; color: #fff; }
.setup-step .t { flex: 1; min-width: 0; }
.setup-step .t b { display: block; font-size: 14px; }
.setup-step .t small { color: var(--fg-3); font-size: 12px; }
.setup-step.done .t b { color: var(--fg-2); text-decoration: line-through; text-decoration-color: var(--fg-3); }

/* График */
.chart { position: relative; height: 200px; padding: 8px 4px 0; }
.chart svg { width: 100%; height: 100%; overflow: visible; display: block; }
.chart .bar { fill: var(--accent); transition: opacity .2s; }
.chart .bar-bg { fill: transparent; cursor: pointer; }
.chart g:hover .bar { fill: var(--accent-2); }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--fg-3); font: 500 10px var(--mono); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; padding: 8px 10px; border-radius: 10px; font-size: 12px; white-space: nowrap;
  background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); transform: translate(-50%, -110%); opacity: 0; transition: opacity .15s;
}
.chart-tip.on { opacity: 1; }
.spark { height: 46px; }

/* Лента */
.feed { display: flex; flex-direction: column; max-height: 470px; overflow: auto; }
.grid.dash.bottom { align-items: start; }
.feed-item { display: flex; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); animation: rise .5s var(--ease) both; }
.feed-item:first-child { border-top: 0; }
.feed-item .txt { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.feed-item .meta { font-size: 12px; color: var(--fg-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Аватар */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff;
  font: 600 14px var(--font-display); letter-spacing: -0.02em; position: relative;
  background: linear-gradient(135deg, hsl(var(--h, 215) 80% 60%), hsl(calc(var(--h, 215) + 40) 70% 42%));
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface-solid); background: var(--fg-3); }
.avatar .dot.on { background: var(--good); }

/* Статусы */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--fg-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--accent-soft); color: var(--accent-2); }
.pill.plain::before { display: none; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font: 700 11px/20px var(--font); text-align: center; }
.badge.warn { background: var(--warn); }

/* Таблицы/списки */
.list { display: flex; flex-direction: column; }
.list-row {
  display: grid; align-items: center; gap: 14px; padding: 14px 22px; border-top: 1px solid var(--line); min-height: 64px;
  transition: background .2s;
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row.sel { background: var(--accent-soft); }
.acc-row { grid-template-columns: 22px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .9fr) auto; }
.tgt-row { grid-template-columns: 44px minmax(0, 2fr) minmax(0, 1fr) minmax(0, .8fr) auto; }
.job-row { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr) minmax(0, .9fr) auto; }
.c-proxy .icon { vertical-align: -3px; margin-right: 2px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who b { display: block; font-size: 14px; font-weight: 600; }
.who small { display: block; font-size: 12px; color: var(--fg-3); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .8s var(--ease); }
.meter.warn i { background: var(--warn); }
.check { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.kind-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--fg-2); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.search { position: relative; min-width: 220px; flex: 0 1 300px; }
.search .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.search .input { padding-left: 40px; height: 40px; min-height: 40px; border-radius: 999px; }
.bulkbar {
  position: fixed; left: 50%; bottom: 24px; z-index: 40; transform: translate(-50%, 140%); transition: transform .45s var(--spring);
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 18px; border-radius: 999px;
  background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: 0 20px 60px rgba(0,0,0,.45); max-width: calc(100vw - 24px); overflow-x: auto;
  opacity: 0; visibility: hidden; pointer-events: none;
}
.bulkbar.on { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; }
.bulkbar:empty { display: none; }

/* Кампании */
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 16px; }
.camp { padding: 20px; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.camp-top { display: flex; align-items: flex-start; gap: 14px; }
.camp-top h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.camp-top .spacer { flex: 1; }
.camp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border-radius: 14px; overflow: hidden; background: var(--line); }
.camp-stats div { background: var(--surface-solid); padding: 12px; }
:root:not([data-theme="light"]) .camp-stats div { background: #15171e; }
.camp-stats b { display: block; font: 400 22px/1.1 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.camp-stats span { font-size: 11px; color: var(--fg-3); }
.camp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.camp-actions .spacer { flex: 1; }
.camp.running { border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.camp.running::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--good), transparent); background-size: 50% 100%; background-repeat: no-repeat;
  animation: scan 2.6s linear infinite;
}
@keyframes scan { from { background-position: -100% 0; } to { background-position: 200% 0; } }

/* Редактор кампании */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.editor .side { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 16px; }
.ed-section { padding: 24px; }
.ed-section + .ed-section { margin-top: 16px; }
.ed-section h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.ed-section h3 .step { font: 500 11px var(--mono); color: var(--fg-3); letter-spacing: .1em; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-card {
  padding: 16px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left;
  transition: border-color .25s, background .25s, transform .15s;
}
.mode-card:active { transform: scale(.98); }
.mode-card b { display: block; font-size: 14px; margin: 10px 0 4px; }
.mode-card small { color: var(--fg-3); font-size: 12px; line-height: 1.4; display: block; }
.mode-card .icon { color: var(--fg-2); }
.mode-card.on { border-color: var(--accent); background: var(--accent-soft); }
.mode-card.on .icon { color: var(--accent-2); }
.text-variant { display: flex; gap: 8px; align-items: flex-start; }
.text-variant + .text-variant { margin-top: 8px; }
.text-variant textarea { min-height: 64px; }
.pick-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.pick-item:first-child { border-top: 0; }
.pick-item:hover { background: var(--surface-2); }
.preview-bubble {
  position: relative; padding: 12px 14px; border-radius: 16px 16px 16px 6px; background: var(--surface-3); font-size: 14px; line-height: 1.45;
  animation: rise .5s var(--ease) both; overflow-wrap: anywhere;
}
.preview-bubble + .preview-bubble { margin-top: 8px; }
.post-ctx { padding: 12px 14px; border-left: 2px solid var(--accent); background: var(--surface-2); border-radius: 0 12px 12px 0; font-size: 13px; color: var(--fg-2); max-height: 140px; overflow: auto; white-space: pre-wrap; }
.load-calc { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.load-calc div b { display: block; font: 400 22px var(--font-display); letter-spacing: -0.04em; }
.load-calc div span { font-size: 12px; color: var(--fg-3); }

/* Модерация */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.mod { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.mod textarea { min-height: 90px; }
.mod-actions { display: flex; gap: 8px; }
.mod-actions .spacer { flex: 1; }
.mod.leaving { animation: leave .4s var(--ease) forwards; }
@keyframes leave { to { opacity: 0; transform: scale(.94) translateY(-10px); } }

/* Журнал */
.terminal { font: 400 12.5px/1.65 var(--mono); max-height: calc(100vh - 230px); overflow: auto; padding: 8px 0; }
.log-line { display: grid; grid-template-columns: 78px 92px minmax(0, 1fr); gap: 12px; padding: 4px 22px; animation: fadeIn .4s both; }
.log-line:hover { background: var(--surface-2); }
.log-line .lv { font-weight: 600; text-transform: uppercase; font-size: 11px; }
.log-line.info .lv { color: var(--fg-3); }
.log-line.success .lv { color: var(--good); }
.log-line.warn .lv { color: var(--warn); }
.log-line.error .lv { color: var(--bad); }
.log-line .msg { overflow-wrap: anywhere; color: var(--fg-2); }
.log-line .msg b { color: var(--fg); font-weight: 500; }
@keyframes fadeIn { from { opacity: 0; } }

/* Пустые состояния */
.empty { padding: 56px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .orb {
  width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; margin-bottom: 8px; color: var(--accent-2);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  animation: float 5s ease-in-out infinite;
}
.empty h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.empty p { margin: 0 0 10px; color: var(--fg-3); max-width: 400px; font-size: 14px; }
@keyframes float { 50% { transform: translateY(-6px) rotate(2deg); } }
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Модальные окна (sheet) */
.overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: rgba(3, 4, 8, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fadeIn .25s both;
}
.overlay.closing { animation: fadeOut .25s both; }
@keyframes fadeOut { to { opacity: 0; } }
.sheet {
  width: min(560px, 100%); max-height: calc(100dvh - 40px); overflow: auto; border-radius: var(--radius-xl);
  background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: 0 40px 120px rgba(0,0,0,.55);
  animation: sheetIn .5s var(--spring) both; transform-origin: 50% 100%;
}
.sheet.wide { width: min(760px, 100%); }
.overlay.closing .sheet { animation: sheetOut .25s var(--ease) both; }
@keyframes sheetIn { from { opacity: 0; transform: translateY(30px) scale(.96) rotateX(8deg); } to { opacity: 1; transform: none; } }
@keyframes sheetOut { to { opacity: 0; transform: translateY(16px) scale(.97); } }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 6px; }
.sheet-head h2 { margin: 0; font: 500 21px/1.2 var(--font-display); letter-spacing: -0.03em; flex: 1; }
.sheet-body { padding: 14px 24px 8px; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px 22px; }
.steps-dots { display: flex; gap: 6px; padding: 0 24px; }
.steps-dots i { height: 4px; flex: 1; border-radius: 4px; background: var(--surface-3); transition: background .4s; }
.steps-dots i.on { background: var(--accent); }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--fg-2); font-size: 13px; line-height: 1.45; }
.note .icon { color: var(--accent-2); margin-top: 1px; }
.note.warn { background: var(--warn-soft); } .note.warn .icon { color: var(--warn); }
.note.bad { background: var(--bad-soft); } .note.bad .icon { color: var(--bad); }
.note + .note, .note + .field, .field + .note, .row + .note, .note + .row { margin-top: 14px; }
kbd { font: 500 12px var(--mono); padding: 1px 6px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--line); }

/* Тосты */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; width: min(380px, calc(100vw - 36px)); padding: 14px 16px; border-radius: 16px;
  background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0,0,0,.4);
  animation: toastIn .5s var(--spring) both; font-size: 14px;
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .icon { margin-top: 1px; }
.toast.good .icon { color: var(--good); } .toast.bad .icon { color: var(--bad); } .toast.warn .icon { color: var(--warn); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* Мобильная навигация */
.tabbar { display: none; }
.mobile-only { display: none; }

@media (max-width: 1180px) {
  .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.dash { grid-template-columns: minmax(0, 1fr); }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor .side { position: static; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30;
    padding: 6px; border-radius: 22px; background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
    backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
    border: 1px solid var(--line-2); box-shadow: 0 12px 40px rgba(0,0,0,.4);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 5px; border-radius: 16px; color: var(--fg-3); font-size: 10.5px; font-weight: 600; text-decoration: none; position: relative; }
  .tabbar a.active { color: var(--accent-2); background: var(--surface-3); }
  .tabbar a .badge { position: absolute; top: 2px; right: calc(50% - 22px); transform: scale(.85); }
  .mobile-only { display: inline-flex; }
  .acc-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .acc-row .c-proxy, .acc-row .c-limit { display: none; }
  .acc-row .c-status { grid-column: 2; }
  .tgt-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .tgt-row .c-members, .tgt-row .c-sent { display: none; }
  .job-row { grid-template-columns: minmax(0, 1fr) auto; }
  .job-row .c-acc, .job-row .c-status { display: none; }
  .bulkbar { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .login { grid-template-columns: 1fr; }
  .login-stage { position: absolute; inset: 0; }
  .login-stage::after { background: linear-gradient(0deg, var(--bg) 25%, transparent 75%); }
  .login-copy { display: none; }
  .login-side { align-items: end; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .grid.g4, .grid.g3, .grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .row { grid-template-columns: 1fr; }
  .row.keep { grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
  .mode-cards { grid-template-columns: 1fr; }
  .mode-card { display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; padding: 14px; }
  .mode-card .icon { grid-row: span 2; margin-top: 2px; }
  .mode-card b { margin: 0 0 2px; }
  .stat { min-height: 124px; padding: 16px; }
  .stat .ico { width: 32px; height: 32px; right: 12px; top: 12px; }
  .hero { min-height: 300px; padding: 22px; }
  .card-pad, .ed-section { padding: 18px; }
  .list-row, .card-head, .feed-item, .setup-step { padding-left: 16px; padding-right: 16px; }
  .top-actions .btn .lbl, .btn-panic .lbl { display: none; }
  .btn-panic { width: 40px; padding: 0; }
  .topbar { gap: 8px; }
  .top-actions .btn:not(.icon-only) { width: 40px; padding: 0; }
  .overlay { padding: 0; align-items: end; }
  .sheet, .sheet.wide { width: 100%; border-radius: 26px 26px 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); }
  .camp-stats b { font-size: 18px; }
  .log-line { grid-template-columns: 62px minmax(0, 1fr); padding: 4px 16px; }
  .log-line .sc { display: none; }
  .toolbar .search { flex: 1 1 100%; }
  .toasts { left: 12px; right: 12px; top: 12px; }
  .toast { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .view, .reveal, .feed-item, .sheet { animation: fadeIn .2s both !important; }
}

/* ── v2: публикации, аналитика, команда ── */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.post-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.post-card .ptext { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 9.5em; overflow: hidden; position: relative; }
.post-card .ptext:not(.long)::after { display: none; }
.post-card .ptext::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2em; background: linear-gradient(transparent, var(--surface-solid)); opacity: .9; pointer-events: none; }
:root:not([data-theme="light"]) .post-card .ptext:not(.long)::after { display: none; }
.post-card .ptext::after { background: linear-gradient(transparent, #15171e); }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { width: 72px; height: 72px; border-radius: 12px; overflow: hidden; position: relative; background: var(--surface-3); flex: none; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: grid; place-items: center; }
.thumb .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .2s; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 16px; text-align: center; color: var(--fg-3); font-size: 13px; cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--fg-2); }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; border-radius: 12px; overflow: hidden; background: var(--line); }
.metrics div { background: var(--surface-solid); padding: 8px 10px; }
:root:not([data-theme="light"]) .metrics div { background: #15171e; }
.metrics b { display: block; font: 500 15px/1.2 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.metrics span { font-size: 10.5px; color: var(--fg-3); }
.preview-phone { border-radius: 22px; border: 1px solid var(--line-2); background: var(--bg-2); padding: 14px; }
.preview-phone .pp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.preview-phone .pp-body { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-phone .pp-media { margin-top: 10px; border-radius: 14px; overflow: hidden; }
.preview-phone .pp-media img, .preview-phone .pp-media video { width: 100%; display: block; max-height: 320px; object-fit: cover; }
.counter { font: 500 12px var(--mono); color: var(--fg-3); text-align: right; }
.counter.over { color: var(--bad); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days .chip { min-width: 44px; justify-content: center; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.bars-mini { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.bars-mini i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; }
.link-short { font: 500 13px var(--mono); color: var(--accent-2); }
.role-pill { font-size: 11px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-head .big-ava { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; flex: none; position: relative; background: var(--surface-3); }
.profile-head .big-ava img { width: 100%; height: 100%; object-fit: cover; }
.avatar.img { background: none; overflow: hidden; }
.avatar.img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
@media (max-width: 640px) { .metrics { grid-template-columns: repeat(3, 1fr); } .table th, .table td { padding: 10px; } }
.composer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.composer-grid > aside { position: sticky; top: 0; }
@media (max-width: 900px) { .composer-grid { grid-template-columns: minmax(0, 1fr); } .composer-grid > aside { position: static; order: 2; } }

.ch-val { font-size: 30px !important; white-space: nowrap; }
.big-ava .avatar { width: 100%; height: 100%; font-size: 22px; }
.list-row.mrow { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .8fr) auto; }
.list-row.rqrow { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; }
@media (max-width: 640px) {
  .ch-val { font-size: 24px !important; }
  .list-row.mrow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 8px; }
  .list-row.mrow > div:nth-child(2) { grid-column: 1; }
  .list-row.mrow .row-actions { grid-column: 2; grid-row: 1 / span 2; }
  .list-row.rqrow { grid-template-columns: minmax(0, 1fr) auto; }
  .list-row .c-date { display: none; }
}

/* Регистрация аккаунтов */
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 14px; line-height: 1.45; cursor: pointer; }
.consent .check { flex: none; margin-top: 1px; }
.consent a { color: var(--accent); }
.tos-text { margin-top: 10px; max-height: 180px; overflow: auto; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 12.5px; line-height: 1.5; color: var(--fg-2); }
.signup-hint { margin: 0 0 16px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.signup-hint summary { cursor: pointer; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; list-style: none; }
.signup-hint summary::-webkit-details-marker { display: none; }
.signup-body { margin-top: 10px; font-size: 14px; }
.signup-body p { margin: 0 0 12px; color: var(--fg-2); }

/* Режим «Первый комментарий» */
.first-all { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 16px; cursor: pointer; transition: border-color .3s var(--ease), background .3s var(--ease); }
.first-all .t-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.first-all .t-text b { font-size: 15px; }
.first-all .t-text small { color: var(--fg-2); font-size: 13px; line-height: 1.4; }
.first-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--fg-2); transition: background .3s var(--ease), color .3s var(--ease); }
.first-all.on { border-color: rgba(255, 159, 10, .35); background: linear-gradient(90deg, rgba(255, 159, 10, .08), transparent 60%), var(--surface); }
.first-all.on .first-ico { background: var(--warn-soft); color: var(--warn); }
.pill.first { background: var(--warn-soft); color: var(--warn); }
.first-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); }
.first-stats div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.first-stats b { font-size: 16px; font-variant-numeric: tabular-nums; }
.first-stats b small { font-size: 12px; color: var(--fg-2); font-weight: 500; }
.first-stats span { font-size: 11.5px; color: var(--fg-2); }
.first-sec.on { border-color: rgba(255, 159, 10, .3); }
.first-sec h3 svg { color: var(--warn); }
.first-how { display: grid; gap: 8px; margin-top: 14px; }
.first-how div { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: var(--fg-2); }
.first-how b { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface-3); color: var(--fg); }
.first-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
.first-line > svg { color: var(--warn); }
.first-line .place { font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); font-variant-numeric: tabular-nums; }
.first-line .place.top { background: var(--good-soft); color: var(--good); }
.first-line .place.near { background: var(--warn-soft); color: var(--warn); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent-2); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* Готовое сообщение для первого комментария */
.label-sm { display: block; font-size: 13px; font-weight: 600; color: var(--fg-2); margin-bottom: 8px; }
.fm { margin-top: 16px; padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 14px; }
.fm .field { margin: 0; }
.fm .toggle { padding: 0; min-height: 0; }
.fm-upload { position: relative; width: max-content; cursor: pointer; }
.fm-media { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--surface-3); }
.fm-media img, .fm-media video { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; background: #000; }
.fm-media-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.mini-check { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--fg-2); cursor: pointer; }
.mini-check .check { width: 16px; height: 16px; }
.fm-btn { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.swatches { display: flex; gap: 6px; }
.sw-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; padding: 0; cursor: pointer; transition: transform .2s var(--spring), border-color .2s; }
.sw-dot:hover { transform: scale(1.1); }
.sw-dot.on { border-color: var(--fg); }
.st-default { background: rgba(255, 255, 255, .14); }
.st-primary { background: #3d8bff; }
.st-success { background: #30b956; }
.st-danger { background: #ff453a; }
.fm-preview { display: grid; gap: 8px; }
.tg-msg { max-width: 340px; border-radius: 16px 16px 16px 6px; overflow: hidden; background: #1f2b38; }
.tg-msg img, .tg-msg video { display: block; width: 100%; max-height: 240px; object-fit: cover; background: #000; }
.tg-body { padding: 8px 12px 10px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.tg-name { color: #6ab3f3; font-size: 13px; }
.tg-via { color: var(--fg-3); font-size: 12px; }
.tg-btns { max-width: 340px; display: grid; gap: 4px; }
.tg-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: #fff; }
.tg-btn svg { width: 12px; height: 12px; opacity: .8; }
.tg-btn.st-default { background: rgba(40, 56, 72, .85); }
@media (max-width: 560px) {
  .fm-btn { grid-template-columns: minmax(0, 1fr) auto; }
  .fm-btn input[data-bf=url] { grid-column: 1 / -1; grid-row: 2; }
  .fm-btn .swatches { grid-column: 1; grid-row: 3; }
  .fm-btn > .btn { grid-column: 2; grid-row: 1; }
}

/* ── Отчёты ─────────────────────────────────────────────────────── */
:root { --s1: #338ced; --s2: #e76624; }
:root[data-theme="light"] { --s1: #257de0; --s2: #f47230; }
.count-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); text-decoration: none; transition: background .2s, border-color .2s; }
.count-card:hover { border-color: var(--line-2, var(--line)); background: var(--surface-3); }
.count-card .label { font-size: 11.5px; }
.count-card > b { font: 600 24px/1.15 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.count-card .faint b { color: var(--fg); font-variant-numeric: tabular-nums; }
.tickup { animation: tickup .6s var(--spring, cubic-bezier(.2,.8,.2,1)); }
@keyframes tickup { 0% { transform: translateY(6px); opacity: .3; color: var(--s1); } 100% { transform: none; opacity: 1; } }
b.tickup, .ch-num.tickup { display: inline-block; }

.counter-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 26px 28px; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, rgba(51, 140, 237, .16), transparent 55%), var(--surface); }
.ch-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ch-num { font: 600 clamp(44px, 7vw, 72px)/1 var(--font-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.ch-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ch-side > div { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.ch-side b { font: 600 28px/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ch-side small { color: var(--fg-2); font-size: 12px; }
.ch-live { position: absolute; top: 14px; right: 18px; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--fg-3); }
.stat .value small { font-size: .5em; color: var(--fg-2); font-weight: 500; }
.stat .foot .up { color: var(--good); font-weight: 600; }
.stat .foot .down { color: var(--bad); font-weight: 600; }

.sec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.sec-head h3 { margin: 0; }
.sec-head .section-sub { margin: 4px 0 0; }
.sec-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--fg-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.s1 { background: var(--s1); } .sw.s2 { background: var(--s2); }

.rchart { position: relative; padding-top: 6px; }
.rchart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.rchart .gridline { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rchart .axis { fill: var(--fg-3); font: 500 10.5px var(--mono); }
.rchart .hit { fill: transparent; }
.rchart .col.on .hit { fill: var(--surface-2); }
.rchart .seg { transform-box: fill-box; transform-origin: bottom; animation: rise .7s var(--ease) both; animation-delay: var(--d); transition: opacity .2s; }
.rchart .seg.s1 { fill: var(--s1); } .rchart .seg.s2 { fill: var(--s2); }
.rchart:hover .col:not(.on) .seg { opacity: .55; }
.rchart .chart-tip { white-space: pre-line; text-align: left; line-height: 1.5; }

.rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.rep-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rep-grid > .card { min-width: 0; }
.hbars { display: grid; gap: 12px; margin-top: 10px; }
.hb { min-width: 0; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.hb-top span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.hb-top a { color: var(--fg); text-decoration: none; } .hb-top a:hover { text-decoration: underline; }
.hb-top b { font-variant-numeric: tabular-nums; flex: none; }
.hb-sub { font-size: 11.5px; margin-top: 1px; }
.hb-track { height: 8px; margin-top: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); transform-origin: left; animation: growX .8s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
@keyframes growX { from { transform: scaleX(0); } }
td.bad-t { color: var(--bad); }
@media (max-width: 1100px) { .rep-grid.three { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .rep-grid { grid-template-columns: minmax(0, 1fr); }
  .counter-hero { grid-template-columns: minmax(0, 1fr); padding: 22px 18px; }
  .ch-live { position: static; order: -1; }
}
.grid.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid.g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rchart .seg { animation-name: barUp; }
@keyframes barUp { from { transform: scaleY(0); } to { transform: none; } }
@media (max-width: 560px) { .segmented[data-seg="pf"] svg { display: none; } .segmented[data-seg="pf"] button { padding-left: 10px; padding-right: 10px; } }
