/* ═══════════════════════════════════════════════════════════
   TIDES DASHBOARD  -  Sapphire-Style Redesign
   ═══════════════════════════════════════════════════════════ */

:root {
  --topbar-h: 54px;
  --sidebar-w: 260px;

  --bg-topbar:   #070a10;
  --bg-sidebar:  #090d15;
  --bg-content:  #0d1120;
  --bg-card:     #111826;
  --bg-input:    #0a0e18;
  --bg-hover:    #192336;
  --bg-active:   rgba(36,160,160,0.12);

  --text:        #dde8f4;
  --text-muted:  #6e8399;
  --text-label:  #354c60;
  --text-link:   #24a0a0;

  --border:      #1a2a3e;
  --border-dark: #10192a;
  --border-bright: #293d55;

  --blue:        #5865f2;
  --blue-hover:  #4752c4;
  --green:       #23a559;
  --green-off:   #152336;
  --red:         #ed4245;
  --yellow:      #faa61a;
  --teal:        #24a0a0;
  --teal-hover:  #1d8888;
  --teal-dim:    rgba(36,160,160,0.08);
  --teal-glow:   rgba(36,160,160,0.22);

  --gradient-teal:    linear-gradient(135deg, #2ab4b4 0%, #1a7878 100%);
  --gradient-card:    linear-gradient(160deg, #131c2c 0%, #0f1720 100%);
  --gradient-sidebar: linear-gradient(180deg, #090d15 0%, #06090f 100%);

  --radius:    6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card:  0 4px 32px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.03);
  --shadow-btn:   0 2px 16px rgba(36,160,160,0.35);
  --shadow-modal: 0 24px 80px rgba(0,0,0,0.7);
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--teal-glow); }
  50%       { box-shadow: 0 0 0 6px transparent; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes subPageIn {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes subPageBack {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
.sub-page-enter { animation: subPageIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }
.sub-main-enter { animation: subPageBack 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Sub-pages for automod and commands */
.automod-sub-page, .cmd-sub-page { }

/* Shared settings card for sub-pages */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}
.card-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--teal-glow); }
  50% { box-shadow: 0 0 12px 2px var(--teal-glow); }
}
@keyframes floatUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page.active { animation: fadeInUp 0.22s ease both; }

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

html, body {
  height: 100%;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   TIDES BOOT SPLASH
═══════════════════════════════════════════════════════════ */
#tides-splash {
  position: fixed; inset: 0; z-index: 99999;
  background: #070a12;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden;
  transition: opacity .5s ease, transform .5s ease;
}
#tides-splash.ts-hiding {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}
#tides-splash.ts-hidden { display: none; }

/* subtle dot-grid background */
.ts-bg-grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(36,160,160,0.07) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 100%);
}

.ts-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.ts-icon {
  margin-bottom: 4px;
  filter: drop-shadow(0 0 18px rgba(36,160,160,.55));
}

/* Wave path draw animation */
.ts-wave-path {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  animation: ts-draw 1.2s cubic-bezier(.4,0,.2,1) forwards;
}
.ts-wp-2 { animation-delay: .2s; }

@keyframes ts-draw {
  to { stroke-dashoffset: 0; }
}

/* Title shimmer */
.ts-title {
  font-size: 52px; font-weight: 800; letter-spacing: 12px;
  background: linear-gradient(90deg,
    #5ee8e8 0%, #24a0a0 20%, #fff 40%, #4de8e8 55%, #24a0a0 75%, #5ee8e8 100%);
  background-size: 250% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: ts-shimmer 2.4s linear infinite;
  animation-delay: .6s;
  filter: drop-shadow(0 0 30px rgba(36,160,160,.35));
}
@keyframes ts-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.ts-sub {
  font-size: 13px; font-weight: 500; letter-spacing: 4px;
  color: #2a6e6e; text-transform: uppercase; margin-top: -4px;
}

/* Bouncing dots */
.ts-dots { display: flex; gap: 7px; margin-top: 20px; }
.ts-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #24a0a0;
  animation: ts-bounce .9s ease-in-out infinite;
}
.ts-dots span:nth-child(1) { animation-delay: 0s; }
.ts-dots span:nth-child(2) { animation-delay: .18s; }
.ts-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes ts-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: .3; }
  40%           { transform: scale(1.15); opacity: 1; }
}

/* Ocean waves at bottom */
.ts-ocean {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 120px; overflow: hidden;
}
.ts-wave-svg {
  position: absolute; bottom: 0;
  width: 200%; height: 80px;
}
.ts-wave-svg-1 { animation: ts-wave-scroll 7s linear infinite; opacity: .6; }
.ts-wave-svg-2 { animation: ts-wave-scroll 11s linear infinite reverse; opacity: .8; }
.ts-wave-svg-3 { animation: ts-wave-scroll 9s linear infinite; opacity: .9; bottom: -4px; }
@keyframes ts-wave-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ═══════════════════════════════════════════════════════════
   PAGE NAV PROGRESS BAR
═══════════════════════════════════════════════════════════ */
#tides-nav-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 99998; pointer-events: none;
  background: transparent;
}
#tides-nav-fill {
  height: 100%; width: 0; border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, #24a0a0, #4de8e8, #24a0a0);
  background-size: 200% 100%;
  box-shadow: 0 0 8px rgba(36,160,160,.7), 0 0 20px rgba(36,160,160,.4);
  transition: width .4s ease, opacity .3s ease;
  opacity: 0;
  animation: ts-bar-shimmer 1.2s linear infinite;
}
#tides-nav-bar.nav-loading #tides-nav-fill {
  opacity: 1;
  width: 85%;
  transition: width 1.2s cubic-bezier(.1,0,.4,1);
}
#tides-nav-bar.nav-done #tides-nav-fill {
  width: 100% !important;
  transition: width .2s ease !important;
  opacity: 0;
  transition: width .2s ease, opacity .35s ease .15s !important;
}
@keyframes ts-bar-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* ═══════════════════════════════════════════════════════════
   WAVE SKELETON SHIMMER (replaces old skeleton-row)
═══════════════════════════════════════════════════════════ */
.skeleton-row {
  height: 20px; border-radius: 5px;
  background: linear-gradient(90deg,
    #111826 0%, #1a2a3e 40%, #111826 80%);
  background-size: 300% 100%;
  animation: ts-wave-shimmer 1.6s ease infinite;
}
@keyframes ts-wave-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-content);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: 13px; }

/* ─────────────────────────────────────────────────────────
   LOGIN PAGE
───────────────────────────────────────────────────────── */

.login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-topbar);
  z-index: 1000;
}

.login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 40px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 320px;
  text-align: center;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  margin-bottom: 4px;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.btn-discord {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #5865f2;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.btn-discord:hover { background: #4752c4; }

/* ─────────────────────────────────────────────────────────
   SERVER SELECTOR PAGE  -  Full-screen redesign
───────────────────────────────────────────────────────── */

#servers-card {
  position: fixed;
  inset: 0;
  background: var(--bg-topbar);
  z-index: 500;
  overflow: hidden;
}

/* Animated background */
.ss-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ss-hex {
  position: absolute;
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  background: var(--teal);
  opacity: 0.07;
}
.ss-hex-1 { width: 220px; height: 220px; top: 8%; left: 4%; animation: ssFloat1 9s ease-in-out infinite; }
.ss-hex-2 { width: 150px; height: 150px; bottom: 12%; right: 6%; animation: ssFloat2 12s ease-in-out infinite; }
.ss-hex-3 { width: 80px; height: 80px; top: 28%; right: 18%; animation: ssFloat1 15s ease-in-out infinite reverse; }

.ss-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
}
.ss-orb-1 { width: 450px; height: 450px; top: -140px; right: -120px; background: var(--teal); opacity: 0.11; animation: ssFloat2 14s ease-in-out infinite; }
.ss-orb-2 { width: 320px; height: 320px; bottom: -120px; left: -60px; background: var(--teal); opacity: 0.09; animation: ssFloat1 11s ease-in-out infinite; }
.ss-orb-3 { width: 200px; height: 200px; top: 38%; left: 28%; background: #5865f2; opacity: 0.06; animation: ssFloat2 18s ease-in-out infinite reverse; }

@keyframes ssFloat1 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-22px) rotate(6deg); }
}
@keyframes ssFloat2 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(16px) rotate(-5deg); }
}

/* Card wrap */
.ss-card-wrap {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ss-center-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: floatUp 0.3s ease both;
}

.ss-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 2px;
}
.ss-logo-wrap img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: contain;
}

.ss-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 8px 16px 8px 8px;
  align-self: center;
}
.ss-user-pill-info { display: flex; flex-direction: column; gap: 1px; }
.ss-user-pill-name  { font-size: 13px; font-weight: 600; color: var(--text); }
.ss-user-pill-label { font-size: 11px; color: var(--text-muted); }

.ss-card-title {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--text) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-top: 2px;
}
.ss-card-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: -8px;
}

/* Server list */
.server-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 44vh;
  padding: 2px 1px;
}
.server-list::-webkit-scrollbar { width: 4px; }
.server-list::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

.server-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  box-sizing: border-box;
  width: 100%;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.server-card:hover {
  background: var(--bg-hover);
  border-color: var(--teal);
  box-shadow: 0 0 0 1px rgba(36,160,160,0.25), 0 4px 20px rgba(0,0,0,0.3);
}
.server-card .server-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  overflow: hidden; flex-shrink: 0;
}
.server-card .server-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-info { flex: 1; min-width: 0; }
.server-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.select-loading { color: var(--text-muted); padding: 20px 0; text-align: center; }

/* ─────────────────────────────────────────────────────────
   DASHBOARD LAYOUT
───────────────────────────────────────────────────────── */

#dashboard {
  display: block;
}

/* ─ Top Bar ─ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 300;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  min-width: 120px;
}

.topbar-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
}

.topbar-server {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.server-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background .12s;
  font-size: 13px;
  font-weight: 500;
  max-width: 260px;
}

.server-chip:hover { background: var(--bg-hover); }

.chip-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.chip-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 120px;
  justify-content: flex-end;
}

.topbar-fetch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: color .12s, border-color .12s;
}

.topbar-fetch-btn:hover { color: var(--text); border-color: #4a4d55; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius);
  transition: background .12s;
}

.topbar-user:hover { background: var(--bg-hover); }

.topbar-status {
  font-size: 11px;
  color: var(--green);
}

/* ─ Dashboard Body ─ */
.dash-body {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-content);
}

/* Inner paired unit  -  sidebar + content centered together */
.dash-inner {
  display: flex;
  width: 100%;
  max-width: 1400px;
  height: 100%;
  overflow: hidden;
}

