:root {
  --bg: #0f1115;
  --bg-2: #16191f;
  --bg-3: #1d222b;
  --card: #1b1f26;
  --card-2: #20252e;
  --text: #e6e8ef;
  --muted: #9aa3b2;
  --accent: #ff4d4d;
  --pill: #2a303a;
  --border: #2a2f39;
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top left, #151922, var(--bg));
  color: var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.cursor-enabled,
.cursor-enabled a,
.cursor-enabled button,
.cursor-enabled input,
.cursor-enabled label,
.cursor-enabled select,
.cursor-enabled textarea,
.cursor-enabled summary,
.cursor-enabled details {
  cursor: none;
}

.card {
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: 16px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 77, 77, 0.4);
}

.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.pill {
  background: var(--pill);
  color: #7ce2ff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  width: fit-content;
}

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

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  font-weight: 700;
}

.brand-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.brand-link .brand-text {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.page-context {
  margin: -2px 0 20px;
}

/* Login page */
.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(560px, 100%);
  padding: 28px;
}

.login-title {
  font-size: 24px;
}

.login-subtitle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-top: 4px;
  margin-bottom: 20px;
}

.login-nav {
  margin-bottom: 12px;
}

.login-btn {
  width: 100%;
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease;
}

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

.spinner-wrap {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.spinner-wrap.show {
  display: flex;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}

.error {
  color: #ffb4b4;
  font-size: 13px;
  margin: 12px 0;
}

/* Servers page */
.user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar,
.guild-icon {
  border-radius: 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.guild-icon {
  width: 48px;
  height: 48px;
}

.avatar img,
.guild-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.logout {
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: #fff;
  width: 36px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.logout:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 77, 77, 0.4);
}

.logout-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.guilds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.guild-card {
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.guild-card:hover {
  transform: translateY(-3px) scale(1.015);
  border-color: rgba(255, 77, 77, 0.35);
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.35);
}

.guild-card-link {
  text-decoration: none;
  cursor: pointer;
}

.guild-card-link:focus-visible {
  outline: 2px solid rgba(124, 226, 255, 0.7);
  outline-offset: 2px;
}

.guild-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guild-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.guild-pro-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 77, 77, 0.55);
  background: rgba(255, 77, 77, 0.16);
  color: #ff9aa8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  line-height: 1;
}

.guild-meta {
  font-size: 12px;
  color: var(--muted);
}

.admin-server-id {
  margin-top: auto;
  padding-top: 6px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.search-wrap {
  margin-bottom: 14px;
}

.guild-search {
  --search-radius: 999px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, 100%);
  border-radius: var(--search-radius);
  border: 1px solid rgba(42, 47, 57, 0.95);
  background: linear-gradient(145deg, rgba(23, 27, 34, 0.94), rgba(18, 21, 28, 0.82));
  padding: 10px 14px;
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.guild-search::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.58),
    0 0 12px rgba(255, 255, 255, 0.9),
    0 0 24px rgba(255, 255, 255, 0.55);
  transition: opacity 0.22s ease;
}

.guild-search:focus-within {
  transform: translateY(-1px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.3);
}

.guild-search:focus-within::after {
  opacity: 1;
}

.guild-search-icon {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.guild-search input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.guild-search input::placeholder {
  color: #8f98a8;
}

.guild-search input::-webkit-search-cancel-button {
  filter: brightness(0) invert(1);
  opacity: 1;
}

.search-empty {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* Modules page */
.modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.module-card {
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.module-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.module-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.module-actions {
  margin-top: 2px;
}

.module-config-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 77, 77, 0.38);
  background: rgba(255, 77, 77, 0.14);
  color: #ff9aa8;
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.module-config-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 77, 77, 0.65);
  color: #ffd1d8;
}

.module-card-actions {
  margin-top: auto;
  padding-top: 6px;
}

.mod-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mod-page .mod-config-card {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(31, 36, 46, 0.95), rgba(22, 26, 34, 0.88));
}

.mod-page .mod-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.mod-shell-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(53, 61, 74, 0.75);
}

.mod-tabbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mod-tab-btn {
  border: 1px solid rgba(53, 61, 74, 0.82);
  background: rgba(25, 29, 37, 0.8);
  color: #d6dde8;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.mod-tab-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 77, 77, 0.45);
  color: #ffffff;
}

