:root {
  --bg: #000000;
  --bg-elevated: #0e0f0d;
  --surface: #151714;
  --surface-2: #1c1f19;
  --surface-3: #242821;
  --text: #f1f4ea;
  --text-2: #a8b09c;
  --text-3: #6f7866;
  --green: #94d82a;
  --green-bright: #a8e63d;
  --green-soft: rgba(148, 216, 42, 0.14);
  --green-soft-2: rgba(148, 216, 42, 0.22);
  --green-ring: rgba(148, 216, 42, 0.35);
  --danger: #ea4335;
  --warn: #fbbc04;
  --info: #8ab4f8;
  --line: rgba(241, 244, 234, 0.08);
  --line-2: rgba(148, 216, 42, 0.22);
  --radius: 24px;
  --radius-sm: 16px;
  --radius-pill: 999px;
  --display: "Figtree", "Roboto", system-ui, sans-serif;
  --sans: "Roboto", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 80% at 50% -10%, #12180e 0%, var(--bg) 55%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}
.glow-a {
  width: min(60vw, 640px);
  height: min(60vw, 640px);
  left: -12%;
  top: -18%;
  background: rgba(148, 216, 42, 0.22);
  animation: drift 18s var(--ease) infinite alternate;
}
.glow-b {
  width: min(40vw, 420px);
  height: min(40vw, 420px);
  right: -8%;
  bottom: 10%;
  background: rgba(148, 216, 42, 0.1);
  animation: drift 22s var(--ease) infinite alternate-reverse;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(3%, 4%) scale(1.05); }
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100dvh;
}

/* —— Sidebar —— */
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.35rem 1rem 1.1rem;
  background: rgba(0, 0, 0, 0.55);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.45rem;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: contain;
  background: #000;
  box-shadow: 0 0 0 1px var(--green-ring);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.brand-text strong {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.brand-text small {
  color: var(--text-3);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.side-nav a {
  display: block;
  padding: 0.72rem 0.95rem;
  border-radius: var(--radius-pill);
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.side-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.side-nav a.active {
  color: var(--green-bright);
  background: var(--green-soft);
  font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.foot-label {
  margin: 0 0 0.55rem;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.foot-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.25rem;
  border-radius: 12px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.86rem;
  transition: background 0.2s, color 0.2s;
}
.foot-link:hover {
  background: var(--green-soft);
  color: var(--green-bright);
}
.foot-link em {
  font-style: normal;
  font-size: 0.68rem;
  color: var(--green);
  letter-spacing: 0.04em;
}

/* —— Main —— */
.main {
  padding: clamp(1.25rem, 3.5vw, 2.75rem);
  padding-bottom: calc(2.75rem + var(--safe-b));
  max-width: 1180px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) 1.15fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  min-height: min(52vh, 440px);
  margin-bottom: 2.25rem;
  padding: 0.5rem 0 2rem;
  border-bottom: 1px solid var(--line);
}

.hero-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 280px;
  animation: rise 0.8s var(--ease) both;
}

.hero-logo {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 48px rgba(148, 216, 42, 0.25));
  animation: float 6s var(--ease) infinite;
}

.hero-ring {
  position: absolute;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--green-soft-2) 0%, transparent 68%);
  border: 1px solid var(--green-ring);
  animation: pulse 5s var(--ease) infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.hero-copy {
  animation: rise 0.85s var(--ease) 0.08s both;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.8rem, 7vw, 4.6rem);
  letter-spacing: -0.055em;
  line-height: 0.95;
  color: var(--text);
}

.lede {
  margin: 1rem 0 0;
  max-width: 34ch;
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.env-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--green-ring);
  background: var(--green-soft);
  color: var(--green-bright);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.server-switch {
  margin-top: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: 420px;
}
.server-hint,
.oauth-hint {
  margin: 0;
  color: var(--text-3);
  font-size: 0.78rem;
  line-height: 1.4;
}
.oauth-hint {
  margin-top: 0.65rem;
  color: #f5b7b1;
}
.guild-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.guild-field[hidden] { display: none !important; }
.guild-field select {
  appearance: none;
  width: 100%;
  min-width: min(320px, 85vw);
  padding: 0.9rem 2.4rem 0.9rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-2);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%23a8b09c'%3E%3Cpath d='M0 0l6 8 6-8z'/%3E%3C/svg%3E") right 0.95rem center no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.btn {
  border: 0;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-pill);
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  color: #000;
  background: var(--green);
  box-shadow: 0 8px 28px rgba(148, 216, 42, 0.28);
}
.btn-primary:hover:not(:disabled) {
  background: var(--green-bright);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(148, 216, 42, 0.36);
}

.btn-secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-2);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green-bright);
  background: var(--green-soft);
}

.btn-ghost {
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid transparent;
}
.module .btn-ghost {
  width: 100%;
  margin-top: auto;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--green-soft);
  color: var(--green-bright);
}
.btn-ghost.is-active {
  background: var(--green-soft-2);
  color: var(--green-bright);
  border-color: var(--green-ring);
}

