:root {
  --ink: #0c0e12;
  --sidebar: #12151b;
  --panel: #171b22;
  --panel-2: #1c212a;
  --line: rgba(232, 244, 255, 0.08);
  --text: #edf3ff;
  --muted: #8b97a8;
  --accent: #b8ff3c;
  --accent-rgb: 184, 255, 60;
  --accent-dim: rgba(var(--accent-rgb), 0.12);
  --danger: #ff5c7a;
  --ok: #5dffa6;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --sidebar-w: 280px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--ink);
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

#app {
  min-height: 100vh;
}

/* Landing */
.landing {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #0e1116 0%, var(--ink) 45%, #0a0c10 100%);
}

.landing::before,
.landing::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(40px);
}

/* Soft accent wash — top-left */
.landing::before {
  width: min(56vw, 520px);
  height: min(56vw, 520px);
  top: -12%;
  left: -8%;
  background: rgba(var(--accent-rgb), 0.11);
  animation: landing-drift-a 18s ease-in-out infinite alternate;
}

/* Matching wash — bottom-right, slightly quieter */
.landing::after {
  width: min(48vw, 440px);
  height: min(48vw, 440px);
  right: -10%;
  bottom: -14%;
  background: rgba(var(--accent-rgb), 0.08);
  animation: landing-drift-b 22s ease-in-out infinite alternate;
}

@keyframes landing-drift-a {
  from {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.85;
  }
  to {
    transform: translate3d(4%, 6%, 0) scale(1.05);
    opacity: 1;
  }
}

@keyframes landing-drift-b {
  from {
    transform: translate3d(0, 0, 0) scale(1.03);
    opacity: 0.7;
  }
  to {
    transform: translate3d(-5%, -4%, 0) scale(1);
    opacity: 0.95;
  }
}

.landing-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  padding: clamp(28px, 5vw, 40px);
  border: 1px solid rgba(232, 244, 255, 0.08);
  border-radius: 24px;
  background: rgba(20, 24, 31, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.landing-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    145deg,
    rgba(var(--accent-rgb), 0.06) 0%,
    transparent 42%,
    transparent 100%
  );
}

@media (prefers-reduced-motion: reduce) {
  .landing::before,
  .landing::after {
    animation: none;
  }
}

.landing h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 9vw, 4.2rem);
  letter-spacing: -0.05em;
}

.landing h1 span {
  color: var(--accent);
}

.landing p {
  margin: 16px 0 26px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 36ch;
}

.landing-access {
  display: grid;
  gap: 10px;
  max-width: 320px;
}

.landing-access-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.landing-access-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1117;
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  letter-spacing: 0.04em;
}

.landing-access-input:focus {
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.08);
}

.landing-access-error {
  margin: 0 !important;
  color: var(--danger) !important;
  font-size: 0.88rem;
  max-width: none !important;
}

.landing-access .btn,
.landing-unlocked .btn {
  justify-self: start;
  margin-top: 4px;
}

