/* Тёмная тема с фиолетовым акцентом. */
:root {
  --bg: #0d0d10;
  --sidebar: #111115;
  --card: #16161b;
  --card-2: #1c1c22;
  --field: #0f0f13;
  --line: #24242c;
  --line-2: #2e2e38;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --hover: #1b1b22;
  --icon-bg: #1d1d24;
  --off: #3f3f46;
  --pill: #27272a;
  --chip: #23232b;
  --btn: #27272f;
  --btn-hover: #33333d;
  --btn-text: #fff;
  --card-hover: #19191f;
  --topbar: rgba(13, 13, 16, 0.78);
  --savebar: #18181f;
  --shadow: rgba(0, 0, 0, 0.5);
  --bg-glow: rgba(139, 92, 246, 0.12);
  --dc-bg: #313338;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
  --dc-mention-bg: rgba(88, 101, 242, 0.3);
  --dc-mention: #c9cdfb;
  --dc-code: #2b2d31;
  --radius: 14px;
  --radius-sm: 10px;
  font-family: "Manrope", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-size: 15px; }
body { background: radial-gradient(1200px 600px at 85% -10%, var(--bg-glow), transparent 60%), var(--bg); background-attachment: fixed; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); }
::selection { background: rgba(139, 92, 246, 0.35); }

.loading, .center { min-height: 100vh; display: grid; place-items: center; color: var(--muted); padding: 16px; }

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px;
  max-width: 460px;
  text-align: center;
  line-height: 1.6;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.login-card h1 { margin: 0 0 12px; font-size: 26px; font-weight: 800; color: var(--text); }
.login-card code { background: var(--accent-soft); color: var(--accent-2); padding: 2px 8px; border-radius: 6px; }

/* Каркас */
.layout { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; overflow-x: clip; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.guild { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.guild img, .guild .noicon { width: 44px; height: 44px; border-radius: 14px; background: var(--accent); flex: none; display: grid; place-items: center; font-weight: 800; }
.guild-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-sub { color: var(--faint); font-size: 12px; }
nav { overflow-y: auto; padding: 4px 12px 12px; flex: 1; }
nav .group { margin-top: 14px; }
nav .group-title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: 0 10px 6px; }
nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  transition: background 0.12s, color 0.12s;
}
nav button:hover { background: var(--hover); color: var(--text); }
nav button.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
nav .icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; background: var(--icon-bg); font-size: 14px; flex: none; }
nav button.active .icon { background: rgba(139, 92, 246, 0.25); }
nav .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--off); flex: none; }
nav .dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
nav .changed { color: var(--yellow); font-size: 18px; line-height: 0; }
.user { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.user img { width: 34px; height: 34px; border-radius: 50%; }
.user .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.content { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 32px;
  background: var(--topbar);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .crumbs { color: var(--muted); font-weight: 600; white-space: nowrap; }
.topbar .crumbs b { color: var(--text); }
.topbar .grow { flex: 1; }

main { padding: 28px 32px 120px; max-width: 1040px; width: 100%; }

/* Поиск */
.search { position: relative; width: min(440px, 100%); }
.search input[type=text] {
  width: 100%;
  padding: 11px 14px 11px 40px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.search::before { content: "⌕"; position: absolute; left: 14px; top: 50%; transform: translateY(-52%); color: var(--faint); font-size: 18px; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 6px;
  max-height: 360px;
  overflow-y: auto;
  box-shadow: 0 20px 50px var(--shadow);
  z-index: 30;
}
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.search-results button:hover, .search-results button.focus { background: var(--accent-soft); }
.search-results .where { color: var(--faint); font-size: 12px; }
.search-results .empty { color: var(--faint); padding: 10px; }

/* Главная */
.hello { font-size: 34px; font-weight: 800; margin: 6px 0 6px; letter-spacing: -0.01em; }
.hello-sub { color: var(--muted); margin: 0 0 22px; }
.home-search { width: 100%; margin-bottom: 24px; }
.home-search input[type=text] { padding: 15px 16px 15px 44px; font-size: 16px; border-radius: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .value { font-size: 26px; font-weight: 800; }
.stat .label { color: var(--muted); font-size: 13px; }
.home-group-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin: 26px 2px 10px; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.module-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.module-card:hover { border-color: rgba(139, 92, 246, 0.55); background: var(--card-hover); transform: translateY(-1px); }
.module-card .head { display: flex; align-items: center; gap: 12px; }
.module-card .mod-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: var(--accent-soft); flex: none; }
.module-card h3 { margin: 0; font-size: 16px; flex: 1; }
.module-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; flex: 1; }
.module-card .foot { display: flex; align-items: center; justify-content: space-between; color: var(--faint); font-size: 13px; }
.module-card .foot .go { color: var(--accent-2); font-weight: 600; }

/* Заголовок раздела */
.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16), rgba(139, 92, 246, 0.03) 60%), var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
}
.section-head .big-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: rgba(139, 92, 246, 0.2); flex: none; }
.section-head h1 { margin: 0 0 4px; font-size: 24px; font-weight: 800; }
.section-head p { margin: 0; color: var(--muted); }
.section-head .grow { flex: 1; min-width: 0; }
.state-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--pill); color: var(--muted); }
.state-pill.on { background: rgba(34, 197, 94, 0.15); color: var(--green); }

