/* 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);
  align-self: flex-start;
  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 14px;
  width: 100%;
  min-height: 52px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, rgba(58, 62, 72, 0.94) 0%, rgba(43, 45, 49, 0.94) 100%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  padding: 7px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  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 160px;
  min-width: 0;
  max-width: 42%;
}

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

.bot-info-center--guest {
  display: flex;
}

.bot-info-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-8);
  flex: 1 1 320px;
  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;
}

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

/* Unified right-side toolbar: nav buttons + community chip */
.topbar-actions-rail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 2px 0;
}

.topbar-actions-divider {
  flex: 0 0 1px;
  align-self: stretch;
  width: 1px;
  min-height: 26px;
  margin: 3px 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.14) 35%,
    rgba(255, 255, 255, 0.14) 65%,
    transparent 100%
  );
}

.bot-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.topbar-nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
}

.btn-topbar {
  padding: 6px 11px !important;
  font-size: var(--fs-xs) !important;
  line-height: 1.15;
  border-radius: 9px !important;
  letter-spacing: 0.1px;
  min-height: 32px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-topbar--muted {
  opacity: 0.82;
}
.btn-topbar--muted:hover {
  opacity: 1;
}

/* Discord community chip — matches topbar button height, sits at far right */
.topbar-community-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  color: rgba(219, 222, 255, 0.72);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(88, 101, 242, 0.11) 0%, rgba(88, 101, 242, 0.05) 100%);
  border: 1px solid rgba(114, 137, 218, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    color 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}
.topbar-community-link:hover {
  color: #eef0ff;
  background: linear-gradient(180deg, rgba(88, 101, 242, 0.22) 0%, rgba(88, 101, 242, 0.12) 100%);
  border-color: rgba(114, 137, 218, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 16px rgba(88, 101, 242, 0.18);
  transform: translateY(-0.5px);
}
.topbar-community-link:focus-visible {
  outline: none;
  box-shadow: var(--ring-accent);
}
.topbar-community-link__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  color: rgba(167, 180, 255, 0.9);
  filter: drop-shadow(0 0 4px rgba(88, 101, 242, 0.35));
}
.topbar-community-link__cloud {
  display: block;
  animation: sc-community-cloud-drift 6s ease-in-out infinite;
}
.topbar-community-link:hover .topbar-community-link__cloud {
  animation-duration: 4s;
  color: #c8d0ff;
}
.topbar-community-link__text {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  letter-spacing: 0.2px;
}
.topbar-community-link__sep {
  opacity: 0.55;
  font-weight: 400;
}
@keyframes sc-community-cloud-drift {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.85; }
  50%      { transform: translateY(-1px) translateX(0.5px); opacity: 1; }
}

/* Fixed anchor for pages without the shared topbar (login, changelog, …) */
.community-link-anchor {
  position: fixed;
  top: max(10px, env(safe-area-inset-top, 10px));
  right: max(10px, env(safe-area-inset-right, 10px));
  z-index: 1000;
}
.community-link-anchor .topbar-community-link {
  box-shadow:
    var(--shadow-md),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Icon-only variant (mobile topbar controls) */
.topbar-community-link--icon-only {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
}
.topbar-community-link--icon-only .topbar-community-link__text {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .topbar-community-link__cloud {
    animation: none;
  }
  .topbar-community-link:hover {
    transform: none;
  }
}

/* Tighten on crowded viewports: compress labels */
@media (max-width: 1180px) {
  .bot-info-left {
    flex: 0 1 auto;
    max-width: 36%;
  }
  .bot-info-right {
    flex: 1 1 auto;
  }
}

@media (max-width: 980px) {
  .topbar-community-link__text {
    display: none;
  }
  .topbar-community-link {
    width: 32px;
    min-width: 32px;
    padding: 0;
    justify-content: center;
  }
  .topbar-actions-divider {
    margin: 3px 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--discord {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.14) 0%, rgba(88, 101, 242, 0.06) 100%);
  border-color: rgba(114, 137, 218, 0.32);
  color: rgba(219, 222, 255, 0.92);
}
.mobile-menu__item--discord .mobile-menu__icon {
  background: rgba(88, 101, 242, 0.16);
  border-color: rgba(114, 137, 218, 0.28);
  color: #b4bcff;
}
.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-actions-rail { 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: 5px;
  flex-wrap: nowrap;
  max-width: 100%;
  min-width: 0;
}

.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%;
  flex-shrink: 0;
  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: auto;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .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; }
}