.landing-unlocked {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.landing-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.access-code-block {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.access-code-form {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.access-code-form .field {
  margin-top: 10px;
  min-width: 0;
}

.access-code-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.access-code-row .field label {
  white-space: nowrap;
}

.access-code-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.password-field {
  position: relative;
  display: block;
  width: 100%;
}

.password-field input {
  width: 100%;
  padding-right: 46px;
  box-sizing: border-box;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.password-toggle:hover {
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.access-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.access-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.access-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.access-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.access-meta strong {
  font-size: 0.98rem;
}

.access-meta span {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* App shell */
.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 14px 16px;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.045) 0%, transparent 28%),
    linear-gradient(180deg, #141820 0%, #10141b 100%);
  border-right: 1px solid var(--line);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.side-top {
  display: grid;
  gap: 18px;
  padding: 0 4px 4px;
}

.side-brand {
  text-decoration: none;
  display: grid;
  gap: 2px;
  padding: 2px 8px 0;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: -0.05em;
  line-height: 1;
}

.brand-mark span {
  color: var(--accent);
}

.brand-sub {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}

.side-section {
  display: grid;
  gap: 8px;
}

.side-label {
  margin: 0 10px 8px;
  color: #6f7a8b;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.side-empty {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.server-picker {
  position: relative;
}

.server-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(232, 244, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.server-trigger:hover,
.server-picker.open .server-trigger {
  border-color: rgba(var(--accent-rgb), 0.35);
  background: rgba(var(--accent-rgb), 0.06);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.06);
}

.server-trigger-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.server-trigger-text {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.server-trigger-label {
  font-weight: 600;
  font-size: 0.94rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 160ms ease;
}

.server-picker.open .server-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.guild-avatar {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(232, 244, 255, 0.1);
}

.guild-avatar-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #243043, #1a2230);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
}

.server-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  gap: 2px;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(232, 244, 255, 0.12);
  background: #161b24;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.server-picker.open .server-menu {
  display: grid;
}

.server-menu[hidden] {
  display: none !important;
}

.server-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease;
}

.server-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.server-option.active {
  background: rgba(var(--accent-rgb), 0.12);
}

.server-option-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  flex: 1;
  font-size: 0.92rem;
}

.server-option-text > span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-tag {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.side-nav {
  display: grid;
  gap: 18px;
  flex: 1;
  align-content: start;
  padding: 8px 0 12px;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.side-link {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  color: #9aa5b5;
  text-align: left;
  border-radius: 12px;
  padding: 11px 12px 11px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.side-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 999px;
  background: var(--accent);
  transform: translateY(-50%);
  opacity: 0;
  transition: height 160ms ease, opacity 160ms ease;
}

.side-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.side-link.active {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.1);
  font-weight: 600;
}

.side-link.active::before {
  height: 58%;
  opacity: 1;
}

.side-link-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: inherit;
  opacity: 0.85;
  flex-shrink: 0;
}

.side-link-icon svg {
  width: 18px;
  height: 18px;
}

.side-link.active .side-link-icon {
  color: var(--accent);
  opacity: 1;
}

.side-link-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--line);
}

.userchip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 12px;
}

.userchip img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.userchip-meta {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.userchip-meta strong {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.userchip-meta span {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-logout {
  width: 100%;
  justify-content: center;
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
}

.main {
  min-width: 0;
  background:
    radial-gradient(900px 360px at 80% -10%, rgba(var(--accent-rgb), 0.07), transparent 50%),
    var(--ink);
}

.main-inner {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.page-head {
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 54ch;
  line-height: 1.5;
}

.back-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  margin-bottom: 10px;
  cursor: pointer;
}

.back-link:hover {
  color: var(--accent);
}

.empty-state,
.invite-card {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.015);
}

.invite-card {
  display: grid;
  gap: 12px;
  justify-items: start;
  border-style: solid;
  background: var(--panel);
}

.plugin-section {
  margin-bottom: 28px;
}

.plugin-section h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.plugin-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 160ms ease, transform 160ms ease;
}

.plugin-card:hover {
  border-color: rgba(var(--accent-rgb), 0.35);
  transform: translateY(-2px);
}

.plugin-card-top {
  display: flex;
  justify-content: space-between;
}

.plugin-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
}

.plugin-icon svg {
  width: 20px;
  height: 20px;
}

.plugin-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.plugin-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  min-height: 3.8em;
}

.feature-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  padding: 20px;
  box-shadow: var(--shadow);
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.7rem 1.05rem;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #10140a;
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: rgba(var(--accent-rgb), 0.4);
}

.toggle-list {
  display: grid;
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.toggle-row strong {
  display: block;
  margin-bottom: 4px;
}

.toggle-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #2a3340;
  cursor: pointer;
  transition: background 160ms ease;
}

.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  transition: transform 160ms ease;
}

.switch input:checked + i {
  background: var(--accent);
}

.switch input:checked + i::after {
  transform: translateX(20px);
}

.log-feed-block {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.log-feed-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.log-feed-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.log-feed-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.log-toolbar {
  display: grid;
  grid-template-columns: 150px 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.log-toolbar select,
.log-toolbar input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d1117;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

.log-feed {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #0d1117;
}

.log-item {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
}

.log-item:hover {
  border-color: var(--line);
}

.log-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.log-cat {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #10140a;
  background: var(--accent);
  font-weight: 600;
}

.log-item time {
  color: var(--muted);
  font-size: 0.8rem;
}

.log-item strong {
  display: block;
  margin-bottom: 6px;
}

.log-user {
  color: var(--accent);
  font-size: 0.84rem;
  margin-bottom: 6px;
}

.log-detail {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.88rem;
  line-height: 1.45;
}

.warn-feed .log-toolbar,
.log-feed-block:has(#warn-filter-q) .log-toolbar {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.warn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.text-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.settings-panel {
  display: grid;
  gap: 8px;
}

.settings-block {
  display: grid;
  gap: 16px;
}

.settings-block-head h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.accent-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(232, 244, 255, 0.08);
  background: #121722;
}

.accent-preview-swatch {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
  flex-shrink: 0;
}

.accent-preview-btn {
  margin-left: auto;
}

.accent-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.accent-preset {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(232, 244, 255, 0.1);
  background: #121722;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease;
}

.accent-preset:hover {
  border-color: rgba(var(--accent-rgb), 0.35);
}

.accent-preset.active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.1);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}

