:root {
  --bg: #0b1020;
  --bg-soft: #131a2f;
  --panel: rgba(18, 25, 47, 0.88);
  --panel-strong: #171f39;
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --text-soft: #acb7d3;
  --text-faint: #7d89ab;
  --accent: #5b7cff;
  --accent-2: #4ad0b8;
  --danger: #ff6b8b;
  --warning: #ffcf66;
  --success: #56d98d;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(91, 124, 255, 0.24), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(74, 208, 184, 0.18), transparent 28%),
    linear-gradient(180deg, #0b1020, #070b16 55%, #090f1d);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black 45%, transparent 95%);
  opacity: 0.35;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

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

.login-body {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.dashboard-body {
  padding: 1.5rem;
}

.app-shell {
  position: relative;
  display: flex;
  gap: 1.5rem;
  min-height: calc(100vh - 3rem);
}

.sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.4rem;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: rgba(13, 18, 34, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar-brand,
.sidebar-guild,
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.sidebar-brand__logo,
.sidebar-guild__fallback {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #7f98ff);
  color: white;
}

.sidebar-brand__title {
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-brand__subtitle,
.sidebar-guild__meta,
.topbar__eyebrow,
.section-header__eyebrow,
.status-card__label,
.login-hint,
.table-meta {
  color: var(--text-faint);
  font-size: 0.85rem;
}

.setup-warning {
  margin: 1rem 0 1.2rem;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 207, 102, 0.28);
  background: rgba(255, 207, 102, 0.08);
}

.setup-warning h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

.setup-warning p {
  margin: 0 0 0.65rem;
}

.setup-warning code {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.24);
  color: #ffe9b1;
}

.sidebar-guild {
  padding: 0.85rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-guild img,
.topbar-user img,
.guild-card__header img {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  object-fit: cover;
}

.sidebar-nav {
  display: grid;
  gap: 0.35rem;
}

.sidebar-link {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  color: var(--text-soft);
  transition: 0.2s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: var(--text);
  background: rgba(91, 124, 255, 0.16);
}

.sidebar-link.disabled {
  opacity: 0.45;
}

.sidebar-footer {
  margin-top: auto;
}

.sidebar-link--logout {
  color: #ffc4d0;
}

.main-shell {
  flex: 1;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--panel-border);
  border-radius: 26px;
  background: rgba(14, 20, 39, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar__title {
  margin: 0.2rem 0 0;
  font-size: 1.7rem;
  line-height: 1.15;
}

.topbar-user {
  padding: 0.55rem 0.7rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.topbar-user__name {
  font-weight: 700;
}

.page-content {
  display: grid;
  gap: 1.3rem;
}

.flash-stack {
  display: grid;
  gap: 0.85rem;
}

.flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 24, 44, 0.92);
}

.flash--success {
  border-color: rgba(86, 217, 141, 0.28);
}

.flash--error {
  border-color: rgba(255, 107, 139, 0.28);
}

.flash--warning {
  border-color: rgba(255, 207, 102, 0.28);
}

.flash__title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.flash__message {
  color: var(--text-soft);
}

.flash__close,
.sidebar-toggle {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 1.4rem;
}

.sidebar-toggle {
  display: none;
}

.panel,
.hero-card,
.status-card,
.login-card,
.info-card,
.guild-card,
.item-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel {
  padding: 1.4rem;
}

.settings-hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr auto;
  gap: 1rem;
  align-items: center;
  background:
    radial-gradient(circle at top right, rgba(91, 124, 255, 0.2), transparent 32%),
    linear-gradient(145deg, rgba(18, 25, 47, 0.96), rgba(10, 16, 32, 0.88));
}

.settings-hero__content h2 {
  margin: 0.25rem 0 0.55rem;
}

.settings-hero__content p {
  margin: 0;
  max-width: 64ch;
  color: var(--text-soft);
}

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

.settings-mini-card {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
}

.settings-mini-card span {
  display: block;
  color: var(--text-faint);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.settings-mini-card strong {
  display: block;
  font-size: 1rem;
}

.settings-form {
  gap: 1.25rem;
}

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

.settings-panel {
  padding: 1.5rem;
}

.settings-panel--roles {
  grid-column: 1 / -1;
}

.settings-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-panel__header h3 {
  margin: 0.2rem 0 0;
  font-size: 1.15rem;
}

.settings-panel__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(91, 124, 255, 0.18);
  color: #dce3ff;
  font-size: 0.82rem;
  font-weight: 700;
}

.settings-panel__badge--mint {
  background: rgba(74, 208, 184, 0.16);
  color: #d4fff6;
}

.settings-panel__badge--rose {
  background: rgba(255, 107, 139, 0.14);
  color: #ffd8e2;
}

.panel--centered {
  max-width: 720px;
  margin: 0 auto;
}

.hero-grid,
.split-grid,
.guild-grid,
.card-list,
.form-grid,
.toggle-grid,
.filter-grid {
  display: grid;
  gap: 1rem;
}

.hero-grid {
  grid-template-columns: 2fr repeat(2, minmax(0, 1fr));
}

.hero-grid--tight {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.split-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.status-card,
.hero-card {
  padding: 1.4rem;
}

.hero-card h2,
.section-header h2 {
  margin: 0.2rem 0 0.4rem;
}

.hero-card p,
.empty-state p,
.guild-card p,
.info-card p {
  color: var(--text-soft);
}

.status-card__value {
  font-size: 2rem;
  font-weight: 800;
  margin: 0.35rem 0;
}

.status-card__value.online {
  color: var(--success);
}

.status-card__value.offline {
  color: var(--danger);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button-row--right {
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 0.8rem 1.1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent), #768ffb);
  color: white;
}

.button--discord {
  background: linear-gradient(135deg, #5865f2, #7a86ff);
  color: white;
}

.button--danger {
  background: rgba(255, 107, 139, 0.12);
  border-color: rgba(255, 107, 139, 0.3);
  color: #ffd4df;
}

.button--ghost {
  border-color: rgba(255, 255, 255, 0.08);
}

.button--large {
  min-height: 56px;
  padding-inline: 1.6rem;
}

.button--small {
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
}

.button--block {
  width: 100%;
}

.stack-form {
  display: grid;
  gap: 1rem;
}

.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.field-hint {
  color: var(--text-faint);
  font-size: 0.82rem;
  line-height: 1.45;
}

.field-hint code {
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

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

.field--checkbox {
  align-self: end;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 52px;
}

.field--checkbox-card {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.field--actions {
  display: flex;
  align-items: end;
}

.field span {
  color: var(--text-soft);
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(6, 10, 24, 0.55);
  color: var(--text);
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(91, 124, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(91, 124, 255, 0.16);
}

.toggle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toggle-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-card input {
  width: 18px;
  height: 18px;
}

.guild-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.role-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  max-height: 280px;
  overflow: auto;
  padding: 0.2rem;
  margin-top: 0.25rem;
}

.role-picker__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.035);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  cursor: pointer;
}

.role-picker__item:hover {
  transform: translateY(-1px);
  border-color: rgba(91, 124, 255, 0.28);
  background: rgba(91, 124, 255, 0.08);
}

.role-picker__item input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}

.role-picker__swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--role-color, #99aab5);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--role-color, #99aab5) 22%, transparent);
  flex-shrink: 0;
}

.role-picker__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(5, 9, 22, 0.42);
}

.selection-preview__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--badge-color, #5b7cff) 18%, rgba(255, 255, 255, 0.05));
  border: 1px solid color-mix(in srgb, var(--badge-color, #5b7cff) 35%, rgba(255, 255, 255, 0.08));
}

.selection-preview__empty {
  color: var(--text-faint);
}

.settings-savebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(91, 124, 255, 0.12), rgba(74, 208, 184, 0.08));
}

.settings-savebar__title {
  font-weight: 700;
  margin-bottom: 0.18rem;
}

.settings-savebar__text {
  color: var(--text-soft);
}

.guild-card,
.item-card {
  padding: 1.2rem;
}

.guild-card__header {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 1rem;
}

.guild-card__fallback {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(91, 124, 255, 0.18);
  font-weight: 800;
}

.guild-card--wide {
  min-height: 210px;
}

.inline-form {
  display: flex;
  gap: 0.75rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.tag-form {
  margin: 0;
}

.tag-badge {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.tag-badge--danger {
  border-color: rgba(255, 107, 139, 0.28);
  color: #ffd6df;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--text-soft);
  font-weight: 600;
}

.filter-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
}

.empty-state h2,
.empty-state h3 {
  margin-top: 0;
}

.login-hero {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.3rem;
}

.login-card {
  padding: 2rem;
}

.login-card h1 {
  margin: 0.5rem 0 1rem;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
}

.login-card p {
  margin-bottom: 1.3rem;
  color: var(--text-soft);
  font-size: 1.02rem;
}

.login-badge {
  display: inline-flex;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(91, 124, 255, 0.18);
  color: #cfd8ff;
  font-size: 0.85rem;
}

.login-features {
  display: grid;
  gap: 1rem;
}

.info-card {
  padding: 1.35rem;
}

.info-card h3 {
  margin-top: 0;
}

@media (max-width: 1180px) {
  .hero-grid,
  .hero-grid--tight,
  .split-grid,
  .login-hero,
  .toggle-grid,
  .form-grid,
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-hero {
    grid-template-columns: 1fr;
  }

  .settings-hero__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .dashboard-body {
    padding: 1rem;
  }

  .app-shell {
    min-height: calc(100vh - 2rem);
  }

  .sidebar {
    position: fixed;
    inset: 1rem auto 1rem 1rem;
    transform: translateX(-120%);
    z-index: 20;
    max-width: calc(100vw - 2rem);
    transition: transform 0.2s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .topbar {
    align-items: flex-start;
    padding: 1rem;
  }

  .topbar-user {
    display: none;
  }

  .hero-grid,
  .hero-grid--tight,
  .split-grid,
  .login-hero,
  .toggle-grid,
  .form-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    flex-direction: column;
  }

  .settings-hero__stats,
  .settings-savebar,
  .role-picker {
    grid-template-columns: 1fr;
  }

  .settings-savebar {
    align-items: stretch;
  }
}