/* Карточки и поля */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.card > .card-title { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.card > .card-title h2 { margin: 0; font-size: 16px; font-weight: 800; flex: 1; }
.card.off > :not(.card-title):not(.hint) { opacity: 0.45; }
.card.error { color: var(--red); border-color: rgba(239, 68, 68, 0.4); }
.field { margin: 14px 0; }
.field:first-child { margin-top: 6px; }
.field > label, .field > .field-label { display: block; font-weight: 700; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.hint { color: var(--faint); font-size: 13px; margin-top: 5px; line-height: 1.45; }
.error { color: var(--red); font-size: 13px; margin-top: 6px; }
.field.has-error input, .field.has-error select, .field.has-error textarea, .field.has-error .chips { border-color: var(--red); }
.field.flash { animation: flash 1.6s ease-out; border-radius: var(--radius-sm); }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.6); background: rgba(139, 92, 246, 0.08); } 100% { box-shadow: 0 0 0 0 transparent; } }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-bottom: 14px; }
.mini-grid > .card { margin-bottom: 0; }
.mini-grid .row { grid-template-columns: 1fr 1fr; }
.row { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 18px; }
.row > .field { margin: 10px 0; }
.toggle-field { display: flex; align-items: center; gap: 12px; justify-content: space-between; min-height: 42px; }
.toggle-field > label { margin: 0; font-size: 14px; color: var(--text); font-weight: 600; }

input[type=text], input[type=number], select, textarea {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
select option, select optgroup { background: var(--card-2); }

/* Переключатель */
.switch { position: relative; display: inline-block; vertical-align: middle; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--off); border-radius: 12px; cursor: pointer; transition: background 0.15s; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Чипы */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--radius-sm); min-height: 42px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border: 1px solid var(--line-2); border-radius: 8px; padding: 3px 4px 3px 9px; font-size: 13px; max-width: 100%; }
.chip .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip span.text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 4px; font-size: 15px; }
.chip button:hover { color: var(--red); }
.chips select, .chips input { flex: 1; min-width: 160px; border: 0; background: none; padding: 4px; box-shadow: none; }