.accent-preset-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.accent-preset-name {
  font-size: 0.92rem;
  font-weight: 600;
}

.accent-custom-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.accent-custom-row input[type="color"] {
  width: 52px;
  height: 42px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(232, 244, 255, 0.12);
  background: #121722;
  cursor: pointer;
}

.accent-custom-row input[type="text"] {
  width: min(160px, 100%);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(232, 244, 255, 0.12);
  background: #121722;
  color: var(--text);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.accent-custom-row input[type="text"]:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

@media (max-width: 720px) {
  .accent-presets {
    grid-template-columns: 1fr 1fr;
  }

  .accent-preview-btn {
    margin-left: 0;
    width: 100%;
  }
}

.stats-page {
  display: grid;
  gap: 18px;
}

.stats-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stats-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-range-btn {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(232, 244, 255, 0.12);
  background: #121722;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.stats-range-btn:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.28);
}

.stats-range-btn.active {
  color: #0b1008;
  background: var(--accent);
  border-color: var(--accent);
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stats-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(232, 244, 255, 0.08);
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(var(--accent-rgb), 0.1), transparent 55%),
    #141a24;
}

.stats-card-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

.stats-card-value {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stats-card-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.stats-panel {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(232, 244, 255, 0.08);
  background: #141a24;
}

.stats-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stats-panel-head h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.stats-legend {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.stats-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 6px;
}

.stats-legend .swatch.messages {
  background: var(--accent);
}

.stats-legend .swatch.users {
  background: #7eb6ff;
}

.stats-chart {
  width: 100%;
  min-height: 220px;
}

.stats-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.stats-chart-axis {
  stroke: rgba(232, 244, 255, 0.12);
  stroke-width: 1;
}

.stats-chart-line.messages {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.stats-chart-line.users {
  stroke: #7eb6ff;
  stroke-width: 2;
  stroke-dasharray: 5 4;
}

.stats-chart-dot {
  fill: var(--accent);
}

.stats-chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.stats-chart-empty {
  display: grid;
  place-items: center;
  min-height: 200px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.stats-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(232, 244, 255, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
}

.stats-totals strong {
  color: var(--text);
  margin-right: 4px;
}

.stats-grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.stats-bars {
  display: grid;
  gap: 12px;
}

.stats-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.stats-bar-meta span {
  text-transform: capitalize;
}

.stats-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.85), rgba(var(--accent-rgb), 0.35));
}

.stats-people {
  display: grid;
  gap: 10px;
}

.stats-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-person img,
.stats-person-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.stats-person-fallback {
  display: grid;
  place-items: center;
  background: #243043;
  color: var(--accent);
  font-weight: 700;
}

.stats-events {
  display: grid;
  gap: 10px;
}

.stats-event {
  padding: 12px 12px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(232, 244, 255, 0.05);
}

.stats-event-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.stats-event-cat {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--accent);
}

.stats-event strong {
  display: block;
  margin-bottom: 4px;
}

.stats-event p {
  margin: 0;
  font-size: 0.9rem;
}

.stats-note {
  margin: 0;
  font-size: 0.88rem;
}

@media (max-width: 980px) {
  .stats-cards,
  .stats-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .stats-cards,
  .stats-grid-2 {
    grid-template-columns: 1fr;
  }
}

.commands-page .page-head h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.cmd-browser {
  display: grid;
  gap: 18px;
}

.cmd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.cmd-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  align-items: center;
}

.cmd-tab {
  position: relative;
  padding: 10px 2px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: color 140ms ease;
}

.cmd-tab:hover {
  color: var(--text);
}

.cmd-tab.active {
  color: var(--text);
}

.cmd-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.cmd-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: min(320px, 100%);
  flex: 0 1 280px;
}

