/* static/style.css */
/* ========== GLOBAL LAYOUT (Discord-inspired styling) ========== */
:root{
  --shell-w: clamp(560px, 80vw, 1320px);

  /* Font Sizes - Discord style */
  --fs-xxs: 10px; --fs-xs: 12px; --fs-sm: 14px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 22px; --fs-xxl: 28px;

  /* Elevation / shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.18);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.28), 0 1px 2px rgba(0,0,0,0.18);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.36), 0 2px 6px rgba(0,0,0,0.22);
  --ring-accent: 0 0 0 3px rgba(88,101,242,0.28);
  --ring-warning: 0 0 0 3px rgba(240,178,50,0.28);
  --ring-danger: 0 0 0 3px rgba(242,63,66,0.28);
  
  /* Border Radius - Discord style */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-round: 9999px;
  
  /* Spacing - Discord style */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  
  /* Font Weights - Discord style */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Font Families - Discord style */
  --font-primary: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-code: "Consolas", "Andale Mono", Monaco, "Courier New", Courier, monospace;
  
  /* Background Colors - Discord style */
  --background-base-low: #313338;
  --background-base-lower: #2b2d31;
  --background-base-lowest: #1e1f22;
  --background-mod-subtle: rgba(4, 4, 5, 0.3);
  --background-mod-normal: rgba(4, 4, 5, 0.6);
  --interactive-background-hover: rgba(4, 4, 5, 0.6);
  --custom-background-secondary: #2b2d31;
  
  /* Text Colors - Discord style */
  --text-strong: #f2f3f5;
  --text-default: #dcddde;
  --text-muted: #72767d;
  --text-link: #00aff4;
  --text-brand: #5865f2;
  --text-feedback-positive: #23a55a;
  --text-feedback-critical: #f23f42;
  --text-feedback-warning: #f0b232;
  --text-feedback-info: #00aff4;
  --interactive-text-default: #b9bbbe;
  --interactive-text-active: #ffffff;
  --interactive-text-hover: #dcddde;
  --input-placeholder-text-default: #72767d;
  
  /* Border Colors - Discord style */
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-normal: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.06);
  
  /* Brand/Accent Colors */
  --brand-500: #5865f2;
  --brand-400: #4752c4;
  --primary-500: #5865f2;
  --primary-400: #4752c4;
  --primary-630: #1e2124;
  
  /* Legacy compatibility */
  --bg-dark: var(--background-base-low);
  --panel: var(--background-base-lower);
  --accent: var(--brand-500);
  --accent-2: #7289da;
  --ok: var(--text-feedback-positive);
  --warn: var(--text-feedback-warning);
  --err: var(--text-feedback-critical);
  --text: var(--text-strong);
  --muted: var(--text-muted);

  /* Templates reference this alias — maps to Discord-style panels */
  --bg-secondary-alt: var(--background-base-lower);

  /* Tighter default rhythm (less vertical air between sections) */
  --layout-stack-gap: 10px;
  --panel-pad: 12px;
}

* { box-sizing: border-box; }
.app-shell {
  width: var(--shell-w);
  max-width: 100%;
  min-height: calc(100vh - 16px);
  display: flex;
  flex-direction: column;
  gap: var(--layout-stack-gap);
  padding-bottom: env(safe-area-inset-bottom, 8px);
}

html, body { 
  height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari */
}

body {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-normal);
  line-height: 1.5;
  background-color: var(--background-base-low);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(88, 101, 242, 0.10), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(114, 137, 218, 0.08), transparent 60%),
    radial-gradient(1000px 600px at 50% 110%, rgba(88, 101, 242, 0.06), transparent 60%);
  background-attachment: fixed;
  position: relative;
  min-height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari */
  color: var(--text-default);
  margin: 0;
  padding: 12px;
  display: flex;
  justify-content: center;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(88, 101, 242, 0.35);
  color: #fff;
}

@supports (min-height: 100dvh) {
  .app-shell {
    min-height: 100dvh;
  }
}

/* ----------------------------------------------------------------------
   Unified visual polish (applies site-wide).
   Brings non-admin pages closer to the calm, compact admin look:
   dark scrollbars, dark native form controls, consistent focus rings.
---------------------------------------------------------------------- */

/* Force OS dark color scheme so native widgets (selects, scrollbars,
   datepickers) match the rest of the site. */
:root { color-scheme: dark; }

