:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #15181e;
  --panel-2: #1e232c;
  --line: #323846;
  --text: #f7f2e8;
  --muted: #aeb6c2;
  --fury: #ff2a1f;
  --fury-dark: #801913;
  --gold: #e8b84a;
  --steel: #6ca6c8;
  --ok: #2ad17d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 42, 31, 0.22), transparent 35%),
    linear-gradient(315deg, rgba(108, 166, 200, 0.14), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

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

button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--fury);
  color: white;
  padding: 10px 14px;
  min-height: 42px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  filter: brightness(1.08);
}

button.ghost {
  background: transparent;
  color: var(--text);
}

button.compact {
  min-height: 34px;
  padding: 6px 10px;
}

.hidden {
  display: none !important;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  background: rgba(21, 24, 30, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.eyebrow {
  color: var(--gold);
  margin: 0 0 8px;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1217;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
}

textarea {
  resize: vertical;
}

form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 22px;
  background: rgba(11, 13, 16, 0.86);
  border-right: 1px solid var(--line);
}

.sidebar h1 {
  font-size: 25px;
}

nav {
  display: grid;
  gap: 8px;
}

nav button {
  background: transparent;
  color: var(--muted);
  text-align: left;
}

nav button.active {
  color: var(--text);
  border-color: rgba(255, 42, 31, 0.7);
  background: rgba(255, 42, 31, 0.15);
}

.content {
  padding: 26px;
  display: grid;
  align-content: start;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-row,
.actions,
.split {
  display: flex;
  gap: 12px;
  align-items: end;
}

.split > * {
  flex: 1;
}

.status-pill {
  border: 1px solid rgba(42, 209, 125, 0.45);
  color: var(--ok);
  border-radius: 999px;
  padding: 8px 12px;
  min-width: 108px;
  text-align: center;
  font-weight: 800;
}

.tab {
  display: none;
}

.tab.active {
  display: grid;
  gap: 18px;
}

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

.metric-grid article,
.panel {
  background: rgba(21, 24, 30, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-grid article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric-grid span,
.hint,
small {
  color: var(--muted);
}

.metric-grid strong {
  font-size: 28px;
}

.panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.preview-panel {
  position: sticky;
  top: 20px;
}

.discord-preview {
  display: grid;
  gap: 12px;
  min-height: 260px;
  padding: 18px;
  border-radius: 8px;
  background: #313338;
  color: #f2f3f5;
}

.discord-message {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
}

.bot-avatar,
.member-avatar,
.tiny-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--fury);
  color: white;
  font-weight: 900;
  overflow: hidden;
}

.bot-avatar {
  width: 44px;
  height: 44px;
}

.bot-avatar img,
.embed-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discord-body span,
.author-preview {
  color: #b5bac1;
  font-size: 12px;
}

.embed-preview {
  margin-top: 8px;
  max-width: 520px;
  overflow: hidden;
  border-left: 4px solid var(--fury);
  border-radius: 4px;
  background: #2b2d31;
}

.embed-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px;
}

.embed-preview h4,
.embed-preview p {
  margin: 0 0 8px;
}

.embed-preview p {
  color: #dbdee1;
}

.embed-banner {
  display: block;
  height: 150px;
  background: #1e1f22;
}

.empty-banner {
  display: grid;
  place-items: center;
  color: #949ba4;
}

.member-avatar {
  width: 66px;
  height: 66px;
  background: var(--gold);
  color: #151515;
}

.tiny-avatar {
  width: 20px;
  height: 20px;
  display: inline-grid;
  margin-right: 6px;
}

.author-preview {
  padding: 0 14px 14px;
}

.ticket-embed {
  padding: 14px;
}

.preview-button {
  min-height: 34px;
  padding: 6px 12px;
  margin: 6px 0;
  background: #5865f2;
}

.route-editor {
  display: grid;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10141b;
}

.toggle {
  grid-template-columns: 18px 1fr;
  align-items: center;
  color: var(--text);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--fury);
}

.list {
  display: grid;
  gap: 8px;
}

.list-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.route-row {
  grid-template-columns: 1fr 1fr 1.4fr auto auto auto;
}

.inline-toggle {
  align-self: end;
  min-height: 43px;
}

.now-playing {
  display: grid;
  gap: 6px;
  border-left: 3px solid var(--gold);
  padding: 12px 14px;
  background: #10141b;
}

hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.error,
.error-toast {
  color: #ffb0aa;
}

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .topbar,
  .status-row,
  .actions,
  .split {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

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

  .preview-panel {
    position: static;
  }

  .route-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}