.cmd-search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.cmd-search input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: 12px;
  border: 1px solid rgba(232, 244, 255, 0.12);
  background: #121722;
  color: var(--text);
  font: inherit;
}

.cmd-search input::placeholder {
  color: var(--muted);
}

.cmd-search input:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.45);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.cmd-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.cmd-list-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.cmd-list {
  display: grid;
  gap: 10px;
}

.cmd-row {
  border-radius: 14px;
  border: 1px solid rgba(232, 244, 255, 0.08);
  background: #141a24;
  overflow: hidden;
  transition: border-color 140ms ease, background 140ms ease;
}

.cmd-row:hover,
.cmd-row.open {
  border-color: rgba(var(--accent-rgb), 0.22);
  background: #171e2a;
}

.cmd-row-main {
  display: grid;
  grid-template-columns: 40px 1fr 28px;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.cmd-row-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.cmd-row-icon svg {
  width: 20px;
  height: 20px;
}

.cmd-row-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cmd-row-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.cmd-row-desc {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.cmd-row-chevron {
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: transform 160ms ease;
}

.cmd-row-chevron svg {
  width: 18px;
  height: 18px;
}

.cmd-row.open .cmd-row-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.cmd-row-body {
  padding: 0 16px 16px 68px;
}

.cmd-detail {
  display: grid;
  gap: 14px;
  padding-top: 2px;
  border-top: 1px solid rgba(232, 244, 255, 0.06);
}

.cmd-detail-block {
  display: grid;
  gap: 6px;
  padding-top: 12px;
}

.cmd-detail-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.cmd-detail-usage {
  display: inline-block;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--accent);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88rem;
  word-break: break-word;
}

.cmd-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.cmd-detail-list li {
  display: grid;
  gap: 2px;
}

.cmd-detail-list code {
  color: var(--accent);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.88rem;
}

.cmd-detail-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.cmd-detail-list em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.78rem;
}

.fun-docs {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d1117;
}

.cmd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.cmd-table th,
.cmd-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.cmd-table th {
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.02);
}

.cmd-table tbody tr:last-child td {
  border-bottom: 0;
}

.cmd-table tbody tr:hover td {
  background: rgba(var(--accent-rgb), 0.03);
}

.cmd-name {
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  white-space: nowrap;
}

.cmd-usage code {
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.86rem;
  word-break: break-word;
}

@media (max-width: 720px) {
  .log-toolbar {
    grid-template-columns: 1fr;
  }

  .cmd-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .cmd-search {
    flex: 1 1 auto;
    min-width: 0;
  }

  .cmd-row-body {
    padding-left: 16px;
  }

  .cmd-table th:nth-child(3),
  .cmd-table td:nth-child(3) {
    display: none;
  }
}

.post-cards {
  display: grid;
  gap: 14px;
}

.post-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.post-card-top {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}

.post-card .field {
  margin-top: 10px;
}

.post-card .field:first-child {
  margin-top: 0;
}

@media (max-width: 720px) {
  .post-card-top {
    grid-template-columns: 1fr;
  }
}