/* Dark scrollbars - Firefox */
* { scrollbar-color: rgba(255,255,255,0.18) transparent; scrollbar-width: thin; }
/* Dark scrollbars - WebKit */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.10);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.18);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* Native form controls - shared dark-theme look (matches admin). */
select, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="url"],
input[type="tel"], input[type="date"], input[type="time"], textarea {
  background-color: #1c1f24;
  color: var(--text-default);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  box-sizing: border-box;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
  min-height: 40px;
}
select { padding-right: 36px; cursor: pointer; }
select:hover, input:hover, textarea:hover { border-color: rgba(88,101,242,0.45); }
select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring-accent);
  background-color: #1f2229;
}
textarea { line-height: 1.5; resize: vertical; min-height: 80px; }

/* Dark dropdown options (best effort - browsers vary). */
select option { background-color: #1c1f24; color: var(--text-default); }
select option:checked,
select option:hover { background-color: rgba(88,101,242,0.25); color: #fff; }

/* Custom chevron for <select> so its arrow doesn't clash with the dark body. */
select:not([multiple]) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a6aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Top bar — thin single-row nav */
.topbar {
  display: block;
  width: 100%;
  margin-bottom: var(--space-8);
  position: sticky;
  top: 8px;
  z-index: 50;
}

.bot-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  background: linear-gradient(180deg, rgba(58, 62, 72, 0.92) 0%, rgba(43, 45, 49, 0.92) 100%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  padding: 6px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: border-color .15s ease, box-shadow .2s ease;
}

.bot-info:hover {
  border-color: rgba(255,255,255,0.12);
}

.bot-info-left {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex: 1 1 0;
  min-width: 0;
}

.bot-info-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
}

.bot-info-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-8);
  flex: 1 1 0;
  min-width: 0;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}

.topbar-avatar,
.topbar-avatar-fallback {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}

.topbar-avatar {
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.12);
  box-shadow: 0 0 0 2px rgba(88,101,242,0.0), 0 1px 2px rgba(0,0,0,0.3);
}

.topbar-user:hover .topbar-avatar {
  box-shadow: 0 0 0 2px rgba(88,101,242,0.55), 0 1px 4px rgba(0,0,0,0.4);
}

.topbar-avatar-fallback {
  background: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
  border: 2px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold);
  font-size: var(--fs-xs);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

.topbar-discord-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-secondary-alt);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 4px;
}

.btn-topbar {
  padding: 6px 12px !important;
  font-size: var(--fs-xs) !important;
  line-height: 1.2;
  border-radius: 8px !important;
  letter-spacing: 0.2px;
}

/* Mobile-only condensed controls (hidden on desktop) */
.topbar-mobile-controls {
  display: none;
  align-items: center;
  gap: 6px;
}
.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-default);
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.topbar-icon-btn:hover {
  background: rgba(88, 101, 242, 0.14);
  border-color: rgba(88, 101, 242, 0.45);
  color: var(--text-strong);
}
.topbar-icon-btn:active { transform: scale(0.96); }
.topbar-icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-accent);
}

/* Full-screen mobile menu (hidden on desktop) */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
}
.mobile-menu:not([hidden]) { display: block; }
.mobile-menu__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.mobile-menu.is-open .mobile-menu__backdrop { opacity: 1; }
.mobile-menu__panel {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #2b2d31 0%, #1e1f22 100%);
  display: flex;
  flex-direction: column;
  padding: 14px 14px env(safe-area-inset-bottom, 14px);
  transform: translateY(-12px);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
  overflow-y: auto;
}
.mobile-menu.is-open .mobile-menu__panel {
  transform: translateY(0);
  opacity: 1;
}
.mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 12px;
}
.mobile-menu__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-menu__close {
  width: 40px;
  height: 40px;
}
.mobile-menu__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(88,101,242,0.10) 0%, rgba(88,101,242,0.03) 100%);
  border: 1px solid rgba(88,101,242,0.20);
  border-radius: 12px;
  margin-bottom: 14px;
}
.mobile-menu__user .topbar-avatar,
.mobile-menu__user .topbar-avatar-fallback {
  width: 44px;
  height: 44px;
  font-size: var(--fs-md);
}
.mobile-menu__user-meta { min-width: 0; flex: 1; }
.mobile-menu__user-name {
  color: var(--text-strong);
  font-weight: var(--font-weight-semibold);
  font-size: var(--fs-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-menu__user-sub {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mobile-menu__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text-default);
  text-decoration: none;
  font-size: var(--fs-md);
  font-weight: var(--font-weight-medium);
  min-height: 52px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu__item:hover,
.mobile-menu__item:active {
  background: rgba(88, 101, 242, 0.10);
  border-color: rgba(88, 101, 242, 0.35);
  color: var(--text-strong);
}
.mobile-menu__item.is-active {
  background: linear-gradient(180deg, rgba(88, 101, 242, 0.22) 0%, rgba(88, 101, 242, 0.12) 100%);
  border-color: rgba(88, 101, 242, 0.55);
  color: var(--text-strong);
}
.mobile-menu__icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(88, 101, 242, 0.10);
  border: 1px solid rgba(88, 101, 242, 0.18);
  font-size: 16px;
  flex-shrink: 0;
}
.mobile-menu__item--premium {
  background: linear-gradient(135deg, rgba(246, 195, 67, 0.18) 0%, rgba(232, 163, 23, 0.10) 100%);
  border-color: rgba(246, 195, 67, 0.45);
}
.mobile-menu__item--premium .mobile-menu__icon {
  background: rgba(246, 195, 67, 0.20);
  border-color: rgba(246, 195, 67, 0.35);
}
.mobile-menu__item--primary {
  background: linear-gradient(180deg, #5e6bf2 0%, #4a57e0 100%);
  border-color: rgba(255,255,255,0.08);
  color: #fff;
}
.mobile-menu__item--primary .mobile-menu__icon {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.20);
  color: #fff;
}
.mobile-menu__item--danger {
  color: var(--text-feedback-critical);
}
.mobile-menu__item--danger .mobile-menu__icon {
  background: rgba(242, 63, 66, 0.10);
  border-color: rgba(242, 63, 66, 0.30);
}
.mobile-menu__divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 8px 4px;
}