/* ─ Sidebar ─ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  background: var(--gradient-sidebar);
  border-right: 1px solid var(--border-bright);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: background .12s, color .12s;
  flex-shrink: 0;
  border: none;
  background: transparent;
  font-size: 15px;
}

.sidebar-home-btn:hover,
.sidebar-home-btn.active { background: var(--bg-hover); color: var(--text); }

.sidebar-fetch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, color .12s;
  background: transparent;
  border: none;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
}

.sidebar-fetch-btn:hover { background: var(--bg-hover); color: var(--text); }

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 6px 0;
  flex-shrink: 0;
}

/* Nav items */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
  border-radius: 0;
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  user-select: none;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-left-color: rgba(36,160,160,0.35);
}

.nav-item.active {
  background: var(--teal-dim);
  color: var(--teal);
  border-left-color: var(--teal);
  font-weight: 600;
}

.nav-item.active i { color: var(--teal); }

.nav-item i {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: inherit;
  transition: color 0.1s;
}

.nav-item span.nav-label-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Section label */
.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-label);
  padding: 16px 22px 5px;
}

/* Module toggle dot */
.module-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-left: auto;
  flex-shrink: 0;
  display: none;
}

.module-dot.on { display: block; }

/* Nav badge */
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 250;
}

.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
  .dash-body { justify-content: flex-start; }
  .dash-inner { max-width: 100%; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 260;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .dash-main { max-width: 100%; }
  .topbar-brand span { display: none; }
  .content-area { padding: 24px 20px 80px; }
}

/* Mobile menu btn */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  font-size: 16px;
  margin-right: 8px;
}

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
}

/* ─ Avatar ─ */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

/* ─ Main Content ─ */
.dash-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-content);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.dash-main::-webkit-scrollbar { width: 6px; }
.dash-main::-webkit-scrollbar-track { background: transparent; }
.dash-main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.content-area {
  padding: 36px 44px 100px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────────────────
   PAGES
───────────────────────────────────────────────────────── */

.page { display: none; }
.page.active { display: block; }

/* Page transitions */
.page-exit {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .16s ease, transform .16s ease;
}

.dash-fade-in { animation: dashFadeIn .3s ease; }
.page-fade-out { animation: pageFadeOut .2s ease forwards; }

@keyframes dashFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pageFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-4px); }
}

/* ─ Page Header ─ */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-header-icon {
  width: 46px;
  height: 46px;
  background: rgba(36, 160, 160, 0.1);
  border: 1px solid rgba(36, 160, 160, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--teal);
  flex-shrink: 0;
}

.page-header-text h2 {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--text) 0%, var(--teal) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header-text p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────
   CARDS & SECTIONS
───────────────────────────────────────────────────────── */

.card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.05);
  pointer-events: none;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.config-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Feature row (like Sapphire's module feature rows) */
.feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  gap: 16px;
  cursor: pointer;
  transition: background .12s;
}

.feature-row:hover { background: var(--bg-hover); }

.feature-row-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.feature-row-icon {
  font-size: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.feature-row-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.feature-row-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.feature-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   FORMS
───────────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.form-group small {
  font-size: 12px;
  color: var(--text-label);
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row .form-group { flex: 1; min-width: 160px; }

input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="color"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
}

input[type="color"] {
  padding: 4px;
  height: 34px;
  cursor: pointer;
}

select option { background: var(--bg-card); }

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.checkbox-label input { width: auto; }

.module-enable-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────
   TOGGLE SWITCH
───────────────────────────────────────────────────────── */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--green-off);
  border-radius: 11px;
  cursor: pointer;
  transition: background .2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}

.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .12s, opacity .12s;
  white-space: nowrap;
}

.btn-primary  { background: var(--gradient-teal); color: #fff; box-shadow: var(--shadow-btn); }
.btn-primary:hover  { filter: brightness(1.1); box-shadow: 0 4px 20px rgba(36,160,160,0.4); }
.btn-secondary { background: var(--bg-hover); color: var(--text); }
.btn-secondary:hover { background: #3a3d45; }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover { background: #c0383b; }
.btn-ghost    { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-save     { background: var(--gradient-teal); color: #fff; box-shadow: var(--shadow-btn); }
.btn-save:hover { filter: brightness(1.1); }

.btn.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-group {
  display: flex;
  gap: 4px;
}

.btn-group .btn { border-radius: var(--radius); }
.btn-group .btn.active { background: var(--blue); color: #fff; }

.save-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* ─────────────────────────────────────────────────────────
   TABLES
───────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-label);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-dark);
  color: var(--text-muted);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.025); }

.empty-row {
  text-align: center;
  color: var(--text-label);
  padding: 32px !important;
}

/* ─────────────────────────────────────────────────────────
   FILTER BAR
───────────────────────────────────────────────────────── */

.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* ─────────────────────────────────────────────────────────
   STATS GRID (overview)
───────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  border-color: rgba(36,160,160,0.25);
}

.stat-icon {
  font-size: 20px;
  color: var(--teal);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-dim);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  border: 1px solid rgba(36,160,160,0.2);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─────────────────────────────────────────────────────────
   SAPPHIRE-STYLE FEATURE ROWS
   Full-width rows like Sapphire's moderation/automod pages
───────────────────────────────────────────────────────── */

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

.feat-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background .12s, border-color .12s, box-shadow .12s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.feat-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.feat-row-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.feat-row-body {
  flex: 1;
  min-width: 0;
}

.feat-row-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.feat-row-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.feat-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.feat-row-chevron {
  color: var(--text-label);
  font-size: 13px;
}

/* Top featured cards (like Cases + User Reports) */
.feat-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.feat-top-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.feat-top-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.feat-top-card p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Permission/command list rows */
.perm-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-label);
  padding: 16px 0 6px;
}

.perm-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}

.perm-row-body {
  flex: 1;
  min-width: 0;
}

.perm-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.perm-row-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ─────────────────────────────────────────────────────────
   AUTOMOD CARDS
───────────────────────────────────────────────────────── */

.automod-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 8px;
}

.automod-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
}

.automod-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.automod-card-title i {
  color: var(--text-muted);
  width: 16px;
}

.automod-card-body {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: none;
}

.automod-card-body.open { display: block; }
.automod-card.enabled .automod-card-body { display: block; }

/* ─────────────────────────────────────────────────────────
   TABS
───────────────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─────────────────────────────────────────────────────────
   VARIABLE CHIPS
───────────────────────────────────────────────────────── */

.var-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.var-chip {
  padding: 3px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all .1s;
}

.var-chip:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ─────────────────────────────────────────────────────────
   PREVIEW BOX
───────────────────────────────────────────────────────── */

.preview-box {
  background: #111214;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 12px;
  margin-bottom: 16px;
}

.preview-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-label);
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.preview-content {
  padding: 14px;
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-word;
  white-space: pre-wrap;
}

/* ─────────────────────────────────────────────────────────
   MODAL
───────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 500;
  display: none;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 501;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  transition: color .12s;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   SAVE BAR
───────────────────────────────────────────────────────── */

.save-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #0d1a28 0%, #111e2e 100%);
  border-top: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  z-index: 400;
  font-size: 13px;
  color: var(--text-muted);
  transform: translateY(100%);
  transition: transform .22s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}

.save-bar.visible { transform: translateY(0); }

.save-bar-actions { display: flex; gap: 8px; }

@media (max-width: 768px) {
  .save-bar { left: 0; }
}

/* ─────────────────────────────────────────────────────────
   TOAST
───────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .2s, transform .2s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
  z-index: 600;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red);   }

/* ─────────────────────────────────────────────────────────
   SOCIAL NOTIFICATIONS
───────────────────────────────────────────────────────── */

.social-section { margin-bottom: 28px; }
.social-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; }

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}

.platform-badge.yt { background: rgba(255,60,60,.12); color: #ff5555; border: 1px solid rgba(255,60,60,.2); }

.noti-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.noti-empty { color: var(--text-label); font-size: 13px; padding: 10px 0; }

.noti-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  gap: 14px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.noti-item:hover {
  border-color: var(--border-bright);
}

.noti-item-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.noti-info { flex: 1; min-width: 0; }
.noti-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.noti-channel-name { font-weight: 600; font-size: 13px; }
.noti-channel-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.noti-item-actions { display: flex; gap: 6px; }

.noti-platform-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: rgba(255,60,60,.1);
  border: 1px solid rgba(255,60,60,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.social-section-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

/* ─────────────────────────────────────────────────────────
   REACTION ROLES
───────────────────────────────────────────────────────── */

.rr-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.rr-header-desc {
  border-left: 3px solid var(--teal);
  padding-left: 14px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.rr-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.rr-counter {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

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

.rr-panel {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.rr-panel:hover {
  border-color: var(--border-bright);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}

.rr-panel-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}

.rr-panel-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--teal-dim);
  border: 1px solid var(--teal-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.rr-panel-info { flex: 1; min-width: 0; }

.rr-panel-channel-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(88,101,242,0.18);
  border: 1px solid rgba(88,101,242,0.3);
  border-radius: var(--radius);
  padding: 3px 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: #8b9cf5;
  margin-bottom: 7px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rr-panel-channel-tag i { font-size: 11px; opacity: 0.7; }

.rr-panel-emojis {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.rr-emoji-dot {
  font-size: 15px;
  line-height: 1;
}

.rr-role-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--border-bright);
}

.rr-panel-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.rr-panel-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.rr-panel-rolecount {
  font-size: 11px;
  color: var(--text-muted);
}

.rr-delete-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}

.rr-delete-btn:hover {
  background: rgba(237,66,69,0.12);
  border-color: rgba(237,66,69,0.3);
  color: var(--red);
}

.rr-edit-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}

.rr-edit-btn:hover {
  background: var(--teal-dim);
  border-color: var(--teal-glow);
  color: var(--teal);
}

.rr-no-roles {
  font-size: 12px;
  color: var(--text-label);
  font-style: italic;
}

.rr-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Modal role entries ─── */
.rr-roles-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.rr-role-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.rr-role-entry .rr-emoji { font-size: 18px; min-width: 22px; text-align: center; }

.rr-add-role-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius-md);
}

.rr-add-role-row input,
.rr-add-role-row select { flex: 1; min-width: 100px; }

/* ─────────────────────────────────────────────────────────
   COMMANDS PAGE
───────────────────────────────────────────────────────── */

.commands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.cmd-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .1s;
}

.cmd-toggle:hover { background: var(--bg-hover); }

.cmd-toggle input { width: auto; accent-color: var(--blue); }

/* ─────────────────────────────────────────────────────────
   STATS CHANNELS
───────────────────────────────────────────────────────── */

.stats-channel-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
}

.stats-channel-row h4 { font-size: 13px; font-weight: 600; margin-bottom: 12px; }

/* ─────────────────────────────────────────────────────────
   BADGES
───────────────────────────────────────────────────────── */

