:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --ink: #111827;
  --muted: #5b6474;
  --surface: rgba(255, 255, 255, 0.88);
  --line: rgba(228, 231, 239, 0.92);
  --primary-purple: #7c3aed;
  --dark-purple: #4c1d95;
  --accent-purple: #a78bfa;
  --cyan: #22d3ee;
  --shadow: 0 18px 45px rgba(30, 27, 75, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.08), transparent 26rem), var(--bg);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 58, 237, 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

button, input, select, textarea { font: inherit; }

button {
  border: 0;
  border-radius: 0.75rem;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.hidden { display: none !important; }

.landing-page {
  min-height: 100vh;
  padding: 1.1rem clamp(1rem, 4vw, 4rem) 2.5rem;
}

.landing-nav {
  position: sticky;
  top: 0.75rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.8rem;
  background: rgba(17, 24, 39, 0.84);
  backdrop-filter: blur(18px);
}

.landing-brand {
  margin: 0;
}

.landing-brand strong {
  color: white;
}

.landing-brand small {
  color: rgba(255, 255, 255, 0.72);
}

.landing-page .muted,
.landing-page .api-status {
  color: var(--muted);
}

.nav-pill {
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.22);
  color: white;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 850;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.invite-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #7a5af8, #a78bfa);
  color: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(122, 90, 248, 0.25);
  transition: transform .2s ease, filter .2s ease;
}

.invite-button:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  max-width: 1180px;
  min-height: calc(100vh - 18rem);
  margin: 0 auto;
  padding: clamp(2rem, 8vh, 5.2rem) 0 2rem;
}

.hero-copy {
  max-width: 710px;
}

.hero-copy h1 {
  max-width: 820px;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.92;
}

.hero-lead {
  max-width: 650px;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.6vw, 1.22rem);
  line-height: 1.65;
  margin: 1.2rem 0 0;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  max-width: 690px;
  margin-top: 1.5rem;
}

.hero-metrics div {
  border-left: 3px solid var(--cyan);
  background: rgba(255, 255, 255, 0.62);
  padding: 0.85rem 0.95rem;
}

.hero-metrics strong,
.hero-metrics span {
  display: block;
}

.hero-metrics strong {
  font-size: 1.05rem;
}

.hero-metrics span {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 0.15rem;
}

.landing-login {
  border: 1px solid rgba(228, 231, 239, 0.95);
  border-radius: 0.8rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.86)),
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.16), transparent 16rem);
  box-shadow: 0 26px 70px rgba(30, 27, 75, 0.16);
  padding: clamp(1.1rem, 3vw, 1.55rem);
}

.landing-login p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0.55rem 0 0;
}

.landing-login .discord-button {
  width: 100%;
  margin: 0;
}

.landing-api {
  border-color: rgba(124, 58, 237, 0.16);
  background: rgba(246, 247, 251, 0.9);
  margin: 1rem 0;
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  max-width: 1180px;
  margin: 0 auto;
}

.landing-cards article {
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 38px rgba(30, 27, 75, 0.08);
  padding: 1rem;
}

.landing-cards span {
  color: var(--primary-purple);
  font-size: 0.78rem;
  font-weight: 900;
}

.landing-cards h3 {
  margin: 0.55rem 0 0.35rem;
}

.landing-cards p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  color: white;
  padding: 1.15rem;
  overflow-y: auto;
  background:
    radial-gradient(circle at 15% 0%, rgba(167, 139, 250, 0.32), transparent 18rem),
    linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(76, 29, 149, 0.94));
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.15rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 24px rgba(124, 58, 237, 0.35);
  overflow: hidden;
  padding: 0.18rem;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand strong, .brand small, .guild-button strong, .guild-button small { display: block; }
.brand small, .muted, .sidebar label, .sidebar .server-list-header, .api-status { color: rgba(255, 255, 255, 0.74); }

.discord-button, .ghost {
  width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.78rem 0.9rem;
}