.selfcord-brand--compact {
  font-size: 16px !important;
  letter-spacing: 0.6px !important;
}

.btn-premium-nav {
  background: linear-gradient(135deg, #f6c343 0%, #e8a317 50%, #d4940f 100%);
  color: #1a1a2e !important;
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(246, 195, 67, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-premium-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(246, 195, 67, 0.5);
  color: #0f0f1a !important;
}

.selfcord-logo {
  width: 24px;
  height: 24px;
  margin-right: 0;
  object-fit: contain;
  flex-shrink: 0;
}

.selfcord-brand {
  font-family: 'gg sans', 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #5865f2 0%, #7289da 50%, #5865f2 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(88, 101, 242, 0.5);
  animation: gradient-shift 3s ease infinite;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@media (max-width: 768px) {
  /* Compact top bar: single row with user on the left and icon controls on the right */
  .bot-info {
    flex-wrap: nowrap;
    padding: 6px 10px;
    gap: 8px;
  }

  /* Hide the SelfCord brand chunk in the center on phones — we already
     have the logo on the home button in the right-side controls, and the
     user name on the left does the identification. */
  .bot-info-center { display: none; }

  .bot-info-left {
    flex: 1 1 auto;
    min-width: 0;
  }
  .bot-info-right {
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  /* Hide the full desktop nav; show the condensed mobile icon row instead */
  .bot-info-right .topbar-nav { display: none !important; }
  .topbar-mobile-controls { display: inline-flex !important; }

  .bot-username {
    max-width: 140px;
    font-size: var(--fs-sm);
  }

  .topbar-discord-pill { display: none; }

  .selfcord-logo {
    width: 22px;
    height: 22px;
  }

  .selfcord-brand--compact {
    font-size: 15px !important;
  }
}

/* Always hide the mobile menu overlay on desktop */
@media (min-width: 769px) {
  .mobile-menu { display: none !important; }
  .topbar-mobile-controls { display: none !important; }
}
.bot-info:hover {
  background-color: var(--background-mod-subtle);
}
.bot-avatar { 
  width: 36px; 
  height: 36px; 
  border-radius: var(--radius-round); 
  flex: 0 0 auto; 
  margin-right: var(--space-8);
  border: 1px solid var(--border-subtle);
}
.bot-username {
  color: var(--text-strong);
  font-size: var(--fs-md);
  font-weight: var(--font-weight-medium);
  line-height: 1.375;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

/* Role indicator + button group */
.role-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
}

.role-indicator {
  user-select: none;
  pointer-events: auto;
  border: 1px solid var(--border-normal);
  background: var(--background-mod-subtle);
  color: var(--interactive-text-default);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-round);
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.role-indicator[title] { cursor: help; }
.role-indicator.active {
  border-color: var(--brand-500);
  background: rgba(88, 101, 242, 0.2);
  color: var(--interactive-text-active);
}

/* Buttons - Discord style, polished */
.rotate-btn, .btn {
  background: linear-gradient(180deg, #5e6bf2 0%, #4a57e0 100%);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-primary);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .12s ease, background-color .15s ease, box-shadow .18s ease, color .15s ease, border-color .15s ease;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
  -webkit-tap-highlight-color: transparent;
}
.rotate-btn:hover:not([disabled]), .btn:hover:not([disabled]) {
  background: linear-gradient(180deg, #6772f5 0%, #4f5be5 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(88, 101, 242, 0.32), inset 0 1px 0 rgba(255,255,255,0.10);
}
.rotate-btn:active:not([disabled]), .btn:active:not([disabled]) {
  transform: translateY(0);
  background: linear-gradient(180deg, #4f5be5 0%, #4047c8 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 1px 2px rgba(0,0,0,0.18);
}
.rotate-btn:focus-visible, .btn:focus-visible {
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08), var(--ring-accent);
}
.rotate-btn[disabled], .btn[disabled]{
  opacity: .45;
  cursor: not-allowed;
  background: rgba(88, 101, 242, 0.3);
  transform: none !important;
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(180deg, #f04a4d 0%, #d83a3d 100%);
}
.btn-danger:hover:not([disabled]) {
  background: linear-gradient(180deg, #f25457 0%, #e54448 100%);
  box-shadow: 0 4px 12px rgba(242, 63, 66, 0.35), inset 0 1px 0 rgba(255,255,255,0.10);
}
.btn-danger:focus-visible {
  box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08), var(--ring-danger);
}

.btn-secondary {
  background: linear-gradient(180deg, #51596a 0%, #424a59 100%);
  color: #e7e9ee;
  border-color: rgba(255,255,255,0.07);
}
.btn-secondary:hover:not([disabled]) {
  background: linear-gradient(180deg, #5b6477 0%, #4b5364 100%);
  box-shadow: 0 4px 12px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.10);
}

.btn-ghost {
  background: transparent;
  color: var(--text-default);
  border-color: rgba(255,255,255,0.10);
  box-shadow: none;
}
.btn-ghost:hover:not([disabled]) {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.18);
  box-shadow: none;
}

.top-right-logo {
  height: 58px;
  width: auto;
  max-width: min(28vw, 320px);
  object-fit: contain;
}

@media (max-width: 720px){
  .topbar { grid-template-columns: 1fr; }
  .top-right-logo { justify-self: end; height: 48px; max-width: 200px; }
}

/* Card */
.chat-container {
  position: relative;
  width: 100%;
  background-color: var(--background-base-lower);
  background-image: linear-gradient(180deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0) 60%);
  padding: 18px;
  border-radius: 14px;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: var(--layout-stack-gap);
}
.chat-container.blocked { pointer-events: none; }

/* ----- Compact page intros & utility grids (shared across tool pages) ----- */
.page-intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--border-subtle);
}
.page-intro__title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-strong);
  line-height: 1.2;
  letter-spacing: -0.2px;
}
.page-intro__desc {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.4;
}
.page-intro .warning-box {
  margin: 0;
}
.page-intro--tight {
  gap: var(--space-8);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
}

.utilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: var(--space-12);
}

.tool-card-tile {
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--bg-secondary-alt);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.tool-card-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(88,101,242,0) 0%, rgba(88,101,242,0) 70%, rgba(88,101,242,0.35) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.tool-card-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(88, 101, 242, 0.45);
  background: linear-gradient(180deg, rgba(88, 101, 242, 0.06) 0%, rgba(255,255,255,0) 100%), var(--background-base-low);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(88, 101, 242, 0.18);
}
.tool-card-tile:hover::before { opacity: 1; }
.tool-card-tile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.55);
}
.tool-card-tile__head {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.tool-card-tile__icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(88,101,242,0.18) 0%, rgba(88,101,242,0.06) 100%);
  border: 1px solid rgba(88,101,242,0.18);
}
.tool-card-tile__title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
  line-height: 1.25;
}
.tool-card-tile__desc {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.4;
}
.tool-card-tile__cta {
  margin-top: var(--space-12);
  display: flex;
  align-items: center;
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-medium);
}
.tool-card-tile__desc code {
  font-family: var(--font-code);
  font-size: 0.92em;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-subtle);
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}
.settings-panel {
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0) 100%), var(--bg-secondary-alt);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.025);
  transition: border-color .15s ease, box-shadow .2s ease;
}
.settings-panel:hover {
  border-color: rgba(255,255,255,0.10);
}
.settings-panel .stack-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}
.settings-panel .stack-form .form-group {
  margin-bottom: 0;
}
.form-row-split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-12);
}
.form-field-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: var(--space-4) 0 0;
  line-height: 1.35;
}