.badge-pill {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.badge-pill.green { background: var(--green); }
.badge-pill.yellow { background: var(--yellow); }

.badge-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-type.ban    { background: rgba(237,66,69,.2);  color: #ed4245; }
.badge-type.kick   { background: rgba(250,166,26,.2); color: #faa61a; }
.badge-type.warn   { background: rgba(250,166,26,.2); color: #faa61a; }
.badge-type.mute   { background: rgba(88,101,242,.2); color: #5865f2; }
.badge-type.unban  { background: rgba(35,165,89,.2);  color: #23a559; }
.badge-type.unmute { background: rgba(35,165,89,.2);  color: #23a559; }

/* ─────────────────────────────────────────────────────────
   MISC
───────────────────────────────────────────────────────── */

code {
  background: var(--bg-hover);
  padding: 1px 6px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: 'Consolas', 'Monaco', monospace;
}

.info-text {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(88,101,242,.1);
  border: 1px solid rgba(88,101,242,.3);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 12px;
}

.char-counter {
  font-size: 11px;
  color: var(--text-label);
  margin-left: 4px;
  font-weight: 400;
}

.xp-bar-wrap {
  background: var(--bg-hover);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  min-width: 80px;
}

.xp-bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
  transition: width .4s ease;
}

#podium-section {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.podium-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.podium-rank { font-size: 22px; margin-bottom: 4px; }
.podium-name { font-weight: 600; font-size: 13px; }
.podium-xp { font-size: 12px; color: var(--text-muted); }

/* Tickets */
.ticket-status-open   { color: var(--green); font-weight: 600; }
.ticket-status-closed { color: var(--text-label); }
.ticket-status-sleep  { color: var(--yellow); }

/* Prefixes */
#prefixes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.prefix-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}

.prefix-chip-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}

.prefix-chip-remove:hover { color: var(--red); }

/* Giveaways */
.giveaway-active { color: var(--green); font-weight: 600; }
.giveaway-ended  { color: var(--text-label); }

/* XP progress bar in table */
td .xp-bar-wrap { width: 80px; display: inline-block; }

/* Search bar card - reduced padding for single-input search cards */
.card:has(> input[type="text"]:only-child) {
  padding: 14px 18px;
}
.card > input[type="text"]:only-child {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  padding: 0;
}

/* ─────────────────────────────────────────────────────────
   SIDEBAR MODULE TOGGLE (pill switch)
───────────────────────────────────────────────────────── */

.sidebar-mod-toggle {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--green-off);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s, opacity .15s;
  margin-left: auto;
  pointer-events: auto;
  display: none; /* hidden unless on that tab */
}

/* Only show toggle for the currently active sidebar item */
.nav-item.active .sidebar-mod-toggle {
  display: block;
}

.sidebar-mod-toggle::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform .2s;
}

.sidebar-mod-toggle.on {
  background: var(--green);
}

.sidebar-mod-toggle.on::after {
  transform: translateX(12px);
}

/* ─────────────────────────────────────────────────────────
   EXPANDABLE FEATURE ROWS (auto mod etc.)
───────────────────────────────────────────────────────── */

.expandable-row {
  cursor: pointer;
  user-select: none;
}

.expandable-row:hover {
  background: var(--bg-hover);
}

.expand-arrow {
  transition: transform .2s;
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 8px;
}

.expand-arrow.open {
  transform: rotate(180deg);
}

.expand-panel {
  display: none;
  padding: 20px 24px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  margin-top: -4px;
  margin-bottom: 8px;
}

.expand-panel.open {
  display: block;
}

.expand-panel .form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.expand-panel .form-row label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 140px;
}

.expand-panel input[type="number"],
.expand-panel input[type="text"],
.expand-panel select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  width: 100px;
}

.expand-panel textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
  resize: vertical;
  min-height: 72px;
}

.expand-panel .form-hint {
  font-size: 11px;
  color: var(--text-label);
  margin-top: -8px;
  margin-bottom: 8px;
}

/* ─────────────────────────────────────────────────────────
   CUSTOM CHANNEL / ROLE PICKER
───────────────────────────────────────────────────────── */

.picker-hidden-select { display: none !important; }

/* Hide the old chevron icon next to logging selects when picker is present */
.feat-row-right .picker-wrap ~ i { display: none; }

/* Picker inside form-group takes full width */
.form-group .picker-wrap { display: flex; }
.form-group .picker-add-btn { width: 100%; justify-content: flex-start; }
.form-group .picker-chip { max-width: 100%; width: 100%; }

.picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(36,160,160,0.1);
  border: 1px solid rgba(36,160,160,0.28);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: background .14s, border-color .14s;
  max-width: 200px;
  min-height: 30px;
}
.picker-chip:hover { background: rgba(36,160,160,0.18); border-color: var(--teal); }

.picker-chip-prefix { color: var(--teal); font-weight: 700; flex-shrink: 0; }
.picker-chip-name   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.picker-chip-x {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  font-size: 15px; line-height: 1;
  border-radius: var(--radius);
  transition: color .14s, background .14s;
  flex-shrink: 0;
}
.picker-chip-x:hover { color: var(--red); background: rgba(237,66,69,0.12); }

.picker-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1.5px dashed var(--border-bright);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .14s, color .14s, background .14s;
  white-space: nowrap;
  min-height: 30px;
}
.picker-add-btn:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-dim); }

/* Picker Modal Overlay */
#picker-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 90px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}
#picker-modal-overlay.picker-open {
  opacity: 1;
  pointer-events: all;
}

#picker-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  width: 360px;
  max-height: 460px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  transform: translateY(-10px) scale(0.98);
  transition: transform .18s cubic-bezier(.2,.8,.4,1);
}
#picker-modal-overlay.picker-open #picker-modal {
  transform: translateY(0) scale(1);
}

.picker-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.picker-modal-title { font-weight: 600; font-size: 13px; color: var(--text); }
.picker-modal-close {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; font-size: 17px; padding: 2px 6px;
  border-radius: var(--radius); line-height: 1;
  transition: color .12s, background .12s;
}
.picker-modal-close:hover { color: var(--text); background: var(--bg-hover); }

.picker-search { padding: 8px 12px; border-bottom: 1px solid var(--border-dark); }
.picker-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color .14s;
}
.picker-search input:focus { border-color: var(--teal); }
.picker-search input::placeholder { color: var(--text-label); }

.picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.picker-list::-webkit-scrollbar { width: 4px; }
.picker-list::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

.picker-group-label {
  padding: 6px 14px 3px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-label);
}

.picker-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background .1s;
  color: var(--text-muted);
  font-size: 13px;
}
.picker-item:hover { background: var(--bg-hover); color: var(--text); }
.picker-item-prefix { color: var(--text-label); font-weight: 600; flex-shrink: 0; font-size: 12px; }
.picker-item-name   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.picker-role-dot {
  width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}
.picker-role-dot--gray { background: var(--border-bright); }
.picker-item--none { opacity: 0.7; }

.picker-empty {
  padding: 24px 14px;
  color: var(--text-muted); font-size: 13px; text-align: center;
}

/* Clickable feature rows */
.feat-row--clickable { cursor: pointer; }
.feat-row--clickable:hover { background: var(--bg-hover); }
.feat-row--nav { cursor: pointer; }
.feat-row--nav:hover { background: var(--bg-hover); }

/* ─ Sub-page breadcrumb ─ */
.page-header-text .h2-breadcrumb {
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
  background-clip: initial;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0;
}
.sub-breadcrumb-parent {
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  font-weight: 600;
}
.sub-breadcrumb-parent:hover { color: var(--teal); }
.sub-breadcrumb-sep {
  color: var(--text-muted);
  margin: 0 10px;
  font-weight: 300;
  opacity: 0.5;
  font-size: 20px;
}

/* Toast info type */
.toast.info { background: var(--teal); }

/* Stat card skeleton while loading */
.stat-value:empty::after {
  content: '';
  display: inline-block;
  width: 40px;
  height: 13px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-hover) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius);
  vertical-align: middle;
}

/* Expand section sublabel */
.expand-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 10px;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════
   LOGGING PAGE  -  GRANULAR CATEGORIES
   ═══════════════════════════════════════════════════════════ */

.log-actions-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.log-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.log-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}
.log-search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  box-sizing: border-box;
}
.log-search-input:focus { outline: none; border-color: var(--teal); }
.log-global-btns { display: flex; gap: 8px; flex-shrink: 0; }

.log-categories-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 4px;
}

/* Category row (the main row) */
.log-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  min-height: 50px;
  border-bottom: 1px solid var(--border-dark);
  gap: 12px;
}
.log-cat-row:last-child { border-bottom: none; }
.log-special-row { background: rgba(36,160,160,0.04); }

.log-cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  user-select: none;
}
.log-cat-header:hover .log-cat-name { color: var(--teal); }
.log-cat-chevron {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
.log-cat-chevron-open { transform: rotate(90deg); }
.log-cat-icon {
  font-size: 13px;
  color: var(--text-muted);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.log-cat-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.15s;
}
.log-cat-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
}
.log-cat-ch {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Types list (expanded content) */
.log-types-list {
  border-bottom: 1px solid var(--border-dark);
  background: rgba(0,0,0,0.12);
}
.log-types-list:last-child { border-bottom: none; }

.log-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 8px 44px;
  border-bottom: 1px solid var(--border-dark);
  gap: 12px;
}
.log-type-row:last-child { border-bottom: none; }
.log-type-name {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}
.log-type-ch { flex-shrink: 0; }

/* Channel chip inside logging rows */
.log-ch-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-hover);
  border: 1px solid var(--border-bright);
  border-radius: 4px;
  padding: 3px 6px 3px 8px;
  font-size: 12px;
  color: var(--text);
  max-width: 220px;
}
.log-ch-chip-hash {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
}
.log-ch-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.log-ch-chip-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  margin-left: 2px;
}
.log-ch-chip-x:hover { color: var(--red); }

