:root {
  color-scheme: dark;
  --bg: #05050a;
  --panel: rgba(13, 13, 23, .72);
  --panel-strong: rgba(15, 15, 28, .94);
  --line: rgba(255, 255, 255, .10);
  --text: #f7f3ff;
  --muted: #c6bbd7;
  --pink: #ff69b4;
  --cyan: #31e7ff;
  --violet: #8c5cff;
  --good: #45f6a1;
  --bad: #ff5d7a;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  background:
    linear-gradient(rgba(5, 5, 10, .86), rgba(5, 5, 10, .93)),
    url('/imagen-neonara.png') top right / min(42vw, 430px) no-repeat fixed,
    radial-gradient(circle at 18% 8%, rgba(255, 105, 180, .18), transparent 28rem),
    radial-gradient(circle at 84% 4%, rgba(49, 231, 255, .12), transparent 24rem),
    linear-gradient(135deg, #05050a 0%, #0b0b18 54%, #05050a 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent, rgba(140, 92, 255, .10), transparent);
  filter: blur(18px);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-hero { width: min(100%, 720px); }
.login-panel, .hero-band, .server-card, .module-card, .stats-grid article, .notice {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .34), 0 0 28px rgba(255, 79, 216, .10), inset 0 1px 0 rgba(255,255,255,.06);
}
.login-panel {
  padding: clamp(28px, 6vw, 64px);
  border-radius: 22px;
  text-align: center;
}
.benefit-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 26px; }
.benefit-row span, .status-pill {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 850;
}
.login-logo { width: 118px; height: 118px; object-fit: contain; filter: drop-shadow(0 0 30px rgba(255,79,216,.7)); }
.eyebrow { margin: 0 0 10px; color: var(--cyan); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(34px, 5vw, 72px); margin-bottom: 14px; }
.lead { color: var(--muted); max-width: 560px; margin: 0 auto 28px; line-height: 1.7; }

.discord-btn, .primary-btn, .secondary-btn, .danger-btn, .mini-btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.discord-btn, .primary-btn {
  padding: 0 20px;
  background: linear-gradient(135deg, var(--pink), var(--violet) 55%, var(--cyan));
  box-shadow: 0 0 32px rgba(255, 79, 216, .34);
}
.secondary-btn {
  padding: 0 18px;
  background: rgba(49, 231, 255, .10);
  border: 1px solid rgba(49, 231, 255, .32);
}
.danger-btn {
  padding: 0 18px;
  background: rgba(255, 93, 122, .16);
  border: 1px solid rgba(255, 93, 122, .36);
}
.discord-btn:hover, .primary-btn:hover, .mini-btn:hover { transform: translateY(-1px); }
.ghost-btn, .mini-btn.ghost {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
}

.sidebar {
  position: fixed;
  inset: 18px auto 18px 18px;
  width: 248px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(7, 7, 14, .82);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a { padding: 12px; border-radius: 10px; color: var(--muted); }
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: white; }
.shell { width: min(1320px, calc(100% - 306px)); margin-left: 286px; padding: 28px 28px 92px; position: relative; }
.mobile-nav { display: none; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { font-size: clamp(28px, 4vw, 48px); margin: 0; }
.avatar { width: 64px; height: 64px; border-radius: 16px; border: 1px solid var(--line); object-fit: cover; }
.back-link { color: var(--cyan); font-weight: 800; }

.hero-band, .guild-hero {
  border-radius: 18px;
  padding: clamp(22px, 4vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.guild-hero {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(18,18,34,.82), rgba(11,11,22,.68));
  backdrop-filter: blur(24px);
  border-radius: 18px;
  padding: clamp(20px, 4vw, 34px);
  justify-content: space-between;
  margin-bottom: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.06);
}
.guild-title-row { display: flex; align-items: center; gap: 16px; }
.guild-title-row h1, .module-hero h1 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 52px); }
.guild-icon { width: 74px; height: 74px; border-radius: 18px; object-fit: cover; border: 1px solid var(--line); }
.dashboard-top p, .guild-hero p { color: var(--muted); margin-bottom: 0; }
.user-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.05); }
.user-card span { display: block; color: var(--muted); font-size: 12px; }
.hero-band h2 { font-size: clamp(24px, 3vw, 38px); margin-bottom: 8px; }
.hero-band p, .section-title span, .server-card p, .module-head p, .module-foot, .module-note { color: var(--muted); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}
.stats-grid article { border-radius: 14px; padding: 18px; }
.stats-grid span { display: block; color: var(--muted); margin-bottom: 8px; }
.stats-grid strong { font-size: 24px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.guild-tabs {
  position: sticky;
  top: 14px;
  z-index: 3;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7,7,14,.72);
  backdrop-filter: blur(18px);
}
.guild-tabs a { flex: 0 0 auto; padding: 9px 12px; color: var(--muted); border-radius: 10px; }
.guild-tabs a:hover { color: var(--text); background: rgba(255,255,255,.07); }
.module-toolbar { margin: 0 0 20px; }
.search-box { display: grid; gap: 8px; max-width: 420px; color: var(--muted); font-weight: 800; }
.search-box input { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); padding: 0 14px; }