.mod-tab-btn.active {
  background: linear-gradient(145deg, rgba(255, 77, 77, 0.25), rgba(255, 77, 77, 0.12));
  border-color: rgba(255, 77, 77, 0.65);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(255, 77, 77, 0.2);
}

.mod-shell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.mod-shell-actions .toast {
  margin-top: 0;
}

.mod-panel {
  display: none;
}

.mod-panel.is-active {
  display: block;
}

.mod-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.mod-grid-single {
  grid-template-columns: 1fr;
}

.mod-page .mod-block {
  background: linear-gradient(160deg, rgba(24, 29, 38, 0.92), rgba(20, 24, 31, 0.84));
  border: 1px solid rgba(53, 61, 74, 0.82);
  border-radius: 14px;
  padding: 14px;
  min-height: 0;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.24);
}

.mod-block h3 {
  font-size: 16px;
  margin-bottom: 6px;
  letter-spacing: 0.6px;
}

.mod-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.role-list {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  max-height: 280px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.role-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.role-row:hover {
  border-color: rgba(255, 77, 77, 0.25);
  background: rgba(255, 77, 77, 0.06);
}

.role-row input {
  width: 16px;
  height: 16px;
}

.role-name {
  font-weight: 600;
  font-size: 14px;
}

.role-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.role-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 4px;
}

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

.mod-inline-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mod-inline-controls .filter-col {
  flex: 1 1 180px;
  min-width: 180px;
  margin-bottom: 0;
}

.mod-actions-tight {
  margin-top: 8px;
  margin-bottom: 8px;
}

.mod-subheading {
  margin: 10px 0 8px;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #d9e0eb;
}

.mod-activity-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 8px;
}

.mod-summary-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(53, 61, 74, 0.85);
  background: rgba(23, 28, 36, 0.86);
  color: #d3dbe8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

#cases-list.role-list,
#queue-list.role-list {
  max-height: 360px;
  gap: 8px;
  padding: 10px;
}

.mod-event-item {
  border: 1px solid rgba(53, 61, 74, 0.82);
  background: rgba(19, 23, 30, 0.92);
  border-radius: 10px;
  padding: 10px;
}

.mod-event-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mod-event-title {
  font-size: 13px;
  font-weight: 700;
  color: #e8edf7;
  letter-spacing: 0.35px;
}

.mod-event-badges {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.mod-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(53, 61, 74, 0.85);
  background: rgba(31, 36, 46, 0.86);
  color: #d4dbea;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.mod-badge.source {
  border-color: rgba(88, 121, 192, 0.6);
  background: rgba(67, 92, 146, 0.24);
  color: #bcd1ff;
}

.mod-badge.target {
  border-color: rgba(158, 118, 236, 0.6);
  background: rgba(99, 78, 156, 0.24);
  color: #dbc8ff;
}

.mod-badge.success {
  border-color: rgba(86, 190, 115, 0.62);
  background: rgba(48, 128, 73, 0.26);
  color: #bff2cf;
}

.mod-badge.warn {
  border-color: rgba(228, 176, 84, 0.64);
  background: rgba(138, 104, 45, 0.27);
  color: #ffe4b1;
}

.mod-badge.info {
  border-color: rgba(93, 173, 230, 0.62);
  background: rgba(51, 108, 146, 0.27);
  color: #bee5ff;
}

.mod-badge.danger {
  border-color: rgba(214, 96, 96, 0.66);
  background: rgba(135, 49, 49, 0.29);
  color: #ffd2d2;
}

.mod-event-meta {
  margin-top: 6px;
  color: #adb8ca;
  font-size: 12px;
  line-height: 1.4;
}

.mod-event-reason {
  margin-top: 7px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid rgba(53, 61, 74, 0.78);
  background: rgba(24, 29, 37, 0.88);
  color: #d8e0ec;
  font-size: 12px;
  line-height: 1.35;
}

.mod-event-error {
  margin-top: 7px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid rgba(214, 96, 96, 0.44);
  background: rgba(120, 39, 39, 0.22);
  color: #ffd7d7;
  font-size: 12px;
  line-height: 1.35;
}

.mod-event-footnote {
  margin-top: 6px;
  color: #8f9aae;
  font-size: 11px;
  line-height: 1.3;
}

.mod-queue-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mod-mini-btn {
  padding: 6px 10px;
  font-size: 11px;
}