/* Списки */
.list-item { background: var(--card-2); border-radius: 12px; padding: 12px 16px; margin: 10px 0; border: 1px solid var(--line); }
.list-item-head { display: flex; align-items: center; gap: 10px; }
.line-item { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.list-item-head .title { flex: 1; font-weight: 700; color: var(--muted); font-size: 13px; }
.subgroup { border-left: 2px solid rgba(139, 92, 246, 0.35); padding-left: 14px; margin: 14px 0; }
.subgroup > .card-title h2 { margin: 0; font-size: 14px; font-weight: 800; flex: 1; }
.subgroup > .card-title { display: flex; align-items: center; gap: 12px; }

button.btn { border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer; white-space: nowrap; background: var(--btn); color: var(--btn-text); font-weight: 700; transition: background 0.12s; }
button.btn:hover { background: var(--btn-hover); }
button.btn.primary { background: var(--accent); color: #fff; }
button.btn.primary:hover { background: var(--accent-hover); }
button.btn.danger { background: transparent; color: var(--red); padding: 4px 8px; }
button.btn.danger:hover { background: rgba(239, 68, 68, 0.12); }
button.btn.small { padding: 6px 12px; font-size: 13px; }
button.btn.ghost { background: transparent; border: 1px solid var(--line-2); }
button.btn:disabled { opacity: 0.6; cursor: default; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 56px; height: 40px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--field); padding: 3px; cursor: pointer; }

/* Панель сохранения */
.savebar {
  position: fixed;
  left: calc(50% + 136px);
  bottom: 20px;
  transform: translate(-50%, 160%);
  width: min(720px, calc(100vw - 32px));
  background: var(--savebar);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 12px 14px 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  transition: transform 0.2s;
  z-index: 20;
}
.savebar.show { transform: translate(-50%, 0); }
.savebar .grow { flex: 1; color: var(--muted); }

#toast {
  position: fixed;
  top: 16px;
  right: 16px;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--green);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 16px 40px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  white-space: pre-line;
  z-index: 40;
}
#toast.show { opacity: 1; }
#toast.bad { border-left-color: var(--red); }

.menu-toggle { display: none; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 35; transform: translateX(-100%); transition: transform 0.2s; height: 100%; }
  .sidebar.open { transform: none; }
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 34; background: rgba(0, 0, 0, 0.5); }
  .topbar { padding: 12px 16px; }
  .topbar .crumbs { display: none; }
  main { padding: 16px 16px 120px; }
  .menu-toggle { display: inline-block; }
  .savebar { left: 50%; }
  .hello { font-size: 26px; }
}