/* ========== Home / landing page ========== */
.home-page {
  gap: 20px;
  overflow: visible;
  padding-bottom: 4px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 20px 28px;
  align-items: center;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(88, 101, 242, 0.22);
  background:
    radial-gradient(ellipse 80% 120% at 0% 0%, rgba(88, 101, 242, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 60% 80% at 100% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.005) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.home-hero__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.home-hero__logo-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 18px;
  padding: 10px;
  background: linear-gradient(145deg, rgba(88, 101, 242, 0.35), rgba(71, 82, 196, 0.2));
  border: 1px solid rgba(88, 101, 242, 0.45);
  box-shadow: 0 8px 28px rgba(88, 101, 242, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.home-hero__logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.home-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.home-hero__badge {
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-normal);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
}

.home-hero__badge--accent {
  color: #c8d0ff;
  border-color: rgba(88, 101, 242, 0.45);
  background: rgba(88, 101, 242, 0.12);
}

.home-user-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(88, 101, 242, 0.35);
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.12) 0%, rgba(30, 31, 34, 0.55) 100%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  min-width: 0;
  width: 100%;
}

.home-user-stat__pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3ba55d;
  box-shadow: 0 0 0 0 rgba(59, 165, 93, 0.55);
  animation: home-user-stat-pulse 2.2s ease-out infinite;
  flex-shrink: 0;
}

@keyframes home-user-stat-pulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 165, 93, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(59, 165, 93, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 165, 93, 0); }
}

.home-user-stat__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}

.home-user-stat__value {
  font-size: var(--fs-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-strong);
  letter-spacing: -0.4px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.home-user-stat__label {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--font-weight-semibold);
}

.home-hero__copy h1 {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: var(--font-weight-bold);
  color: var(--text-strong);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.home-hero__lead {
  margin: 0 0 14px;
  font-size: var(--fs-sm);
  color: var(--text-default);
  line-height: 1.55;
  max-width: 52ch;
}

.home-hero__cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.home-hero__cta-row .btn {
  font-size: var(--fs-sm);
  padding: 9px 18px;
}

.home-quick-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.home-quick-tools a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid var(--border-normal);
  background: rgba(255, 255, 255, 0.03);
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.home-quick-tools a:hover {
  color: var(--text-default);
  border-color: rgba(88, 101, 242, 0.4);
  background: rgba(88, 101, 242, 0.08);
}

.home-section {
  margin: 0;
}

.home-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.home-section__title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-strong);
}

.home-section__sub {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.home-feature {
  padding: 14px 14px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-normal);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.home-feature:hover {
  border-color: rgba(88, 101, 242, 0.35);
  transform: translateY(-1px);
}

.home-feature__icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 8px;
}

.home-feature h3 {
  margin: 0 0 4px;
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-strong);
}

.home-feature p {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.45;
}

.home-reviews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  align-items: start;
}

.home-review {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-normal);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: visible;
}

.home-review__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-review__name {
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-strong);
}

.home-review__stars {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 1px;
}

.home-review__stars .on { color: #ffd700; }
.home-review__stars .off { color: var(--text-muted); }

.home-review__body {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-default);
  line-height: 1.5;
}

.home-review__date {
  font-size: 10px;
  color: var(--text-muted);
}

.home-review__reply {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(88, 101, 242, 0.28);
  border-left: 3px solid var(--accent);
  background: rgba(88, 101, 242, 0.06);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.home-review__reply-label {
  display: block;
  font-size: 9px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 4px;
}

.home-cta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(88, 101, 242, 0.35);
  background: linear-gradient(90deg, rgba(88, 101, 242, 0.12), rgba(139, 92, 246, 0.08));
}

.home-cta-bar__text h2 {
  margin: 0 0 2px;
  font-size: var(--fs-md);
  color: var(--text-strong);
}

