:root {
  --bg: #0a0d16;
  --bg-soft: #0f1422;
  --panel: #141a2b;
  --panel-2: #1a2237;
  --line: #242e46;
  --text: #e9eefb;
  --muted: #8d99b5;
  --brand: #5865f2;
  --brand-2: #8b5cf6;
  --ok: #35c98b;
  --warn: #f5b23f;
  --err: #ff5f6d;
  --radius: 16px;
  --sidebar-bg: rgba(12, 16, 27, .86);
  --card-in: rgba(10, 13, 22, .45);
  --card-in2: rgba(10, 13, 22, .55);
  --card-soft: rgba(20, 26, 43, .8);
  --input-bg: rgba(9, 13, 22, .8);
  --glow1: rgba(88, 101, 242, .22);
  --glow2: rgba(139, 92, 246, .16);
}
:root[data-theme="light"] {
  --bg: #eef1f8;
  --bg-soft: #e4e9f5;
  --panel: #ffffff;
  --panel-2: #f3f5fb;
  --line: #d5dcec;
  --text: #1a2036;
  --muted: #5e6a88;
  --sidebar-bg: rgba(255, 255, 255, .92);
  --card-in: rgba(235, 239, 250, .8);
  --card-in2: rgba(235, 239, 250, .9);
  --card-soft: rgba(255, 255, 255, .95);
  --input-bg: #ffffff;
  --glow1: rgba(88, 101, 242, .12);
  --glow2: rgba(139, 92, 246, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  overflow-x: hidden;
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background:
    radial-gradient(1100px 620px at 85% -10%, var(--glow1), transparent 62%),
    radial-gradient(900px 520px at 5% 0%, var(--glow2), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
h4 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(26, 34, 55, .92), rgba(18, 24, 40, .96));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 30px 26px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { font-size: 21px; text-align: center; }
.login-card > p.muted { text-align: center; }
.login-card .logo-badge { align-self: center; }
.logo-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 26px rgba(88, 101, 242, .4);
}
.logo-badge.small { width: 40px; height: 40px; border-radius: 13px; font-size: 18px; }

/* ---------- layout ---------- */
.app {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  min-width: 0;
  background: var(--sidebar-bg);
  border-inline-start: 1px solid var(--line);
  border-inline-end: 1px solid rgba(36, 46, 70, .6);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 17px; font-weight: 800; }
.brand-text small { color: var(--muted); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: start;
  transition: .16s ease;
}
.nav-item .ico { font-size: 15px; opacity: .9; }
.nav-item:hover { background: rgba(88, 101, 242, .1); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(88, 101, 242, .26), rgba(139, 92, 246, .16));
  border-color: rgba(120, 132, 255, .35);
  color: #fff;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.server-state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--card-soft);
  border: 1px solid rgba(36, 46, 70, .7);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(53, 201, 139, .18); }
.dot.off { background: var(--err); }