/* Страница «Команды». */
.stat.over { border-color: rgba(239, 68, 68, 0.5); }
.stat.over .value { color: var(--red); }
.cmd-filter { width: 100%; margin: 0 0 14px; }
.card.module-off > .cmd { opacity: 0.55; }
.cmd { border-top: 1px solid var(--line); padding: 12px 0; }
.cmd:first-of-type { border-top: 0; }
.cmd.flash { animation: flash 1.6s ease-out; border-radius: var(--radius-sm); }
.cmd-head { display: flex; align-items: flex-start; gap: 14px; }
.cmd-head .switch { margin-top: 2px; }
.cmd-text { flex: 1; min-width: 0; }
.cmd-text b { font-weight: 800; margin-right: 8px; }
.cmd.off .cmd-text { opacity: 0.5; }
.cmd-desc { color: var(--muted); font-size: 13px; margin-top: 3px; }
.cmd-subs { color: var(--faint); font-size: 12px; margin-top: 3px; word-spacing: 4px; }
.cmd-summary { color: var(--accent-2); font-size: 12px; margin-top: 5px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--pill); color: var(--muted); vertical-align: 1px; }
.badge.access-mod { background: rgba(234, 179, 8, 0.14); color: var(--yellow); }
.badge.access-admin { background: rgba(239, 68, 68, 0.14); color: var(--red); }
.cmd-settings { margin: 10px 0 2px 58px; padding: 4px 16px; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
@media (max-width: 700px) { .cmd-settings { margin-left: 0; } }

/* История изменений. */
.history-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.history-item:first-child { border-top: 0; }
.history-item .grow { flex: 1; min-width: 0; }

/* Кнопки переменных под шаблоном. */
.vars { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.var { border: 1px solid var(--line-2); background: var(--accent-soft); color: var(--accent-2); border-radius: 8px; padding: 3px 9px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; cursor: pointer; }
.var:hover { border-color: var(--accent); color: var(--text); }

/* Светлая тема: переключается в шапке и в подвале, как «Тема оформления» у Akemi. */
:root[data-theme="light"] {
  --bg: #f4f4f7;
  --sidebar: #ffffff;
  --card: #ffffff;
  --card-2: #f6f6f9;
  --field: #ffffff;
  --line: #e4e4ea;
  --line-2: #d4d4dc;
  --text: #18181b;
  --muted: #52525b;
  --faint: #71717a;
  --accent: #7c3aed;
  --accent-2: #6d28d9;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.1);
  --hover: #f1f0f7;
  --icon-bg: #f0eef8;
  --off: #d4d4d8;
  --pill: #ececf1;
  --chip: #f1f1f5;
  --btn: #ececf1;
  --btn-hover: #e2e2ea;
  --btn-text: #18181b;
  --card-hover: #fbfaff;
  --topbar: rgba(255, 255, 255, 0.85);
  --savebar: #ffffff;
  --shadow: rgba(24, 24, 27, 0.12);
  --bg-glow: rgba(124, 58, 237, 0.08);
  --dc-bg: #ffffff;
  --dc-text: #313338;
  --dc-muted: #5c5e66;
  --dc-mention-bg: rgba(88, 101, 242, 0.15);
  --dc-mention: #505cdc;
  --dc-code: #f2f3f5;
  color-scheme: light;
}

/* Шапка: тема и аватар с меню. */
.theme-toggle { font-size: 15px; line-height: 1; padding: 8px 10px; }
.user-wrap { position: relative; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font-weight: 600; max-width: 220px; }
.user-chip:hover { border-color: var(--line-2); }
.user-chip img, .user-chip .noavatar { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.user-chip .noavatar, .bot-card .noavatar { display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; }
.user-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .caret { color: var(--faint); font-size: 11px; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px var(--shadow); z-index: 30; }
.user-menu-name { padding: 8px 10px; color: var(--faint); font-size: 13px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.user-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--red); font-weight: 600; }
.user-menu button:hover { background: var(--hover); }

/* Низ бокового меню: бот и его состояние. */
.bot-card { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.bot-card img, .bot-card .noavatar { width: 34px; height: 34px; border-radius: 50%; flex: none; }
.bot-card .grow { flex: 1; min-width: 0; }
.bot-card .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-card .online { font-size: 12px; color: var(--green); display: flex; align-items: center; gap: 6px; }
.bot-card .online::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
nav .new-badge { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; background: var(--accent); border-radius: 6px; padding: 2px 6px; flex: none; }

/* Подвал страницы. */
.page-footer { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); }
.foot-brand { display: flex; gap: 12px; align-items: center; }
.foot-brand img { width: 40px; height: 40px; border-radius: 50%; }
.foot-links { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.foot-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
button.link { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; font-weight: 600; }
button.link:hover { color: var(--accent-2); }

/* Недавно посещённые на главной. */
.recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 22px; }
.recent-item { display: flex; gap: 12px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: var(--radius); padding: 12px; cursor: pointer; min-width: 0; }
.recent-item:hover { border-color: rgba(139, 92, 246, 0.55); background: var(--card-hover); }
.recent-item .mod-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); font-size: 18px; flex: none; }
.recent-text { display: flex; flex-direction: column; min-width: 0; }
.recent-text span { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ползунок. */
.slider { display: flex; align-items: center; gap: 12px; }
.slider input[type=range] { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--off) var(--fill, 0%)); outline: none; cursor: pointer; }
.slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 1px 4px var(--shadow); }
.slider input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.slider input.slider-number { width: 84px; flex: none; text-align: center; }

/* Плашки выбора. */
.choice-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { border: 1px solid var(--line-2); background: var(--field); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s; }
.choice:hover { border-color: var(--accent); color: var(--text); }
.choice.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