.home-cta-bar__text p {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.home-version-strip {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 193, 7, 0.22);
  background: rgba(255, 193, 7, 0.05);
  font-size: var(--fs-xs);
  color: var(--text-default);
  line-height: 1.45;
  text-align: center;
}

.home-version-strip p { margin: 0; }
.home-version-strip a { color: var(--accent); }

.home-empty-reviews {
  padding: 20px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  border: 1px dashed var(--border-normal);
  border-radius: var(--radius-md);
}

@media (max-width: 860px) {
  .home-hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 16px;
  }
  .home-hero__copy h1 { font-size: var(--fs-xl); }
  .home-hero__lead { margin-left: auto; margin-right: auto; }
  .home-hero__cta-row { justify-content: center; }
  .home-quick-tools { justify-content: center; }
  .home-features { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .home-cta-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .home-cta-bar .btn { width: 100%; }
}

/* ----- App pages (logged-in routes): compact hero + quick nav ideology ----- */
.app-subnav-wrap {
  width: 100%;
  max-width: var(--layout-max-width, 1100px);
  margin: 0 auto 10px;
  padding: 0 12px;
}

.app-quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(88, 101, 242, 0.18);
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.08) 0%, rgba(30, 31, 34, 0.6) 100%);
}

.app-quick-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: var(--fs-xxs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.app-quick-nav__link:hover {
  color: var(--text-strong);
  border-color: rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.1);
}

.app-quick-nav__link.is-active {
  color: #fff;
  border-color: rgba(88, 101, 242, 0.55);
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.55) 0%, rgba(114, 137, 218, 0.35) 100%);
}

.app-quick-nav__link--premium {
  color: #1a1a2e;
  border-color: rgba(246, 195, 67, 0.45);
  background: linear-gradient(135deg, #f6c343 0%, #e8a317 100%);
}

.app-quick-nav__link--premium:hover {
  color: #0f0f1a;
  border-color: rgba(246, 195, 67, 0.65);
  background: linear-gradient(135deg, #ffd054 0%, #f0ad1a 100%);
}

.app-quick-nav__link--premium.is-active {
  color: #0f0f1a;
  border-color: rgba(246, 195, 67, 0.8);
  background: linear-gradient(135deg, #ffd86b 0%, #f6c343 100%);
  box-shadow: 0 2px 10px rgba(246, 195, 67, 0.35);
}

.app-page {
  padding: 14px 16px !important;
  gap: 10px !important;
}

.app-page .page-intro {
  margin-bottom: 0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(88, 101, 242, 0.2);
  border-bottom: 1px solid rgba(88, 101, 242, 0.2);
  background: radial-gradient(ellipse at top left, rgba(88, 101, 242, 0.12) 0%, rgba(30, 31, 34, 0.4) 55%);
  gap: 6px;
}

.app-page .page-intro__title {
  font-size: var(--fs-lg);
  letter-spacing: -0.3px;
}

.app-page .page-intro__desc,
.app-page .page-intro > p {
  font-size: var(--fs-xs);
  max-width: 52ch;
}

.app-page .app-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 8px;
}

.app-page .app-section-head h3 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
}

.app-page .app-section-head p {
  margin: 0;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

.app-banner {
  position: relative;
  overflow: hidden;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-normal);
  background: var(--bg-secondary-alt);
  margin-bottom: 10px;
}

.app-banner--premium {
  border-color: var(--accent);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.app-banner--premium::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.app-banner__inner {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-banner__title {
  font-weight: var(--font-weight-semibold);
  margin-bottom: 3px;
  font-size: var(--fs-sm);
}

.app-banner__meta {
  font-size: var(--fs-xxs);
  line-height: 1.4;
}

.app-banner--premium .app-banner__title,
.app-banner--premium .app-banner__meta {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.app-banner--free .app-banner__title {
  color: var(--text-strong);
}

.app-banner--free .app-banner__meta {
  color: var(--text-muted);
}

.app-banner__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.app-promo-link {
  display: block;
  text-decoration: none;
  margin-bottom: 10px;
}

.app-promo-card {
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.15) 0%, rgba(139, 92, 246, 0.12) 100%);
  border: 1px solid rgba(88, 101, 242, 0.45);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.15s ease;
}

.app-promo-link:hover .app-promo-card {
  transform: translateY(-1px);
  border-color: var(--brand-500, var(--accent));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.app-promo-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

.app-promo-card__body {
  flex: 1;
  min-width: 0;
}

.app-promo-card__title {
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-strong);
  margin-bottom: 2px;
}

.app-promo-card__title .pill {
  margin-left: 6px;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  padding: 2px 7px;
}

.app-promo-card__desc {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  line-height: 1.45;
}

.app-promo-card__arrow {
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
}

.app-page .utilities-grid {
  gap: 10px;
  margin-bottom: 8px;
}

.app-page .tool-card-tile {
  padding: 12px 14px;
  border-radius: 10px;
}

.app-page .tool-card-tile__icon {
  width: 32px;
  height: 32px;
  font-size: 18px;
  border-radius: 8px;
}

.app-page .tool-card-tile__title {
  font-size: var(--fs-sm);
}

.app-page .tool-card-tile__desc {
  font-size: var(--fs-xxs);
  line-height: 1.35;
}

.app-page .tool-card-tile__cta {
  margin-top: 8px;
  font-size: var(--fs-xxs);
}

.app-page .tool-card,
.app-page .settings-panel,
.app-page .warning-box {
  border-radius: var(--radius-md);
}

.app-page .account-card {
  padding: 10px !important;
  min-height: 120px !important;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%), var(--bg-secondary-alt);
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.app-page .account-card:hover {
  border-color: rgba(88, 101, 242, 0.4);
  transform: translateY(-1px);
}

.app-page .account-card--selected {
  border-color: rgba(88, 101, 242, 0.75) !important;
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.35), 0 8px 20px rgba(0, 0, 0, 0.22);
  opacity: 1 !important;
}

.app-page .account-card:not(.account-card--selected) {
  opacity: 0.72;
}

.app-page .accounts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 640px) {
  .app-subnav-wrap { padding: 0 8px; margin-bottom: 8px; }
  .app-quick-nav { padding: 6px 8px; gap: 5px; }
  .app-quick-nav__link { padding: 4px 8px; font-size: 11px; }
  .app-page { padding: 12px !important; }
  .app-banner__inner { flex-direction: column; align-items: flex-start; }
}

