/* ==========================================================================
   BOTFARM · админ-панель — тёмная стеклянная тема
   ========================================================================== */
:root {
  --bg: #080b12;
  --bg-soft: #0d1220;
  --panel: rgba(20, 26, 42, 0.72);
  --panel-solid: #111726;
  --panel-2: rgba(28, 36, 56, 0.65);
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eef2ff;
  --text-dim: #9aa6c4;
  --text-mute: #67718f;
  --acc: #7c5cff;
  --acc-2: #22d3ee;
  --acc-3: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 45%, #22d3ee 100%);
  --grad-soft: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(34, 211, 238, 0.1));
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 0 0 1px rgba(139, 92, 246, 0.25), 0 18px 50px -20px rgba(99, 102, 241, 0.5);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Consolas", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-size: 14.5px;
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(800px 500px at 92% 0%, rgba(34, 211, 238, 0.12), transparent 55%),
    radial-gradient(700px 700px at 70% 110%, rgba(244, 114, 182, 0.09), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; color: var(--text); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: rgba(139, 92, 246, 0.35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: content-box; }

.hidden { display: none !important; }

/* ==========================================================================
   AUTH
   ========================================================================== */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; overflow: hidden; }

.aurora { position: fixed; inset: 0; overflow: hidden; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.55; animation: float 18s ease-in-out infinite; }
.blob.b1 { width: 520px; height: 520px; background: #6d28d9; top: -160px; left: -120px; }
.blob.b2 { width: 460px; height: 460px; background: #0e7490; bottom: -180px; right: -100px; animation-delay: -6s; }
.blob.b3 { width: 380px; height: 380px; background: #be185d; top: 40%; left: 55%; animation-delay: -12s; opacity: 0.32; }
.grid-overlay {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 78%);
}
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(30px, -40px, 0) scale(1.08); }
}

.auth-wrap { position: relative; z-index: 2; width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 18px; }

.auth-card {
  width: 100%;
  background: linear-gradient(160deg, rgba(24, 30, 48, 0.92), rgba(13, 17, 28, 0.94));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(22px);
  animation: rise .6s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

.auth-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--grad-soft);
  border: 1px solid rgba(139, 92, 246, 0.32);
  box-shadow: 0 8px 30px -12px rgba(139, 92, 246, 0.9);
}
.logo-mark svg { width: 24px; height: 24px; }
.logo-mark.lg { width: 60px; height: 60px; border-radius: 18px; }
.logo-mark.lg svg { width: 36px; height: 36px; }