.mod-collapsible {
  border: 1px solid rgba(53, 61, 74, 0.82);
  border-radius: 11px;
  background: rgba(22, 26, 33, 0.72);
  margin-top: 10px;
  overflow: hidden;
}

.mod-collapsible summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #e6eaf2;
}

.mod-collapsible summary::-webkit-details-marker {
  display: none;
}

.mod-collapsible summary::after {
  content: "+";
  font-size: 16px;
  line-height: 1;
  color: #ff8b8b;
}

.mod-collapsible[open] summary::after {
  content: "-";
}

.mod-collapsible-body {
  border-top: 1px solid rgba(53, 61, 74, 0.7);
  padding: 10px 12px 12px;
}

.mod-checkbox-row {
  gap: 8px;
}

.mod-panel-mobile-actions {
  display: none;
  margin-top: 12px;
}

.role-row .btn {
  padding: 6px 10px;
  font-size: 12px;
}

.role-selection-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(53, 61, 74, 0.82);
  border-radius: 10px;
  background: rgba(23, 28, 36, 0.86);
  color: #cfd6e2;
  font-size: 13px;
  line-height: 1.45;
}

.role-picker-layer {
  position: fixed;
  inset: 0;
  z-index: 240;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.role-picker-layer.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.role-picker-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  background: rgba(9, 12, 18, 0.66);
  cursor: pointer;
}

.role-picker-card {
  position: relative;
  width: min(760px, calc(100% - 26px));
  margin: 42px auto;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(53, 61, 74, 0.9);
  background: linear-gradient(145deg, rgba(27, 32, 41, 0.96), rgba(22, 26, 34, 0.95));
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.role-picker-layer.open .role-picker-card {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

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

.role-picker-head h3 {
  margin-bottom: 6px;
}

.role-picker-list {
  max-height: min(58vh, 480px);
}

body.role-picker-open {
  overflow: hidden;
}

.mod-config-card {
  margin-top: 14px;
}

.toggle {
  position: relative;
  width: 50px;
  min-width: 50px;
  height: 26px;
  flex: 0 0 50px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s ease;
}

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

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.toggle.on {
  background: rgba(255, 77, 77, 0.3);
  border-color: rgba(255, 77, 77, 0.5);
}

.toggle.on::after {
  transform: translateX(24px);
}

.status {
  font-size: 12px;
  color: var(--muted);
}

.status strong {
  color: #fff;
}

.toast {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.inline-spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.ai-config-card {
  margin-top: 16px;
  padding: 18px;
}

.ai-config-card h3 {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  margin-bottom: 12px;
}

.ai-config-note {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.ai-config-card textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border: 1px solid #343c4c;
  border-radius: 10px;
  background: #292f3c;
  color: #e8ebf3;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}

.ai-config-card textarea:focus {
  border-color: rgba(255, 77, 77, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 77, 77, 0.18);
}

.ai-config-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.embed-layout {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 16px;
}

.embed-module-head {
  margin-bottom: 16px;
}

.embed-layout.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.embed-sidebar,
.embed-main {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
}

.embed-sidebar {
  height: fit-content;
}

.welcome-layout {
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.85fr);
}

.welcome-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.embed-new-btn,
.embed-action {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--bg-3);
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, border-color 0.16s ease;
}

.embed-new-btn:hover,
.embed-action:hover {
  transform: translateY(-1px);
}

.embed-new-btn {
  width: 100%;
  background: #2f3643;
  margin-bottom: 14px;
}

.embed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.embed-list-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #161b25;
  color: var(--text);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.embed-list-item.active {
  border-color: rgba(255, 77, 77, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 77, 77, 0.25);
}

.embed-delete-btn {
  border: none;
  background: transparent;
  color: #ff8a8a;
  cursor: pointer;
}

.embed-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.embed-block {
  background: #151a24;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.embed-block h3 {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  margin-bottom: 14px;
}

.embed-note {
  color: #9fb4d9;
  margin-bottom: 14px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.3px;
}

.embed-grid-2,
.embed-grid-3 {
  display: grid;
  gap: 10px;
}

.embed-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.embed-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-col {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}

.form-col label {
  color: #8fa0bf;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-weight: 700;
}

.form-col input,
.form-col select,
.form-col textarea,
.embed-grid-2 input,
.embed-grid-3 input,
.embed-field-row input {
  background: #292f3c;
  border: 1px solid #343c4c;
  color: #e8ebf3;
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 14px;
  outline: none;
}

.embed-layout input::placeholder,
.embed-layout textarea::placeholder {
  color: #9da6b7;
}

.embed-layout input:focus,
.embed-layout select:focus,
.embed-layout textarea:focus {
  border-color: rgba(255, 77, 77, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 77, 77, 0.18);
}

.form-col textarea {
  resize: vertical;
  min-height: 80px;
}

.color-col input[type="color"] {
  width: 120px;
  height: 42px;
  padding: 3px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.color-col input[type="color"]:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(255, 77, 77, 0.36);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
}

.embed-section {
  border-top: 1px solid var(--border);
  padding: 10px 0 4px;
}

.embed-section summary {
  cursor: pointer;
  color: #d8deea;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  list-style: none;
}

.embed-section summary::-webkit-details-marker {
  display: none;
}

.embed-section summary::before {
  content: "+";
  display: inline-block;
  margin-right: 8px;
  color: #9fb4d9;
}

.embed-section[open] summary::before {
  content: "-";
}

.embed-fields-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

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

.embed-field-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.embed-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.embed-action.primary {
  background: var(--accent);
  border-color: transparent;
}

.embed-action.secondary {
  background: #2f3643;
}

.embed-action.danger {
  background: transparent;
  border-color: rgba(255, 77, 77, 0.55);
  color: #ffb3c0;
}

.embed-preview {
  border-radius: 10px;
  background: #121723;
  border: 1px solid var(--border);
  padding: 14px;
}

.preview-empty {
  color: var(--muted);
  font-size: 13px;
}

.preview-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
}

.preview-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #2a3140;
}