.muted-placeholder-box {
  padding: var(--panel-pad);
  background: var(--bg-secondary-alt);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-normal);
  text-align: center;
}
.muted-placeholder-box p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.version-strip {
  margin-top: var(--space-12);
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255, 193, 7, 0.10) 0%, rgba(255, 193, 7, 0.04) 100%);
  border: 1px solid rgba(255, 193, 7, 0.28);
  border-radius: 10px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025);
}
.version-strip p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-default);
  line-height: 1.45;
}

.panel-heading {
  margin: 0 0 var(--space-12);
  font-size: var(--fs-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-strong);
  line-height: 1.25;
}

.feedback-star-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.feedback-star-row .star {
  font-size: 26px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, transform 0.1s;
  user-select: none;
  line-height: 1;
}

/* Form elements */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

/* Custom Select Dropdown with Icons */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-12) var(--space-16);
  background: var(--background-base-lower);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
  min-height: 44px;
  gap: var(--space-12);
}

.custom-select-trigger:hover {
  border-color: var(--border-strong);
  background: var(--background-base-low);
}

.custom-select-trigger.active {
  border-color: var(--brand-500);
  background: var(--background-base-low);
}

.custom-select-trigger .select-value {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  flex: 1;
  min-width: 0;
}

.custom-select-trigger .server-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: cover;
  background: var(--background-base-lowest);
}

