/* ==========================================================
   Astro — Panel de control
   Misma paleta y estilo que la web (blurple, fondo oscuro, tarjetas).
   ========================================================== */
:root {
  --brand: #5865f2;
  --brand-hover: #4752c4;
  --brand-soft: #8b93ff;
  --accent: #29d3ff;
  --bg: #0b0d12;
  --bg-alt: #11141c;
  --card: #161a24;
  --card-2: #1b2030;
  --border: #232838;
  --border-strong: #323a55;
  --text: #f2f3f5;
  --muted: #9aa1b2;
  --muted-2: #6f778c;
  --success: #57f287;
  --warning: #fee75c;
  --danger: #ed4245;
  --orange: #ff9f43;
  --radius: 12px;
  --radius-lg: 18px;
  --sidebar: 276px;
  --topbar: 64px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
button:disabled { cursor: not-allowed; }
input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--brand-soft); outline-offset: 2px; border-radius: 8px; }

.noise {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(88, 101, 242, 0.18), transparent 42%),
    radial-gradient(circle at 85% 0%, rgba(41, 211, 255, 0.09), transparent 36%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; min-height: 100vh; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ico { width: 18px; height: 18px; flex: none; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn .ico { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; transform: none !important; box-shadow: none !important; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 22px rgba(88, 101, 242, 0.32); }
.btn-primary:not(:disabled):hover { background: var(--brand-hover); transform: translateY(-1px); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: rgba(255, 255, 255, 0.02); }
.btn-ghost:not(:disabled):hover { border-color: var(--brand); background: rgba(88, 101, 242, 0.08); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 8px 22px rgba(237, 66, 69, 0.25); }
.btn-danger:not(:disabled):hover { background: #d93a3d; transform: translateY(-1px); }
.btn-success { background: #2fbf63; color: #06210f; }
.btn-success:not(:disabled):hover { background: #3bd673; transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: #2b2500; }
.btn-warning:not(:disabled):hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-discord { background: #5865f2; color: #fff; box-shadow: 0 10px 28px rgba(88, 101, 242, 0.4); }
.btn-discord:hover { background: #4752c4; transform: translateY(-1px); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

/* ---------- Avatar / badges ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; flex: none;
  background: linear-gradient(135deg, #2a3150, #1d2236);
  color: var(--brand-soft); font-weight: 700; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.square { border-radius: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.badge .ico { width: 13px; height: 13px; }
.badge-neutral { background: rgba(255, 255, 255, 0.06); color: var(--muted); border-color: var(--border); }
.badge-brand { background: rgba(88, 101, 242, 0.16); color: var(--brand-soft); border-color: rgba(88, 101, 242, 0.35); }
.badge-success { background: rgba(87, 242, 135, 0.12); color: var(--success); border-color: rgba(87, 242, 135, 0.3); }
.badge-warning { background: rgba(254, 231, 92, 0.12); color: var(--warning); border-color: rgba(254, 231, 92, 0.3); }
.badge-danger { background: rgba(237, 66, 69, 0.14); color: #ff7b7e; border-color: rgba(237, 66, 69, 0.35); }
.badge-owner { background: rgba(254, 231, 92, 0.12); color: var(--warning); border-color: rgba(254, 231, 92, 0.3); }

.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); color: var(--muted); margin-left: 6px; }
.tag-warn { background: rgba(254, 231, 92, 0.14); color: var(--warning); }

/* ---------- Banners ---------- */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card-2); font-size: 14px;
}
.banner-icon { flex: none; margin-top: 1px; }
.banner-text { flex: 1; min-width: 0; }
.banner-text strong { display: block; margin-bottom: 2px; }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.banner-info { border-color: rgba(88, 101, 242, 0.4); background: rgba(88, 101, 242, 0.08); }
.banner-info .banner-icon { color: var(--brand-soft); }
.banner-warning { border-color: rgba(254, 231, 92, 0.35); background: rgba(254, 231, 92, 0.07); }
.banner-warning .banner-icon { color: var(--warning); }
.banner-error { border-color: rgba(237, 66, 69, 0.4); background: rgba(237, 66, 69, 0.08); }
.banner-error .banner-icon { color: #ff7b7e; }
.banner-success { border-color: rgba(87, 242, 135, 0.35); background: rgba(87, 242, 135, 0.07); }
.banner-success .banner-icon { color: var(--success); }

/* ---------- Tarjetas y rejillas ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-head { display: flex; align-items: center; gap: 14px; padding: 20px 22px 0; }
.card-icon {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(88, 101, 242, 0.14); color: var(--brand-soft);
}
.card-titles { flex: 1; min-width: 0; }
.card-titles h2 { font-size: 16px; font-weight: 700; }
.card-titles p { font-size: 13px; color: var(--muted); margin-top: 1px; }
.card-aside { flex: none; }
.card-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 0; }
.card-body > .field + .field { border-top: 1px solid var(--border); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row-gap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 10px; padding: 16px 0; }
.card-body > .field:first-child { padding-top: 2px; }
.card-body > .field:last-child { padding-bottom: 0; }
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 20px; }
.field-text { flex: 1; min-width: 0; }
.field-label { font-weight: 600; font-size: 14px; display: block; }
.field-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.field-control { display: flex; flex-direction: column; gap: 6px; }
.field-inline .field-control { flex: none; align-items: flex-end; }
.field-error { color: #ff7b7e; font-size: 12.5px; }
.has-error .input, .has-error .picker { border-color: var(--danger); }

.input {
  width: 100%; height: 42px; padding: 0 14px;
  background: var(--bg-alt); border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; min-height: 90px; padding: 11px 14px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--muted-2); }
.input:hover { border-color: #3d476a; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25); }
.input:disabled { opacity: 0.6; cursor: not-allowed; }

.textwrap { position: relative; }
.textmeta { display: flex; justify-content: flex-end; margin-top: 4px; }
.counter { font-size: 11.5px; color: var(--muted-2); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.step-btn { width: 32px; height: 32px; border-radius: 9px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.step-btn:not(:disabled):hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.input-number { width: 84px; text-align: center; padding: 0 8px; -moz-appearance: textfield; font-weight: 600; }
.input-number::-webkit-outer-spin-button, .input-number::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit { color: var(--muted); font-size: 13px; margin-left: 4px; min-width: 52px; }

.switch {
  width: 46px; height: 26px; border-radius: 999px; padding: 3px;
  background: #343b52; border: 1px solid var(--border-strong);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s; flex: none;
}
.switch-knob { display: block; width: 18px; height: 18px; border-radius: 50%; background: #c9cfe0; transition: transform 0.2s, background 0.2s; }
.switch[aria-checked="true"] { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.22); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(20px); background: #fff; }
.switch:disabled { opacity: 0.5; }

.color-control { display: inline-flex; align-items: center; gap: 10px; }
.color-input { width: 42px; height: 42px; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-alt); cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 4px; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 8px; }
.input-hex { width: 120px; text-transform: uppercase; }

.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.segmented-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--bg-alt); color: var(--muted);
  font-weight: 600; font-size: 14px; transition: all 0.15s;
}
.seg:not(:disabled):hover { border-color: var(--brand); color: var(--text); }
.seg[aria-checked="true"] { border-color: var(--brand); background: rgba(88, 101, 242, 0.16); color: #fff; box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.18); }
.seg:disabled { opacity: 0.45; }

/* ---------- Selectores y popover ---------- */
.picker {
  width: 100%; min-height: 42px; padding: 0 12px 0 14px;
  display: flex; align-items: center; gap: 8px; text-align: left;
  background: var(--bg-alt); border: 1px solid var(--border-strong); border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.picker:not(:disabled):hover { border-color: #3d476a; }
.picker[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25); }
.picker:disabled { opacity: 0.6; }
.picker-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-caret { color: var(--muted); }
.picker-clear { display: inline-flex; padding: 4px; border-radius: 6px; color: var(--muted); }
.picker-clear:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.placeholder { color: var(--muted-2); }

.opt-line { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.opt-icon { color: var(--muted); width: 16px; height: 16px; }
.opt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08); }

.popover {
  position: fixed; z-index: 250; background: #1a1f2e;
  border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
  animation: pop 0.14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.searchlist { display: flex; flex-direction: column; max-height: 340px; }
.popover-search { height: 40px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
.popover-search:focus { box-shadow: none; }
.popover-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.opt {
  display: flex; align-items: center; padding: 8px 10px; border-radius: 9px; text-align: left; width: 100%;
  font-size: 14px; color: var(--text);
}
.opt:not(:disabled):hover, .opt.is-active { background: rgba(88, 101, 242, 0.18); }
.opt:disabled { opacity: 0.45; }
.opt-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.popover-empty { padding: 18px 12px; text-align: center; color: var(--muted); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 12px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-strong);
  font-size: 13px; font-weight: 500;
}
.chip-x { display: inline-flex; padding: 2px; border-radius: 50%; color: var(--muted); }
.chip-x:hover { background: rgba(237, 66, 69, 0.25); color: #fff; }
.chip-x .ico { width: 13px; height: 13px; }
.chip-add { border-style: dashed; color: var(--muted); padding: 6px 14px 6px 10px; transition: all 0.15s; }
.chip-add:hover { color: var(--text); border-color: var(--brand); background: rgba(88, 101, 242, 0.1); }

.var-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.var-chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 3px 9px; border-radius: 7px; background: rgba(88, 101, 242, 0.14); color: var(--brand-soft); border: 1px solid rgba(88, 101, 242, 0.3); }
.var-chip:hover { background: rgba(88, 101, 242, 0.28); color: #fff; }

/* ---------- Barra de guardado ---------- */
.savebar {
  position: sticky; bottom: 18px; z-index: 30; margin-top: 24px;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px 12px 20px; border-radius: 999px;
  background: rgba(27, 32, 48, 0.92); border: 1px solid var(--border-strong);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: var(--shadow); animation: rise 0.25s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.savebar-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 10px var(--warning); flex: none; }
.savebar-text { flex: 1; font-size: 14px; font-weight: 600; }
.savebar-actions { display: flex; gap: 8px; }

/* ---------- Toasts y modales ---------- */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px;
  background: #1c2132; border: 1px solid var(--border-strong); border-left-width: 4px; border-radius: 14px; box-shadow: var(--shadow);
}
.toast-icon { margin-top: 1px; flex: none; }
.toast-body { flex: 1; min-width: 0; font-size: 14px; }
.toast-body strong { display: block; }
.toast-body p { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.toast-close { color: var(--muted); padding: 2px; border-radius: 6px; }
.toast-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.toast-success { border-left-color: var(--success); } .toast-success .toast-icon { color: var(--success); }
.toast-error { border-left-color: var(--danger); } .toast-error .toast-icon { color: #ff7b7e; }
.toast-warning { border-left-color: var(--warning); } .toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left-color: var(--brand); } .toast-info .toast-icon { color: var(--brand-soft); }

.modal-overlay {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(5, 7, 12, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.modal { width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border-strong); border-radius: 20px; box-shadow: var(--shadow); }
.modal-sm { max-width: 440px; } .modal-md { max-width: 560px; } .modal-lg { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.modal-head h3 { flex: 1; font-size: 18px; }
.modal-icon { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: rgba(88, 101, 242, 0.15); color: var(--brand-soft); }
.modal-body { padding: 10px 22px 6px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-text { color: var(--muted); font-size: 14.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }

/* ---------- Carga y vacíos ---------- */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 20px; color: var(--muted); }
.empty { text-align: center; padding: 38px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; background: rgba(88, 101, 242, 0.12); color: var(--brand-soft); margin-bottom: 6px; }
.empty-icon .ico { width: 26px; height: 26px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 420px; }
.empty .btn { margin-top: 10px; }

.sk { border-radius: 8px; background: linear-gradient(90deg, #1b2030 25%, #232a40 37%, #1b2030 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton-card { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.sk-title { height: 18px; width: 40%; } .sk-line { height: 12px; } .sk-line.short { width: 60%; }

/* ---------- Cabecera de página ---------- */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.page-icon { width: 48px; height: 48px; border-radius: 14px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(88, 101, 242, 0.25), rgba(139, 147, 255, 0.1)); color: var(--brand-soft); border: 1px solid rgba(88, 101, 242, 0.3); }
.page-icon .ico { width: 24px; height: 24px; }
.page-titles { flex: 1; min-width: 0; }
.page-titles h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.page-titles p { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==========================================================
   Login
   ========================================================== */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 56px; align-items: center; padding: 48px 7%; max-width: 1280px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; }
.login-hero h1 { font-size: 46px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; margin: 26px 0 16px; text-wrap: balance; }
.grad { background: linear-gradient(90deg, var(--brand), var(--brand-soft), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero .lead { color: var(--muted); font-size: 18px; max-width: 520px; }
.feature-list { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-top: 34px; }
.feature-list li { display: flex; align-items: center; gap: 14px; }
.feature-list .fi { width: 40px; height: 40px; border-radius: 12px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: rgba(88, 101, 242, 0.14); color: var(--brand-soft); }
.feature-list strong { display: block; font-size: 15px; }
.feature-list span.t { color: var(--muted); font-size: 13.5px; }
.login-card { padding: 34px; border-radius: 24px; background: linear-gradient(180deg, var(--card-2), var(--card)); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.login-card h2 { font-size: 24px; margin-bottom: 6px; }
.login-card > p { color: var(--muted); margin-bottom: 24px; }
.login-note { display: flex; gap: 10px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.login-note .ico { color: var(--success); margin-top: 2px; }
.login-foot { margin-top: 18px; font-size: 12.5px; color: var(--muted-2); display: flex; gap: 14px; flex-wrap: wrap; }
.login-foot a:hover { color: var(--text); }

/* ==========================================================
   Selección de servidor
   ========================================================== */
.topbar-simple { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; padding: 14px 6%; border-bottom: 1px solid var(--border); background: rgba(11, 13, 18, 0.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.spacer { flex: 1; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 999px; border: 1px solid var(--border-strong); background: rgba(255, 255, 255, 0.03); font-size: 14px; font-weight: 600; }
.user-chip .name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.servers { max-width: 1120px; margin: 0 auto; padding: 38px 6% 80px; }
.servers h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }
.servers .sub { color: var(--muted); margin: 4px 0 26px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 34px 0 14px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.section-title .count { background: rgba(255, 255, 255, 0.07); border-radius: 999px; padding: 1px 9px; font-size: 12px; letter-spacing: 0; }
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.guild-card {
  position: relative; display: flex; align-items: center; gap: 16px; padding: 18px; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
a.guild-card:hover, button.guild-card:hover, .guild-card.invite:hover { transform: translateY(-3px); border-color: var(--brand); background: var(--card-2); box-shadow: 0 14px 34px rgba(88, 101, 242, 0.18); }
.guild-card .info { flex: 1; min-width: 0; }
.guild-card .gname { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-card .gmeta { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.guild-card .gcount { color: var(--muted); font-size: 13px; margin-top: 6px; }
.guild-card .go { color: var(--muted); flex: none; transition: transform 0.18s, color 0.18s; }
a.guild-card:hover .go { color: var(--brand-soft); transform: translateX(3px); }
.guild-card.invite { align-items: flex-start; }
.guild-card.invite .avatar { filter: grayscale(0.35); opacity: 0.9; }
.guild-card.invite .btn { margin-top: 12px; }
.guild-card.invite .gname { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-box { position: relative; max-width: 360px; margin-bottom: 18px; }
.search-box .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 40px; }

/* ==========================================================
   Layout del servidor
   ========================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: rgba(14, 17, 25, 0.9); border-right: 1px solid var(--border);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); z-index: 60;
}
.side-top { padding: 18px 16px 14px; border-bottom: 1px solid var(--border); }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 4px 8px 4px 4px; border-radius: 8px; margin-bottom: 12px; }
.back-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.back-link .ico { width: 15px; height: 15px; }
.side-guild { display: flex; align-items: center; gap: 12px; }
.side-guild .gname { font-weight: 700; font-size: 15px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.side-guild .gmeta { font-size: 12.5px; color: var(--muted); }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; display: flex; flex-direction: column; gap: 2px; }
.nav-group { padding: 16px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px;
  border-radius: 11px; color: var(--muted); font-size: 14.5px; font-weight: 500; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-item[aria-current="page"] { background: rgba(88, 101, 242, 0.17); color: #fff; font-weight: 600; }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--brand), var(--accent)); }
.nav-item .ico { width: 19px; height: 19px; }
.nav-item .nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); }
.nav-item .nav-dot.off { background: #4a526b; box-shadow: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar); display: flex; align-items: center; gap: 14px; padding: 0 28px; border-bottom: 1px solid var(--border); background: rgba(11, 13, 18, 0.82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); min-width: 0; }
.crumbs strong { color: var(--text); }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--border-strong); background: rgba(255, 255, 255, 0.03); color: var(--muted); }
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #6f778c; }
.live-pill[data-state="live"] { color: var(--success); border-color: rgba(87, 242, 135, 0.3); background: rgba(87, 242, 135, 0.07); }
.live-pill[data-state="live"] .dot { background: var(--success); box-shadow: 0 0 0 0 rgba(87, 242, 135, 0.6); animation: pulse 1.8s infinite; }
.live-pill[data-state="connecting"] .dot, .live-pill[data-state="offline"] .dot { background: var(--warning); animation: blink 1s infinite; }
.live-pill[data-state="offline"] { color: var(--warning); border-color: rgba(254, 231, 92, 0.3); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(87, 242, 135, 0); } 100% { box-shadow: 0 0 0 0 rgba(87, 242, 135, 0); } }
@keyframes blink { 50% { opacity: 0.3; } }
.content { padding: 30px 34px 60px; width: 100%; max-width: 1180px; }
.scrim { display: none; }

/* ---------- Resumen ---------- */
.stat { padding: 18px 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stat-icon .ico { width: 22px; height: 22px; }
.tone-brand { background: rgba(88, 101, 242, 0.16); color: var(--brand-soft); }
.tone-green { background: rgba(87, 242, 135, 0.12); color: var(--success); }
.tone-yellow { background: rgba(254, 231, 92, 0.12); color: var(--warning); }
.tone-cyan { background: rgba(41, 211, 255, 0.12); color: var(--accent); }
.tone-red { background: rgba(237, 66, 69, 0.14); color: #ff7b7e; }
.tone-orange { background: rgba(255, 159, 67, 0.14); color: var(--orange); }
.tone-grey { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.stat .num { font-size: 28px; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: 13px; }

.module-card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; text-align: left; transition: transform 0.18s, border-color 0.18s, background 0.18s; }
.module-card:hover { transform: translateY(-2px); border-color: var(--brand); background: var(--card-2); }
.module-top { display: flex; align-items: center; gap: 12px; }
.module-top .name { flex: 1; font-weight: 700; font-size: 15px; }
.module-card p { color: var(--muted); font-size: 13px; }
.module-foot { display: flex; align-items: center; justify-content: space-between; }

.health-list { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 22px; }
.health-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 6px 0; }
.health-list .ok { color: var(--success); } .health-list .bad { color: #ff7b7e; } .health-list .warn { color: var(--warning); }
.health-list small { color: var(--muted-2); display: block; font-size: 12px; }

.lockdown { display: flex; align-items: center; gap: 18px; padding: 20px 22px; }
.lockdown .state { flex: 1; }
.lockdown h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.lockdown p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.lockdown.is-on { border-color: rgba(237, 66, 69, 0.55); background: linear-gradient(90deg, rgba(237, 66, 69, 0.1), var(--card) 60%); }

/* ---------- Feed en vivo ---------- */
.feed { display: flex; flex-direction: column; }
.ev { display: flex; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.ev:last-child { border-bottom: 0; }
.ev-bubble { width: 38px; height: 38px; border-radius: 12px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.ev-main { flex: 1; min-width: 0; }
.ev-title { font-size: 14.5px; overflow-wrap: anywhere; }
.ev-title strong { font-weight: 700; }
.ev-sub { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.ev-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; text-align: right; }
.ev-time { color: var(--muted-2); font-size: 12.5px; white-space: nowrap; }
.ev.is-new { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(88, 101, 242, 0.18); } to { background: transparent; } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--border-strong); color: var(--muted); transition: all 0.15s; }
.filter:hover { color: var(--text); border-color: var(--brand); }
.filter[aria-pressed="true"] { background: rgba(88, 101, 242, 0.2); color: #fff; border-color: var(--brand); }

/* ---------- Sanciones ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 14px; width: fit-content; max-width: 100%; overflow-x: auto; margin-bottom: 20px; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--card-2); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
.member-row { display: flex; align-items: center; gap: 12px; padding: 4px 0; min-width: 0; }
.member-row .who { min-width: 0; }
.member-row .who .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .who .u { font-size: 12.5px; color: var(--muted); }
.target-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-alt); border: 1px solid var(--brand); }
.target-card .grow { flex: 1; min-width: 0; }
.sanction-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--bg-alt); font-weight: 600; font-size: 14px; transition: all 0.15s; text-align: center; }
.tile .ico { width: 24px; height: 24px; }
.tile small { color: var(--muted); font-weight: 500; font-size: 12px; }
.tile:not(:disabled):hover { transform: translateY(-2px); }
.tile:disabled { opacity: 0.4; }
.tile[aria-checked="true"] { color: #fff; }
.tile.t-warn[aria-checked="true"] { border-color: var(--warning); background: rgba(254, 231, 92, 0.12); }
.tile.t-timeout[aria-checked="true"] { border-color: var(--orange); background: rgba(255, 159, 67, 0.14); }
.tile.t-kick[aria-checked="true"] { border-color: #ff7b2e; background: rgba(255, 123, 46, 0.14); }
.tile.t-ban[aria-checked="true"] { border-color: var(--danger); background: rgba(237, 66, 69, 0.16); }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.preset { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 13px; font-weight: 600; color: var(--muted); }
.preset:hover { color: var(--text); border-color: var(--brand); }
.preset[aria-pressed="true"] { background: rgba(88, 101, 242, 0.2); border-color: var(--brand); color: #fff; }
.ban-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.ban-row:last-child { border-bottom: 0; }
.ban-row .grow { flex: 1; min-width: 0; }

/* ---------- Vistas previas ---------- */
.preview-title { font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.discord-msg { background: #313338; border-radius: 12px; padding: 16px 18px; font-family: "gg sans", "Segoe UI", sans-serif; color: #dbdee1; }
.dm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.dm-head .nm { font-weight: 600; color: #fff; font-size: 15px; }
.dm-head .bot { background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.dm-head .ts { color: #949ba4; font-size: 12px; }
.dm-mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; padding: 0 3px; border-radius: 4px; font-weight: 500; }
.dm-embed { display: grid; margin-top: 6px; max-width: 520px; background: #2b2d31; border-left: 4px solid var(--brand); border-radius: 4px; padding: 12px 14px 14px; position: relative; }
.dm-embed .e-title { font-weight: 700; color: #fff; font-size: 15px; margin-bottom: 6px; overflow-wrap: anywhere; }
.dm-embed .e-desc { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-embed .e-thumb { position: absolute; top: 12px; right: 12px; width: 56px; height: 56px; border-radius: 6px; background: #3a3d44; overflow: hidden; }
.dm-embed .e-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dm-embed.has-thumb .e-title, .dm-embed.has-thumb .e-desc { padding-right: 72px; }
.dm-embed .e-image { margin-top: 10px; border-radius: 4px; max-height: 200px; overflow: hidden; }
.dm-embed .e-image img { width: 100%; max-height: 200px; object-fit: cover; }
.dm-embed .e-foot { margin-top: 10px; font-size: 12px; color: #949ba4; display: flex; align-items: center; gap: 8px; }
.dm-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dm-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 4px; font-size: 14px; font-weight: 500; color: #fff; }
.dm-btn.azul { background: #5865f2; } .dm-btn.gris { background: #4e5058; } .dm-btn.verde { background: #248046; } .dm-btn.rojo { background: #da373c; }

.bot-card { overflow: hidden; border-radius: 16px; background: #111214; border: 1px solid var(--border); }
.bot-banner { height: 96px; background: linear-gradient(135deg, #3b4590, #5865f2 60%, #29d3ff); background-size: cover; background-position: center; }
.bot-body { padding: 0 18px 18px; margin-top: -34px; }
.bot-body .avatar { border: 5px solid #111214; background: #1e1f22; }
.bot-body h3 { margin-top: 10px; font-size: 18px; }
.bot-body p { color: #b5bac1; font-size: 14px; margin-top: 6px; overflow-wrap: anywhere; }

/* ---------- Tickets: botones personalizados ---------- */
.tbtn { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); background: var(--bg-alt); border-radius: var(--radius); }
.tbtn .grow { flex: 1; min-width: 0; }
.tbtn .t { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tbtn .m { color: var(--muted); font-size: 13px; margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.style-swatches { display: flex; gap: 10px; }
.swatch { width: 38px; height: 38px; border-radius: 10px; border: 2px solid transparent; transition: transform 0.15s; }
.swatch:hover { transform: scale(1.08); }
.swatch[aria-checked="true"] { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2); }
.swatch.azul { background: #5865f2; } .swatch.gris { background: #4e5058; } .swatch.verde { background: #248046; } .swatch.rojo { background: #da373c; }

/* ---------- Auditoría ---------- */
.audit-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--border); align-items: start; }
.audit-row:last-child { border-bottom: 0; }
.audit-time { font-size: 13px; color: var(--muted); }
.audit-time strong { display: block; color: var(--text); font-size: 13.5px; }
.diff { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.diff div { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.diff .k { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.diff .old { color: #ff9b9d; text-decoration: line-through; overflow-wrap: anywhere; }
.diff .new { color: var(--success); overflow-wrap: anywhere; }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; gap: 32px; padding: 32px 6%; }
  .login-hero h1 { font-size: 36px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform 0.25s ease; background: rgba(14, 17, 25, 0.98); }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(5, 7, 12, 0.6); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 22px 16px 60px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .sanction-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-4, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .field-inline { flex-direction: column; align-items: stretch; gap: 10px; }
  .field-inline .field-control { align-items: flex-start; }
  .field-inline .switch { align-self: flex-start; }
  .health-list { grid-template-columns: minmax(0, 1fr); }
  .audit-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .page-head { flex-wrap: wrap; }
  .page-titles h1 { font-size: 22px; }
  .lockdown { flex-direction: column; align-items: flex-start; }
  .savebar { border-radius: 18px; flex-wrap: wrap; }
  .savebar-actions { width: 100%; }
  .savebar-actions .btn { flex: 1; }
  .live-pill .txt { display: none; }
  .crumbs > .muted, .crumbs > .ico { display: none; }
  .servers { padding: 28px 5% 60px; }
  .ev { flex-wrap: wrap; }
  .ev-meta { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; margin-left: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

.noscript-box { position: relative; z-index: 2; max-width: 520px; margin: 15vh auto; padding: 24px; text-align: center; }
.noscript-box p { color: var(--muted); margin-top: 8px; }


/* Anti-Raid: reglas de la protección contra ataques */
.rules { display: grid; margin-top: 4px; }
.rule { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.rule .rule-text .t { font-weight: 600; }
.rule .rule-text .d { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rule .rule-limits { display: grid; grid-template-columns: max-content max-content; column-gap: 22px; row-gap: 8px; justify-content: end; align-items: center; }
.rule .lim { display: inline-grid; align-items: center; column-gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.rule .lim-max { grid-template-columns: 48px max-content 96px; }
.rule .lim-win { grid-template-columns: 20px max-content 12px; }
.rule .lim-l { text-align: right; }
.rule .lim-n { text-align: left; }
.rule.is-off .rule-limits { opacity: 0.4; }
.rule.is-off .rule-text .t { color: var(--muted); }
@media (max-width: 1240px) {
  .rule { grid-template-columns: auto minmax(0, 1fr); }
  .rule .rule-limits { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-start; padding-left: 56px; }
}
@media (max-width: 720px) {
  .rule .rule-limits { padding-left: 0; }
}

/* Las vistas previas se quedan a la vista mientras se edita el formulario de la izquierda */
.sticky-col { position: sticky; top: 76px; align-self: start; }
@media (max-width: 1024px) { .sticky-col { position: static; } }