/* 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; }
}

/* ── Hoster (list + terminal) ─────────────────────────────────────────── */
.hoster-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.hoster-page .page-intro {
  margin-bottom: 0;
}

.hoster-page .page-intro__desc {
  margin: 0;
  max-width: 62ch;
}

.hoster-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-secondary-alt);
}

.hoster-toolbar__lead {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 200px;
  min-width: 0;
}

.hoster-back {
  flex-shrink: 0;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-normal);
  background: var(--bg-primary);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.hoster-back:hover {
  color: var(--text-default);
  border-color: rgba(88, 101, 242, 0.45);
}

.hoster-toolbar__title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hoster-status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--fs-xxs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.hoster-status.s-running {
  background: var(--text-feedback-positive);
  color: #fff;
}

.hoster-status.s-stopped {
  background: var(--bg-primary);
  color: var(--text-muted);
  border: 1px solid var(--border-normal);
}

.hoster-status.s-error {
  background: var(--text-feedback-critical);
  color: #fff;
}

.hoster-statbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  flex: 1 1 100%;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

.hoster-statbar .stat-chip {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-normal);
  white-space: nowrap;
}

.hoster-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.hoster-toolbar__actions .btn {
  padding: 6px 12px;
  font-size: var(--fs-xs);
}

.hoster-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  min-height: min(68vh, 680px);
}

.hoster-panel {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  min-width: 0;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-secondary-alt);
  overflow: hidden;
}

.hoster-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-normal);
  background: rgba(0, 0, 0, 0.12);
}

.hoster-panel__head strong {
  font-size: var(--fs-xs);
  color: var(--text-default);
  font-weight: var(--font-weight-semibold);
}

.hoster-panel__meta {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

.hoster-panel__foot {
  padding: 8px 12px;
  border-top: 1px solid var(--border-normal);
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  line-height: 1.45;
}

.hoster-panel__foot code {
  font-size: 0.95em;
}

.code-editor {
  flex: 1 1 auto;
  width: 100%;
  min-height: 240px;
  margin: 0;
  padding: 12px 14px;
  border: none;
  resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-default);
  background: var(--bg-primary);
  tab-size: 4;
}