/* Предпросмотр сообщения в виде Discord. */
.dc-preview { margin-top: 10px; }
.dc-msg { display: flex; gap: 14px; background: var(--dc-bg); color: var(--dc-text); border-radius: 10px; padding: 12px 16px; border: 1px solid var(--line); font-family: "gg sans", "Noto Sans", "Segoe UI", sans-serif; font-size: 15px; line-height: 1.375; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; }
.dc-body { min-width: 0; flex: 1; }
.dc-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dc-name { font-weight: 600; color: var(--dc-text); }
.dc-tag { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 1px 5px; }
.dc-time { color: var(--dc-muted); font-size: 12px; }
.dc-content { margin-top: 2px; overflow-wrap: anywhere; }
.dc-content code { background: var(--dc-code); border-radius: 4px; padding: 0 4px; font-size: 13px; }
.dc-mention { background: var(--dc-mention-bg); color: var(--dc-mention); border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-var { background: var(--accent-soft); color: var(--accent-2); border: 1px dashed var(--accent); border-radius: 6px; padding: 0 5px; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }
.dc-h1 { font-size: 22px; font-weight: 700; margin: 4px 0; }
.dc-h2 { font-size: 19px; font-weight: 700; margin: 4px 0; }
.dc-h3 { font-size: 16px; font-weight: 700; margin: 4px 0; }
.dc-quote { border-left: 4px solid var(--dc-muted); padding-left: 10px; }
.dc-empty { color: var(--dc-muted); font-style: italic; }

@media (max-width: 860px) {
  .user-chip .name, .user-chip .caret { display: none; }
  .user-chip { padding: 4px; }
}
.cmd-head .lock { width: 44px; text-align: center; font-size: 16px; flex: none; }

/* Выбор каналов и ролей с поиском. */
.picker { position: relative; }
.picker-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 5px 8px 5px 6px; background: var(--field); border: 1px solid var(--line-2); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s; }
.picker-field:hover { border-color: var(--accent); }
.picker-field:focus-visible, .picker-field[aria-expanded="true"] { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); }
.picker-placeholder { color: var(--faint); padding: 4px 6px; flex: 1; }
.picker-meta { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; font-weight: 700; padding-left: 4px; }
.picker-meta .caret { font-size: 11px; }
.picker-field .chip.missing { border-color: rgba(239, 68, 68, 0.5); color: var(--red); }
.picker-panel { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 25; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 20px 50px var(--shadow); padding: 6px; }
.picker-search { width: 100%; margin-bottom: 6px; }
.picker-list { max-height: 280px; overflow-y: auto; }
.picker-group { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 8px 10px 4px; }
.picker-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.picker-option .text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-option .swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.picker-option .check { color: var(--accent-2); font-weight: 800; width: 16px; text-align: center; }
.picker-option:hover, .picker-option.active { background: var(--accent-soft); }
.picker-option.on .text { color: var(--accent-2); font-weight: 700; }
.picker-option.disabled { opacity: 0.45; cursor: not-allowed; }
.picker-option.clear .text { color: var(--faint); }
.picker-empty { color: var(--faint); padding: 10px; }

