:root {
  --bg: #f3f0fa;
  --panel: #ffffff;
  --text: #16121f;
  --muted: #6a6478;
  --line: #d9d3e8;
  --purple: #7c3aed;
  --purple-deep: #6d28d9;
  --purple-dim: rgba(124, 58, 237, 0.1);
  --danger: #dc2626;
  --side: #ebe6f7;
  --font: "DM Sans", sans-serif;
  --display: "Syne", sans-serif;
  --mono: "JetBrains Mono", monospace;
  --side-w: 240px;
}

[data-theme="dark"] {
  --bg: #050508;
  --panel: #111018;
  --text: #f0eef6;
  --muted: #8b8798;
  --line: #1c1a26;
  --purple: #a855f7;
  --purple-deep: #7c3aed;
  --purple-dim: rgba(168, 85, 247, 0.18);
  --danger: #ef4444;
  --side: #0c0b12;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  transition: background 0.25s ease, color 0.25s ease;
}

.topbar {
  display: none;
}

.side-bg {
  display: none;
}

body.embedded .topbar {
  display: none !important;
}

.side {
  position: sticky;
  top: 0;
  width: var(--side-w);
  min-height: 100vh;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-shrink: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Space Grotesk", var(--display), sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  padding: 0 0.35rem;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  object-fit: contain;
  flex-shrink: 0;
  background: #0a0a0f;
}

.side-server {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.35rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

body:not(.is-ready) .guild-slot {
  visibility: hidden;
}

.server-av:not([src]),
.group-icon:not([src]) {
  background: var(--line);
}

.server-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--line);
}

.server {
  font-weight: 600;
  font-size: 0.9rem;
}

.demo {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--purple);
  background: var(--purple-dim);
  border: 1px solid rgba(124, 58, 237, 0.35);
  border-radius: 5px;
  padding: 0.15rem 0.4rem;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.side-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.side-nav a:hover {
  color: var(--text);
  background: var(--purple-dim);
}

.side-nav a.on {
  color: var(--purple);
  background: var(--purple-dim);
  font-weight: 600;
}

.side-foot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-right: 0.15rem;
}

.theme {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme:hover {
  color: var(--text);
  border-color: rgba(124, 58, 237, 0.5);
  background: var(--purple-dim);
}

.theme svg {
  width: 16px;
  height: 16px;
  display: none;
}

html:not([data-theme="dark"]) .theme-moon,
html[data-theme="dark"] .theme-sun {
  display: block;
}

.main {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 1.75rem 2rem 3rem;
}

.page {
  display: none;
}

.page.on {
  display: block;
}

.page-head {
  margin-bottom: 1.5rem;
}

.page-head.bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-head h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}

.sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.sub.tight {
  margin-top: 0.4rem;
  margin-bottom: 0;
}

.bar-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.search {
  width: 200px;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  outline: none;
}

.search:focus {
  border-color: var(--purple);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
}

.panel.pad-0 {
  padding: 0;
  overflow: hidden;
}

.panel h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-val {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.on {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}

.mini-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.mini-list li {
  font-size: 0.9rem;
  color: var(--muted);
}

.mini-list strong {
  color: var(--text);
  font-weight: 600;
}

.mini-list .when {
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 0.35rem;
}

.link {
  color: var(--purple);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.quick {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}

.quick .btn {
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s;
}

.btn-main {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-deep) 100%);
  color: #fff;
}

.btn-main:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(124, 58, 237, 0.45);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
}

.btn-danger {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.08);
}

.rules {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.kw-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
  align-items: center;
}

.kw-toolbar .search {
  flex: 1 1 12rem;
  min-width: 0;
}

.kw-checks {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}

.check:hover {
  border-color: rgba(124, 58, 237, 0.35);
}

.check input {
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin: 0;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  display: grid;
  place-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.check input::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  transform: scale(0);
  transition: transform 0.12s ease;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
  background: #fff;
}

.check input:checked {
  border-color: var(--purple);
  background: var(--purple);
}

.check input:checked::before {
  transform: scale(1);
}

.check:has(input:checked) {
  border-color: rgba(124, 58, 237, 0.45);
  background: var(--purple-dim);
}

.sort-wrap {
  position: relative;
  flex: 0 0 auto;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.45rem;
  padding: 0.45rem 0.85rem 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sort-btn:hover,
.sort-wrap.open .sort-btn {
  border-color: rgba(124, 58, 237, 0.45);
}

.sort-wrap.open .sort-btn {
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.sort-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sort-val {
  font-weight: 500;
}

.sort-caret {
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.15rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.15s;
}

.sort-wrap.open .sort-caret {
  transform: rotate(225deg) translateY(-1px);
}

.sort-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 20;
  min-width: 11.5rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20, 16, 30, 0.14);
}