.custom-select-trigger .server-name {
  color: var(--text-default);
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.custom-select-trigger .select-placeholder {
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.custom-select-trigger .select-arrow {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform .15s ease;
  flex-shrink: 0;
}

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

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--background-base-lower);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.custom-select.open .custom-select-options {
  display: block;
}

.custom-select-option {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-16);
  cursor: pointer;
  transition: background-color .15s ease;
  border-bottom: 1px solid var(--border-subtle);
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover {
  background: var(--background-base-low);
}

.custom-select-option.selected {
  background: var(--brand-500);
  color: var(--text-strong);
}

.custom-select-option .server-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: cover;
  background: var(--background-base-lowest);
}

.custom-select-option .server-name {
  color: var(--text-default);
  font-size: var(--fs-sm);
  flex: 1;
}

.custom-select-option.selected .server-name {
  color: var(--text-strong);
}

.custom-select-option .server-badge {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-left: auto;
}

.custom-select-option.selected .server-badge {
  color: rgba(255, 255, 255, 0.8);
}

/* Default icon for servers without icon */
.server-icon-placeholder {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--brand-500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-strong);
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-semibold);
  flex-shrink: 0;
}

.form-select, .form-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--background-base-low);
  color: var(--text-strong);
  font-size: 16px;
  font-family: var(--font-primary);
  font-weight: var(--font-weight-normal);
  transition: background-color .15s ease, border-color .15s ease;
  box-sizing: border-box;
}

.form-select::placeholder, .form-input::placeholder {
  color: var(--input-placeholder-text-default);
  user-select: none;
}

.form-select:focus, .form-input:focus {
  outline: none;
  border-color: var(--brand-500);
  background-color: var(--background-base-low);
}

.form-select:disabled, .form-input:disabled {
  border-color: var(--text-muted);
  opacity: .5;
  cursor: not-allowed;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

.checkbox-item label {
  font-size: var(--fs-sm);
  cursor: pointer;
  user-select: none;
}

.warning-box {
  background: linear-gradient(180deg, rgba(240, 178, 50, 0.14) 0%, rgba(240, 178, 50, 0.07) 100%);
  border: 1px solid rgba(240, 178, 50, 0.5);
  border-left: 3px solid var(--text-feedback-warning);
  border-radius: 10px;
  padding: 12px 14px;
  margin: var(--space-12) 0;
  transition: background-color .15s ease, border-color .15s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.warning-box strong {
  color: var(--text-feedback-warning);
  display: block;
  margin-bottom: var(--space-8);
  font-weight: var(--font-weight-semibold);
  font-size: var(--fs-sm);
}

.warning-box p {
  font-size: var(--fs-sm);
  margin: 0;
  color: var(--text-default);
  line-height: 1.375;
}

/* Progress overlay — full-viewport, blocks all interaction with the page */
.copying-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0,0,0,.78);
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
  z-index: 10000;
  padding: 16px;
  box-sizing: border-box;
  overscroll-behavior: contain;
}

.copying-overlay.active {
  display: flex;
  animation: copyOverlayIn 0.2s ease-out;
}

@keyframes copyOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.copying-card {
  width: min(640px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--background-base-lower);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,0.36)), inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 22px;
  color: var(--text-strong);
  max-height: min(86vh, 86dvh);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Body-level scroll lock helper applied whenever a full-screen overlay is open */