.preview-header {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.preview-author-name {
  color: #ff4d4d;
  font-weight: 700;
}

.preview-embed {
  border-left: 4px solid #ff4d4d;
  background: #1b2230;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-title {
  font-weight: 700;
}

.preview-description {
  color: #d0d6e3;
  white-space: pre-wrap;
}

.preview-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.preview-field {
  background: #121a29;
  border: 1px solid #2b3345;
  border-radius: 6px;
  padding: 7px;
}

.preview-field.inline-false {
  grid-column: 1 / -1;
}

.preview-field-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.preview-thumb {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
}

.preview-image {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
}

.embed-toast {
  margin-top: 10px;
}

.welcome-helper-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.welcome-token-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.welcome-token-btn {
  border: 1px solid rgba(255, 77, 77, 0.28);
  background: rgba(255, 77, 77, 0.08);
  color: #ffd5d5;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.welcome-token-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 77, 77, 0.55);
  background: rgba(255, 77, 77, 0.14);
}

.welcome-variable-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.welcome-variable-item {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: #d7deea;
  font-size: 12px;
  line-height: 1.5;
}

.welcome-variable-item code {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(41, 47, 60, 0.9);
  border: 1px solid rgba(52, 60, 76, 0.95);
  color: #ffd7d7;
}

/* Embeds page hardening */
body.embeds-page .embed-layout input,
body.embeds-page .embed-layout select,
body.embeds-page .embed-layout textarea,
body.embeds-page .embed-layout button,
body.welcome-message-page .embed-layout input,
body.welcome-message-page .embed-layout select,
body.welcome-message-page .embed-layout textarea,
body.welcome-message-page .embed-layout button {
  font: inherit;
}

body.embeds-page .embed-layout input,
body.embeds-page .embed-layout select,
body.embeds-page .embed-layout textarea,
body.welcome-message-page .embed-layout input,
body.welcome-message-page .embed-layout select,
body.welcome-message-page .embed-layout textarea {
  width: 100%;
  background: #292f3c;
  border: 1px solid #343c4c;
  color: #e8ebf3;
  border-radius: 8px;
  padding: 10px 11px;
  appearance: none;
}

body.embeds-page .embed-layout input[type="checkbox"],
body.welcome-message-page .embed-layout input[type="checkbox"] {
  width: auto;
  appearance: auto;
}

body.embeds-page .embed-layout input[type="color"],
body.welcome-message-page .embed-layout input[type="color"] {
  width: 120px;
  height: 42px;
  padding: 3px;
  appearance: auto;
}

body.embeds-page .embed-layout select,
body.welcome-message-page .embed-layout select {
  background-image:
    linear-gradient(45deg, transparent 50%, #adb6c7 50%),
    linear-gradient(135deg, #adb6c7 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% + 1px),
    calc(100% - 11px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

body.embeds-page .embed-layout textarea,
body.welcome-message-page .embed-layout textarea {
  resize: vertical;
  min-height: 90px;
}

@media (max-width: 980px) {
  .container {
    padding: 22px 16px 34px;
  }

  .page-context {
    margin-bottom: 16px;
  }

  .modules {
    grid-template-columns: 1fr;
  }

  .embed-layout {
    grid-template-columns: 1fr;
  }

  .welcome-layout {
    grid-template-columns: 1fr;
  }

  .embed-sidebar {
    position: static;
  }

  .embed-main,
  .embed-sidebar {
    padding: 16px;
  }

  .embed-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 18px 14px 28px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .topbar-actions .back {
    padding: 8px 10px;
  }

  .page-context.user,
  .page-context.guild {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .search-wrap {
    margin-bottom: 12px;
  }

  .guild-search {
    width: 100%;
  }

  .guilds-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .module-card {
    padding: 15px;
  }

  .embed-grid-2 {
    grid-template-columns: 1fr;
  }

  .welcome-variable-item {
    grid-template-columns: 1fr;
  }

  .mod-grid {
    grid-template-columns: 1fr;
  }

  .mod-shell-head {
    gap: 10px;
    margin-bottom: 12px;
  }

  .mod-tabbar {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .mod-tab-btn {
    flex: 0 0 auto;
  }

  .mod-shell-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .mod-shell-actions #save-mod-btn {
    display: none;
  }

  .mod-panel-mobile-actions {
    display: block;
  }

  .mod-panel-mobile-actions .btn {
    width: 100%;
  }

  .mod-activity-summary {
    gap: 6px;
  }

  .mod-event-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .mod-event-badges {
    width: 100%;
  }

  .embed-field-row {
    grid-template-columns: 1fr;
  }

  .embed-block {
    padding: 14px;
  }

  .embed-actions {
    gap: 6px;
  }

  .embed-action {
    flex: 1 1 140px;
    text-align: center;
  }
}

.back {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  text-decoration: none;
  font-size: 12px;
}

.back:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 77, 77, 0.4);
  color: var(--text);
}

.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 0.08s ease, opacity 0.25s ease, box-shadow 0.25s ease, width 0.18s ease, height 0.18s ease, border-radius 0.18s ease, background-color 0.18s ease;
  z-index: 9999;
  opacity: 0;
  overflow: visible;
}

.cursor-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.88), 0 0 18px rgba(255, 255, 255, 0.56);
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease, border-radius 0.2s ease, box-shadow 0.25s ease;
}

.cursor-orb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.5), 0 0 10px rgba(255, 255, 255, 0.28);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
  clip-path: polygon(50% 50%, 50% 50%, 50% 50%);
  will-change: transform, opacity, clip-path;
  transition:
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 240ms cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 260ms cubic-bezier(0.22, 1, 0.36, 1),
    clip-path 280ms cubic-bezier(0.22, 1, 0.36, 1),
    width 260ms cubic-bezier(0.22, 1, 0.36, 1),
    height 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.custom-cursor.button-hover .cursor-core {
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.96), 0 0 26px rgba(255, 77, 77, 0.55);
}