.sort-menu.hidden {
  display: none;
}

.sort-opt {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}

.sort-opt:hover {
  background: rgba(124, 58, 237, 0.08);
}

.sort-opt.on {
  background: var(--purple-dim);
  color: var(--purple);
  font-weight: 600;
}

.sort-opt:disabled,
.sort-opt.dim {
  opacity: 0.4;
  cursor: not-allowed;
}

.filt-bar {
  margin: 0 0 0.65rem;
}

.filt-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0 0 1rem;
}

.filt-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 0.5rem;
  align-items: end;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.filt-row.is-custom {
  grid-template-columns: 5.5rem 1fr 1fr auto;
}

.filt-kind {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-bottom: 0.55rem;
}

.filt-row .field {
  margin: 0;
}

.filt-row .field label {
  font-size: 0.75rem;
}

.filt-row input {
  width: 100%;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.1rem 0 0.25rem;
}

.pager.hidden {
  display: none;
}

.pager-meta {
  font-size: 0.88rem;
  color: var(--muted);
  min-width: 7rem;
  text-align: center;
}

.rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.15rem;
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.rule.is-paused {
  opacity: 0.62;
}

.rule:hover {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.06);
}

.rule-kw {
  min-width: 110px;
}

.rule-kw .mono {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.95rem;
}

.rule-path {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.rule-path .mono {
  font-family: var(--mono);
  color: var(--text);
  font-size: 0.88rem;
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.chip {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.tag-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.4rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: text;
}

.tag-box:focus-within {
  border-color: var(--purple);
}

.tag-list {
  display: contents;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple);
  background: var(--purple-dim);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 999px;
  padding: 0.25rem 0.35rem 0.25rem 0.65rem;
}

.tag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-x {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.tag-x:hover {
  color: var(--text);
  background: rgba(124, 58, 237, 0.15);
}

.tag-input {
  flex: 1;
  min-width: 140px;
  border: none !important;
  background: transparent !important;
  padding: 0.35rem 0.25rem !important;
  box-shadow: none !important;
  outline: none;
  font-size: 1rem;
}

.hint-line {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.img-preview {
  display: block;
  margin-top: 0.65rem;
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: var(--bg);
}

.img-preview.hidden {
  display: none;
}

.mute-panel {
  margin-bottom: 1.25rem;
}

.mute-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.mute-row .pick {
  flex: 1;
  min-width: 180px;
}

.mute-list {
  list-style: none;
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mute-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.9rem;
}

.mute-list .mono {
  font-family: var(--mono);
  font-weight: 500;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  background: var(--line);
  color: var(--muted);
  margin-left: 0.35rem;
  vertical-align: middle;
}

.badge.on {
  background: var(--purple-dim);
  color: var(--purple);
}

.badge.pause {
  background: rgba(180, 120, 40, 0.15);
  color: #b47828;
}

.rule-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.rule:hover .rule-actions,
.rule:focus-within .rule-actions {
  opacity: 1;
}

.empty {
  display: none;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty.show {
  display: block;
}

.empty p {
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--purple-dim);
}

.mono {
  font-family: var(--mono);
  font-size: 0.85em;
}

.muted {
  color: var(--muted);
}

.group-card {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
}

.group-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
  flex-shrink: 0;
}

.group-info {
  flex: 1;
  min-width: 160px;
}

.group-info h2 {
  margin-bottom: 0.15rem;
}

.group-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.plan {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--purple);
  background: var(--purple-dim);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
}

.changelog {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.changelog li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
}

.changelog .date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--purple);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.changelog h3 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.changelog p {
  color: var(--muted);
  font-size: 0.92rem;
}

.demo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  width: 100%;
  flex: 0 0 100%;
  padding: 0.7rem 1rem;
  background: var(--purple-dim);
  border-bottom: 1px solid rgba(124, 58, 237, 0.35);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.demo-banner.hidden {
  display: none;
}

.demo-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

body.demo-mode:not(.embedded) {
  flex-wrap: wrap;
}

.guide h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.guide p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.65rem;
}

.guide p:last-child {
  margin-bottom: 0;
}

