:root {
  --bg: #08111f;
  --panel: rgba(10, 20, 35, 0.82);
  --panel-strong: rgba(13, 27, 46, 0.92);
  --line: rgba(122, 177, 255, 0.16);
  --line-strong: rgba(122, 177, 255, 0.28);
  --text: #edf5ff;
  --muted: #9ab0ca;
  --primary: #44d5ff;
  --secondary: #6ea8ff;
  --accent: #53f2b8;
  --danger: #ff6a7a;
  --warning: #ffcb67;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.32);
}

* { 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(68, 213, 255, 0.12), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(83, 242, 184, 0.1), transparent 24%),
    linear-gradient(145deg, #050b14 0%, #08111f 45%, #0a1626 100%);
  overflow-x: hidden;
}

.bg-orb,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-orb {
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.26;
}

.orb-a { top: -80px; left: -100px; background: #2dd8ff; }
.orb-b { right: -90px; bottom: -100px; background: #49f1b4; }

.bg-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.62), transparent 85%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.loading-screen,
.login-screen {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.loading-card,
.login-card {
  width: min(720px, 100%);
  padding: 40px;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(14, 28, 46, 0.94), rgba(9, 19, 32, 0.88));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(68, 213, 255, 0.1);
  border: 1px solid rgba(68, 213, 255, 0.18);
  color: #d9f8ff;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1, h2, h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.04em;
}

.loading-card p,
.login-card p,
.hero-copy p,
.panel-header p,
.field-help,
.command-card p,
.server-card p,
.empty-state p,
.toast {
  color: var(--muted);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 20px;
  border-radius: 16px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease;
}

.button:hover { transform: translateY(-2px); }
.button-primary { color: #08111f; background: linear-gradient(135deg, #53f2b8, #44d5ff); box-shadow: 0 18px 30px rgba(68, 213, 255, 0.22); }
.button-secondary { color: var(--text); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.08); }
.button-danger { color: white; background: rgba(255, 106, 122, 0.14); border-color: rgba(255, 106, 122, 0.24); }

.dashboard-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; }

.sidebar,
.main-panel,
.server-list-panel,
.section-card,
.command-card,
.server-card,
.toolbar,
.hero-panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  min-height: calc(100vh - 48px);
  padding: 22px;
  border-radius: var(--radius-xl);
}

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-badge {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(68, 213, 255, 0.22), rgba(83, 242, 184, 0.18));
  border: 1px solid var(--line-strong);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
}

.brand-copy strong { display: block; font-size: 1.1rem; }
.brand-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.88rem; }

.user-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.user-card img { width: 54px; height: 54px; border-radius: 16px; display: block; margin-bottom: 12px; }
.user-card strong { display: block; }

.nav-title { margin: 22px 0 10px; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; }
.nav-list { display: grid; gap: 10px; }

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(68, 213, 255, 0.08);
  border-color: rgba(68, 213, 255, 0.22);
  transform: translateX(2px);
}

.main-panel { min-height: calc(100vh - 48px); padding: 22px; border-radius: var(--radius-xl); }
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 22px;
  margin-bottom: 20px;
}

.toolbar > div,
.panel-header > div {
  min-width: 0;
}

.toolbar-actions,
.inline-actions,
.list-actions,
.server-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.guild-group + .guild-group {
  margin-top: 22px;
}

.group-label {
  margin-bottom: 14px;
  color: #dff8ff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toolbar-note { color: var(--muted); font-size: 0.9rem; }

.hero-panel {
  padding: 24px;
  border-radius: 26px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(68, 213, 255, 0.12), transparent 20%),
    radial-gradient(circle at 85% 30%, rgba(83, 242, 184, 0.12), transparent 22%);
  pointer-events: none;
}

.hero-copy { position: relative; z-index: 1; }
.hero-copy h1,
.toolbar strong,
.panel-header h3,
.command-card h3,
.server-card strong {
  overflow-wrap: anywhere;
}
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.hero-stat { padding: 14px; border-radius: 18px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); }
.hero-stat strong { display: block; font-size: 1.25rem; }
.hero-stat span { color: var(--muted); font-size: 0.88rem; }