.custom-cursor.typing-hover {
  box-shadow: none;
}

.custom-cursor.typing-hover .cursor-core {
  width: 4.5px;
  height: 22px;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.95), 0 0 22px rgba(255, 255, 255, 0.68);
}

.custom-cursor.scroll-middle .cursor-core {
  transform: translate(-50%, -50%) scale(0.72);
}

.custom-cursor.scroll-middle .cursor-orb {
  opacity: 1;
  width: 8px;
  height: 10px;
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.68), 0 0 12px rgba(255, 255, 255, 0.36);
}

.custom-cursor.scroll-middle .cursor-orb-up {
  transform: translate(-50%, -178%) scale(1);
  clip-path: polygon(50% 16%, 84% 78%, 72% 92%, 28% 92%, 16% 78%);
}

.custom-cursor.scroll-middle .cursor-orb-down {
  transform: translate(-50%, 78%) scale(1);
  clip-path: polygon(16% 22%, 28% 8%, 72% 8%, 84% 22%, 50% 84%);
}

.custom-cursor.scroll-middle.scroll-up .cursor-orb-down {
  transform: translate(-50%, -50%) scale(0.35);
  opacity: 0;
}

.custom-cursor.scroll-middle.scroll-down .cursor-orb-up {
  transform: translate(-50%, -50%) scale(0.35);
  opacity: 0;
}