.main { padding: 22px 26px 44px; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(36, 46, 70, .7);
}
.bot-picker {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 12px;
}
.bot-picker label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.bot-picker select {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  max-width: 210px;
}
.bot-picker select option { background: #141a2b; color: var(--text); }

/* ---------- pages ---------- */
.page { display: flex; flex-direction: column; gap: 18px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head.tight { align-items: center; margin-bottom: 12px; }
.page-head h3 + p { margin-top: 4px; font-size: 13px; }

.card {
  background: linear-gradient(180deg, rgba(23, 30, 48, .92), rgba(17, 23, 38, .96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card.narrow { width: 100%; max-width: 640px; margin-inline: auto; }
.card h3 + p { margin-top: 4px; font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 10px 17px;
  cursor: pointer;
  transition: .16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 10px 24px rgba(88, 101, 242, .3);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost {
  background: rgba(26, 34, 55, .8);
  border-color: var(--line);
  color: var(--text);
}
.btn.ghost:hover { background: rgba(38, 48, 74, .9); }
.btn.danger { background: rgba(255, 95, 109, .12); border-color: rgba(255, 95, 109, .35); color: #ff9aa3; }
.btn.danger:hover { background: rgba(255, 95, 109, .2); }
.btn.small { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.icon { padding: 10px 12px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  outline: none;
  width: 100%;
  transition: .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(120, 132, 255, .7);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, .16);
}
textarea { resize: vertical; line-height: 1.6; }
.input-row { display: flex; gap: 8px; }
.input-row input { direction: ltr; text-align: left; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.form-error { color: #ff9aa3; font-size: 13px; min-height: 0; }
.form-error:empty { display: none; }

.hint {
  font-size: 13px;
  color: #cfd7ee;
  background: rgba(245, 178, 63, .09);
  border: 1px solid rgba(245, 178, 63, .28);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.7;
}
.hint strong { color: var(--warn); }

/* ---------- bot cards ---------- */
.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.bot-card {
  background: linear-gradient(180deg, rgba(24, 31, 50, .95), rgba(16, 22, 37, .97));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  transition: .18s ease;
}
.bot-card:hover { border-color: rgba(120, 132, 255, .45); transform: translateY(-2px); }
.bot-top { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  overflow: hidden;
  flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.bot-meta { min-width: 0; }
.bot-meta strong { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-meta small { color: var(--muted); font-size: 11.5px; direction: ltr; display: block; }
.pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  margin-inline-start: auto;
  white-space: nowrap;
}
.pill.online { color: #7ff0bb; background: rgba(53, 201, 139, .12); border-color: rgba(53, 201, 139, .35); }
.pill.stopped { color: #b9c2d8; background: rgba(141, 153, 181, .12); border-color: rgba(141, 153, 181, .3); }
.pill.starting { color: #ffd88a; background: rgba(245, 178, 63, .12); border-color: rgba(245, 178, 63, .35); }
.pill.error { color: #ff9aa3; background: rgba(255, 95, 109, .12); border-color: rgba(255, 95, 109, .35); }
.bot-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.bot-error {
  font-size: 12px;
  color: #ffb3b9;
  background: rgba(255, 95, 109, .08);
  border: 1px solid rgba(255, 95, 109, .22);
  border-radius: 10px;
  padding: 8px 10px;
  line-height: 1.6;
}
.bot-warn {
  font-size: 12px;
  color: #ffd88a;
  background: rgba(245, 178, 63, .08);
  border: 1px solid rgba(245, 178, 63, .25);
  border-radius: 10px;
  padding: 8px 10px;
  line-height: 1.6;
}
.bot-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- config ---------- */
.config-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.config-actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.bot-mini { display: flex; align-items: center; gap: 12px; min-width: 0; }
.status-line { font-size: 12.5px; color: var(--muted); }
.chip {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
  background: var(--card-soft);
}
.cmd-list { display: flex; flex-direction: column; gap: 10px; }
.cmd-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 13px;
  background: rgba(11, 16, 27, .65);
  border: 1px solid rgba(36, 46, 70, .9);
}
.cmd-row.disabled { opacity: .55; }
.cmd-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.cmd-trigger {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  font-weight: 700;
  color: #b9c4ff;
  direction: ltr;
  text-align: start;
  word-break: break-all;
}
.cmd-mode { font-size: 11px; color: var(--muted); }
.cmd-response { font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.cmd-actions { display: flex; gap: 6px; flex: none; }

/* ---------- empty / toast / added ---------- */
.empty {
  text-align: center;
  padding: 44px 20px;
  border: 1px dashed rgba(60, 74, 108, .8);
  border-radius: var(--radius);
  background: rgba(16, 22, 37, .5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.empty.small { padding: 22px; border-style: solid; background: transparent; }
.empty-ico { font-size: 30px; }
.empty h4 { font-size: 16px; }
.empty .btn { margin-top: 6px; }

.added-card {
  border-radius: 13px;
  border: 1px solid rgba(53, 201, 139, .35);
  background: rgba(53, 201, 139, .08);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast {
  position: fixed;
  inset-inline-start: 50%;
  bottom: 26px;
  transform: translateX(50%);
  background: #1c2438;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
  z-index: 50;
  max-width: min(90vw, 460px);
  text-align: center;
}
.toast.ok { border-color: rgba(53, 201, 139, .5); }
.toast.err { border-color: rgba(255, 95, 109, .5); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    gap: 14px;
    border-inline-start: none;
    border-bottom: 1px solid var(--line);
    padding: 16px;
  }
  .nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .nav-item {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 9px 4px;
    font-size: 11.5px;
    gap: 3px;
    line-height: 1.3;
    white-space: normal;
    min-width: 0;
  }
  .nav-item .ico { font-size: 14px; }
  .sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; }
  .main { padding: 16px 16px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .bot-picker { margin-inline-start: 0; }
  .topbar { flex-wrap: wrap; }
}

/* ---------- v2 additions ---------- */
.stats-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(120, 132, 255, .35);
  background: linear-gradient(120deg, #1a2150, #2b1d57, #1a2150);
  background-size: 220% 100%;
  animation: bannerShift 9s ease-in-out infinite alternate;
  padding: 16px 16px 0;
}
@keyframes bannerShift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.banner-glow {
  position: absolute; inset: -40%;
  background: radial-gradient(closest-side, rgba(139, 92, 246, .35), transparent 70%);
  animation: glowMove 7s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes glowMove { from { transform: translateX(-25%); } to { transform: translateX(25%); } }
.stat-tiles { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-tile {
  background: var(--card-in2);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
  animation: tilePop .5s ease both;
}
.stat-tile:nth-child(2) { animation-delay: .06s; }
.stat-tile:nth-child(3) { animation-delay: .12s; }
.stat-tile:nth-child(4) { animation-delay: .18s; }
@keyframes tilePop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.stat-num { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-tile.online .stat-num { color: #7ff0bb; }
.stat-tile.offline .stat-num { color: #b9c2d8; }
.stat-tile.problem .stat-num { color: #ff9aa3; }
.stat-tile.total .stat-num { color: var(--brand); }
.ticker { position: relative; overflow: hidden; margin: 14px -16px 0; padding: 9px 0; background: var(--card-in2); border-top: 1px solid rgba(255, 255, 255, .06); direction: ltr; }
.ticker-track { display: inline-flex; white-space: pre; animation: tickerMove 28s linear infinite; }
.ticker-track span { padding-inline: 34px; font-size: 13px; font-weight: 700; color: #cfd6ff; }
@keyframes tickerMove { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (max-width: 760px) { .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.staff-nav { display: flex; flex-direction: column; gap: 6px; padding: 14px 0 6px; margin-top: 10px; border-top: 1px dashed var(--line); }
.staff-nav .nav-item { justify-content: flex-start; padding-inline: 8px; font-size: 12.5px; border: 1px solid rgba(245, 178, 63, .35); color: #ffd88a; }
.staff-nav .nav-item.active { background: rgba(245, 178, 63, .15); }
.staff-link { background: none; border: none; color: var(--muted); font-family: inherit; font-size: 11.5px; cursor: pointer; text-align: start; padding: 2px 4px; opacity: .75; }
.staff-link:hover { opacity: 1; color: var(--text); }
.lang-switch { display: flex; gap: 6px; }
.lang-switch button { flex: 1; font-family: inherit; font-size: 12px; font-weight: 700; padding: 7px 8px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.lang-switch button.active { background: rgba(88, 101, 242, .2); border-color: rgba(120, 132, 255, .6); color: var(--text); }
.login-card .lang-switch { margin-top: 4px; }

.invite-box { display: flex; flex-direction: column; gap: 6px; }
.invite-box input { font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cat h3 { margin-bottom: 2px; }
.cmd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cmd-card { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--card-in); }
.cmd-card.on { border-color: rgba(53, 201, 139, .5); background: rgba(53, 201, 139, .06); }
.cmd-card-main { display: flex; flex-direction: column; gap: 6px; }
.cmd-trigger { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 15px; color: var(--brand); }
.cmd-desc { font-size: 13.5px; }
.cmd-opts code { background: rgba(88, 101, 242, .15); padding: 1px 6px; border-radius: 6px; direction: ltr; display: inline-block; }
.cmd-card-act { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chip.ok { color: #7ff0bb; border-color: rgba(53, 201, 139, .4); background: rgba(53, 201, 139, .1); }

.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.status-box { background: var(--card-in); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.status-k { font-size: 12px; color: var(--muted); font-weight: 600; }
.status-box strong { font-size: 15px; overflow-wrap: anywhere; }

.devs-card { align-items: center; text-align: center; padding: 40px 20px; gap: 18px; }
.devs-card h3 { font-size: 24px; }
.devs-id { font-size: 22px; font-weight: 800; letter-spacing: .5px; color: var(--brand); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; unicode-bidi: isolate; }

.about { max-width: 780px; line-height: 1.9; }
.about h3 { font-size: 22px; }
.about h4 { margin-top: 8px; color: var(--brand); }
.about ul, .about ol { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; }
.about a { color: #9aa6ff; }

.admin-list { display: flex; flex-direction: column; gap: 14px; }
.admin-head { display: flex; align-items: center; gap: 12px; }
.admin-head .pill { margin-inline-start: auto; }
.token-box { display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, .35); border: 1px dashed rgba(245, 178, 63, .5); border-radius: 10px; padding: 10px 12px; }
.token-box code { flex: 1; word-break: break-all; font-size: 12px; color: #ffd88a; }
.table-card { overflow-x: auto; padding: 8px; }
.visits-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.visits-table th, .visits-table td { padding: 9px 12px; text-align: start; border-bottom: 1px solid var(--line); }
.visits-table th { color: var(--muted); font-weight: 700; }
.visits-table td.ua { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(4, 6, 12, .72); display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; }

.cmd-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cmd-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.cmd-line:last-child { border-bottom: 0; }
.cmd-line-main { min-width: 0; flex: 1; }
.cmd-bullet { color: #8e99ff; font-weight: 700; }
.cmd-line .cmd-trigger { display: inline; }
.cmd-line.on .cmd-trigger { color: #7ee2b8; }

/* ---------- v3: banner, theme, logs, auto replies ---------- */
.site-banner { position: relative; overflow: hidden; border-radius: var(--radius); margin-bottom: 18px; min-height: 96px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(120, 132, 255, .35); background: linear-gradient(115deg, #3a2fb8, #5865f2, #8b5cf6, #1f9d8a, #3a2fb8); background-size: 300% 300%; animation: bannerShift 12s ease-in-out infinite; }
.site-banner.has-img { background-size: cover; background-position: center; animation: none; min-height: 140px; }
.site-banner .bn-title { position: relative; z-index: 2; font-size: 30px; font-weight: 800; letter-spacing: .5px; color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, .35); animation: bnFloat 4s ease-in-out infinite; display: flex; align-items: center; gap: 12px; }
.site-banner.has-img .bn-title, .site-banner.has-img .bn-orb, .site-banner.has-img .bn-shine { display: none; }
.site-banner .bn-palm { display: inline-block; transform-origin: 50% 100%; animation: bnSway 3.2s ease-in-out infinite; }
.site-banner .bn-orb { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .14); filter: blur(2px); animation: bnDrift 9s ease-in-out infinite; }
.bn-orb.o1 { width: 90px; height: 90px; inset-inline-start: 6%; top: -30px; }
.bn-orb.o2 { width: 60px; height: 60px; inset-inline-end: 12%; bottom: -18px; animation-delay: -3s; }
.bn-orb.o3 { width: 40px; height: 40px; inset-inline-start: 38%; bottom: 10px; animation-delay: -6s; }
.site-banner .bn-shine { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%); background-size: 250% 100%; animation: bnShine 5s linear infinite; }
@keyframes bannerShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes bnFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes bnSway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes bnDrift { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(18px, 14px); } }
@keyframes bnShine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .site-banner, .site-banner * { animation: none !important; } }
.theme-btn { width: 100%; }
:root[data-theme="light"] .login-card, :root[data-theme="light"] .card { box-shadow: 0 6px 22px rgba(40, 55, 110, .08); }
:root[data-theme="light"] .btn.ghost { color: var(--text); }
.log-list { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; margin-top: 12px; direction: ltr; text-align: left; }
.log-row { display: flex; gap: 10px; align-items: baseline; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; padding: 7px 10px; border-radius: 9px; background: var(--card-in); border: 1px solid var(--line); }
.log-row .lt { color: var(--muted); flex: none; }
.log-row .lv { flex: none; font-weight: 700; text-transform: uppercase; font-size: 11px; }
.log-row.error .lv { color: var(--err); }
.log-row.warn .lv { color: var(--warn); }
.log-row.info .lv { color: var(--ok); }
.log-row .lm { word-break: break-word; min-width: 0; }
.ar-rule { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-in); margin-top: 14px; }
.ar-rule h4 { font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ar-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ar-row > label.lbl { font-size: 13px; color: var(--muted); min-width: 120px; }
.ar-rule input[type=text], .ar-rule textarea, .ar-rule select { background: var(--input-bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; }
.ar-rule input[type=text] { flex: 1; min-width: 200px; }
.ar-rule textarea { flex: 1; min-width: 200px; min-height: 60px; resize: vertical; }
.ar-reply { display: flex; gap: 8px; align-items: flex-start; width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 8px 14px; font: inherit; cursor: pointer; }
.seg button.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.ar-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.ar-warn { margin-top: 12px; }
:root[data-theme="light"] .card { background: linear-gradient(180deg, #ffffff, #f6f8fd); }
:root[data-theme="light"] .bot-card { background: linear-gradient(180deg, #ffffff, #f4f6fc); }
:root[data-theme="light"] .btn.ghost { background: #ffffff; }
:root[data-theme="light"] .btn.ghost:hover { background: #eef1fb; }
:root[data-theme="light"] .btn.danger { color: #c4303f; }
:root[data-theme="light"] .stats-banner { background: linear-gradient(120deg, #dfe4ff, #ece3ff, #dfe4ff); background-size: 220% 100%; border-color: rgba(88, 101, 242, .35); }
:root[data-theme="light"] .ticker { background: rgba(255, 255, 255, .55); border-top-color: rgba(88, 101, 242, .15); }
:root[data-theme="light"] .ticker-track span { color: #3c47a8; }
:root[data-theme="light"] .staff-nav .nav-item { color: #9a6200; }
:root[data-theme="light"] .form-error, :root[data-theme="light"] .pill.error { color: #c4303f; }
:root[data-theme="light"] .cmd-trigger { color: #3c47a8; }
:root[data-theme="light"] .stat-num, :root[data-theme="light"] .status-box strong { color: var(--text); }
:root[data-theme="light"] .ar-rule, :root[data-theme="light"] .status-box, :root[data-theme="light"] .cmd-card { background: var(--card-in); }
:root[data-theme="light"] .login-card { background: #fff; }


.site-banner.has-img { background: none; min-height: 0; border: 0; display: block; line-height: 0; }
.site-banner.has-img img { width: 100%; height: auto; display: block; border-radius: var(--radius); }

.app > .site-banner { grid-column: 1 / -1; margin: 14px 14px 0; }
@media (min-width: 861px) { .app > .site-banner { margin: 16px 26px 0; } }

.main-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.main-row select { flex: 1; min-width: 180px; background: var(--input-bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; }
.main-pick { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card-in); }
.sub-h { margin: 16px 0 8px; font-size: 15px; }
.top-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.top-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-in); }
.top-list .rk { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; flex: none; }
.top-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-list .ct { color: var(--muted); font-size: 13px; }
.fl-radios { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.fl-radios label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.fl-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-in); flex-wrap: wrap; }
.fl-word { flex: 1; min-width: 120px; word-break: break-word; font-weight: 600; }
.fl-ban { color: #ff8b8b; } .fl-timeout { color: #ffc46b; }
#flForm input[type=text] { background: var(--input-bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; flex: 1; min-width: 200px; }
#flForm { margin-top: 14px; }
#flForm .fl-radios label { display: flex; flex-direction: row; align-items: center; gap: 10px; width: auto; min-width: 0; flex: none; }
#flForm .fl-radios input[type=radio] { flex: none; width: 18px; height: 18px; min-width: 0; margin: 0; padding: 0; accent-color: #7c6cff; }
#flForm .fl-radios span { flex: none; }

.auth-tabs { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.auth-tabs button { flex: 1; background: transparent; color: var(--muted); border: 0; padding: 10px; font: inherit; cursor: pointer; }
.auth-tabs button.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form[hidden], .auth-tabs[hidden], #ownerLink[hidden] { display: none; }
.login-card .field input[type=email], .login-card .field input[type=text] { width: 100%; }
#ownerLink { align-self: center; }

.perm-add, .perm-row { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.perm-add select { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2, var(--panel)); color: var(--text); font-family: inherit; }
.perm-chk { display: flex; flex-wrap: wrap; gap: 14px; }
.perm-chk label { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; cursor: pointer; }
.acct-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid rgba(245,178,63,.45); color: #ffd88a; }
.token-box .lbl { font-size: 11.5px; opacity: .7; margin-inline-end: 8px; }

.acct-menu { position: relative; width: 100%; }
.acct-btn { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--card-soft); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer; font: inherit; }
.acct-name { flex: 1; text-align: start; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-caret { color: var(--muted); font-size: 12px; }
.acct-pop { display: none; position: absolute; bottom: calc(100% + 6px); inset-inline: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; flex-direction: column; gap: 6px; z-index: 30; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.acct-menu.open .acct-pop { display: flex; }
.av-sm, .av-lg { border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #7c6cff, #35c98b); color: #fff; font-weight: 800; flex: none; }
.av-sm { width: 30px; height: 30px; font-size: 14px; }
.av-lg { width: 72px; height: 72px; font-size: 30px; }
.set-avatar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.card .field { margin-top: 10px; }
.card .field input:not([type=checkbox]):not([type=radio]), .card .field textarea, .inline-form input, .reply-row textarea { background: var(--input-bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; width: 100%; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.chk-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.chk-row input { width: 18px; height: 18px; accent-color: #7c6cff; flex: none; }
.vars-card { margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.vars-card code { background: var(--input-bg); padding: 1px 6px; border-radius: 6px; }
.reply-row { margin-top: 10px; }
.danger-zone { border-color: rgba(240, 90, 90, .5); }
.terms-card { max-width: 520px; max-height: 88vh; }
.terms-text { white-space: pre-wrap; overflow-y: auto; max-height: 55vh; line-height: 1.9; font-size: 14px; }
.watch-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: 13px; }
.watch-row.alert.unread { background: rgba(240, 90, 90, .08); }
.watch-list { max-height: 360px; overflow-y: auto; }
#watchBox .card { margin-bottom: 12px; }
.card .field .chk-row input { width: 18px; padding: 0; }
.bot-watch { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-soft); }
.watch-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.watch-alert { margin: 8px 0; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.7; border: 1px solid var(--line); }
.watch-alert.unread { background: rgba(240, 90, 90, .1); border-color: rgba(240, 90, 90, .45); }
.watch-log summary { cursor: pointer; font-weight: 700; margin-top: 8px; }
.watch-log .watch-row { display: block; }
.radio-card { margin-top: 12px; }
.radio-card.on { border-color: rgba(53, 201, 139, .55); box-shadow: 0 0 0 1px rgba(53, 201, 139, .25); }
.radio-head { display: flex; align-items: center; gap: 12px; }
.radio-head small { display: block; }
.radio-ico { font-size: 28px; }
.radio-ctl { display: flex; align-items: center; gap: 14px; margin: 12px 0 6px; flex-wrap: wrap; }
.radio-vol { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 140px; }
.radio-vol input { flex: 1; accent-color: #7c6cff; }
.radio-ctl .btn.muted { color: var(--muted); }

.cat-fold { padding: 0; }
.cat-fold > summary { cursor: pointer; padding: 14px 16px; font-weight: 700; font-size: 1.05rem; list-style: none; display: flex; align-items: center; gap: 10px; }
.cat-fold > summary::-webkit-details-marker { display: none; }
.cat-fold > summary::after { content: '▾'; margin-inline-start: auto; opacity: .6; transition: transform .2s; }
.cat-fold[open] > summary::after { transform: rotate(180deg); }
.cat-fold > .cmd-lines, .cat-fold > p { padding: 0 16px 14px; }
#addLang label { margin-inline-end: 14px; cursor: pointer; }
#addLang input { width:auto; display:inline-block; margin:0 6px; } #addLang label { display:inline-flex; align-items:center; }

#bannedScreen { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(900px 500px at 85% -10%, rgba(255,95,109,.18), transparent 60%), radial-gradient(700px 500px at 0% 110%, var(--glow2), transparent 60%), var(--bg); }
.ban-card { max-width: 520px; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 36px 28px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.ban-ic { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 18px; background: rgba(255,95,109,.14); border: 1px solid rgba(255,95,109,.45); display: flex; align-items: center; justify-content: center; }
.ban-card h1 { margin: 0 0 10px; font-size: 1.4rem; color: var(--err); }
.ban-site { color: var(--muted); font-size: .95rem; margin-bottom: 16px; }
.ban-card p { margin: 0 0 10px; line-height: 1.9; }
.ban-card .ban-en { direction: ltr; color: var(--muted); font-size: .9rem; margin-bottom: 18px; }

.pres-list { background: var(--card-in); border-radius: 14px; margin: 10px 0 14px; }
.pres-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; border-bottom: 1px solid var(--line); }
.pres-row:last-child { border-bottom: 0; }
.pres-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.pres-name { flex: 1; font-weight: 600; }
.pres-row input { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }
.pres-custom { display: flex; align-items: center; gap: 10px; background: var(--card-in); border-radius: 14px; padding: 8px 12px; }
.pres-smile { font-size: 1.4rem; color: var(--muted); }
.pres-custom input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font: inherit; padding: 8px 4px; }
.pres-emojis { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }

.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.plan-card h3 { margin: 0 0 6px; }
.plan-card.current { border: 2px solid var(--brand); }
.plan-card.best { box-shadow: 0 0 0 1px rgba(255, 200, 87, .5), 0 8px 30px rgba(255, 200, 87, .08); }
.plan-price { font-size: 1.9rem; font-weight: 800; margin: 6px 0 12px; }
.plan-price small { font-size: .85rem; font-weight: 600; color: var(--muted); }
.plan-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.plan-list li { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ad-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(5, 8, 16, .78); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ad-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; width: min(560px, 100%); text-align: center; display: grid; gap: 12px; }
.ad-slot { background: repeating-linear-gradient(45deg, var(--card-in), var(--card-in) 10px, var(--card-soft) 10px, var(--card-soft) 20px); border: 1px dashed var(--line); border-radius: 12px; min-height: 160px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-weight: 700; }

.ad-card { width: min(740px, 100%); }
.ad-img { display: block; width: 100%; height: auto; aspect-ratio: 728 / 250; border-radius: 12px; background: var(--card-in); }