/* —— Compact dashboard hero —— */
.app--dashboard .hero {
  min-height: 0;
  margin-bottom: 1.5rem;
  padding: 0.25rem 0 1.25rem;
  grid-template-columns: 120px 1fr;
  gap: 1.25rem;
}
.app--dashboard .hero-stage {
  min-height: 0;
}
.app--dashboard .hero-logo {
  width: 96px;
  animation: none;
  filter: drop-shadow(0 8px 20px rgba(148, 216, 42, 0.2));
}
.app--dashboard .hero-ring {
  width: 100%;
  opacity: 0.55;
  animation: none;
}
.app--dashboard .wordmark {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}
.app--dashboard .lede {
  margin-top: 0.45rem;
  font-size: 0.95rem;
  max-width: 42ch;
}
.app--dashboard .hero-controls {
  margin-top: 1rem;
}
.account-line {
  margin: 0.75rem 0 0;
  color: var(--text-3);
  font-size: 0.82rem;
}
.account-line a {
  color: var(--green-bright);
  text-decoration: none;
}
.account-line a:hover { text-decoration: underline; }

/* —— Login gate —— */
.login-page {
  min-height: 100dvh;
}
.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) 1.1fr;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(1.5rem, 5vw, 4rem);
  max-width: 1100px;
  margin: 0 auto;
}
.login-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(48vh, 380px);
  animation: rise 0.8s var(--ease) both;
}
.login-logo {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 48px rgba(148, 216, 42, 0.28));
  animation: float 6s var(--ease) infinite;
}
.login-ring {
  position: absolute;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--green-soft-2) 0%, transparent 68%);
  border: 1px solid var(--green-ring);
  animation: pulse 5s var(--ease) infinite;
}
.login-copy {
  animation: rise 0.85s var(--ease) 0.08s both;
}
.login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.login-error {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(234, 67, 53, 0.12);
  border: 1px solid rgba(234, 67, 53, 0.35);
  color: #f5b7b1;
  font-size: 0.9rem;
}
.login-fine {
  margin: 1.25rem 0 0;
  max-width: 40ch;
  color: var(--text-3);
  font-size: 0.82rem;
  line-height: 1.5;
}

@media (max-width: 820px) {
  .login-shell {
    grid-template-columns: 1fr;
    padding-top: 2rem;
  }
  .login-stage {
    min-height: 200px;
  }
  .login-logo {
    width: min(56vw, 220px);
  }
  .app--dashboard .hero {
    grid-template-columns: 72px 1fr;
  }
  .app--dashboard .hero-logo {
    width: 64px;
  }
}

.toolbar {
  margin-bottom: 1.15rem;
}
.toolbar h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.toolbar-meta {
  margin: 0.25rem 0 0;
  color: var(--text-3);
  font-size: 0.88rem;
}

/* —— Modules —— */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.9rem;
}

.module {
  --accent: var(--green);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 198px;
  padding: 1.15rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.55s var(--ease) forwards;
  transition: transform 0.25s var(--ease), border-color 0.25s, background 0.25s;
}
.module:hover {
  transform: translateY(-3px);
  border-color: var(--green-ring);
  background: var(--surface-2);
}

.module[data-status="active"] { --accent: var(--green); }
.module[data-status="enable"] { --accent: var(--green-bright); }
.module[data-status="soon"] { --accent: var(--text-3); }
.module[data-status="partner"] { --accent: var(--info); }
.module[data-status="premium"] { --accent: var(--warn); }

.module-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.module-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--accent);
}
.module-icon svg { width: 21px; height: 21px; }

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-3);
  border: 1px solid var(--line);
}
.badge.active {
  color: var(--green-bright);
  background: var(--green-soft);
  border-color: var(--green-ring);
}
.badge.enable {
  color: var(--green);
  background: rgba(148, 216, 42, 0.08);
  border-color: rgba(148, 216, 42, 0.25);
}
.badge.soon { color: var(--text-3); }
.badge.partner {
  color: var(--info);
  background: rgba(66, 133, 244, 0.12);
  border-color: rgba(66, 133, 244, 0.28);
}
.badge.premium {
  color: #fdd663;
  background: rgba(251, 188, 4, 0.12);
  border-color: rgba(251, 188, 4, 0.3);
}

.module h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.module p {
  margin: 0;
  color: var(--text-2);
  font-size: 0.86rem;
  flex: 1;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    text-align: center;
  }
  .hero-stage { min-height: 220px; order: -1; }
  .hero-logo { width: min(100%, 220px); }
  .lede { margin-inline: auto; }
  .hero-controls { justify-content: center; }
  .eyebrow { letter-spacing: 0.14em; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    padding: 0.8rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { flex: 1; }
  .nav-toggle { display: flex; }
  .side-nav {
    display: none;
    width: 100%;
    order: 5;
  }
  .sidebar.is-open .side-nav { display: flex; }
  .sidebar-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