.code-editor:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(88, 101, 242, 0.35);
}

.code-editor:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.term {
  flex: 1 1 auto;
  min-height: 240px;
  overflow: auto;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #d4d7dc;
  background: #0c0d10;
  white-space: pre-wrap;
  word-break: break-word;
}

.term .ln-err {
  color: #f87171;
}

.term .ln-sys {
  color: #94a3b8;
}

.stdin-row {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border-normal);
  background: var(--bg-primary);
}

.stdin-row input {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary-alt);
  color: var(--text-default);
  font-family: ui-monospace, monospace;
  font-size: var(--fs-xs);
}

.stdin-row input:disabled {
  opacity: 0.55;
}

.stdin-row .btn {
  flex-shrink: 0;
  padding: 6px 12px;
  font-size: var(--fs-xs);
}

.hoster-accordion {
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-secondary-alt);
  overflow: hidden;
}

.hoster-accordion summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-default);
  list-style: none;
}

.hoster-accordion summary::-webkit-details-marker {
  display: none;
}

.hoster-accordion__body {
  padding: 0 14px 14px;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  line-height: 1.55;
}

.hoster-accordion__body p {
  margin: 0 0 10px;
}

.hoster-accordion__row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.hoster-accordion__row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-default);
  font-family: ui-monospace, monospace;
  font-size: var(--fs-xs);
}

.hoster-danger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid rgba(237, 66, 69, 0.35);
  border-radius: var(--radius-md);
  background: rgba(237, 66, 69, 0.06);
}

.hoster-danger__text {
  margin: 0;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

/* Hoster list page */
.hoster-tier-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-normal);
  background: var(--bg-secondary-alt);
  position: relative;
  overflow: hidden;
}

.hoster-tier-card.is-premium {
  border-color: var(--accent);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.hoster-tier-card.is-premium::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.hoster-tier-card__inner {
  position: relative;
  z-index: 1;
}

.hoster-tier-card__title {
  font-weight: var(--font-weight-semibold);
  font-size: var(--fs-sm);
  margin-bottom: 4px;
}

.hoster-tier-card.is-premium .hoster-tier-card__title,
.hoster-tier-card.is-premium .hoster-tier-card__stats,
.hoster-tier-card.is-premium .hoster-tier-card__upgrade {
  color: rgba(255, 255, 255, 0.95);
}

.hoster-tier-card__stats {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  line-height: 1.65;
}

.hoster-tier-card__upgrade {
  margin-top: 8px;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

.hoster-create-card {
  padding: 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-secondary-alt);
}

.hoster-create-card h3 {
  margin: 0 0 10px;
  font-size: var(--fs-sm);
  color: var(--text-default);
}

.hoster-create-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hoster-create-row .form-input {
  flex: 1;
  min-width: 200px;
}

.hoster-bot-list {
  display: grid;
  gap: 8px;
}

.hoster-bot-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary-alt);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
}

.hoster-bot-row__main {
  flex: 1;
  min-width: 0;
}

.hoster-bot-row__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.hoster-bot-row__name {
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hoster-bot-row__meta {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

.hoster-bot-row__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 960px) {
  .hoster-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hoster-panel {
    min-height: 220px;
  }

  .code-editor,
  .term {
    min-height: 200px;
  }
}

@media (max-width: 640px) {
  .hoster-toolbar__actions {
    width: 100%;
    margin-left: 0;
  }

  .hoster-toolbar__actions .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }

  .hoster-bot-row {
    flex-wrap: wrap;
  }

  .hoster-bot-row__actions {
    width: 100%;
  }

  .hoster-bot-row__actions .btn {
    flex: 1;
  }
}

/* Reddit forwarder — Discord webhook pin */
.reddit-webhook-picker {
  position: relative;
}

.reddit-webhook-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 0;
}

.reddit-webhook-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(88, 101, 242, 0.45);
  background: var(--bg-primary);
  max-width: 100%;
}

.reddit-webhook-chip.is-loading {
  opacity: 0.75;
}