.log-set-ch-btn {
  background: none;
  border: 1px dashed var(--border-bright);
  color: var(--text-muted);
  font-size: 12px;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.log-set-ch-btn:hover { border-color: var(--teal); color: var(--teal); }

/* ═══════════════════════════════════════════════════════════
   ROLE CONNECTIONS  -  CONDITIONS
   ═══════════════════════════════════════════════════════════ */

.rc-conditions-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.rc-condition-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.rc-condition-body {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.rc-condition-label {
  font-size: 13px;
  color: var(--text-muted);
}
.rc-remove-btn {
  flex-shrink: 0;
  color: var(--text-muted);
}
.rc-remove-btn:hover { color: var(--red); border-color: var(--red); }

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px 2px 5px;
  font-size: 12px;
  color: var(--text);
}
.role-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   REACTION ROLES  -  UPDATED MODAL
   ═══════════════════════════════════════════════════════════ */

.modal--lg { max-width: 600px; }

.rr-roles-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.rr-role-entries-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.rr-entry-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
}
.rr-entry-num {
  font-size: 11px;
  color: var(--text-muted);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.rr-entry-role  { flex: 1.5; }
.rr-entry-label { flex: 1; }

/* Emoji picker button (replaces text input) */
.rr-emoji-btn {
  width: 44px; height: 36px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
}
.rr-emoji-btn:hover { border-color: var(--border-bright); background: var(--card); }
.rr-emoji-btn .rr-ep-placeholder { color: var(--text-muted); font-size: 15px; }

/* Emoji picker popup */
.rr-ep {
  background: #1a2332; border: 1px solid #2a3a50;
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.5);
  width: 280px; max-height: 360px;
  overflow: hidden; display: flex; flex-direction: column;
}
.rr-ep-inner { display: flex; flex-direction: column; height: 100%; }
.rr-ep-search {
  margin: 8px; padding: 7px 10px;
  background: #0f1923; border: 1px solid #2a3a50; border-radius: 6px;
  color: #e2e8f0; font-size: 13px; outline: none; width: calc(100% - 16px); box-sizing: border-box;
}
.rr-ep-search:focus { border-color: #818cf8; }
.rr-ep-section { padding: 4px 10px 2px; font-size: 11px; font-weight: 600; color: #4a6580; text-transform: uppercase; letter-spacing: .05em; }
.rr-ep-grid {
  display: flex; flex-wrap: wrap; gap: 2px;
  padding: 4px 8px 8px; max-height: 260px; overflow-y: auto;
}
.rr-ep-grid::-webkit-scrollbar { width: 4px; }
.rr-ep-grid::-webkit-scrollbar-track { background: transparent; }
.rr-ep-grid::-webkit-scrollbar-thumb { background: #2a3a50; border-radius: 2px; }
.rr-ep-item {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 6px;
  cursor: pointer; font-size: 20px;
  transition: background .12s;
}
.rr-ep-item:hover { background: #2a3a50; }
.rr-ep-item img { width: 24px; height: 24px; object-fit: contain; }
.rr-entry-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
}
.rr-entry-del:hover { color: var(--red); background: rgba(237,66,69,0.12); }
.rr-entries-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.rr-embed-preview-bar {
  border-left: 4px solid var(--teal);
  background: var(--bg-input);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 14px;
  margin-top: 10px;
}
.rr-embed-prev-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.rr-embed-prev-desc  { font-size: 13px; color: var(--text-muted); }

/* Modal open/close animations
   IMPORTANT: every keyframe must include translate(-50%,-50%) so the
   centering transform is never wiped out by animation fill-mode. */
.modal-open {
  animation: modal-in 0.2s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}
.modal-overlay-open { animation: fadein 0.18s ease both; }

@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Close animation - added via .modal-closing class */
.modal-closing {
  animation: modal-out 0.16s ease both;
  pointer-events: none;
}
.modal-overlay-closing {
  animation: fadeout 0.16s ease both;
  pointer-events: none;
}
@keyframes modal-out {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to   { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(0.97); }
}
@keyframes fadeout {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ─────────────────────────────────────────────────────────
   ROLE CONNECTIONS v2
───────────────────────────────────────────────────────── */

.rc-top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.rc-top-bar .btn:last-child { margin-left: auto; }

.rc-connection-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.rc-conn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

.rc-conn-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.rc-conn-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rc-conds-area {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.rc-cond-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
}

.rc-cond-pill.has { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.rc-cond-pill.hasnt { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }

.rc-cond-pill-x {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: 0.6; font-size: 14px; line-height: 1;
  padding: 0 2px;
}
.rc-cond-pill-x:hover { opacity: 1; }

.rc-logic-sep {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  padding: 0 4px;
}

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

.rc-logic-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
}
.btn-xs.active {
  background: var(--teal-dim);
  border-color: var(--teal-glow);
  color: var(--teal);
}

/* ─────────────────────────────────────────────────────────
   DUPE LIST  -  card layout
───────────────────────────────────────────────────────── */
.dl-top-bar { display:flex; align-items:center; gap:12px; margin-bottom:4px; }
.dl-fields-container {
  columns: 270px;
  column-gap: 12px;
  margin-top: 16px;
}
.dl-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.dl-field-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 12px;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
  break-inside: avoid;
  margin-bottom: 12px;
}
.dl-field-card:hover {
  border-color: rgba(255,255,255,0.13);
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.dl-field-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.dl-field-card:hover .dl-field-card-actions { opacity: 1; }
.btn-icon-xs {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-muted);
  cursor: pointer; font-size: 11px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-icon-xs:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.btn-icon-xs--danger:hover { color: #f87171; border-color: rgba(248,113,113,.4); }
.dl-field-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  padding-right: 56px;
}
.dl-field-card-serials {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.dl-serial-pill {
  background: rgba(129,140,248,0.1);
  color: #818cf8;
  border: 1px solid rgba(129,140,248,0.25);
  border-radius: 12px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────
   CUSTOM COMMANDS BUILDER
───────────────────────────────────────────────────────── */
.cc-layout {
  display: flex;
  gap: 16px;
  min-height: 500px;
}
.cc-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cc-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.cc-list-item {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-faint, rgba(255,255,255,.04));
  transition: background .12s;
}
.cc-list-item:hover { background: var(--bg-hover); }
.cc-list-item.active { background: var(--teal-dim); color: var(--teal); }
.cc-list-name { font-weight: 500; }
.cc-list-type { font-size: 11px; color: var(--text-muted); background: var(--bg-input); border-radius: 8px; padding: 1px 6px; }
.cc-empty { padding: 20px 14px; color: var(--text-muted); font-size: 13px; text-align: center; }
.cc-editor {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-y: auto;
}
.cc-editor-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 200px; color: var(--text-muted); font-size: 13px; text-align: center;
}
.cc-section { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.cc-section:last-child { border-bottom: none; }
.cc-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.cc-response-tabs { display:flex; gap:4px; margin-bottom:12px; }
.cc-rtab {
  padding: 5px 14px; font-size: 12px; border-radius: var(--radius);
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
}
.cc-rtab.active { background: var(--teal-dim); border-color: var(--teal-glow); color: var(--teal); }
.cc-resp-panel { }
.cc-arg-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
  background: var(--bg-hover); padding: 8px; border-radius: var(--radius); flex-wrap: wrap;
}
.form-row-2 { display: flex; gap: 16px; }
.form-row-2 .form-group { flex: 1; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: block; }
.required { color: var(--red, #ef4444); }

/* ── Action cards ─────────────────────────────────────────────── */
.cc-actions-empty {
  text-align: center; color: var(--text-muted); font-size: 13px; padding: 20px;
  background: var(--card); border: 1px dashed var(--border); border-radius: 8px;
}
.cc-action-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 10px; overflow: hidden;
}
.cc-action-header {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.cc-action-type-sel { flex: 1; font-weight: 600; font-size: 13px; height: 32px; padding: 3px 8px; }
.cc-action-btns { display: flex; gap: 4px; flex-shrink: 0; }
.cc-action-del-btn { color: #ef4444 !important; border-color: rgba(239,68,68,.3) !important; }
.cc-action-del-btn:hover { background: rgba(239,68,68,.12) !important; }
.cc-action-body { padding: 14px 14px 10px; }

/* ═══════════════════════════════════════════════════════════
   MESSAGES / TEMPLATES PAGE
═══════════════════════════════════════════════════════════ */

/* Toolbar */
.tpl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tpl-toolbar-left { display: flex; flex-direction: column; gap: 6px; }
.tpl-desc-small { font-size: 13px; color: var(--text-muted); }
.tpl-count-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
}
.tpl-count-add {
  width: 22px; height: 22px;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  border-radius: 50%; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; transition: background 0.14s, color 0.14s;
}
.tpl-count-add:hover { background: #818cf8; color: white; border-color: #818cf8; }
.tpl-toolbar-right { display: flex; align-items: center; gap: 10px; }
.tpl-search-wrap {
  position: relative;
  display: flex; align-items: center;
}
.tpl-search-icon {
  position: absolute; left: 10px;
  color: var(--text-muted); font-size: 12px; pointer-events: none;
}
.tpl-search-wrap input {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  padding: 7px 12px 7px 30px; font-size: 13px; width: 180px;
}
.tpl-search-wrap input:focus { outline: none; border-color: #818cf8; }

/* Template grid */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.tpl-empty-list {
  grid-column: 1/-1;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
.tpl-grid-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tpl-grid-item:hover {
  border-color: #818cf8;
  box-shadow: 0 2px 16px rgba(129,140,248,0.12);
}
.tpl-grid-item-header {
  display: flex; align-items: flex-start; justify-content: space-between;
}
.tpl-grid-item-icon {
  width: 36px; height: 36px;
  background: rgba(129,140,248,0.12);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #818cf8;
}
.tpl-grid-del {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  padding: 2px 4px; font-size: 12px; border-radius: 4px;
  opacity: 0; transition: opacity 0.14s, color 0.14s;
}
.tpl-grid-item:hover .tpl-grid-del { opacity: 1; }
.tpl-grid-del:hover { color: #f87171; }
.tpl-grid-item-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Template grid item actions (folder move + delete) */
.tpl-grid-item-actions { display:flex;gap:4px;align-items:center; }
.tpl-move-folder-btn { background:none;border:none;color:#4a6580;cursor:pointer;padding:2px 4px;border-radius:4px;font-size:12px;transition:color .15s; }
.tpl-move-folder-btn:hover { color:#818cf8; }
.tpl-grid-item:hover .tpl-move-folder-btn { opacity:1; }

/* Folder rows in the template list */
.tpl-folder-row { display:flex;align-items:center;gap:8px;padding:8px 12px;background:#0f1923;border:1px solid #1a2a3a;border-radius:8px;margin-bottom:4px;width:100%;box-sizing:border-box; }
.tpl-folder-row-name { flex:1;font-size:14px;color:#c8d8f0;font-weight:500; }
.tpl-folder-row-count { font-size:12px;color:#4a6580;background:#1a2a3a;padding:1px 7px;border-radius:10px; }
.tpl-folder-del-btn { background:none;border:none;color:#4a6580;cursor:pointer;padding:2px 5px;border-radius:4px;font-size:12px; }
.tpl-folder-del-btn:hover { color:#ef4444; }
.tpl-folder-contents { padding-left:12px;margin-bottom:8px; }
.tpl-grid-item-folder { font-size:10px;color:#4a6580;margin-top:2px; }

/* Folder picker dropdown */
.tpl-folder-dp { position:absolute;background:#1e2a3a;border:1px solid #2a3a50;border-radius:8px;padding:6px;min-width:160px;z-index:99999;box-shadow:0 4px 20px rgba(0,0,0,.4); }
.tpl-folder-dp-item { padding:6px 10px;border-radius:5px;cursor:pointer;font-size:13px;color:#c8d8f0; }
.tpl-folder-dp-item:hover { background:#2a3a50; }
.tpl-folder-dp-item.active { color:#818cf8;font-weight:600; }
.tpl-folder-dp-new { display:flex;gap:4px;margin-top:6px;padding-top:6px;border-top:1px solid #1a2a3a; }
.tpl-folder-dp-new input { flex:1;background:#0f1923;border:1px solid #2a3a50;border-radius:5px;padding:5px 8px;color:#e2e8f0;font-size:12px;outline:none; }
.tpl-folder-dp-new button { background:#2563eb;border:none;border-radius:5px;color:#fff;padding:5px 8px;cursor:pointer;font-size:12px; }

/* Folder breadcrumb (subpage header) */
.tpl-folder-breadcrumb { display:flex;align-items:center;gap:8px;padding:8px 4px 12px 4px;border-bottom:1px solid #1a2a3a;margin-bottom:12px; }
.tpl-folder-breadcrumb span { font-size:14px;color:#c8d8f0;font-weight:500; }
.tpl-folder-back-btn { background:none;border:1px solid #2a3a50;border-radius:6px;color:#94a3b8;cursor:pointer;padding:4px 8px;font-size:13px;line-height:1;transition:background .15s,color .15s; }
.tpl-folder-back-btn:hover { background:#1a2a3a;color:#e2e8f0; }

/* Template list rows (inside folder subpage) */
.tpl-list-item { display:flex;align-items:center;justify-content:space-between;padding:10px 14px;background:#0f1923;border:1px solid #1a2a3a;border-radius:8px;margin-bottom:6px;cursor:pointer;transition:background .15s,border-color .15s; }
.tpl-list-item:hover { background:#1a2a3a;border-color:#2a3a50; }
.tpl-list-item-name { font-size:14px;color:#c8d8f0;font-weight:500;flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.tpl-list-item-actions { display:flex;gap:6px;flex-shrink:0;margin-left:10px; }
.tpl-list-item-actions button { background:none;border:none;color:#4a6580;cursor:pointer;padding:4px 6px;border-radius:4px;font-size:13px;transition:color .15s,background .15s; }
.tpl-list-item-actions button:hover { color:#c8d8f0;background:#1a2a3a; }

/* Show folders toggle row */
.tpl-show-folders-row { display:flex;align-items:center;margin-bottom:10px; }
.tpl-show-folders-label { display:flex;align-items:center;gap:6px;cursor:pointer;font-size:13px;color:#94a3b8;user-select:none; }
.tpl-show-folders-label input[type="checkbox"] { accent-color:#818cf8;width:14px;height:14px;cursor:pointer; }
.tpl-show-folders-label:hover { color:#c8d8f0; }

/* Modal overlay */
.tpl-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  backdrop-filter: blur(2px);
}

/* Editor modal */
.tpl-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  background: var(--surface);
  border-radius: 12px;
  width: min(780px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  box-shadow: 0 28px 80px rgba(0,0,0,0.55);
  overflow: hidden;
}

/* Modal tab bar */
.tpl-modal-tabbar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  border-radius: 12px 12px 0 0;
  padding: 0 8px;
  flex-shrink: 0;
}
.tpl-tab {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer;
  font-size: 13px; font-weight: 600;
  padding: 12px 18px;
  margin-bottom: -1px;
  transition: color 0.14s, border-color 0.14s;
}
.tpl-tab:hover { color: var(--text); }
.tpl-tab.active { color: #5865f2; border-bottom-color: #5865f2; }
.tpl-modal-name {
  flex: 1;
  padding: 0 8px;
}
.tpl-modal-name input {
  background: none; border: none;
  color: var(--text); font-size: 13px; font-weight: 500;
  width: 100%; outline: none;
}
.tpl-modal-name input::placeholder { color: var(--text-muted); }
.tpl-modal-x {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 16px; padding: 8px 10px; border-radius: 6px;
  transition: color 0.14s, background 0.14s;
}
.tpl-modal-x:hover { color: var(--text); background: rgba(255,255,255,0.06); }

/* Sub-tabs */
.tpl-sub-tabs {
  display: flex; gap: 4px;
  padding: 10px 16px 0;
  flex-shrink: 0;
}
.tpl-sub-tab {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted); cursor: pointer;
  font-size: 12px; font-weight: 500;
  padding: 5px 14px;
  transition: all 0.14s;
}
.tpl-sub-tab:hover { color: var(--text); border-color: rgba(255,255,255,0.12); }
.tpl-sub-tab.active {
  background: rgba(88,101,242,0.15);
  border-color: #5865f2;
  color: #818cf8;
}

/* Panes */
.tpl-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.tpl-pane--edit, .tpl-pane--use { /* explicit flex column for edit/use panes */ }
.tpl-subpane--scroll {
  flex: 1;
  overflow-y: auto;
}

/* Visual sub-pane: Discord frame */
.tpl-discord-frame {
  background: #36393f;
  border-radius: 8px;
  padding: 14px 16px;
  margin: 12px 16px;
}
.tpl-bot-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.tpl-content-wrap { position: relative; margin-bottom: 6px; }
.tpl-inline-content {
  width: 100%; background: rgba(0,0,0,0.2);
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 4px; color: #dcddde;
  font-size: 13px; padding: 8px 10px;
  resize: vertical; min-height: 44px; max-height: 140px;
  box-sizing: border-box; font-family: inherit;
  transition: border-color 0.14s;
}
.tpl-inline-content:focus { outline: none; border-color: rgba(88,101,242,0.6); }
.tpl-inline-content::placeholder { color: #72767d; }
.tpl-content-count {
  position: absolute; bottom: 5px; right: 8px;
  font-size: 10px; color: #72767d; pointer-events: none;
}

/* Embed blocks inside Discord frame  -  Discord-card WYSIWYG style */
.tpl-embeds-list { display: flex; flex-direction: column; gap: 8px; }

.tpl-embed-card {
  border-left: 4px solid #5865f2;
  border-radius: 0 4px 4px 0;
  background: rgba(0,0,0,0.28);
  overflow: hidden;
}
.tpl-ec-header {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.tpl-ec-label {
  flex: 1; font-size: 10px; font-weight: 700;
  color: #72767d; text-transform: uppercase; letter-spacing: 0.07em;
}
.tpl-ec-color-label { cursor: pointer; display: flex; align-items: center; position: relative; }
.tpl-ec-color-label input[type="color"] { position: absolute; opacity: 0; width: 0; height: 0; }
.tpl-ec-colorswatch {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.2); flex-shrink: 0;
}
.tpl-ec-remove {
  background: none; border: none; color: #72767d;
  cursor: pointer; font-size: 14px; padding: 2px 5px; border-radius: 3px;
  transition: color 0.14s;
}
.tpl-ec-remove:hover { color: #f87171; }

/* Embed header icon/reorder/collapse/duplicate controls */
.tpl-ec-header-actions { display: flex; align-items: center; gap: 1px; margin-right: 2px; }
.tpl-ec-btn {
  background: none; border: none; color: #72767d;
  cursor: pointer; font-size: 11px; padding: 2px 5px; border-radius: 3px;
  transition: color 0.14s, background 0.14s; line-height: 1;
}
.tpl-ec-btn:hover { color: #b9bbbe; background: rgba(255,255,255,0.06); }
.tpl-ec-btn--dup:hover { color: #818cf8; }
.tpl-embed-card.collapsed .tpl-ec-body { display: none; }

.tpl-ec-body { padding: 8px 10px 8px; display: flex; flex-direction: column; gap: 3px; }
.tpl-ec-top { display: flex; gap: 10px; align-items: flex-start; }
.tpl-ec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }

/* Transparent Discord-style inputs */
.tpl-embed-in {
  background: transparent; border: none;
  border-bottom: 1px dashed transparent;
  color: #dcddde; width: 100%; box-sizing: border-box;
  font-family: inherit; outline: none; padding: 2px 0;
  transition: border-color 0.15s;
}
.tpl-embed-in:hover { border-bottom-color: rgba(255,255,255,0.12); }
.tpl-embed-in:focus { border-bottom-color: #5865f2; }
.tpl-embed-in::placeholder { color: rgba(255,255,255,0.22); font-style: italic; }
textarea.tpl-embed-in { resize: none; }

.tpl-embed-in--author { font-size: 12px; font-weight: 600; color: #b9bbbe; }
.tpl-embed-in--title  { font-size: 15px; font-weight: 700; color: #fff; }
.tpl-embed-in--desc   { font-size: 13px; line-height: 1.4; min-height: 38px; }
.tpl-embed-in--footer { font-size: 12px; color: #b9bbbe; }
.tpl-embed-in--small  { font-size: 11px; color: #72767d; font-style: italic; }
.tpl-embed-in--image  { font-size: 11px; color: #72767d; margin: 2px 0; }
.tpl-embed-in--thumb  { font-size: 10px; color: #72767d; text-align: center; width: 64px; }

/* Rows with main field + URL field beside it */
.tpl-ec-author-row,
.tpl-ec-title-row  { display: flex; gap: 6px; align-items: baseline; }
.tpl-ec-author-row .tpl-embed-in:first-child,
.tpl-ec-title-row  .tpl-embed-in:first-child { flex: 2; }
.tpl-ec-author-row .tpl-embed-in--small,
.tpl-ec-title-row  .tpl-embed-in--small { flex: 1; }

/* Embed fields */
.tpl-ec-fields { display: flex; flex-direction: column; gap: 3px; margin: 2px 0; }
.tpl-ec-field-row {
  display: grid; grid-template-columns: auto 1fr 1fr auto auto;
  gap: 4px; align-items: center;
}
.tpl-ec-inline-label {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: #72767d; white-space: nowrap; cursor: pointer;
}
.tpl-ec-field-del {
  background: none; border: none; color: #72767d;
  cursor: pointer; font-size: 12px; padding: 1px 4px; border-radius: 3px;
  transition: color 0.14s;
}
.tpl-ec-field-del:hover { color: #f87171; }

/* Field reorder group */
.tpl-ec-field-reorder { display: flex; flex-direction: column; gap: 0; width: 14px; }
.tpl-ec-field-move {
  background: none; border: none; color: #4a4d57;
  cursor: pointer; font-size: 8px; padding: 0 3px; line-height: 1.2; border-radius: 2px;
  transition: color 0.14s;
}
.tpl-ec-field-move:hover { color: #b9bbbe; }
.tpl-ec-field-move:disabled { color: #2a2d35; cursor: default; }
.tpl-ec-add-field {
  background: none; border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 3px; color: #72767d; cursor: pointer;
  font-size: 11px; padding: 3px 8px; text-align: left;
  margin: 2px 0; transition: border-color 0.14s, color 0.14s;
}
.tpl-ec-add-field:hover { border-color: #818cf8; color: #818cf8; }

/* Footer row */
.tpl-ec-footer-row { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.tpl-ec-footer-row .tpl-embed-in--footer { flex: 2; }
.tpl-ec-footer-row .tpl-embed-in--small  { flex: 1; }
.tpl-ec-ts-check {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: #72767d; white-space: nowrap; cursor: pointer; flex-shrink: 0;
}

/* Thumbnail slot (top-right of embed card) */
.tpl-ec-thumb-slot {
  width: 72px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tpl-ec-thumb-empty {
  width: 64px; height: 64px; border-radius: 4px;
  border: 1px dashed rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.15); font-size: 22px;
}
.tpl-ec-thumb-slot > img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 4px; display: block;
}

/* Action bar (bottom of visual pane) */
.tpl-action-bar {
  display: flex; gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.tpl-action-btn {
  padding: 6px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  display: flex; align-items: center; gap: 6px;
  transition: filter 0.14s;
}
.tpl-action-btn:hover { filter: brightness(1.1); }
.tpl-action-btn--blue { background: #5865f2; color: white; }
.tpl-action-btn--green { background: #22c55e; color: white; }
.tpl-action-btn--red { background: #ef4444; color: white; }

/* Raw editor pane */
.tpl-raw-hint { font-size: 12px; color: var(--text-muted); padding: 12px 16px 0; }
.tpl-raw-ta {
  flex: 1; min-height: 240px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: #a8d5e8;
  font-family: 'Courier New', monospace; font-size: 12px;
  padding: 12px; resize: vertical; box-sizing: border-box; width: 100%;
  margin: 8px 16px; width: calc(100% - 32px);
}
.tpl-raw-ta:focus { outline: none; border-color: #818cf8; }
.tpl-raw-err { font-size: 12px; color: #f87171; min-height: 16px; padding: 0 16px; }

/* Variables pane */
.tpl-vars-grid {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; margin: 0 16px;
}
.tpl-var-item {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
  cursor: pointer; transition: background 0.12s; user-select: none;
}
.tpl-var-item:last-child { border-bottom: none; }
.tpl-var-item:hover { background: rgba(129,140,248,0.07); }
.tpl-var-item:active { background: rgba(129,140,248,0.14); }
.tpl-var-item code {
  background: rgba(88,101,242,0.12); color: #818cf8;
  padding: 2px 8px; border-radius: 4px; font-size: 12px;
  min-width: 195px; font-family: 'Courier New', monospace;
}
.tpl-var-item span { color: var(--text-muted); flex: 1; }
.tpl-var-item .tpl-var-copy-icon { font-size: 10px; color: #4a5568; opacity: 0; transition: opacity 0.12s; }
.tpl-var-item:hover .tpl-var-copy-icon { opacity: 1; }
.tpl-vars-copy-hint { font-size: 11px; color: var(--text-muted); padding: 0 14px 10px; font-style: italic; }

/* Preview pane */
.tpl-preview-discord {
  flex: 1; overflow-y: auto; background: #36393f; padding: 20px;
}
.tpl-preview-empty {
  color: #72767d; font-size: 13px; text-align: center; padding: 48px 20px;
}

/* Use pane */
.tpl-use-pane-wrap { flex: 1; overflow-y: auto; }
.tpl-use-pane {
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.tpl-use-hint { font-size: 13px; color: var(--text-muted); margin: 0; }
.tpl-use-row { display: flex; align-items: center; gap: 10px; }
.tpl-use-select, .tpl-use-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 8px 12px; font-size: 13px;
}
.tpl-use-select:focus, .tpl-use-input:focus { outline: none; border-color: #818cf8; }
.tpl-use-section-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: var(--text);
}
.tpl-use-counter { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.tpl-item-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 6px;
}
.tpl-item-card-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.tpl-item-card-row:last-child { margin-bottom: 0; }
.tpl-item-card-row label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; min-width: 60px;
}
.tpl-item-card-row input[type="text"],
.tpl-item-card-row select {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text); padding: 5px 8px; font-size: 12px;
}
.tpl-item-del-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-muted); cursor: pointer;
  padding: 4px 10px; font-size: 12px;
  transition: color 0.14s, border-color 0.14s; margin-left: auto;
}
.tpl-item-del-btn:hover { color: #f87171; border-color: #f87171; }

/* Schedule day-of-week / day-of-month pickers */
.tpl-sched-day-grid { display: flex; gap: 4px; flex-wrap: wrap; }
.tpl-sched-day-btn {
  padding: 3px 7px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 11px; cursor: pointer;
  transition: all 0.12s;
}
.tpl-sched-day-btn.active { background: rgba(129,140,248,0.2); border-color: #818cf8; color: #818cf8; font-weight: 600; }
.tpl-sched-dom-grid { display: flex; gap: 3px; flex-wrap: wrap; max-width: 280px; }
.tpl-sched-dom-btn {
  width: 26px; height: 26px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 11px; cursor: pointer;
  transition: all 0.12s; display: flex; align-items: center; justify-content: center;
}
.tpl-sched-dom-btn.active { background: rgba(129,140,248,0.2); border-color: #818cf8; color: #818cf8; font-weight: 600; }

/* Automation reply/DM options */
.tpl-auto-options { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tpl-auto-opt-label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.tpl-auto-opt-label input[type="checkbox"] { accent-color: #818cf8; }
.tpl-auto-opt-num { width: 58px; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; color: var(--text); padding: 4px 6px; font-size: 12px; }

/* Sticky options */
.tpl-sticky-opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tpl-sticky-opt-label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.tpl-sticky-opt-label input[type="checkbox"] { accent-color: #818cf8; }

/* Unsaved changes bar */
.tpl-unsaved-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #1c1c1e;
  border-top: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  flex-shrink: 0;
}
.tpl-unsaved-text { font-size: 13px; color: #fbbf24; }
.tpl-unsaved-text strong { font-weight: 700; }
.tpl-unsaved-btns { display: flex; gap: 8px; }
.btn-success {
  background: #22c55e; color: white;
  border: none; border-radius: 6px;
  padding: 7px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: filter 0.14s;
}
.btn-success:hover { filter: brightness(1.1); }
@keyframes tplShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-7px); }
  40%       { transform: translateX(7px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.tpl-unsaved-bar.shake {
  animation: tplShake 0.42s ease;
  background: rgba(239,68,68,0.15);
  border-top-color: rgba(239,68,68,0.4);
}
.tpl-unsaved-bar.shake .tpl-unsaved-text { color: #f87171; }

/* Discord preview elements (reused in preview pane) */
.discord-message { display: flex; gap: 12px; }
.discord-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
}
.discord-avatar--blue { background: #5865F2; }
.discord-msg-right { flex: 1; min-width: 0; }
.discord-msg-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.discord-msg-name { font-size: 14px; font-weight: 600; color: #fff; }
.discord-msg-badge {
  background: #5865F2; color: white;
  font-size: 9px; font-weight: 700;
  padding: 1px 4px; border-radius: 3px; letter-spacing: 0.03em;
}
.discord-msg-body { font-size: 13px; color: #dcddde; line-height: 1.4; }
.preview-embed {
  display: flex; background: #2f3136;
  border-radius: 4px; overflow: hidden; margin-bottom: 4px; max-width: 520px;
}
.preview-embed-bar { width: 4px; flex-shrink: 0; }
.preview-embed-content {
  flex: 1; padding: 10px 12px; position: relative;
  display: flex; flex-direction: column; gap: 6px;
}
.preview-embed-thumbnail {
  position: absolute; top: 10px; right: 10px;
  width: 60px; height: 60px; border-radius: 4px; object-fit: cover;
}
.preview-embed-author { display: flex; align-items: center; gap: 6px; }
.preview-embed-author-icon { width: 16px; height: 16px; border-radius: 50%; }
.preview-embed-author-name { font-size: 11px; font-weight: 600; color: #dcddde; }
.preview-embed-title { font-size: 14px; font-weight: 600; color: #00b0f4; }
.preview-embed-desc { font-size: 13px; color: #dcddde; line-height: 1.4; white-space: pre-wrap; }
.preview-embed-fields { display: flex; flex-wrap: wrap; gap: 8px; }
.preview-embed-field { flex: 1; min-width: 100px; }
.preview-embed-field-name { font-size: 11px; font-weight: 700; color: #dcddde; margin-bottom: 2px; }
.preview-embed-field-value { font-size: 12px; color: #b9bbbe; }
.preview-embed-image { width: 100%; border-radius: 4px; max-width: 400px; }
.preview-embed-footer { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #72767d; }
.preview-embed-footer-icon { width: 16px; height: 16px; border-radius: 50%; }

/* Discord-style markdown rendered in preview pane */
.preview-md-pre { background: rgba(0,0,0,0.3); border-radius: 4px; padding: 6px 8px; font-size: 12px; white-space: pre-wrap; font-family: 'Courier New', monospace; margin: 2px 0; color: #dcddde; }
.preview-md-code { background: rgba(0,0,0,0.35); padding: 1px 5px; border-radius: 3px; font-size: 12px; font-family: 'Courier New', monospace; color: #f8a8c8; }
.preview-md-quote { border-left: 3px solid #4f545c; padding-left: 8px; margin: 2px 0; color: #b9bbbe; }
.preview-md-spoiler { background: #202225; color: transparent; border-radius: 3px; padding: 0 2px; cursor: pointer; transition: color 0.2s, background 0.2s; }
.preview-md-spoiler:hover { background: rgba(32,34,37,0.5); color: #dcddde; }

/* ─────────────────────────────────────────────────────────
   SUBTABS
───────────────────────────────────────────────────────── */
.subtab-bar {
  display: flex;
  gap: 6px;
}
.subtab {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.subtab:hover { background: var(--bg-hover); color: var(--text); }
.subtab.active {
  background: rgba(129,140,248,0.12);
  border-color: rgba(129,140,248,0.4);
  color: #818cf8;
}

/* ─────────────────────────────────────────────────────────
   DISCORD-STYLE TRANSCRIPT VIEWER
───────────────────────────────────────────────────────── */
.discord-chat-wrap {
  background: #313338;
  border-radius: 10px;
  padding: 16px 0;
  font-family: 'gg sans', 'Noto Sans', Whitney, sans-serif;
  border: 1px solid rgba(255,255,255,0.06);
}
.dc-message {
  display: flex;
  gap: 16px;
  padding: 4px 16px 4px 16px;
  transition: background 0.1s;
}
.dc-message:hover { background: rgba(0,0,0,0.06); }
.dc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  object-fit: cover;
}
.dc-msg-body { flex: 1; min-width: 0; }
.dc-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.dc-author {
  font-size: 15px;
  font-weight: 600;
  color: #f2f3f5;
  line-height: 1.2;
}
.dc-author-bot  { color: #57f287; }
.dc-author-staff { color: #5865f2; }
.dc-bot-tag {
  background: #5865f2;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  line-height: 1.6;
}
.dc-staff-tag {
  background: #ed4245;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  line-height: 1.6;
}
.dc-timestamp {
  font-size: 11px;
  color: #949ba4;
  font-weight: 400;
}
.dc-msg-content {
  font-size: 15px;
  color: #dbdee1;
  line-height: 1.375;
  white-space: pre-wrap;
  word-break: break-word;
}
.dc-embed {
  margin-top: 6px;
  background: #2b2d31;
  border-radius: 4px;
  padding: 12px 16px;
  max-width: 520px;
}
.dc-embed-title {
  font-size: 15px;
  font-weight: 600;
  color: #f2f3f5;
  margin-bottom: 6px;
}
.dc-embed-desc {
  font-size: 14px;
  color: #dbdee1;
  line-height: 1.4;
  white-space: pre-wrap;
}
.dc-embed-field { margin-top: 8px; }
.dc-embed-field-name { font-size: 12px; font-weight: 700; color: #f2f3f5; margin-bottom: 2px; }
.dc-embed-field-value { font-size: 13px; color: #dbdee1; }
.dc-attachment-img {
  display: block;
  max-width: 400px;
  max-height: 300px;
  border-radius: 6px;
  margin-top: 6px;
  cursor: zoom-in;
}
.dc-attachment-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 14px;
  background: #2b2d31;
  border-radius: 6px;
  color: #00aff4;
  font-size: 13px;
  text-decoration: none;
}
.dc-attachment-file:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────────────────
   ROLE CHIP PICKER  (join roles, giveaways, general)
───────────────────────────────────────────────────────── */
.role-chip-display {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  margin-bottom: 10px;
}
.role-chip-adder {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.role-chip-sel {
  flex: 1;
  max-width: 320px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}
.role-chip-sel:focus { border-color: var(--teal); }

/* ═══════════════════════════════════════════════════════════
   ADVANCED AUTO MODERATION  -  Sapphire-style card grid
═══════════════════════════════════════════════════════════ */

/* 2-column grid */
.am-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-bottom: 32px;
}
@media (max-width: 860px) {
  .am-grid { grid-template-columns: 1fr; }
}

/* Individual module card */
.am-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.15s;
}
.am-card:hover { border-color: var(--border-bright); }

/* Card top section */
.am-card-top {
  padding: 14px 14px 0;
}

/* Title row: name + count badge */
.am-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.am-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

/* Count badge + plus button cluster */
.am-count-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.am-count-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
  line-height: 1.4;
  white-space: nowrap;
}
.am-count-plus {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border-bright);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: background 0.13s, color 0.13s;
}
.am-count-plus:hover {
  background: rgba(88,101,242,0.2);
  color: #5865f2;
  border-color: #5865f2;
}

/* Description with left accent bar */
.am-card-desc-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.am-card-desc-bar {
  width: 3px;
  min-height: 100%;
  border-radius: 2px;
  background: var(--border-bright);
  flex-shrink: 0;
  align-self: stretch;
}
.am-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Info button (e.g. "How to format links") */
.am-info-btn {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 3px 9px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.13s, color 0.13s;
}
.am-info-btn:hover { background: var(--border); color: var(--text); }

/* Action buttons row (Manage roles + Add condition) */
.am-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  background: rgba(0,0,0,0.1);
}
.am-btn-manage {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 5px 11px;
  cursor: pointer;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.am-btn-manage:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text-muted); }

.am-btn-add {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #5865f2;
  border: none;
  border-radius: var(--radius);
  padding: 5px 13px;
  cursor: pointer;
  transition: background 0.13s;
  flex-shrink: 0;
}
.am-btn-add:hover { background: #4752c4; }

/* Conditions / groups list */
.am-items-list {
  flex: 1;
  padding: 0;
}

/* Empty state */
.am-empty-state {
  padding: 18px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.8;
}
.am-empty-state-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
}

/* Condition row */
.am-cond-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 6px 0 0;
  border-top: 1px solid var(--border-dark);
  min-height: 38px;
  transition: background 0.12s;
}
.am-cond-row:hover { background: var(--bg-hover); }

.am-cond-expand {
  width: 32px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  transition: color 0.12s, transform 0.18s;
}
.am-cond-expand:hover { color: var(--text); }
.am-cond-expand.expanded { transform: rotate(90deg); }

.am-cond-text {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 6px;
}

.am-cond-btns {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.am-cond-icon-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  transition: background 0.12s, color 0.12s;
}
.am-cond-icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.am-cond-icon-btn.am-btn-delete:hover { color: var(--red); background: rgba(237,66,69,0.1); }
.am-cond-icon-btn.am-btn-shield:hover { color: var(--teal); background: var(--teal-dim); }
.am-cond-icon-btn.am-btn-expand-grp:hover { color: #5865f2; background: rgba(88,101,242,0.1); }

/* Expanded condition actions panel */
.am-cond-actions-panel {
  border-top: 1px solid var(--border-dark);
  background: var(--bg-input);
  padding: 10px 12px;
  display: none;
}
.am-cond-actions-panel.open { display: block; }
.am-cond-actions-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.am-cond-actions-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.am-action-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-hover);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 3px 9px 3px 7px;
  cursor: default;
}
.am-action-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 0;
  line-height: 1;
  transition: color 0.12s;
}
.am-action-chip-remove:hover { color: var(--red); }
.am-add-action-btn {
  font-size: 11px;
  font-weight: 600;
  color: #5865f2;
  background: rgba(88,101,242,0.1);
  border: 1px dashed rgba(88,101,242,0.4);
  border-radius: 20px;
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.12s;
}
.am-add-action-btn:hover { background: rgba(88,101,242,0.2); }

/* Exception channels below condition text */
.am-cond-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 14px 8px 32px;
  background: var(--bg-input);
  border-top: 1px solid var(--border-dark);
}
.am-cond-ch-chip {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}

/* ── Modal pieces ── */
.am-modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}
.am-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 14px;
}
.am-sel-inline {
  background: var(--bg-input);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  color: var(--text);
  padding: 4px 8px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.am-sel-inline:focus { border-color: var(--teal); }

/* Role/channel pills area */
.am-pills-area {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
}
.am-pills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.am-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-hover);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  padding: 3px 5px 3px 8px;
}
.am-pill-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.am-pill-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  transition: background 0.12s, color 0.12s;
}
.am-pill-remove:hover { background: rgba(237,66,69,0.15); color: var(--red); }
.am-pill-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px dashed var(--border-bright);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
}
.am-pill-add-btn:hover {
  background: rgba(88,101,242,0.15);
  color: #5865f2;
  border-color: #5865f2;
}

/* Condition builder form */
.am-cond-builder {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.am-cond-builder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.am-cond-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.am-num-input {
  width: 70px;
  background: var(--bg-input);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  text-align: center;
}
.am-num-input:focus { border-color: var(--teal); }
.am-cond-unit-txt {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Caps condition special fields */
.am-caps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Special channels content type selector */
.am-special-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.am-special-type-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.13s, border-color 0.13s, color 0.13s;
}
.am-special-type-btn:hover { background: var(--bg-hover); color: var(--text); }
.am-special-type-btn.selected {
  background: rgba(88,101,242,0.12);
  border-color: #5865f2;
  color: #7289da;
}
.am-special-type-btn.selected .am-type-radio { background: #5865f2; border-color: #5865f2; }
.am-type-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  flex-shrink: 0;
  transition: background 0.13s, border-color 0.13s;
}

/* ── Condition item wrapper ── */
.am-cond-item {
  border-top: 1px solid var(--border-dark);
}
.am-cond-item:first-child { border-top: none; }
.am-cond-item > .am-cond-row { border-top: none; }

/* ── Expanded actions panel ── */
.am-cond-panel {
  background: rgba(0,0,0,0.18);
  border-top: 1px solid var(--border-dark);
}

.am-actions-list { padding: 4px 0; }

.am-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 40px;
  transition: background 0.12s;
}
.am-action-row:hover { background: rgba(255,255,255,0.03); }

.am-action-icon {
  font-size: 11px;
  color: var(--teal);
  width: 14px;
  flex-shrink: 0;
}

.am-action-label {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

.am-action-row-btns {
  display: flex;
  align-items: center;
  gap: 2px;
}

.am-action-gear-btn:hover { color: var(--teal) !important; background: var(--teal-dim) !important; }

.am-action-empty {
  padding: 10px 40px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.am-action-add-row {
  padding: 6px 12px 8px 40px;
  border-top: 1px solid var(--border-dark);
}

.am-add-action-row-btn {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  transition: opacity 0.12s;
}
.am-add-action-row-btn:hover { opacity: 0.75; }

/* ── Add action picker grid ── */
.am-action-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.am-action-pick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.13s, border-color 0.13s;
}
.am-action-pick-btn:hover { background: var(--bg-hover); border-color: var(--teal); }
.am-action-pick-btn i { width: 16px; text-align: center; color: var(--teal); }

/* ══════════════════════════════════════════════════════════════════
   MODERATION - SHARED HELPERS
═════════════════════════════════════════════════════════════════ */

.card-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px;
  letter-spacing: 0.02em;
}

.label-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

.label-small {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

.check-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Punish settings tabs ── */
.punish-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.punish-tab {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.punish-tab.active {
  background: var(--teal-dim);
  border-color: var(--teal);
  color: var(--teal);
}

.punish-tab:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.punish-panel { display: none; }
.punish-panel.active { display: block; }

/* ── Immune roles grid ── */
.immune-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}

.immune-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.immune-card-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.immune-card-header i { color: var(--teal); font-size: 12px; }

.immune-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ── User reports close actions grid ── */
.ur-close-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 600px) {
  .ur-close-grid { grid-template-columns: 1fr; }
  .immune-grid   { grid-template-columns: 1fr 1fr; }
  .punish-tabs   { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════════
   DEFAULT COMMANDS PAGE
   ══════════════════════════════════════════════════════════════════ */

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

.dc-search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
  max-width: 340px;
}

.dc-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

/* This rule needs to override the default input styling */
input.dc-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px 7px 32px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
input.dc-search-input:focus { border-color: var(--teal); }

.dc-filter-sel {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  cursor: pointer;
}
.dc-filter-sel:focus { border-color: var(--teal); }

/* ── Category block ── */
.dc-cat-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.dc-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0,0,0,0.22);
  border-bottom: 1px solid var(--border-dark);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.dc-cat-header i { color: var(--teal); font-size: 11px; }

.dc-cat-count {
  margin-left: auto;
  background: var(--bg-input);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

/* ── Command rows ── */
.dc-cmd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-dark);
  transition: background 0.1s;
}
.dc-cmd-row:last-child { border-bottom: none; }
.dc-cmd-row:hover      { background: var(--bg-hover); }
.dc-cmd-row.dc-cmd-disabled { opacity: 0.5; }

.dc-cmd-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dc-cmd-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
}

.dc-cmd-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

.dc-cmd-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Status badge ── */
.dc-status-badge {
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.dc-badge-on  { background: rgba(35,165,89,0.15);  color: var(--green); }
.dc-badge-off { background: rgba(237,66,69,0.12);   color: var(--red);  }

/* ── ⋮ menu button ── */
.dc-menu-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.dc-menu-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
  color: var(--text);
}

/* ── Options dropdown ── */
.dc-dropdown {
  position: fixed;
  z-index: 9000;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  min-width: 195px;
  padding: 4px;
  animation: fadeInUp 0.12s ease both;
}

.dc-dd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.dc-dd-item:hover { background: var(--bg-hover); }
.dc-dd-item i     { color: var(--teal); width: 16px; text-align: center; font-size: 12px; }

.dc-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Command name row (name + slash badge) ── */
.dc-cmd-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Slash registered badge ── */
.dc-slash-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(36,160,160,0.15);
  border: 1px solid rgba(36,160,160,0.35);
  border-radius: 4px;
  color: var(--teal);
  font-size: 8px;
  flex-shrink: 0;
}

/* ── ? Help button ── */
.dc-help-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.dc-help-btn:hover {
  background: var(--bg-hover);
  border-color: var(--teal);
  color: var(--teal);
}

/* ── Slash command row button ── */
.dc-slash-row-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  height: 28px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  white-space: nowrap;
}
.dc-slash-row-btn:hover {
  background: var(--bg-hover);
  border-color: var(--teal);
  color: var(--teal);
}
.dc-slash-row-btn.dc-slash-active {
  border-color: rgba(36,160,160,0.5);
  background: rgba(36,160,160,0.08);
  color: var(--teal);
}

/* ── Prefix toggle in row ── */
.dc-prefix-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}
.dc-prefix-toggle .tog-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.15s;
}
.dc-prefix-toggle .tog-dot.on  { background: var(--green); }
.dc-prefix-toggle .tog-dot.off { background: var(--text-muted); }
.dc-prefix-toggle .tog-label { font-size: 11px; }

/* ── Command modals shared ── */
.dc-modal-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}
.dc-usage-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}
.dc-about-desc-text {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* ── Pills (aliases/perms) ── */
.dc-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  align-items: flex-start;
  padding: 8px 0 4px;
}
.dc-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(36,160,160,0.12);
  border: 1px solid rgba(36,160,160,0.3);
  border-radius: 999px;
  padding: 3px 10px 3px 10px;
  font-size: 12px;
  color: var(--teal);
  font-weight: 500;
}
.dc-pill-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
  transition: color 0.1s;
}
.dc-pill-x:hover { color: var(--red); }
.dc-pill-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px dashed var(--border-bright);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
  margin-top: 4px;
}
.dc-pill-add-btn:hover { border-color: var(--teal); color: var(--teal); }
.dc-perm-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 14px 0 2px;
}
.dc-perm-section-title:first-child { margin-top: 0; }
.dc-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.dc-input-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.dc-input-row input:focus { border-color: var(--teal); }
.dc-autodel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.dc-autodel-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.dc-slash-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.dc-slash-status .status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dc-slash-status .status-dot.registered   { background: var(--green); }
.dc-slash-status .status-dot.unregistered { background: var(--text-muted); }

/* ══════════════════════════════════════════════════
   MESSAGES SUB-NAVIGATION
══════════════════════════════════════════════════ */
.msgs-subnav {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.msgs-subnav-item {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
}
.msgs-subnav-item:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.msgs-subnav-item.active { color: var(--teal); border-bottom-color: var(--teal); background: rgba(36,160,160,0.06); }
.msgs-subpage { }

.msgs-kits-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  width: fit-content;
}
.msgs-kits-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 6px 16px;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.15s;
}
.msgs-kits-tab.active { background: var(--teal); color: #fff; }
.msgs-kits-tab:hover:not(.active) { color: var(--text); }
.kits-pane { }

/* ══════════════════════════════════════════════════
   COMPONENTS SUB-PAGE
══════════════════════════════════════════════════ */
.comp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.comp-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: block;
}
.comp-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}
.comp-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.comp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.comp-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.comp-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.comp-card-actions {
  display: flex;
  gap: 6px;
}
.comp-card-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.comp-card-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.comp-card-btn.danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: rgba(239,68,68,0.3); }
.comp-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 0;
}
.comp-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: default;
}
.comp-preview-btn.style-1 { background: #5865F2; color: #fff; }
.comp-preview-btn.style-2 { background: #4e5058; color: #fff; }
.comp-preview-btn.style-3 { background: #248046; color: #fff; }
.comp-preview-btn.style-4 { background: #da373c; color: #fff; }
.comp-preview-btn.style-5 { background: none; color: #00b0f4; border: 1px solid #4e5058; }

.comp-actions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 20px;
}
.comp-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
}
.comp-action-label {
  flex: 1;
  color: var(--text);
  font-size: 13px;
}
.comp-action-meta {
  color: var(--text-muted);
  font-size: 12px;
}
.comp-action-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.comp-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.comp-action-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.comp-action-btn.danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

.comp-options-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.comp-option-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.comp-option-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.comp-option-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}

/* ══════════════════════════════════════════════════
   DEFAULT MESSAGES SUB-PAGE
══════════════════════════════════════════════════ */
.defmsg-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.defmsg-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.defmsg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
}
.defmsg-row:hover { background: var(--card); }
.defmsg-row + .defmsg-row { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: -1px; }
.defmsg-row:first-child:not(:last-child) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.defmsg-row:not(:first-child):not(:last-child) { border-radius: 0; }
.defmsg-info { display: flex; flex-direction: column; gap: 2px; }
.defmsg-name { font-size: 13px; font-weight: 600; color: var(--text); }
.defmsg-desc { font-size: 12px; color: var(--text-muted); }
.defmsg-edit-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}
.defmsg-edit-btn:hover { background: var(--teal); color: #fff; border-color: var(--teal); }
.defmsg-row.customized .defmsg-name::after {
  content: 'Custom';
  display: inline-block;
  margin-left: 8px;
  background: rgba(36,160,160,0.15);
  color: var(--teal);
  border: 1px solid rgba(36,160,160,0.3);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}

/* ══════════════════════════════════════════════════
   ACTION ROWS IN TEMPLATE EDITOR
══════════════════════════════════════════════════ */
.tpl-action-rows-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.tpl-ar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.tpl-ar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.tpl-ar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.tpl-ar-type-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(129,140,248,0.15);
  color: #818cf8;
  font-weight: 600;
}
.tpl-ar-header-btns {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.tpl-ar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.tpl-ar-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.tpl-ar-btn.danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; }
.tpl-ar-body {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tpl-ar-btn-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
}
.tpl-ar-btn-item.style-1 { background: rgba(88,101,242,0.2); color: #818cf8; border-color: rgba(88,101,242,0.35); }
.tpl-ar-btn-item.style-2 { background: rgba(78,80,88,0.3); color: #c9cdd3; border-color: rgba(78,80,88,0.5); }
.tpl-ar-btn-item.style-3 { background: rgba(36,128,70,0.2); color: #3fb950; border-color: rgba(36,128,70,0.35); }
.tpl-ar-btn-item.style-4 { background: rgba(218,55,60,0.2); color: #f87171; border-color: rgba(218,55,60,0.35); }
.tpl-ar-btn-item.style-5 { background: none; color: #60a5fa; border-color: var(--border); }
.tpl-ar-btn-item-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
  line-height: 1;
}
.tpl-ar-btn-item-x:hover { background: #ef4444; color: #fff; border-color: #ef4444; }
.tpl-ar-add-btn {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tpl-ar-add-btn:hover { border-color: var(--teal); color: var(--teal); }
.tpl-ar-menu-item {
  background: rgba(36,160,160,0.08);
  border: 1px solid rgba(36,160,160,0.2);
  border-radius: 4px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.tpl-ar-menu-item i { color: var(--teal); }
.tpl-action-btn--purple {
  background: rgba(129,140,248,0.12);
  border-color: rgba(129,140,248,0.25);
  color: #818cf8;
}
.tpl-action-btn--purple:hover { background: rgba(129,140,248,0.2); }

/* ══════════════════════════════════════════════════
   ADD ROW TYPE MODAL
══════════════════════════════════════════════════ */
.row-type-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 600;
}
.row-type-btn small { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.row-type-btn:hover { background: var(--card); border-color: var(--teal); }

/* ══════════════════════════════════════════════════
   IMPROVED SCHEDULE / AUTOMATION / STICKY CARDS
══════════════════════════════════════════════════ */
.tpl-sched-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.tpl-sched-type-row label { font-size: 11px; color: var(--text-muted); }
.tpl-sched-type-fields {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tpl-sched-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tpl-sched-field-row label { font-size: 12px; color: var(--text-muted); min-width: 50px; }
.tpl-sched-mini-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  outline: none;
  width: 70px;
  transition: border-color 0.15s;
}
.tpl-sched-mini-input:focus { border-color: var(--teal); }
.tpl-sched-mini-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.tpl-sched-mini-select:focus { border-color: var(--teal); }
.tpl-sched-days {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tpl-sched-day-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.tpl-sched-day-btn.active { background: rgba(36,160,160,0.15); color: var(--teal); border-color: rgba(36,160,160,0.35); }

.auto-item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.auto-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.auto-item-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auto-trigger-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-height: 28px;
}
.auto-trigger-pill {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 12px;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.auto-trigger-pill-x {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 0;
  line-height: 1;
}
.auto-trigger-pill-x:hover { color: #ef4444; }
.auto-add-trigger {
  display: flex;
  gap: 4px;
  align-items: center;
}
.auto-add-trigger input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
  width: 130px;
  transition: border-color 0.15s;
}
.auto-add-trigger input:focus { border-color: var(--teal); }
.auto-add-trigger-btn {
  background: var(--teal);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}
.auto-advanced-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  transition: color 0.12s;
}
.auto-advanced-toggle:hover { color: var(--text); }
.auto-advanced-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auto-advanced-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
}
.auto-advanced-row label { cursor: pointer; display: flex; align-items: center; gap: 6px; }

.sticky-item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.sticky-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.sticky-item-body {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sticky-setting-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.sticky-setting-row label { color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.sticky-setting-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
}

/* ══════════════════════════════════════════════════
   MESSAGE KITS
══════════════════════════════════════════════════ */
.kit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.kit-card-info { flex: 1; }
.kit-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.kit-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kit-card-code {
  font-family: monospace;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--teal);
  cursor: pointer;
  transition: all 0.12s;
}
.kit-card-code:hover { background: rgba(36,160,160,0.1); }
.kit-card-btns { display: flex; gap: 6px; }