html.is-locked,
body.is-locked {
  overflow: hidden !important;
  touch-action: none;
}

@media (max-width: 560px) {
  .copying-overlay { padding: 10px; }
  .copying-card { padding: 16px; border-radius: 12px; max-height: min(92vh, 92dvh); }
}

.copying-title {
  font-size: var(--fs-lg);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-display);
  margin-bottom: var(--space-12);
  color: var(--text-strong);
  line-height: 1.2;
}

.progress-log {
  background: var(--background-base-lowest);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-12);
  margin-top: var(--space-12);
  max-height: 300px;
  overflow-y: auto;
  text-align: left;
  font-size: var(--fs-xs);
  font-family: var(--font-code);
  line-height: 1.5;
}

.progress-log-item {
  padding: var(--space-4) 0;
  color: var(--text-muted);
}

.progress-log-item.success {
  color: var(--text-feedback-positive);
}

.progress-log-item.error {
  color: var(--text-feedback-critical);
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  margin: var(--space-16) 0;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--background-base-lowest);
  border-radius: var(--radius-round);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-500) 0%, var(--brand-400) 100%);
  border-radius: var(--radius-round);
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(88, 101, 242, 0.4);
}

.progress-text {
  text-align: center;
  margin-top: var(--space-8);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
}

/* Loading Overlay - Full Screen Freeze */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.loading-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--background-base-lower);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: var(--space-24);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.04);
  text-align: center;
  min-width: 280px;
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.loading-title {
  font-size: var(--fs-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-strong);
  margin-top: var(--space-16);
  font-family: var(--font-primary);
}

/* Spinner - Discord style */
.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--brand-500);
  border-right-color: rgba(88, 101, 242, 0.55);
  border-radius: var(--radius-round);
  animation: spin 0.9s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
  margin: 0 auto var(--space-8) auto;
  box-shadow: 0 0 0 1px rgba(88,101,242,0.15), 0 4px 14px rgba(88, 101, 242, 0.18);
}
@keyframes spin { 
  to { transform: rotate(360deg); } 
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--background-base-lower);
  border-radius: 14px;
  padding: var(--space-24);
  max-width: 520px;
  width: min(92%, 520px);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalIn {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-title {
  font-size: var(--fs-xl);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-display);
  margin-bottom: var(--space-16);
  color: var(--text-strong);
  line-height: 1.2;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

/* Login page */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  gap: 0;
}
/* Make the version banner that lives next to .login-card behave as a
   full-width column item below the card instead of a side-by-side sibling. */
.login-container > * + * {
  margin-top: 18px;
}
.login-container > div:not(.login-card) {
  max-width: 460px;
  width: 100%;
}

.login-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--background-base-lower);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.login-title {
  font-size: var(--fs-xl);
  font-weight: var(--font-weight-bold);
  font-family: var(--font-display);
  margin-bottom: var(--space-8);
  color: var(--text-strong);
  line-height: 1.2;
}

.login-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-24);
  line-height: 1.375;
}

.discord-btn {
  background: var(--brand-500);
  color: #ffffff;
  padding: var(--space-12) var(--space-24);
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-block;
  font-size: var(--fs-md);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-primary);
  transition: background-color 50ms ease-in;
  box-sizing: border-box;
}

.discord-btn:hover {
  background: var(--brand-400);
  transition: background-color .15s ease-out;
}

.token-input-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.token-input-section .form-label {
  text-align: left;
}

.token-info {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 8px;
  text-align: left;
}

/* Server select dropdown */
.server-select-wrapper {
  position: relative;
}

.server-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.server-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.server-name {
  font-weight: 500;
}

.server-owner-badge {
  font-size: var(--fs-xxs);
  background: var(--ok);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}

