:root {
  --bg: #0b0d11;
  --panel: rgba(13, 17, 24, 0.78);
  --panel-strong: rgba(18, 23, 31, 0.92);
  --stroke: rgba(255, 255, 255, 0.09);
  --text: #f4f7fb;
  --muted: #9da8ba;
  --accent: #d4425f;
  --accent-soft: rgba(212, 66, 95, 0.18);
  --accent-cyan: #4dd7cf;
  --success: #33d17a;
  --warning: #ffcc66;
  --danger: #ff6b6b;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Sora", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(212, 66, 95, 0.22), transparent 32%),
    radial-gradient(circle at top right, rgba(77, 215, 207, 0.18), transparent 28%),
    linear-gradient(180deg, #07090d 0%, #0c1017 48%, #090b10 100%);
  overflow-x: hidden;
}

body.locked .shell {
  filter: blur(16px);
  pointer-events: none;
  user-select: none;
}

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

code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9em;
  color: #ffd7de;
}

.page-glow {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  filter: blur(50px);
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
}

.page-glow-left {
  top: -12rem;
  left: -8rem;
  background: rgba(212, 66, 95, 0.32);
}

.page-glow-right {
  right: -10rem;
  bottom: -12rem;
  background: rgba(77, 215, 207, 0.24);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 20px 56px;
  transition: filter 0.25s ease;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hidden {
  display: none !important;
}

.login-shell {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(100%, 560px);
  padding: 28px;
}

.login-card h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.login-form {
  margin-top: 22px;
}

.login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.text-input,
.primary-button,
.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.text-input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

textarea.text-input {
  min-height: 140px;
  padding: 14px 16px;
  resize: vertical;
}

select.text-input {
  appearance: none;
}

.text-input:focus {
  border-color: rgba(77, 215, 207, 0.45);
  box-shadow: 0 0 0 4px rgba(77, 215, 207, 0.12);
}

.primary-button,
.ghost-button {
  min-height: 54px;
  padding: 0 18px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

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

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

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.eyebrow,
.card-label,
.section-note {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--accent-cyan);
  font-size: 0.8rem;
  margin: 0 0 10px;
}

.card-label {
  margin: 0 0 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.95fr);
  gap: 20px;
  padding: 28px;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -55% 42%;
  height: 280px;
  background: linear-gradient(120deg, rgba(212, 66, 95, 0.18), rgba(77, 215, 207, 0.1));
  transform: rotate(-8deg);
  pointer-events: none;
}

.hero-copy,
.hero-card {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.25rem);
  line-height: 0.95;
  max-width: 10ch;
}

.hero-text {
  max-width: 60ch;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-meta,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-meta {
  margin-top: 22px;
}

.status-pill,
.hero-updated,
.section-note,
.save-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.85rem;
}

.status-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 6px rgba(255, 204, 102, 0.12);
}

.status-pill.online::before {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(51, 209, 122, 0.12);
}

.status-pill.offline::before,
.status-pill.error::before {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.12);
}

.save-note[data-tone="warning"] {
  color: #ffe49b;
}

.save-status,
.login-status {
  margin: 14px 0 0;
  color: var(--muted);
}

.save-status[data-tone="error"],
.login-status[data-tone="error"] {
  color: #ff9a9a;
}

.save-status[data-tone="success"],
.login-status[data-tone="success"] {
  color: #8df0b8;
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 24px;
}

.hero-card-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bot-avatar-shell {
  width: 84px;
  height: 84px;
  padding: 4px;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(212, 66, 95, 0.9), rgba(77, 215, 207, 0.75));
}

.bot-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  background: #111820;
}

.hero-latency {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.hero-latency strong {
  color: var(--text);
  font-size: clamp(1.75rem, 3vw, 2.4rem);
}

.action-row {
  margin-top: 4px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.stat-card {
  padding: 20px;
}

.stat-card strong {
  display: block;
  margin: 14px 0 10px;
  font-size: clamp(1.4rem, 2.8vw, 2rem);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.dashboard-grid > .panel,
.shell > .panel {
  padding: 24px;
}

.section-head,
.subsection-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.section-head h3,
.subsection-head h4 {
  margin: 0;
}

.subsection {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.compact-head {
  margin-bottom: 14px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 0.95rem;
}

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

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

.toggle-card {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.toggle-card input {
  margin-top: 4px;
}

.usage-list,
.recent-list,
.warn-list,
.threshold-list {
  display: grid;
  gap: 14px;
}

.usage-item,
.recent-item,
.warn-item,
.threshold-row,
.command-editor {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.usage-item,
.recent-item,
.warn-item {
  padding: 16px 18px;
}

.usage-head,
.recent-head,
.warn-top,
.command-editor-head,
.command-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.usage-name {
  font-weight: 700;
}

.usage-value,
.warn-time,
.recent-time,
.command-usage-badge {
  color: var(--muted);
  font-size: 0.9rem;
}

.usage-bar-track {
  height: 10px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.usage-bar-fill {
  width: var(--fill, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-cyan));
}

.warn-item p,
.recent-item p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.warn-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.threshold-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.compact-field .text-input {
  min-height: 48px;
}

.threshold-remove {
  align-self: end;
}

.template-note {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  line-height: 1.7;
}

.command-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.command-editor {
  padding: 20px;
}

.command-title-row {
  justify-content: start;
}

.command-title-row h4 {
  margin: 0;
  font-size: 1.15rem;
}

.command-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.15rem;
}

.command-usage-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.command-toggle-grid {
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.role-list {
  display: grid;
  gap: 14px;
}

.role-guild-card {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.role-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.role-option input {
  margin: 0;
}

.role-swatch {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--role-color, var(--accent));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.role-option-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 3px;
}

.role-option-copy strong,
.role-option-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-option-copy span {
  color: var(--muted);
  font-size: 0.86rem;
}

.mono-input {
  font-family: "IBM Plex Mono", monospace;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 1180px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .command-editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .toggle-grid,
  .threshold-row,
  .command-toggle-grid,
  .role-checkbox-grid {
    grid-template-columns: 1fr;
  }

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

  .shell {
    padding: 28px 14px 44px;
  }

  .dashboard-grid > .panel,
  .shell > .panel,
  .hero {
    padding: 20px;
  }

  .action-row {
    flex-direction: column;
  }

  .action-row button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-row {
    grid-template-columns: 1fr;
  }
}