.auth-card h1 {
  text-align: center; font-size: 25px; letter-spacing: 4px; font-weight: 800;
  background: linear-gradient(120deg, #fff, #c4b5fd 60%, #67e8f9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-sub { text-align: center; color: var(--text-mute); font-size: 12.5px; margin: 4px 0 24px; letter-spacing: .3px; }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; font-weight: 500; }
.field-input {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field-input:focus-within {
  border-color: rgba(139, 92, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.14);
  background: rgba(139, 92, 246, 0.07);
}
.field-input .ico { width: 17px; height: 17px; color: var(--text-mute); flex: none; }
.field-input input {
  flex: 1; background: none; border: none; outline: none;
  padding: 13px 0; letter-spacing: 1px;
}
.field-input input::placeholder { color: var(--text-mute); letter-spacing: 2px; }
.eye { color: var(--text-mute); display: grid; place-items: center; padding: 4px; border-radius: 8px; }
.eye:hover { color: var(--text); background: rgba(255,255,255,.06); }
.eye svg { width: 17px; height: 17px; }

.auth-error {
  background: rgba(251, 113, 133, 0.12);
  border: 1px solid rgba(251, 113, 133, 0.32);
  color: #fecdd3;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.8px;
  margin-bottom: 14px;
  animation: shake .4s ease;
}
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

.auth-hint { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--text-mute); line-height: 1.7; }
.auth-hint code { background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 6px; color: #c4b5fd; }
.auth-foot { font-size: 11px; color: var(--text-mute); letter-spacing: .4px; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(15, 20, 33, 0.9), rgba(10, 14, 23, 0.94));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: 2.4px; font-weight: 800; }
.brand-text span { font-size: 10.5px; color: var(--text-mute); letter-spacing: .6px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 13.4px; font-weight: 500;
  transition: background .16s, color .16s, transform .16s;
}
.nav-item .ni { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), rgba(34, 211, 238, 0.07));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.28);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 4px 4px 0;
  background: var(--grad);
  box-shadow: 0 0 14px rgba(139, 92, 246, .9);
}
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 700;
  background: rgba(255, 255, 255, 0.08); color: var(--text-dim);
  padding: 2px 7px; border-radius: 20px; min-width: 22px; text-align: center;
}
.nav-badge.alt { background: rgba(34, 211, 238, 0.14); color: #a5f3fc; }
.nav-badge.warn { background: rgba(251, 191, 36, 0.14); color: #fde68a; }

.side-bottom { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.tunnel-card {
  background: var(--grad-soft);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: 14px;
  padding: 11px 12px;
}
.tunnel-head { display: flex; align-items: center; gap: 7px; font-size: 11px; color: #c4b5fd; font-weight: 600; letter-spacing: .3px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); animation: pulse 2.2s infinite; }
.pulse.off { background: var(--err); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.tunnel-url {
  margin: 7px 0 8px; font-family: var(--mono); font-size: 11px; color: #e0e7ff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tunnel-actions { display: flex; gap: 6px; }
.mini-btn {
  flex: 1; font-size: 10.5px; padding: 5px 0; border-radius: 8px;
  background: rgba(255, 255, 255, 0.07); color: var(--text-dim);
  transition: background .15s, color .15s;
}
.mini-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

.logout {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  padding: 10px; border-radius: 12px; font-size: 12.6px; color: var(--text-mute);
  border: 1px solid var(--line);
  transition: color .15s, border-color .15s, background .15s;
}
.logout svg { width: 16px; height: 16px; }
.logout:hover { color: #fda4af; border-color: rgba(251, 113, 133, .35); background: rgba(251, 113, 133, .07); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 15px 26px;
  background: rgba(8, 11, 18, 0.72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.page-head h1 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.page-head p { font-size: 12px; color: var(--text-mute); margin-top: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.live-dot {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-mute); letter-spacing: .6px; text-transform: uppercase;
  padding: 0 6px;
}
.live-dot span { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s infinite; }

.content { padding: 22px 26px 60px; display: flex; flex-direction: column; gap: 18px; }

.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--text-dim); }
.icon-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.icon-btn svg { width: 19px; height: 19px; }
.burger { display: none; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px; border-radius: 12px;
  font-size: 13px; font-weight: 600;
  transition: transform .12s, box-shadow .2s, background .18s, opacity .18s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(.975); }
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 10px 26px -12px rgba(99, 102, 241, 0.95), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover { box-shadow: 0 14px 34px -12px rgba(99, 102, 241, 1); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .55; transform: none; box-shadow: none; cursor: not-allowed; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #b91c1c); color: #fff; box-shadow: 0 10px 26px -14px rgba(244, 63, 94, .9); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 10px; }
.btn-block { width: 100%; padding: 12px; font-size: 14px; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spin-on-click.spinning { animation: spin .8s linear infinite; }

/* ==========================================================================
   CARDS / GRID
   ========================================================================== */
.card {
  background: linear-gradient(165deg, rgba(22, 29, 46, 0.82), rgba(12, 16, 27, 0.86));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 13.5px; font-weight: 700; letter-spacing: .2px; }
.card-head .sub { font-size: 11.5px; color: var(--text-mute); }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 16px 18px; }

.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-stats > *, .grid-2 > *, .grid-2-even > * { min-width: 0; }
@media (max-width: 1080px) { .grid-2, .grid-2-even { grid-template-columns: 1fr; } }

.stat {
  position: relative;
  padding: 16px 17px;
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(24, 31, 49, 0.9), rgba(12, 16, 27, 0.9));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, border-color .2s, box-shadow .25s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 26px 60px -30px rgba(0,0,0,.95); }
.stat::after {
  content: ""; position: absolute; inset: -1px;
  background: radial-gradient(240px 90px at 88% -25%, var(--tint, rgba(139, 92, 246, .22)), transparent 70%);
  pointer-events: none;
}
.stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stat-ico {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--tint, rgba(139, 92, 246, .18));
  border: 1px solid rgba(255, 255, 255, .08);
  color: #fff;
}
.stat-ico svg { width: 17px; height: 17px; }
.stat-label { font-size: 11.6px; color: var(--text-dim); font-weight: 500; letter-spacing: .2px; }
.stat-value { font-size: 29px; font-weight: 750; letter-spacing: -1px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 600; color: var(--text-mute); letter-spacing: 0; margin-left: 5px; }
.stat-foot { display: flex; align-items: center; gap: 10px; margin-top: 9px; font-size: 11.5px; color: var(--text-mute); flex-wrap: wrap; }
.chip-mini {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,.06); color: var(--text-dim);
}
.chip-mini.ok { background: rgba(52, 211, 153, .13); color: #6ee7b7; }
.chip-mini.err { background: rgba(251, 113, 133, .13); color: #fda4af; }
.chip-mini.warn { background: rgba(251, 191, 36, .13); color: #fde68a; }
.chip-mini.info { background: rgba(34, 211, 238, .13); color: #a5f3fc; }

/* ==========================================================================
   CHARTS
   ========================================================================== */
.chart-wrap { padding: 8px 6px 0; }
.chart-svg { width: 100%; height: 190px; display: block; overflow: visible; }
.chart-grid-line { stroke: rgba(255, 255, 255, .055); stroke-width: 1; }
.chart-axis-label { fill: var(--text-mute); font-size: 9.5px; font-family: var(--font); }
.chart-area { fill: url(#areaGrad); }
.chart-line { fill: none; stroke: url(#lineGrad); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 4px 10px rgba(99, 102, 241, .45)); }
.chart-dot { fill: #0b0f17; stroke: #a78bfa; stroke-width: 2; opacity: 0; transition: opacity .15s; }
.chart-point:hover .chart-dot { opacity: 1; }
.chart-legend { display: flex; gap: 16px; padding: 6px 12px 0; font-size: 11.5px; color: var(--text-mute); }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

.donut-block { display: flex; align-items: center; gap: 18px; padding: 6px 4px 10px; flex-wrap: wrap; }
.donut { position: relative; width: 132px; height: 132px; flex: none; }
.donut svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut-center b { display: block; font-size: 21px; font-weight: 750; letter-spacing: -.6px; }
.donut-center span { font-size: 10.5px; color: var(--text-mute); }
.donut-legend { display: flex; flex-direction: column; gap: 9px; font-size: 12.5px; min-width: 140px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; color: var(--text-dim); }
.donut-legend b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-name { width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.bar-track { display: block; flex: 1; height: 7px; border-radius: 20px; background: rgba(255,255,255,.055); overflow: hidden; }
.bar-fill {
  display: block; height: 100%; border-radius: 20px; background: var(--grad);
  box-shadow: 0 0 12px rgba(124, 92, 255, .55);
  transition: width .7s cubic-bezier(.2,.8,.2,1);
}
.bar-val { width: 46px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 10.8px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-mute); font-weight: 600; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap; background: rgba(255,255,255,.015);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.045); font-size: 13px; vertical-align: middle; }
tbody tr { transition: background .14s; }
tbody tr:hover { background: rgba(255, 255, 255, .032); }
tbody tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
th.num { text-align: right; }

.bot-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--grad-soft); border: 1px solid rgba(139, 92, 246, .25); color: #ddd6fe;
  text-transform: uppercase;
}
.avatar.neutral { background: rgba(255,255,255,.06); border-color: var(--line); color: var(--text-dim); }
.bot-meta { min-width: 0; }
.bot-meta b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-meta span { display: block; font-size: 11.2px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-meta b.wrap, .bot-meta span.wrap { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.bot-meta b.wrap { font-size: 13.2px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11.2px; font-weight: 600;
  white-space: nowrap; border: 1px solid transparent;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: rgba(52, 211, 153, .12); color: #6ee7b7; border-color: rgba(52,211,153,.2); }
.pill.err { background: rgba(251, 113, 133, .12); color: #fda4af; border-color: rgba(251,113,133,.2); }
.pill.warn { background: rgba(251, 191, 36, .12); color: #fde68a; border-color: rgba(251,191,36,.2); }
.pill.mute { background: rgba(255, 255, 255, .06); color: var(--text-dim); border-color: var(--line); }
.pill.info { background: rgba(34, 211, 238, .12); color: #a5f3fc; border-color: rgba(34,211,238,.2); }
.pill.violet { background: rgba(139, 92, 246, .14); color: #ddd6fe; border-color: rgba(139,92,246,.24); }

.row-actions { display: flex; gap: 5px; justify-content: flex-end; }
.act {
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  color: var(--text-mute); background: rgba(255, 255, 255, .04);
  transition: background .15s, color .15s, transform .12s;
}
.act svg { width: 14.5px; height: 14.5px; }
.act:hover { background: rgba(255, 255, 255, .11); color: #fff; transform: translateY(-1px); }
.act.ok:hover { background: rgba(52, 211, 153, .16); color: #6ee7b7; }
.act.err:hover { background: rgba(251, 113, 133, .16); color: #fda4af; }
.act.violet:hover { background: rgba(139, 92, 246, .2); color: #ddd6fe; }

.toolbar { display: flex; align-items: center; gap: 9px; padding: 13px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter {
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  color: var(--text-dim); background: rgba(255, 255, 255, .045);
  border: 1px solid transparent; transition: all .16s;
}
.filter:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.filter.active { background: var(--grad-soft); color: #ddd6fe; border-color: rgba(139, 92, 246, .35); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line);
  border-radius: 11px; padding: 0 11px; min-width: 190px; flex: 1; max-width: 320px;
  transition: border-color .16s, box-shadow .16s;
}
.search:focus-within { border-color: rgba(139, 92, 246, .55); box-shadow: 0 0 0 3px rgba(139,92,246,.1); }
.search svg { width: 15px; height: 15px; color: var(--text-mute); flex: none; }
.search input { flex: 1; background: none; border: none; outline: none; padding: 8px 0; font-size: 13px; }
.search input::placeholder { color: var(--text-mute); }

.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-mute); }
.pager .spacer { margin-left: auto; }
.page-btn {
  padding: 5px 11px; border-radius: 9px; background: rgba(255,255,255,.05);
  border: 1px solid var(--line); font-size: 12px; color: var(--text-dim);
}
.page-btn:hover:not(:disabled) { background: rgba(255,255,255,.1); color: #fff; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }

.empty { padding: 46px 20px; text-align: center; color: var(--text-mute); font-size: 13px; }
.empty svg { width: 42px; height: 42px; margin-bottom: 12px; opacity: .35; }
.empty b { display: block; color: var(--text-dim); font-size: 14px; margin-bottom: 4px; }

/* ==========================================================================
   CONSOLE / IMPORT
   ========================================================================== */
.dropzone {
  border: 2px dashed rgba(139, 92, 246, .3);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  color: var(--text-dim);
  background: rgba(139, 92, 246, .045);
  transition: all .18s;
  cursor: pointer;
  font-size: 13px;
}
.dropzone:hover, .dropzone.over {
  border-color: rgba(139, 92, 246, .7);
  background: rgba(139, 92, 246, .1);
  color: #fff;
}
.dropzone svg { width: 34px; height: 34px; margin-bottom: 10px; color: #a78bfa; }
.dropzone b { color: #ddd6fe; }

textarea.big {
  width: 100%; min-height: 190px; resize: vertical;
  background: rgba(0, 0, 0, .32);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  font-family: var(--mono); font-size: 12.4px; line-height: 1.7;
  outline: none; transition: border-color .16s, box-shadow .16s;
  color: #e2e8f5;
}
textarea.big:focus { border-color: rgba(139, 92, 246, .6); box-shadow: 0 0 0 3px rgba(139,92,246,.1); }
textarea.big::placeholder { color: var(--text-mute); }

.progress-wrap { display: flex; flex-direction: column; gap: 10px; }
.progress-head { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-dim); }
.progress-head b { color: #fff; }
.progress-bar { height: 9px; border-radius: 20px; background: rgba(255,255,255,.07); overflow: hidden; position: relative; }
.progress-fill {
  height: 100%; border-radius: 20px; background: var(--grad);
  transition: width .4s cubic-bezier(.2,.8,.2,1);
  position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.console {
  background: rgba(0, 0, 0, .42);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  max-height: 280px; overflow-y: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.85;
}
.console .ln { display: flex; gap: 9px; animation: lineIn .22s ease both; }
@keyframes lineIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.console .ln .t { color: var(--text-mute); flex: none; }
.console .ln.ok .m { color: #6ee7b7; }
.console .ln.error .m { color: #fda4af; }
.console .ln.info .m { color: var(--text-dim); }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.summary-tile {
  border-radius: 14px; padding: 13px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  text-align: center;
}
.summary-tile b { display: block; font-size: 22px; font-weight: 750; letter-spacing: -.6px; }
.summary-tile span { font-size: 11px; color: var(--text-mute); }
.summary-tile.ok b { color: #6ee7b7; }
.summary-tile.err b { color: #fda4af; }
.summary-tile.warn b { color: #fde68a; }

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
.form-row { display: flex; flex-direction: column; gap: 7px; }
.form-row.full { grid-column: 1 / -1; }
.form-row label { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.form-row .hint { font-size: 11px; color: var(--text-mute); }
.inp, select.inp {
  width: 100%; padding: 10px 12px; border-radius: 11px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line); outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.inp:focus { border-color: rgba(139, 92, 246, .6); box-shadow: 0 0 0 3px rgba(139,92,246,.1); background: rgba(139,92,246,.06); }
select.inp { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa6c4' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }
select.inp option { background: #131a29; }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.switch-row:last-child { border-bottom: none; }
.switch-row .txt { flex: 1; }
.switch-row .txt b { display: block; font-size: 13px; font-weight: 600; }
.switch-row .txt span { font-size: 11.5px; color: var(--text-mute); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 20px; background: rgba(255,255,255,.11);
  transition: background .2s; pointer-events: none;
}
.switch i::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: transform .2s;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(18px); }

/* ==========================================================================
   TIMELINE / EVENTS
   ========================================================================== */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 11px 4px; border-bottom: 1px solid rgba(255,255,255,.04); }
.tl-item:last-child { border-bottom: none; }
.tl-ico { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 12px; }
.tl-ico.ok { background: rgba(52, 211, 153, .14); }
.tl-ico.err { background: rgba(251, 113, 133, .14); }
.tl-ico.warn { background: rgba(251, 191, 36, .14); }
.tl-ico.info { background: rgba(255, 255, 255, .06); }
.tl-body { min-width: 0; flex: 1; }
.tl-body p { font-size: 12.8px; color: var(--text-dim); word-break: break-word; }
.tl-body time { font-size: 10.8px; color: var(--text-mute); }

.kv { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.045); font-size: 12.8px; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--text-mute); }
.kv b { margin-left: auto; font-weight: 600; }
.kv b.mono-code { font-family: var(--mono); font-size: 11.6px; color: #c4b5fd; font-weight: 500; }

/* ==========================================================================
   TOASTS / MODAL
   ========================================================================== */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 400px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(20, 27, 44, .96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 50px -18px rgba(0,0,0,.9);
  animation: toastIn .3s cubic-bezier(.2,.8,.2,1) both;
  font-size: 12.8px;
  backdrop-filter: blur(14px);
}
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px) scale(.96); } }
.toast .tico { width: 20px; height: 20px; border-radius: 7px; display: grid; place-items: center; flex: none; font-size: 11px; }
.toast.ok .tico { background: rgba(52,211,153,.16); color: #6ee7b7; }
.toast.err .tico { background: rgba(251,113,133,.16); color: #fda4af; }
.toast.info .tico { background: rgba(139,92,246,.18); color: #ddd6fe; }
.toast .tmsg { flex: 1; color: var(--text); line-height: 1.45; }
.toast .tmsg small { display: block; color: var(--text-mute); font-size: 11px; margin-top: 2px; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(4, 6, 12, .72);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(420px, calc(100vw - 40px));
  background: linear-gradient(165deg, #171e30, #0d121e);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 40px 90px -30px #000;
  animation: rise .25s cubic-bezier(.2,.8,.2,1) both;
}
.modal h3 { font-size: 16px; margin-bottom: 8px; }
.modal p { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.modal.wide { max-width: 620px; }
.modal-body { margin-top: 10px; max-height: 62vh; overflow-y: auto; }
.wrapval { white-space: normal; overflow-wrap: anywhere; text-align: right; max-width: 70%; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; }

/* ==========================================================================
   SKELETON / UTIL
   ========================================================================== */
.sk { background: linear-gradient(90deg, rgba(255,255,255,.045) 25%, rgba(255,255,255,.09) 37%, rgba(255,255,255,.045) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 10px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-card { height: 104px; }
.sk-line { height: 12px; margin-bottom: 10px; }

.fade-in { animation: rise .35s cubic-bezier(.2,.8,.2,1) both; }
.muted { color: var(--text-mute); }
.mono-code { font-family: var(--mono); font-size: 11.8px; color: #c4b5fd; }
.sep { height: 1px; background: var(--line); margin: 4px 0; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 600; background: rgba(255,255,255,.07); color: var(--text-dim); }
.tag.gold { background: rgba(251, 191, 36, .14); color: #fde68a; }
.lang-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; padding: 1px 5px; border-radius: 6px;
  font-size: 9.8px; font-weight: 800; letter-spacing: .6px;
  background: rgba(139, 92, 246, .2); color: #ddd6fe;
  border: 1px solid rgba(139, 92, 246, .3);
  vertical-align: middle;
}
.lang-chip.en { background: rgba(56, 189, 248, .16); color: #bae6fd; border-color: rgba(56, 189, 248, .28); }
.lang-chip.ru { background: rgba(244, 63, 94, .15); color: #fecdd3; border-color: rgba(244, 63, 94, .26); }
.lang-chip.es { background: rgba(251, 191, 36, .15); color: #fde68a; border-color: rgba(251, 191, 36, .26); }
.lang-chip.ua { background: rgba(52, 211, 153, .15); color: #a7f3d0; border-color: rgba(52, 211, 153, .26); }

/* ==========================================================================
   MASTERS (главные боты)
   ========================================================================== */
.masters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(315px, 1fr)); gap: 12px; }
.master-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(165deg, rgba(24, 31, 49, 0.9), rgba(12, 16, 27, 0.92));
  transition: transform .18s, border-color .18s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.master-card::after {
  content: ""; position: absolute; inset: -1px; pointer-events: none;
  background: radial-gradient(220px 80px at 88% -20%, rgba(251, 191, 36, .16), transparent 70%);
}
.master-card:hover { transform: translateY(-2px); box-shadow: 0 24px 50px -28px #000; }
.master-card.alive { border-color: rgba(52, 211, 153, .28); }
.master-card.dead { border-color: rgba(251, 113, 133, .3); }
.mc-head { display: flex; align-items: center; gap: 10px; }
.mc-title { min-width: 0; flex: 1; }
.mc-title b { display: block; font-size: 13.4px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-title span { display: block; font-size: 11.4px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-lang { margin: 10px 0; font-size: 11.8px; color: var(--text-dim); }
.mc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.mc-stats > div {
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 4px; text-align: center;
}
.mc-stats b { display: block; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mc-stats span { font-size: 9.6px; color: var(--text-mute); }
.mc-foot { display: flex; align-items: center; gap: 4px; margin-top: 11px; font-size: 11px; }
@media (max-width: 640px) { .masters-grid { grid-template-columns: 1fr; } }
.chk { width: 16px; height: 16px; accent-color: #7c5cff; cursor: pointer; }
.selbar {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  background: rgba(139, 92, 246, .1);
  border-bottom: 1px solid rgba(139, 92, 246, .2);
  font-size: 12.5px; color: #ddd6fe;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 268px;
    transform: translateX(-104%);
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
    box-shadow: 30px 0 80px -30px #000;
  }
  .sidebar.open { transform: none; }
  .burger { display: grid; }
  .content { padding: 16px 14px 60px; }
  .topbar { padding: 12px 14px; }
  .page-head p { display: none; }
  #btn-check span { display: none; }
}
@media (max-width: 640px) {
  .grid-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; min-width: 0; }
  .stat-value { font-size: 21px; letter-spacing: -.6px; }
  .stat-label { font-size: 10.8px; }
  .stat-foot { font-size: 10.8px; gap: 5px; margin-top: 7px; }
  .chip-mini { font-size: 10px; padding: 2px 6px; }
  .live-dot { display: none; }
  .search { max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 13px 14px; }
  thead th, tbody td { padding: 9px 10px; font-size: 12px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .donut-block { gap: 14px; }
  .donut { width: 112px; height: 112px; }
  .page-head h1 { font-size: 16px; }
  .content { padding-bottom: 40px; }
}
@media (max-width: 430px) {
  .grid-stats { grid-template-columns: 1fr; }
  .stat-value { font-size: 24px; }
  .toolbar { gap: 7px; padding: 11px 12px; }
  .filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .filter { flex: none; }
}

.preset-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.preset-row .filter { padding: 4px 10px; font-size: 11.5px; }

/* ==========================================================================
   QUICK ACTIONS
   ========================================================================== */
.quick-row { display: flex; gap: 8px; flex-wrap: wrap; }
.quick {
  flex: 1 1 150px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  color: var(--text-dim); font-size: 12.5px; font-weight: 500;
  transition: background .16s, color .16s, transform .12s, border-color .16s;
}
.quick:hover { background: var(--grad-soft); color: #fff; border-color: rgba(139, 92, 246, .32); transform: translateY(-1px); }
.quick:active { transform: scale(.985); }
@media (max-width: 640px) { .quick { flex: 1 1 120px; font-size: 11.8px; padding: 9px 8px; } }

/* ==========================================================================
   USER CARD (профиль админа в сайдбаре)
   ========================================================================== */
.user-card {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .14), rgba(34, 211, 238, .07));
  border: 1px solid rgba(139, 92, 246, .24);
}
.uc-avatar {
  width: 30px; height: 30px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 13px;
  box-shadow: 0 6px 18px -8px rgba(139, 92, 246, .9);
}
.uc-info { min-width: 0; flex: 1; }
.uc-info b { display: block; font-size: 12.6px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-info span { display: block; font-size: 10.6px; color: #c4b5fd; letter-spacing: .2px; }
.uc-btn {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: var(--text-mute);
  background: rgba(255, 255, 255, .06);
  transition: background .15s, color .15s;
}
.uc-btn svg { width: 15px; height: 15px; }
.uc-btn:hover { background: rgba(251, 113, 133, .18); color: #fda4af; }
.role-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 700; letter-spacing: .3px; }
.role-pill.owner { background: rgba(251, 191, 36, .16); color: #fde68a; }
.role-pill.admin { background: rgba(139, 92, 246, .18); color: #ddd6fe; }
.role-pill.viewer { background: rgba(148, 163, 184, .18); color: #cbd5e1; }