.guide ul {
  margin: 0.35rem 0 0 1.15rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.guide li {
  margin-bottom: 0.35rem;
}

.guide li:last-child {
  margin-bottom: 0;
}

.help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

input,
select {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  outline: none;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--purple);
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pick {
  position: relative;
}

.pick-q {
  width: 100%;
}

.pick-list {
  position: relative;
  margin-top: 0.35rem;
  z-index: 5;
  max-height: 220px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.35rem;
}

.pick-list.hidden {
  display: none;
}

.pick-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.7rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
}

.pick-item:hover:not(:disabled) {
  background: var(--purple-dim);
}

.pick-item.dim,
.pick-item:disabled {
  color: var(--muted);
  cursor: default;
}

.pick-sel {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.pick-sel.on {
  color: var(--purple);
  font-weight: 500;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0.15rem 0 0.5rem;
}

.check input {
  width: auto;
  accent-color: var(--purple);
}

.toast {
  display: none;
  color: var(--purple);
  font-size: 0.9rem;
  font-weight: 600;
}

.toast.show {
  display: block;
}

.drawer-bg {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 16, 0.4);
  z-index: 30;
  opacity: 1;
  transition: opacity 0.2s;
}

.drawer-bg.hidden {
  display: none;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 100%);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.25s ease;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.12);
}

.drawer.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  font-family: var(--display);
  font-size: 1.15rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}

.icon-btn:hover {
  background: var(--purple-dim);
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem 1.25rem 1.5rem;
}

.group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 1rem 0 0.65rem;
}

.group-label:first-child {
  margin-top: 0;
}

.drawer-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
}

.panel-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.panel-bar h2 {
  margin-bottom: 0.25rem;
}

.view-as {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.view-as select {
  width: auto;
  min-width: 110px;
}

.invite-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.invite-row input {
  flex: 1;
  min-width: 200px;
}

.invite-block .member-pick,
.invite-block #invite-discord {
  width: 100%;
  margin-bottom: 0.75rem;
}

.member-pick {
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}

.hint-line {
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.admin-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-wrap: wrap;
}

.admin-av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--purple-dim);
  color: var(--purple);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  object-fit: cover;
}

.admin-info {
  flex: 1;
  min-width: 140px;
}

.admin-info strong {
  display: block;
  font-size: 0.95rem;
}

.admin-info span {
  font-size: 0.82rem;
  color: var(--muted);
}

.admin-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

.help {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

body.is-admin .owner-only {
  display: none !important;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .rule {
    flex-wrap: wrap;
  }

  .rule-chips {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  body {
    display: block;
  }

  .topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 0.7rem 0.9rem;
    background: var(--side);
    border-bottom: 1px solid var(--line);
  }

  .menu-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .menu-btn span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
  }

  .topbar-server {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
  }

  .topbar-server .server {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .side-bg {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 8, 16, 0.45);
    z-index: 40;
  }

  .side-bg.hidden {
    display: none;
  }

  .side {
    position: fixed;
    top: 0;
    left: 0;
    width: min(280px, 86vw);
    height: 100%;
    height: 100dvh;
    z-index: 50;
    background: var(--side);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    border-right: 1px solid var(--line);
    border-bottom: none;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.18);
    pointer-events: auto;
  }

  body.nav-open .side {
    transform: translateX(0);
  }

  .side-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    flex: 1;
  }

  .side-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1;
  }

  .side-foot {
    flex-direction: column;
  }

  .main {
    padding: 1.15rem 1rem 2.5rem;
    width: 100%;
  }

  .page-head h1 {
    font-size: 1.45rem;
  }

  .search {
    width: 100%;
  }

  .kw-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .kw-checks {
    width: 100%;
  }

  .check {
    flex: 1;
    justify-content: center;
  }

  .sort-wrap,
  .sort-btn {
    width: 100%;
  }

  .sort-btn {
    justify-content: space-between;
  }

  .sort-menu {
    left: 0;
    right: 0;
    min-width: 0;
  }

  .filt-row,
  .filt-row.is-custom {
    grid-template-columns: 1fr;
  }

  .filt-kind {
    padding-bottom: 0;
  }

  .bar-actions {
    width: 100%;
  }

  .bar-actions .btn {
    flex: 1;
    min-height: 44px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .form-panel {
    max-width: none;
  }

  .rule-actions {
    opacity: 1;
  }

  .rule-actions .btn {
    min-width: 44px;
    min-height: 40px;
  }

  .drawer {
    width: 100%;
  }

  .drawer-foot {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .drawer-foot .btn {
    min-height: 44px;
    flex: 1;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }
}