.server-grid, .module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.server-card { min-height: 112px; border-radius: 16px; padding: 16px; display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 12px; position: relative; overflow: hidden; }
.server-card:before, .module-card:before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,79,216,.18), transparent 34%, rgba(49,231,255,.10));
  opacity: .55;
}
.server-card img { width: 58px; height: 58px; border-radius: 14px; object-fit: cover; }
.server-card h3 { margin-bottom: 5px; font-size: 16px; }
.mini-btn { padding: 0 14px; background: rgba(49, 231, 255, .16); border: 1px solid rgba(49, 231, 255, .34); }

.module-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); align-items: start; }
.module-grid.compact { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.module-card { border-radius: 16px; padding: 18px; position: relative; overflow: hidden; }
.module-card > * { position: relative; z-index: 1; }
.module-head { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; margin-bottom: 16px; }
.module-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; background: linear-gradient(135deg, rgba(255,79,216,.34), rgba(49,231,255,.24)); }
.state { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.state.on { background: rgba(69,246,161,.14); color: var(--good); }
.state.off { background: rgba(255,93,122,.14); color: var(--bad); }
.status-pill.full { color: var(--good); border-color: rgba(69,246,161,.34); background: rgba(69,246,161,.12); }
.status-pill.partial { color: #ffe7a4; border-color: rgba(255,196,87,.34); background: rgba(255,196,87,.10); }
.status-pill.readOnly { color: var(--cyan); border-color: rgba(49,231,255,.34); background: rgba(49,231,255,.10); }
.status-pill.pending { color: var(--bad); border-color: rgba(255,93,122,.34); background: rgba(255,93,122,.10); }
.module-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); margin: 14px 0; font-size: 13px; }
.module-cta { width: 100%; }
.module-warning, .notice { border-radius: 14px; padding: 14px; color: #ffe7a4; background: rgba(255,196,87,.10); border-color: rgba(255,196,87,.25); }
.module-detail-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.module-subnav {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(7,7,14,.66);
  backdrop-filter: blur(18px);
}
.module-subnav a { padding: 10px 12px; border-radius: 10px; color: var(--muted); }
.module-subnav a:hover { color: var(--text); background: rgba(255,255,255,.07); }
.module-editor, .module-form { display: grid; gap: 16px; }
.editor-section, .pending-card, .preview-card, .log-box {
  border: 1px solid var(--line);
  background: rgba(13,13,23,.70);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 20px 70px rgba(0,0,0,.30);
}
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-textarea, .field-json, .field-commandToggles, .field-buttons, .preview-section { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; color: var(--muted); font-weight: 700; }
.field input, .field textarea, .field select {
  width: 100%;
  color: var(--text);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  outline: none;
}
.field textarea { min-height: 132px; resize: vertical; }
.field small { color: var(--muted); font-weight: 600; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(49,231,255,.62); box-shadow: 0 0 0 3px rgba(49,231,255,.10); }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-weight: 800; }
.switch-row input { display: none; }
.switch-row b { width: 52px; height: 30px; border-radius: 999px; background: rgba(255,255,255,.12); position: relative; border: 1px solid var(--line); }
.switch-row b:before { content: ""; position: absolute; width: 22px; height: 22px; top: 3px; left: 4px; border-radius: 50%; background: white; transition: left .18s ease, background .18s ease; }
.switch-row input:checked + b { background: rgba(69,246,161,.22); border-color: rgba(69,246,161,.45); }
.switch-row input:checked + b:before { left: 24px; background: var(--good); }
.switch-row.inline { justify-content: flex-start; }
.module-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; }
.sticky-actions {
  position: sticky;
  bottom: 14px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7,7,14,.84);
  backdrop-filter: blur(18px);
  color: var(--muted);
}
.variables-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.variables-list code { padding: 7px 9px; border: 1px solid rgba(49,231,255,.20); border-radius: 999px; background: rgba(49,231,255,.08); color: var(--cyan); }
.preview-card h3 { color: var(--pink); }
.log-box { overflow: auto; color: var(--muted); }
.pending-card { margin-top: 24px; }
.pending-card summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; color: var(--text); }
.pending-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.pending-grid p { color: var(--muted); line-height: 1.6; }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 14px 18px; border-radius: 12px; background: var(--panel-strong); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.35); z-index: 5; }
.runtime-toast.success { border-color: rgba(69,246,161,.35); }
.runtime-toast.error { border-color: rgba(255,93,122,.35); }

@media (max-width: 860px) {
  body { background-attachment: scroll; }
  .sidebar { display: none; }
  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 8;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(7,7,14,.88);
    backdrop-filter: blur(18px);
  }
  .mobile-nav a, .mobile-nav button { width: 100%; min-height: 38px; border: 0; border-radius: 10px; color: var(--text); background: rgba(255,255,255,.06); }
  .shell { width: auto; margin: 0; padding: 12px 12px 92px; }
  .hero-band, .guild-hero, .topbar, .section-title { align-items: flex-start; flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-grid { grid-template-columns: 1fr; }
  .module-detail-layout { grid-template-columns: 1fr; }
  .module-subnav { position: static; display: flex; overflow-x: auto; }
  .field-grid { grid-template-columns: 1fr; }
  .server-card { grid-template-columns: 48px 1fr; }
  .server-card .mini-btn { grid-column: 1 / -1; }
  .sticky-actions { flex-direction: column; align-items: stretch; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .module-card, .server-card { border-radius: 12px; }
}