/* Предпросмотр панели: встроенный блок и кнопки Discord. */
.panel-preview { margin: 10px 0 6px; }
.preview-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.dc-embed { margin-top: 6px; max-width: 520px; background: var(--dc-code); border-left: 4px solid #248046; border-radius: 4px; padding: 10px 14px 12px; }
.dc-embed-title { font-weight: 700; margin-bottom: 6px; }
.dc-embed-desc { font-size: 14px; }
.dc-embed-footer { font-size: 12px; color: var(--dc-muted); margin-top: 8px; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-button { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 4px; font-size: 14px; font-weight: 500; color: #fff; }
.dc-button.success { background: #248046; }
.dc-button.primary { background: #5865f2; }
.dc-button.secondary { background: #4e5058; }
.dc-button.danger { background: #da373c; }
.dc-select { display: flex; justify-content: space-between; margin-top: 8px; max-width: 520px; padding: 9px 12px; border-radius: 4px; background: var(--dc-code); border: 1px solid var(--line-2); color: var(--dc-muted); font-size: 14px; }

/* Карточки сводки, которые ведут на свою страницу. */
button.stat.link-stat { text-align: left; color: var(--text); cursor: pointer; font: inherit; transition: border-color 0.15s, background 0.15s; }
button.stat.link-stat:hover { border-color: rgba(139, 92, 246, 0.55); background: var(--card-hover); }
.stat .value.small { font-size: 18px; padding: 5px 0 4px; }

/* Переключатель режимов и сегменты. */
.segmented { display: inline-flex; background: var(--field); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex: none; }
.segmented .seg { border: 0; background: none; color: var(--muted); padding: 6px 12px; border-radius: 7px; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap; }
.segmented .seg:hover { color: var(--text); }
.segmented .seg.on { background: var(--accent); color: #fff; }
.segmented.small .seg { padding: 5px 10px; font-size: 12px; }

/* Визуальный редактор панели. */
.visual-editor { margin-top: 10px; }
.ve-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 8px; }
.ve-tool { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; position: relative; }
.ve-stripe-swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-2); flex: none; }
.ve-color-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 0; bottom: 0; }
.ve-hint { margin: 0 0 10px; }
.ve-embed { position: relative; }
.ve-stripe { position: absolute; left: -8px; top: 0; bottom: 0; width: 12px; border: 0; background: transparent; cursor: pointer; border-radius: 4px 0 0 4px; }
.ve-stripe:hover { background: rgba(255, 255, 255, 0.15); }
.ve-editable { border-radius: 4px; padding: 1px 4px; margin: 0 -4px 2px; cursor: text; outline: 1px dashed transparent; transition: outline-color 0.12s, background 0.12s; }
.ve-editable:hover, .ve-editable:focus-visible { outline-color: var(--accent); background: var(--accent-soft); }
.ve-editable.empty { color: var(--dc-muted); font-style: italic; font-size: 13px; }
.ve-editable.invalid { outline: 1px dashed var(--red); }
.ve-input { width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--accent); border-radius: 6px; padding: 4px 6px; font: inherit; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18); margin-bottom: 4px; }
textarea.ve-input { min-height: 60px; resize: vertical; line-height: 1.4; }
.dc-embed-title .ve-input, .ve-text .ve-input { font-weight: inherit; }
.ve-button { border: 0; cursor: pointer; font: inherit; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color 0.12s, filter 0.12s; }
.ve-button:hover { filter: brightness(1.1); }
.ve-button.selected { outline-color: #fff; box-shadow: 0 0 0 4px var(--accent); }
.ve-button.invalid { outline: 2px dashed var(--red); }
.ve-add { border: 1px dashed var(--dc-muted); background: transparent; color: var(--dc-muted); border-radius: 4px; padding: 6px 14px; font-size: 16px; font-weight: 700; cursor: pointer; }
.ve-add:hover { border-color: var(--accent); color: var(--accent-2); }
.ve-select-head .ve-text { flex: 1; }
.ve-select-list { max-width: 520px; margin-top: 4px; background: var(--dc-code); border: 1px solid var(--line-2); border-radius: 4px; padding: 4px; }
.ve-select-option { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; color: var(--dc-text); border-radius: 4px; padding: 8px; cursor: pointer; font: inherit; }
.ve-select-option:hover { background: var(--accent-soft); }
.ve-select-option.on { background: var(--accent-soft); outline: 1px solid var(--accent); }
.ve-select-option.invalid { outline: 1px dashed var(--red); }
.ve-select-option .emoji { font-size: 18px; }
.ve-select-option .text { display: flex; flex-direction: column; }
.ve-select-option .text span { color: var(--dc-muted); font-size: 13px; }
.ve-add-row { width: 100%; border: 1px dashed var(--line-2); background: none; color: var(--dc-muted); border-radius: 4px; padding: 7px; cursor: pointer; margin-top: 4px; font: inherit; }
.ve-add-row:hover { border-color: var(--accent); color: var(--accent-2); }
.ve-details { margin-top: 14px; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.ve-details.empty { color: var(--faint); text-align: center; }
.ve-details-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ve-details-head h3 { margin: 0; flex: 1; font-size: 15px; }
.ve-actions { display: flex; gap: 6px; align-items: center; }
.ve-subtitle { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin: 16px 0 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.emoji-input { font-size: 16px; }
.swatches { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.swatch-btn { width: 30px; height: 30px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; color: #fff; font-weight: 800; }
.swatch-btn.on { border-color: var(--text); }
.swatch-btn.dc-primary { background: #5865f2; }
.swatch-btn.dc-secondary { background: #4e5058; }
.swatch-btn.dc-success { background: #248046; }
.swatch-btn.dc-danger { background: #da373c; }
.swatch-btn.inherit { width: auto; padding: 0 10px; background: var(--field); color: var(--muted); border: 1px solid var(--line-2); font-size: 12px; font-weight: 700; }
.swatch-btn.inherit.on { border-color: var(--accent); color: var(--accent-2); }
.list-item-head .segmented { margin-left: auto; }

/* Вкладки внутри раздела. */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.tab { position: relative; border: 0; background: none; color: var(--muted); padding: 10px 14px; font-weight: 700; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab-error { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-left: 6px; vertical-align: 2px; }

/* Отправка панели в канал. */
.publish-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.publish-title { font-weight: 800; font-size: 14px; }
.publish-picker { flex: 1; min-width: 220px; max-width: 360px; }
.publish-bar .hint { flex-basis: 100%; margin: 0; }
.ve-option-error { margin-bottom: 12px; font-size: 13px; }

/* Узкий экран: меньше отступов у вложенных блоков, чтобы пример панели не сжимался. */
@media (max-width: 600px) {
  .card { padding: 14px 12px; }
  .list-item { padding: 10px; }
  .ve-details { padding: 12px 10px; }
  .dc-msg { gap: 10px; padding: 10px; }
  .dc-avatar { width: 32px; height: 32px; }
  .dc-embed { padding: 8px 10px 10px; }
  .section-head { padding: 16px; }
  .section-head .big-icon { width: 44px; height: 44px; font-size: 22px; }
}
.sidebar-backdrop { display: none; }
.picker.up .picker-panel { top: auto; bottom: calc(100% + 6px); }

/* Сворачиваемые блоки. */
.collapse-toggle { border: 0; background: none; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; cursor: pointer; font-size: 13px; flex: none; display: inline-grid; place-items: center; transition: transform 0.15s, background 0.12s, color 0.12s; }
.collapse-toggle:hover { background: var(--hover); color: var(--text); }
.collapse-toggle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.collapsible.collapsed > .collapse-head > .collapse-toggle { transform: rotate(-90deg); }
.collapse-title { cursor: pointer; user-select: none; }
.collapse-title:hover { color: var(--accent-2); }
.collapsible.collapsed > :not(.collapse-head) { display: none !important; }
.card.collapsible.collapsed > .card-title { margin-bottom: 0; }
.subgroup.collapsible.collapsed { padding-bottom: 2px; }
.section-tools { display: flex; justify-content: flex-end; gap: 8px; margin: -4px 0 12px; }
.ve-what > .ve-subtitle { display: flex; align-items: center; gap: 6px; }
.ve-what.collapsed > .ve-subtitle { margin-bottom: 0; }

/* Пояснение к открытой вкладке. */
.tab-hint { color: var(--muted); font-size: 14px; margin: -6px 2px 16px; line-height: 1.5; }

/* Плашки «что включено» группами: зелёная записывается, серая нет. */
.choice-groups { display: grid; gap: 14px; }
.choice-summary { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 700; }
.choice-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.choice-group-head b { font-size: 14px; }
.choice-group-head .count { color: var(--faint); font-size: 12px; font-weight: 700; margin-right: auto; }
.choice-groups .choice.on { background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.55); color: var(--green); }
.choice-groups .choice:not(.on) { color: var(--faint); }
.link-btn { border: 0; background: none; color: var(--accent-2); font-weight: 700; font-size: 13px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.link-btn:hover { background: var(--accent-soft); }

/* Участники в полях выбора: аватар, ник и метка бота. */
.chip img.avatar, .picker-option img.avatar { width: 20px; height: 20px; border-radius: 50%; flex: none; object-fit: cover; }
.chip.loading .text { color: var(--faint); font-style: italic; }
.picker-option .sub { color: var(--faint); font-size: 12px; font-weight: 500; margin-left: 8px; }
.bot-tag { background: #5865f2; color: #fff; font-size: 10px; font-weight: 800; border-radius: 4px; padding: 1px 5px; flex: none; }

/* Пример блока рядом с его полями: на широком экране справа, на узком под ними. */
.with-preview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 22px; align-items: start; }
.preview-col { position: sticky; top: 76px; }
.preview-title { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); margin: 8px 0 6px; }
.block-preview { display: grid; gap: 6px; margin-top: 0; }
.block-preview .dc-msg { padding: 10px 14px; }
.preview-caption { font-size: 12px; color: var(--faint); margin: 8px 2px 4px; }
.preview-caption:first-child { margin-top: 0; }
.dc-codeblock { font-family: Consolas, "Courier New", monospace; font-size: 13px; background: #1e1f22; border: 1px solid #1e1f22; border-radius: 4px; padding: 7px 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .with-preview { grid-template-columns: minmax(0, 1fr); } .preview-col { position: static; } }