.panel-grid { display: grid; gap: 18px; }
.section-card { padding: 22px; border-radius: 24px; overflow: visible; }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h3 { font-size: 1.35rem; }
.panel-header p { margin: 8px 0 0; max-width: 64ch; line-height: 1.7; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.field { display: grid; gap: 8px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 0.92rem; color: #d8e7fb; }
.field-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.field-card.two-col {
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
}

.field-card .field {
  min-width: 0;
}

.card-title {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.card-title strong {
  font-size: 0.98rem;
  color: var(--text);
}

.card-title span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(5, 12, 21, 0.58);
  color: var(--text);
  outline: none;
}

.field textarea { min-height: 120px; resize: vertical; overflow-wrap: anywhere; }
.field select[multiple] { min-height: 128px; }
.field select.role-select {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
    rgba(5, 12, 21, 0.58);
}

.field select.role-select[multiple] {
  min-height: 160px;
  padding: 10px;
}

.field select.role-select option {
  padding: 8px 10px;
  border-radius: 10px;
}

.role-picker {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.role-picker-trigger {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
    rgba(5, 12, 21, 0.58);
  color: var(--text);
  cursor: pointer;
}

.role-picker-trigger span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-picker-trigger:hover,
.role-picker.open .role-picker-trigger {
  border-color: rgba(68, 213, 255, 0.24);
}

.role-picker-menu {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(7, 14, 24, 0.98);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.34);
}

.role-picker-search {
  width: 100%;
  min-width: 0;
}

.role-picker-options {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.role-picker-option {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.role-picker-option span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-picker-option:hover,
.role-picker-option.active {
  border-color: rgba(68, 213, 255, 0.24);
  background: rgba(68, 213, 255, 0.08);
  transform: translateY(-1px);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(68, 213, 255, 0.36);
  box-shadow: 0 0 0 4px rgba(68, 213, 255, 0.08);
}

.field-help { font-size: 0.8rem; line-height: 1.5; }
.selection-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.selection-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(68, 213, 255, 0.1);
  border: 1px solid rgba(68, 213, 255, 0.16);
  color: #dff8ff;
  font-size: 0.82rem;
}

.selection-badge.empty {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
  color: var(--muted);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  color: #d8e7fb;
  cursor: pointer;
}

.toggle.stack {
  align-items: flex-start;
}

.toggle-copy {
  display: grid;
  gap: 4px;
}

.toggle-copy strong {
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 600;
}

.toggle-copy span {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  position: relative;
  transition: background .2s ease, border-color .2s ease;
}

.toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: transform .2s ease;
}

.toggle input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #53f2b8, #44d5ff);
  border-color: rgba(83, 242, 184, 0.34);
}

.toggle input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.repeat-list { display: grid; gap: 12px; }

.repeat-item,
.command-card,
.server-card {
  position: relative;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.server-card.favorite {
  border-color: rgba(255, 208, 92, 0.35);
  box-shadow: 0 18px 40px rgba(255, 208, 92, 0.08);
}

.repeat-item .fields { margin-bottom: 12px; }

.server-list-panel { padding: 24px; border-radius: var(--radius-xl); }
.server-grid,
.command-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

.server-card img { width: 56px; height: 56px; border-radius: 18px; display: block; margin-bottom: 14px; }
.server-card strong { display: block; margin-bottom: 8px; }

.favorite-guild-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 1.1rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.68);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.favorite-guild-button.active {
  color: #ffd05c;
  background: rgba(255, 208, 92, 0.12);
  border-color: rgba(255, 208, 92, 0.28);
}

.empty-state {
  padding: 28px;
  border-radius: 22px;
  text-align: center;
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.12);
}

.publish-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #dff4ff;
  font-size: 0.84rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 280px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(10, 20, 35, 0.92);
  box-shadow: var(--shadow);
}

.toast.success { border-color: rgba(83, 242, 184, 0.24); }
.toast.error { border-color: rgba(255, 106, 122, 0.24); }

@media (max-width: 1120px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: auto; }
  .main-panel { min-height: auto; }
  .hero-stats,
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .app-shell { width: calc(100% - 18px); padding: 12px 0 28px; }
  .loading-card,
  .login-card,
  .sidebar,
  .main-panel,
  .server-list-panel,
  .hero-panel,
  .section-card { padding: 18px; border-radius: 22px; }
  .toolbar,
  .panel-header { flex-direction: column; align-items: flex-start; }
  .toolbar,
  .toolbar-actions,
  .server-actions,
  .inline-actions,
  .list-actions,
  .publish-bar { width: 100%; }
  .toolbar-actions,
  .server-actions,
  .inline-actions,
  .list-actions { flex-direction: column; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields,
  .server-grid,
  .command-grid { grid-template-columns: 1fr; }
  .field-card.two-col { grid-template-columns: 1fr; }
  .button { width: 100%; }
  .brand { align-items: flex-start; }
  .brand-copy span,
  .toolbar-note,
  .panel-header p,
  .field-help { max-width: none; }
  .user-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: center; }
  .user-card img { margin-bottom: 0; }
  .nav-list { grid-template-columns: 1fr; }
  .status-pill { width: 100%; justify-content: center; text-align: center; }
  .favorite-guild-button { top: 12px; right: 12px; }
  .role-picker-menu {
    position: static;
    margin-top: 6px;
    box-shadow: none;
  }
  .role-picker-options { max-height: 220px; }
  .role-picker-option { padding: 12px; }
  .publish-bar { align-items: stretch; }
  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast { width: 100%; }
}

@media (max-width: 520px) {
  .app-shell { width: calc(100% - 12px); }
  .sidebar,
  .main-panel,
  .server-list-panel,
  .hero-panel,
  .section-card,
  .toolbar { padding: 14px; border-radius: 18px; }
  .hero-stats { grid-template-columns: 1fr; }
  .brand { gap: 10px; }
  .brand-badge,
  .server-card img { width: 48px; height: 48px; border-radius: 14px; }
  .brand-copy strong { font-size: 1rem; }
  .nav-button,
  .role-picker-trigger,
  .field input,
  .field textarea,
  .field select { padding: 12px; }
  .role-picker-search { font-size: 16px; }
  .server-card,
  .command-card,
  .repeat-item { padding: 14px; }
}