/* Toaster styles */
.toaster{
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast{
  min-width: 260px;
  max-width: min(92vw, 400px);
  background: linear-gradient(180deg, rgba(58, 62, 72, 0.95) 0%, rgba(43, 45, 49, 0.95) 100%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 4px solid var(--brand-500);
  color: var(--text-strong);
  box-shadow: var(--shadow-lg);
  border-radius: 10px;
  padding: 12px 14px;
  transform: translateY(-8px) scale(0.98);
  opacity: 0;
  transition: transform .22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity .18s ease;
  pointer-events: auto;
  position: relative;
}
.toast.show{
  transform: translateY(0) scale(1);
  opacity: 1;
}
.toast-title{ 
  font-size: var(--fs-sm); 
  font-weight: var(--font-weight-semibold); 
  margin-bottom: var(--space-4);
  color: var(--text-strong);
  font-family: var(--font-primary);
}
.toast-text{ 
  font-size: var(--fs-xs); 
  color: var(--text-default);
  line-height: 1.375;
}

.toast.ok    { border-left-color: var(--text-feedback-positive);    }
.toast.warn  { border-left-color: var(--text-feedback-warning);  }
.toast.err   { border-left-color: var(--text-feedback-critical);   }
.toast.info  { border-left-color: var(--brand-500);}

.toast-close{
  position: absolute;
  top: var(--space-4);
  right: var(--space-8);
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  transition: background-color .15s ease, color .15s ease;
}
.toast-close:hover{ 
  background: var(--background-mod-subtle);
  color: var(--text-strong);
}

/* Account card styles */
.account-card {
  min-width: 120px;
  max-width: 140px;
  margin: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--bg-secondary-alt);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.account-card:hover {
  transform: translateY(-2px);
  border-color: rgba(88, 101, 242, 0.45);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(88, 101, 242, 0.18);
}
.account-card.active,
.account-card[data-active="true"] {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.55), 0 6px 18px rgba(88, 101, 242, 0.22);
}

/* Account delete button styles */
.account-delete-btn {
  transition: transform 0.12s ease, opacity 0.15s ease, filter 0.15s ease;
  border-radius: 6px;
}
.account-delete-btn:hover {
  opacity: 1 !important;
  filter: brightness(1.15);
  transform: scale(1.08);
}

.account-delete-btn:active {
  transform: scale(0.95);
}

.account-delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #202225; border-radius: 8px; }
::-webkit-scrollbar-thumb {
  background: var(--accent); border-radius: 8px; border: 2px solid #202225;
}
::-webkit-scrollbar-thumb:hover { background: #6773ff; }
body { scrollbar-width: thin; scrollbar-color: var(--accent) #202225; }

/* Small screens */
@media (max-width: 560px){
  :root{ --shell-w: clamp(320px, 96vw, 1000px); --panel-pad: 14px; }
  body { padding: 8px; }
  .bot-avatar{ width: 32px; height: 32px; }
  .bot-username{ font-size: var(--fs-sm); }
  .top-right-logo{ height: 44px; max-width: 180px; }
  .toaster{ top: auto; bottom: 16px; right: 12px; left: 12px; }
  .toast{ max-width: 100%; }

  /* Make tap targets comfortable */
  .btn, .rotate-btn, .btn-topbar, .discord-btn {
    min-height: 40px;
  }
  .btn-topbar { min-height: 36px; }

  /* Chat container slightly less padded on tiny screens */
  .chat-container { padding: 14px; border-radius: 12px; }

  /* Modal/dialog padding tightened */
  .modal-content, .loading-card, .copying-card { padding: 18px; border-radius: 12px; }

  /* Make utilities grid single column on smaller phones */
  .utilities-grid { grid-template-columns: 1fr; }
  
  /* Ensure body covers full viewport on mobile 9:16 */
  html, body {
    height: 100vh;
    height: -webkit-fill-available;
    overflow-x: hidden;
  }
  
  body {
    background-color: var(--background-base-low);
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }
  
  /* Fix transparent overlays to cover full screen */
  .copying-overlay,
  .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    z-index: 9999;
  }
}

/* Mobile 9:16 aspect ratio specific fixes */
@media (max-width: 560px) and (min-aspect-ratio: 9/16) and (max-aspect-ratio: 9/16) {
  html, body {
    height: 100vh;
    height: -webkit-fill-available;
    overflow: hidden;
  }

  .copying-overlay,
  .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: -webkit-fill-available;
    margin: 0;
    padding: 0;
  }
}

/* ============================================================
   Site-wide visual polish (additive, applies to every route)
   ============================================================ */

/* Smooth typography defaults */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-strong);
  letter-spacing: -0.2px;
  line-height: 1.25;
}
h1 { font-size: clamp(28px, 4vw, 38px); font-weight: var(--font-weight-bold); }
h2 { font-size: clamp(20px, 2.4vw, 24px); font-weight: var(--font-weight-semibold); }
h3 { font-size: var(--fs-lg); font-weight: var(--font-weight-semibold); }

p { line-height: 1.6; }
hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 16px 0;
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}
a:hover { color: #2cc1ff; text-shadow: 0 0 16px rgba(0, 175, 244, 0.35); }
a:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: var(--ring-accent);
}