.pokecode-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.pokecode-create-card,
.pokecode-list-card {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
}

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

.pokecode-panel-head h3 {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  margin-bottom: 8px;
}

.pokecode-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pokecode-rewards-wrap {
  margin-top: 4px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(53, 61, 74, 0.82);
  background: rgba(21, 26, 36, 0.92);
}

.pokecode-rewards-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #9fb4d9;
  margin-bottom: 12px;
}

.pokecode-rewards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pokecode-reward-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #d8dfeb;
  font-size: 13px;
}

.pokecode-reward-field span {
  font-weight: 600;
}

.pokecode-reward-field input {
  background: #292f3c;
  border: 1px solid #343c4c;
  color: #e8ebf3;
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 14px;
  outline: none;
}

.pokecode-reward-field input:focus {
  border-color: rgba(255, 77, 77, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 77, 77, 0.18);
}

.pokecode-form-actions {
  margin-top: 8px;
}

.pokecode-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pokecode-card {
  border: 1px solid rgba(53, 61, 74, 0.82);
  border-radius: 14px;
  background: rgba(19, 23, 30, 0.92);
  padding: 16px;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
}

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

.pill.is-expired {
  color: #ffb6b6;
}

.pokecode-reward-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pokecode-reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(53, 61, 74, 0.85);
  background: rgba(23, 28, 36, 0.86);
  color: #d3dbe8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.pokecode-reward-chip.muted {
  color: var(--muted);
}

.pokecode-card-actions {
  margin-top: 14px;
}

.pokecode-remove-btn {
  color: #ffb6b6;
}

.pokecode-edit-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(53, 61, 74, 0.82);
}

.pokecode-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.maintenance-admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
}

.maintenance-settings-card {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
}

.maintenance-settings-card h3 {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  margin-bottom: 12px;
}

.maintenance-settings-card textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid #343c4c;
  border-radius: 10px;
  background: #292f3c;
  color: #e8ebf3;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}

.maintenance-settings-card textarea:focus {
  border-color: rgba(255, 77, 77, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 77, 77, 0.18);
}

.maintenance-actions {
  margin-top: 10px;
}

.staff-admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 16px;
}

.staff-add-card,
.staff-list-card {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(145deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
}

.staff-add-card h3,
.staff-list-card h3 {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  margin-bottom: 12px;
}

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

.staff-member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.staff-member-card {
  border: 1px solid rgba(53, 61, 74, 0.82);
  border-radius: 14px;
  background: rgba(19, 23, 30, 0.92);
  padding: 16px;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
}

.staff-member-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.staff-member-avatar {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}

.staff-member-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.staff-member-actions {
  margin-top: 14px;
  justify-content: space-between;
}

@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .brand-link .brand-text {
    font-size: 16px;
  }

  .brand-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .back {
    font-size: 11px;
  }

  .module-title {
    font-size: 17px;
  }

  .module-desc,
  .status,
  .guild-meta {
    font-size: 12px;
  }

  .embed-block h3 {
    font-size: 11px;
    letter-spacing: 0.8px;
  }

  .form-col label {
    letter-spacing: 1.2px;
  }

  .embed-list-item {
    padding: 9px;
  }

  .preview-message {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .preview-avatar {
    width: 30px;
    height: 30px;
  }

  .preview-fields {
    grid-template-columns: 1fr;
  }

  .pokecode-rewards-grid,
  .pokecode-edit-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .pokecode-layout,
  .maintenance-admin-grid,
  .staff-admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (hover: none), (pointer: coarse) {
  .guild-card:hover {
    transform: none;
    box-shadow: none;
  }

  .custom-cursor {
    display: none;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes search-glow-pulse {
  0% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.22),
      0 0 10px rgba(255, 255, 255, 0.12);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.5),
      0 0 24px rgba(255, 255, 255, 0.3);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.22),
      0 0 10px rgba(255, 255, 255, 0.12);
  }
}