.reddit-webhook-chip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary, #2b2d31);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reddit-webhook-chip__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reddit-webhook-chip__avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #7289da 0%, #5865f2 100%);
  color: #fff;
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
}

.reddit-webhook-chip__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.reddit-webhook-chip__name {
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
}

.reddit-webhook-chip__title {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

/* Reddit forwarder — subreddit search picker */
.reddit-sub-picker {
  position: relative;
}

.reddit-sub-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 0;
}

.reddit-sub-empty {
  margin: 0;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

.reddit-sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-normal);
  background: var(--bg-primary);
  max-width: 100%;
}

.reddit-sub-chip.is-missing {
  border-color: rgba(237, 66, 69, 0.45);
}

.reddit-sub-chip__avatar,
.reddit-sub-result__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary, #2b2d31);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reddit-sub-result__avatar {
  width: 40px;
  height: 40px;
}

.reddit-sub-chip__avatar-img,
.reddit-sub-result__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reddit-sub-chip__avatar-fallback,
.reddit-sub-result__avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #ff5700 0%, #ff4500 100%);
  color: #fff;
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
}

.reddit-sub-result__avatar-fallback {
  font-size: 16px;
}

.reddit-sub-chip__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.reddit-sub-chip__name {
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
}

.reddit-sub-chip__title {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.reddit-sub-chip__remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.reddit-sub-chip__remove:hover {
  color: var(--text-feedback-critical);
  background: rgba(237, 66, 69, 0.12);
}

.reddit-sub-search-wrap {
  position: relative;
}

.reddit-sub-results {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-secondary-alt);
  box-shadow: var(--shadow-md);
}

.reddit-sub-results__empty {
  padding: 12px 14px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.reddit-sub-results__error {
  color: var(--danger, #f87171);
}

.reddit-sub-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid var(--border-normal);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.12s ease;
}

.reddit-sub-result:last-child {
  border-bottom: none;
}

.reddit-sub-result:hover {
  background: rgba(255, 255, 255, 0.05);
}

.reddit-sub-result.is-picked {
  opacity: 0.55;
  cursor: default;
}

.reddit-sub-result__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.reddit-sub-result__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.reddit-sub-result__name {
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.reddit-sub-result__title {
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
}

.reddit-sub-result__meta {
  flex-shrink: 0;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  white-space: nowrap;
}

.reddit-sub-nsfw {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  color: #fff;
  background: #e53935;
  vertical-align: middle;
}

/* Reddit forwarder — keyword chips */
.reddit-kw-picker {
  position: relative;
}

.reddit-kw-hint {
  margin: 0 0 8px;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  line-height: 1.4;
}

.reddit-kw-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 0;
}

.reddit-kw-empty {
  margin: 0;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
}

.reddit-kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 6px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.08);
  max-width: 100%;
}

.reddit-kw-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
  color: #fff;
  font-size: 14px;
  font-weight: var(--font-weight-semibold);
  line-height: 1;
}

.reddit-kw-chip__label {
  font-size: var(--fs-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-default);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.reddit-kw-chip__remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}

.reddit-kw-chip__remove:hover {
  color: var(--text-feedback-critical);
  background: rgba(237, 66, 69, 0.12);
}

/* Reddit forwarder page layout */
.reddit-forwarder-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reddit-forwarder-setup .form-group {
  margin-bottom: 12px;
}

.reddit-forwarder-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  margin-bottom: 14px;
}

.reddit-forwarder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reddit-forwarder-actions .btn {
  min-height: 40px;
}

.reddit-forwarder-status {
  margin: 12px 0 0;
  font-size: var(--fs-xxs);
  color: var(--text-muted);
  line-height: 1.5;
}

.reddit-forwarder-status .is-active {
  color: var(--text-feedback-positive);
}

.reddit-forwarder-status .is-error {
  color: var(--text-feedback-critical);
}

.reddit-deliveries {
  margin-top: 4px;
}

/* Same row layout as desktop — undo global hoster mobile stacking */
@media (max-width: 640px) {
  .reddit-forwarder-page .hoster-bot-row {
    flex-wrap: nowrap;
    align-items: center;
  }

  .reddit-forwarder-page .hoster-bot-row > .btn {
    width: auto;
    flex: 0 0 auto;
    margin-top: 0;
  }
}