.discord-button, .section-heading button, .small-button {
  background: linear-gradient(135deg, #7a5af8, #a78bfa);
  color: white;
  box-shadow: 0 16px 34px rgba(122, 90, 248, 0.3);
}

.ghost, .icon-button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.api-box {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.85rem;
  margin: 0.85rem 0 1.15rem;
}

.api-status {
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 0.55rem 0 0;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.field-group {
  display: grid;
  gap: 0.45rem;
}

.field-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.hidden-native-select {
  display: none;
}

.field-note {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  padding: 0.72rem 0.78rem;
}

textarea {
  resize: vertical;
}

select[multiple] {
  min-height: 7.8rem;
}

.role-checklist {
  display: grid;
  gap: 0.35rem;
  max-height: 16rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(246, 247, 251, 0.52);
  padding: 0.45rem;
}

.role-checklist.compact {
  max-height: 13rem;
}

.role-check {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: transparent;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
}

.role-check:hover {
  border-color: rgba(124, 58, 237, 0.22);
  background: rgba(255, 255, 255, 0.86);
}

.role-check input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary-purple);
}

.role-check strong,
.role-check small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-check strong {
  color: var(--ink);
  font-size: 0.84rem;
}

.role-check small {
  color: var(--muted);
  font-size: 0.72rem;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.45);
}

.server-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.65rem;
}

.icon-button { padding: 0.45rem 0.6rem; }
.guild-list { display: grid; gap: 0.55rem; }

.guild-button {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: white;
  padding: 0.65rem;
  text-align: left;
}

.guild-button:hover, .guild-button.active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
}

.guild-icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.13);
  overflow: hidden;
  font-weight: 850;
}

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

.guild-button strong, .guild-button small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.guild-button small {
  color: rgba(255, 255, 255, 0.64);
  font-weight: 500;
}

.workspace {
  padding: clamp(1.25rem, 3vw, 2.4rem);
  overflow-x: hidden;
}

.topbar, .section-heading, .ticket-options-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  align-items: center;
  margin-bottom: 1.45rem;
}

.eyebrow {
  display: inline-flex;
  color: var(--primary-purple);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 0.35rem;
}

h1, h2, h3, p { letter-spacing: 0; }
h1, h2, h3 { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.02; }
h2 { font-size: clamp(1.45rem, 2vw, 2rem); line-height: 1.1; }
h3 { margin: 1.4rem 0 0.75rem; color: var(--ink); font-size: 1rem; }

.user-badge, .empty-state, .guild-card, .stats div, .settings-panel, .activity-panel {
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.user-badge {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  max-width: 260px;
  padding: 0.52rem 0.72rem;
  color: var(--muted);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  color: var(--primary-purple);
  overflow: hidden;
  font-weight: 900;
}

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

.user-badge strong,
.user-badge small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.user-badge small {
  color: var(--muted);
  font-size: 0.74rem;
}

.empty-state {
  max-width: 980px;
  padding: 1.5rem;
}

.empty-state p, .section-heading p, .ticket-options-head p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0.5rem 0 0;
}

.guild-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.guild-card {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 1rem;
  text-align: left;
  box-shadow: 0 12px 32px rgba(30, 27, 75, 0.08);
}

.guild-card:hover,
.guild-card.active {
  border-color: rgba(124, 58, 237, 0.34);
  background: rgba(255, 255, 255, 0.98);
}

.guild-card-icon {
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.8rem;
  background: rgba(124, 58, 237, 0.1);
  color: var(--primary-purple);
  overflow: hidden;
  font-weight: 900;
}

.guild-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guild-card-copy strong,
.guild-card-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guild-card-copy strong {
  color: var(--ink);
  font-size: 1rem;
}

.guild-card-copy small,
.dashboard-muted {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.guild-card-action {
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.1);
  color: var(--primary-purple);
  padding: 0.42rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 900;
}