/* Universal focus ring for keyboard users (skips already-styled buttons) */
:focus-visible:not(.btn):not(.rotate-btn):not(.discord-btn):not(input):not(select):not(textarea):not(a) {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Reduce excessive animation for users who request it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Polish details/summary widgets (used on accounts/security panels).
   Skip .security-details and any <details> that already has its own
   inline border/background, so we don't paint a double outline. */
details:not(.security-details):not([style*="border"]):not([style*="background"]) {
  background: linear-gradient(180deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0) 100%), var(--bg-secondary-alt);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  transition: border-color .15s ease, box-shadow .2s ease;
}
details:not(.security-details):not([style*="border"]):not([style*="background"]):hover {
  border-color: rgba(255,255,255,0.10);
}
details:not(.security-details):not([style*="border"]):not([style*="background"])[open] {
  border-color: rgba(88, 101, 242, 0.30);
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
details > summary {
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
details:not(.security-details):not([style*="border"]):not([style*="background"]) > summary {
  padding: 12px 14px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
}
details > summary::-webkit-details-marker { display: none; }

/* Security panel: make sure it always renders as one seamless outlined card.
   The template uses inline border:2px solid var(--accent) on both the
   summary and the body — strip any outer details border/shadow so we
   never get a double outline. */
.security-details {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.security-details > summary {
  /* keep the inline gradient + accent border from the template */
  transition: filter 0.15s ease;
}
.security-details[open] > summary {
  /* Visually fuse summary with body: drop bottom radius/border when open */
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-bottom: none !important;
}

.security-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
}
details[open] .security-arrow {
  transform: rotate(180deg);
}

/* Subtle entrance for primary card */
.chat-container {
  animation: cardFadeIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stronger contrast for "Get Premium" type primary CTAs on cards */
.btn-primary {
  background: linear-gradient(180deg, #5e6bf2 0%, #4a57e0 100%);
}

/* Tighten heavy inline-style cards on home/accounts: target generic
   inline-styled tiles via attribute selectors so we don't have to touch
   the templates. Adds hover lift + nicer border. */
[style*="background: var(--bg-secondary-alt)"][style*="border-radius"][style*="padding"]:not(.warning-box):not(.settings-panel):not(.tool-card-tile) {
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Hoster entry-point tile hover polish (the gradient link in accounts.html) */
a[href="/hoster"] > div {
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.18s ease, box-shadow 0.18s ease !important;
}
a[href="/hoster"]:hover > div {
  transform: translateY(-2px) !important;
  box-shadow: 0 10px 28px rgba(88, 101, 242, 0.28), 0 0 0 1px rgba(88, 101, 242, 0.32) !important;
}

/* Pulse the brand subtly on first paint */
.selfcord-logo {
  transition: transform 0.2s ease, filter 0.2s ease;
}
.topbar-user:hover .selfcord-logo,
.bot-info-center:hover .selfcord-logo {
  transform: scale(1.04);
  filter: drop-shadow(0 0 8px rgba(88, 101, 242, 0.4));
}

/* Wider, more breathable card on large screens */
@media (min-width: 1100px) {
  .chat-container { padding: 22px 24px; }
  .settings-panel { padding: 18px 20px; }
}

/* Tablet polish */
@media (min-width: 561px) and (max-width: 1024px) {
  :root { --shell-w: clamp(560px, 92vw, 1100px); }
  .chat-container { padding: 16px; }
}

/* Small phones: tighter intro spacing, larger touch targets */
@media (max-width: 480px) {
  .page-intro {
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }
  .page-intro__title { font-size: var(--fs-lg); }
  .page-intro__desc { font-size: var(--fs-xs); }

  .tool-card-tile { padding: 14px; }
  .tool-card-tile__icon { width: 32px; height: 32px; font-size: 18px; }
  .tool-card-tile__title { font-size: var(--fs-sm); }
  .tool-card-tile__desc { font-size: var(--fs-xs); }

  /* Top bar: avoid horizontal overflow on tiny screens */
  .topbar { top: 4px; }
  .bot-info { padding: 6px 10px; }
  .topbar-nav { gap: 4px; }
  .btn-topbar { padding: 6px 10px !important; }

  /* Ensure CTA buttons stack nicely */
  .home-cta-row, .modal-buttons { flex-wrap: wrap; gap: 8px; }
}

/* Make any element with .clickable feel interactive */
.clickable {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}
.clickable:hover { transform: translateY(-1px); }
.clickable:active { transform: translateY(0); }

/* Status pills (success / warning / error / info) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--fs-xxs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border: 1px solid currentColor;
  background: rgba(255,255,255,0.02);
}
.pill.ok { color: var(--text-feedback-positive); }
.pill.warn { color: var(--text-feedback-warning); }
.pill.err { color: var(--text-feedback-critical); }
.pill.info { color: var(--text-feedback-info); }

/* Loading skeletons */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