.exception-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.exception-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.exception-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.exception-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.exception-card {
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.exception-card-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.exception-card .hint {
  display: block;
  margin-bottom: 10px;
}

.pick-panel {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.pick-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pick-search {
  flex: 1;
  min-width: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d1117;
  color: var(--text);
  padding: 9px 12px;
  outline: none;
}

.pick-search:focus {
  border-color: rgba(var(--accent-rgb), 0.45);
}

.pick-count {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.pick-list {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1117;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  transition: background 140ms ease;
}

.pick-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.pick-item.is-on {
  background: rgba(var(--accent-rgb), 0.08);
}

.pick-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pick-box {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid rgba(232, 244, 255, 0.22);
  background: transparent;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: border-color 140ms ease, background 140ms ease;
}

.pick-item.is-on .pick-box {
  border-color: var(--accent);
  background: var(--accent);
}

.pick-item.is-on .pick-box::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #10140a;
  border-bottom: 2px solid #10140a;
  transform: rotate(-45deg) translateY(-1px);
}

.pick-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  .exception-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field label {
  color: var(--muted);
  font-size: 0.9rem;
}

.field select,
.field textarea,
.field input,
.rank-row input,
.rank-row select,
.rr-row input,
.rr-row select,
.cc-grid input,
.cc-grid select,
.cc-row textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1117;
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.field select:focus,
.field textarea:focus,
.field input:focus {
  border-color: rgba(var(--accent-rgb), 0.5);
}

/* Custom select / channel dropdown */
.nice-select {
  position: relative;
  width: 100%;
}

.nice-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.nice-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1117;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.nice-select-trigger:hover,
.nice-select.open .nice-select-trigger {
  border-color: rgba(var(--accent-rgb), 0.4);
  background: #10161f;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.07);
}

.nice-select-label {
  min-width: 0;
  flex: 1;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nice-select-label.is-placeholder {
  color: var(--muted);
}

.nice-select-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 160ms ease, color 160ms ease;
}

.nice-select.open .nice-select-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.nice-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 50;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(232, 244, 255, 0.12);
  background: #12171f;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.5);
}

.nice-select-menu[hidden] {
  display: none !important;
}

.nice-select-search-wrap {
  padding: 0 2px 2px;
}

.nice-select-search {
  width: 100%;
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  background: #0d1117 !important;
  color: var(--text);
  padding: 10px 12px !important;
  outline: none;
}

.nice-select-search:focus {
  border-color: rgba(var(--accent-rgb), 0.45) !important;
}

.nice-select-options {
  display: grid;
  gap: 2px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.nice-select-options::-webkit-scrollbar {
  width: 8px;
}

.nice-select-options::-webkit-scrollbar-thumb {
  background: rgba(232, 244, 255, 0.14);
  border-radius: 99px;
}

.nice-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease;
}

.nice-select-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.nice-select-option.active {
  background: rgba(var(--accent-rgb), 0.12);
}

.nice-select-hash {
  width: 1.4rem;
  flex-shrink: 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}

.kind-channel .nice-select-hash {
  color: #8ea0b8;
}

.kind-role .nice-select-hash {
  color: var(--accent);
}

.nice-select-hash-empty {
  opacity: 0.45;
}

.nice-select-option-text {
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.94rem;
}

.nice-select-check {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.rank-row .nice-select,
.rr-row .nice-select,
.cc-grid .nice-select,
.log-toolbar .nice-select {
  min-width: 0;
}

.log-toolbar .nice-select-trigger {
  padding: 10px 12px;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.muted {
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
}

.save-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.status {
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--danger);
}

.rank-rows,
.rr-rows {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 8px;
  align-items: center;
}

.rr-row {
  display: grid;
  grid-template-columns: 110px 1fr 1.2fr auto;
  gap: 8px;
  align-items: center;
}

.cc-rows {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.cc-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.cc-grid {
  display: grid;
  grid-template-columns: 1fr 110px 1fr 100px 1fr auto auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.cc-eph {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 100px 1.2fr;
  gap: 10px;
}

.gw-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.gw-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* Rules editor */
.rules-editor-shell {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #0d1117;
}

.rules-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.rules-tool {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}

.rules-tool:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: var(--accent-dim);
}

.rules-tool-sep {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 0 2px;
}

.rules-editor {
  min-height: 240px;
  max-height: 480px;
  overflow: auto;
  padding: 14px 16px;
  line-height: 1.55;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.rules-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.rules-editor a {
  color: #6ea8fe;
  text-decoration: underline;
}

.rules-editor-shell .hint {
  display: block;
  padding: 0 14px 12px;
}

@media (max-width: 920px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
  }

  .nav-group {
    gap: 2px;
  }

  .main-inner {
    width: min(1080px, calc(100% - 28px));
  }
}

.bot-profile-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 22px;
  align-items: start;
}

.bot-profile-card {
  display: grid;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 16px;
  border: 1px solid rgba(232, 244, 255, 0.1);
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(var(--accent-rgb), 0.12), transparent 55%),
    linear-gradient(160deg, #1a2030, #121722);
}

.bot-profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(var(--accent-rgb), 0.35);
  background: #0e121a;
}

.bot-profile-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bot-profile-tag {
  margin-top: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.bot-profile-bio {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bot-profile-fields {
  display: grid;
  gap: 4px;
}

.avatar-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.avatar-upload-row input[type="file"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(232, 244, 255, 0.12);
  background: #121722;
  color: var(--text);
  font: inherit;
}

.avatar-upload-row input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: 8px;
  padding: 7px 12px;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

@media (max-width: 900px) {
  .bot-profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .rank-row,
  .rr-row,
  .cc-grid,
  .field-row,
  .access-code-row,
  .save-bar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }
}