.dashboard {
  display: grid;
  gap: 1.25rem;
  max-width: 1180px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.stats div {
  padding: 1.05rem 1.15rem;
  box-shadow: 0 12px 32px rgba(30, 27, 75, 0.08);
}
.stats span { display: block; font-size: 1.85rem; font-weight: 900; }
.stats small { color: var(--muted); }
.settings-panel {
  padding: clamp(1.1rem, 2vw, 1.55rem);
}
.section-heading {
  align-items: center;
  margin-bottom: 1.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(228, 231, 239, 0.86);
}

.section-heading button, .actions button, .small-button {
  padding: 0.72rem 0.9rem;
  white-space: nowrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.settings-layout {
  display: grid;
  gap: 1.4rem;
}

.settings-nav {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.settings-tab {
  border-radius: 999px;
  border: 1px solid rgba(124, 58, 237, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 850;
  white-space: nowrap;
  box-shadow: none;
}

.settings-tab:hover,
.settings-tab.active {
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.28);
  color: var(--primary-purple);
}

.settings-sections {
  min-height: 28rem;
}

.setup-section {
  display: none;
  scroll-margin-top: 1rem;
}

.setup-section.active {
  display: block;
  animation: section-in 0.16s ease;
}

@keyframes section-in {
  from {
    opacity: 0;
    transform: translateY(0.35rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.setup-section-head {
  max-width: 720px;
  margin-bottom: 1.1rem;
}

.setup-section h3 {
  margin-top: 0;
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.wide-field {
  grid-column: 1 / -1;
}

.ticket-options-head {
  align-items: end;
  margin-bottom: 0.9rem;
}

.ticket-types-list { display: grid; gap: 0.75rem; }

.ticket-type-row {
  display: grid;
  grid-template-columns: 0.8fr 1.1fr 1.4fr 0.55fr 0.8fr auto;
  gap: 0.7rem;
  align-items: end;
  border: 1px solid rgba(228, 231, 239, 0.9);
  border-radius: 0.75rem;
  background: rgba(246, 247, 251, 0.66);
  padding: 0.85rem;
}

.remove-ticket-type {
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.12);
  color: #be123c;
  padding: 0.72rem 0.8rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 0.8rem;
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(228, 231, 239, 0.86);
}

.actions button.secondary {
  background: linear-gradient(135deg, #5b4be8, #22d3ee);
  color: white;
  box-shadow: 0 16px 34px rgba(91, 75, 232, 0.24);
}

code {
  color: var(--primary-purple);
  white-space: pre-wrap;
  word-break: break-word;
}

.command-details {
  min-width: min(100%, 28rem);
  color: var(--muted);
  font-size: 0.82rem;
}

.command-details summary {
  cursor: pointer;
  color: var(--primary-purple);
  font-weight: 900;
  padding: 0.7rem 0;
}

.command-details code {
  display: block;
  border: 1px solid rgba(124, 58, 237, 0.14);
  border-radius: 0.65rem;
  background: rgba(124, 58, 237, 0.06);
  padding: 0.75rem;
}

.activity-panel {
  max-width: 1180px;
  padding: 1rem 1.15rem;
  box-shadow: 0 12px 32px rgba(30, 27, 75, 0.08);
}

.activity-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.activity-head h3 {
  margin: 0;
}

.activity-head p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0.35rem 0 0;
}

.status-pill {
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  color: #0e7490;
  padding: 0.4rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.error {
  background: rgba(251, 113, 133, 0.14);
  color: #be123c;
}

.debug-details {
  margin-top: 0.9rem;
}

.debug-details summary {
  color: var(--primary-purple);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

pre {
  max-height: 22rem;
  margin: 0.75rem 0 0;
  overflow: auto;
  border: 1px solid rgba(124, 58, 237, 0.14);
  border-radius: 0.65rem;
  background: rgba(17, 24, 39, 0.96);
  color: #dbeafe;
  padding: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1100px) {
  .ticket-type-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .landing-nav {
    align-items: flex-start;
    flex-direction: column;
  }
  .landing-hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .hero-copy h1 {
    font-size: clamp(2.6rem, 15vw, 4.4rem);
  }
  .hero-metrics,
  .landing-cards {
    grid-template-columns: 1fr;
  }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; }
  .settings-nav {
    margin-inline: -0.2rem;
  }
  .topbar, .section-heading, .ticket-options-head, .actions {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .stats, .form-grid, .guild-card-grid, .ticket-type-row { grid-template-columns: 1fr; }
  .guild-card {
    grid-template-columns: 3rem minmax(0, 1fr);
  }
  .guild-card-action {
    grid-column: 1 / -1;
    justify-self: start;
  }
}
