:root {
  --bg: #0d0f14;
  --bg-2: #13161d;
  --panel: #181b24;
  --panel-2: #20242f;
  --border: #282d3a;
  --border-2: #353b4b;
  --text: #e9ebf1;
  --muted: #8f96a8;
  --primary: #5865f2;
  --primary-2: #4752c4;
  --accent: #8b5cf6;
  --success: #3ba55d;
  --danger: #ed4245;
  --warning: #faa61a;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --topbar: 58px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
body > main, body > .layout { flex: 1; }
a { color: inherit; text-decoration: none; }
a.link { color: #8ea1ff; }
a.link:hover { text-decoration: underline; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: .88em; font-family: var(--mono); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
p { margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.accent { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ---------- Iconos SVG (nunca emojis) ---------- */
.icon { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; }
.with-icon { display: inline-flex; align-items: center; gap: 6px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--muted); }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap > .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search-wrap > .input { padding-left: 34px; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; }
.medal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.medal-1 { color: #f5c542; background: rgba(245, 197, 66, .14); }
.medal-2 { color: #c0c7d4; background: rgba(192, 199, 212, .14); }
.medal-3 { color: #d8955a; background: rgba(216, 149, 90, .14); }
.tone-blue { color: #6ea8ff; background: rgba(110, 168, 255, .12) !important; }
.tone-green { color: #5fd38a; background: rgba(95, 211, 138, .12) !important; }
.tone-violet { color: #a98bff; background: rgba(169, 139, 255, .12) !important; }
.tone-amber { color: #f5b74a; background: rgba(245, 183, 74, .12) !important; }
.tone-cyan { color: #55d0e0; background: rgba(85, 208, 224, .12) !important; }
.tone-pink { color: #f27ab8; background: rgba(242, 122, 184, .12) !important; }
.strip-icon { width: 22px; height: 22px; color: var(--primary); margin: 0 auto 6px; }
.icon-btn { display: inline-grid; place-items: center; }
.icon-btn .icon { width: 16px; height: 16px; }
.chip-x { display: inline-grid; place-items: center; }
.chip-x .icon { width: 13px; height: 13px; }
.menu-btn { place-items: center; }
.menu-btn .icon { width: 20px; height: 20px; }
.pill { display: inline-flex; align-items: center; gap: 6px; }
.feature-icon .icon, .stat-icon .icon { width: 22px; height: 22px; }
.feature-icon { color: #9aa5ff; }
.toast { display: flex; align-items: flex-start; gap: 10px; }
.toast-icon { width: 18px; height: 18px; margin-top: 2px; color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.note { display: flex; gap: 10px; align-items: flex-start; }
.note-icon { width: 18px; height: 18px; margin-top: 1px; }
.note-info .note-icon { color: #8ea1ff; }
.note-warn .note-icon { color: var(--warning); }
.note-error .note-icon { color: var(--danger); }
.mock-side span { display: flex; align-items: center; gap: 6px; }
.mock-side .icon { width: 13px; height: 13px; }
.dc-button { display: inline-flex; align-items: center; gap: 6px; }
.dc-button .icon { width: 14px; height: 14px; }
.dc-select-head .icon { width: 16px; height: 16px; }
.dc-emoji { display: inline-grid; place-items: center; color: #b5bac1; }
.dc-emoji .icon { width: 16px; height: 16px; }
.check .icon { width: 18px; height: 18px; }
.error-box .with-icon .icon { color: var(--danger); }
.savebar .with-icon .icon { width: 18px; height: 18px; }

/* Valoraciones */
.stars { display: inline-flex; align-items: center; gap: 2px; }
.stars .icon { width: 15px; height: 15px; }
.star-on { color: #f5b74a; fill: #f5b74a; }
.star-off { color: #4e5058; }
.stars .muted { margin-left: 6px; }

/* Barras horizontales */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 14px; }
.hbar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar > div { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; }
.hbar i.amber { background: linear-gradient(90deg, #f5b74a, #f27ab8); }
.hbar b { text-align: right; }

/* Botones de Discord por estilo */
.dc-button.dc-btn-primary { background: #5865f2; }
.dc-button.dc-btn-secondary { background: #4e5058; }
.dc-button.dc-btn-success { background: #248046; }
.dc-button.dc-btn-danger { background: #da373c; }
.dc-button .icon { width: 14px; height: 14px; }

/* FiveM */
.player-list { display: flex; flex-wrap: wrap; gap: 6px; }
.player-list .chip { padding: 3px 10px; gap: 8px; }
.player-list .chip b { color: var(--muted); font-weight: 600; font-family: var(--mono); font-size: 12px; }

/* Página pública de postulación */
.card.apply-head { border-top: 4px solid var(--accent-color, var(--primary)); gap: 10px; }
.apply-guild { display: flex; align-items: center; gap: 10px; }
.apply-guild img { width: 36px; height: 36px; border-radius: 50%; }
.apply-desc { white-space: pre-wrap; color: #c8ccd8; }
.card.apply-form { gap: 18px; }
.apply-form .btn { align-self: flex-start; }
.card.apply-done { align-items: center; padding: 40px 24px; }
.apply-done-icon { width: 56px; height: 56px; color: var(--success); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 9px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .1s, opacity .15s; white-space: nowrap; color: inherit; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-xs { padding: 3px 9px; font-size: 12.5px; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-lg { padding: 13px 24px; font-size: 16px; border-radius: 11px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-2); }
.btn-ghost { background: rgba(255,255,255,.02); border-color: var(--border-2); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-2); }
.btn-dashed { background: transparent; color: var(--muted); border: 1px dashed var(--border-2); width: 100%; }
.btn-dashed:hover { color: var(--text); border-color: var(--primary); }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--muted); min-width: 30px; height: 30px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.icon-btn:hover:not(:disabled) { background: var(--panel-2); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger:hover:not(:disabled) { color: var(--danger); }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar); display: flex; align-items: center; gap: 20px; padding: 0 20px; background: rgba(13, 15, 20, .82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.brand img { width: 32px; height: 32px; border-radius: 50%; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.topnav a:hover { color: var(--text); background: var(--panel); }
.topnav a.active { color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 4px 10px 4px 4px; border-radius: 999px; }
.user-chip:hover { background: var(--panel); }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; }
.menu-btn { display: none; background: none; border: 1px solid var(--border-2); color: var(--text); border-radius: 8px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); background: var(--bg-2); margin-top: 60px; }
.footer-inner { max-width: 1140px; margin: 0 auto; padding: 36px 16px; display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-brand { max-width: 320px; display: flex; flex-direction: column; gap: 10px; }
.footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.footer-cols div { display: flex; flex-direction: column; gap: 8px; }
.footer-cols a { color: var(--muted); font-size: 14px; }
.footer-cols a:hover { color: var(--text); }
.footer-bottom { text-align: center; padding: 14px; border-top: 1px solid var(--border); }

/* ---------- Inicio ---------- */
.hero { padding: 72px 16px 56px; background: radial-gradient(900px 420px at 15% -10%, rgba(88, 101, 242, .25), transparent 60%), radial-gradient(700px 380px at 95% 10%, rgba(139, 92, 246, .18), transparent 60%); }
.hero-inner { max-width: 1140px; margin: 0 auto; display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.hero-text { display: flex; flex-direction: column; gap: 18px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.08; }
.lead { font-size: 18px; color: #c3c8d6; max-width: 560px; }
.pill { align-self: flex-start; background: rgba(88, 101, 242, .15); border: 1px solid rgba(88, 101, 242, .4); color: #c7ccff; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.mock-window { background: var(--panel); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; transform: perspective(1200px) rotateY(-8deg) rotateX(4deg); }
.mock-bar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.mock-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-2); }
.mock-bar i:first-child { background: #ed4245; } .mock-bar i:nth-child(2) { background: #faa61a; } .mock-bar i:nth-child(3) { background: #3ba55d; }
.mock-body { display: grid; grid-template-columns: 130px 1fr; min-height: 250px; }
.mock-side { background: var(--bg-2); padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.mock-side span { padding: 6px 8px; border-radius: 6px; }
.mock-side .on { background: rgba(88, 101, 242, .2); color: #fff; }
.mock-main { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.mock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mock-stats b { background: var(--panel-2); border-radius: 8px; padding: 10px; font-size: 18px; }
.mock-chart { display: flex; align-items: flex-end; gap: 8px; height: 90px; padding: 8px; background: var(--bg-2); border-radius: 8px; }
.mock-chart i { flex: 1; background: linear-gradient(var(--accent), var(--primary)); border-radius: 4px 4px 0 0; }
.mock-line { height: 10px; border-radius: 5px; background: var(--panel-2); }
.mock-line.short { width: 60%; }
.stats-strip { max-width: 1140px; margin: 0 auto; padding: 0 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats-strip div { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; display: flex; flex-direction: column; }
.stats-strip b { font-size: 28px; }
.stats-strip span { color: var(--muted); font-size: 14px; }
.section-head { text-align: center; margin: 56px 0 24px; display: flex; flex-direction: column; gap: 8px; }
.section-head h2 { font-size: 28px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s, transform .15s; }
.feature:hover { border-color: var(--border-2); transform: translateY(-2px); }
.feature p { color: var(--muted); font-size: 14px; }
.feature-icon { width: 42px; height: 42px; display: grid; place-items: center; font-size: 22px; background: var(--panel-2); border-radius: 10px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.step span { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); font-weight: 800; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 14px; }
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin-top: 10px; color: var(--muted); }
.cta { max-width: 1140px; margin: 56px auto 0; padding: 40px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; background: linear-gradient(135deg, rgba(88, 101, 242, .2), rgba(139, 92, 246, .15)); border: 1px solid var(--border-2); border-radius: 20px; width: calc(100% - 32px); }

/* ---------- Contenedores ---------- */
.container { max-width: 1140px; width: 100%; margin: 0 auto; padding: 32px 16px; }
.container.narrow { max-width: 520px; }
.narrow-md { max-width: 820px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }
.group-title { font-size: 15px; color: var(--muted); margin: 28px 0 12px; text-transform: uppercase; letter-spacing: .05em; }
.empty, .loading { color: var(--muted); padding: 40px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Comandos ---------- */
.cmd-filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.cat-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-btn { background: var(--panel); border: 1px solid var(--border); color: var(--muted); padding: 5px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; }
.pill-btn:hover { color: var(--text); }
.pill-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.cmd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.cmd-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.cmd-card code { align-self: flex-start; color: #c7ccff; background: rgba(88, 101, 242, .15); font-size: 14px; }
.cmd-card p { color: var(--muted); font-size: 14px; flex: 1; }
.tag { align-self: flex-start; font-size: 11.5px; color: var(--muted); border: 1px solid var(--border-2); border-radius: 999px; padding: 1px 8px; }

/* ---------- Estado ---------- */
.status-hero { display: flex; align-items: center; gap: 18px; padding: 24px; border-radius: var(--radius); border: 1px solid; margin-bottom: 18px; }
.status-hero.ok { background: rgba(59, 165, 93, .1); border-color: rgba(59, 165, 93, .4); }
.status-hero.down { background: rgba(237, 66, 69, .1); border-color: rgba(237, 66, 69, .4); }
.status-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; }
.ok .status-dot { background: var(--success); box-shadow: 0 0 0 6px rgba(59, 165, 93, .2); }
.down .status-dot { background: var(--danger); box-shadow: 0 0 0 6px rgba(237, 66, 69, .2); }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.status-grid .card { gap: 4px; margin: 0; }
.status-grid b { font-size: 22px; }

/* ---------- Legal ---------- */
.legal-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.legal-nav { position: sticky; top: calc(var(--topbar) + 20px); display: flex; flex-direction: column; gap: 4px; }
.legal-nav a { padding: 9px 12px; border-radius: 8px; color: var(--muted); }
.legal-nav a.active, .legal-nav a:hover { background: var(--panel); color: var(--text); }
.legal { padding: 32px clamp(18px, 4vw, 44px); gap: 12px; }
.legal h2 { margin-top: 16px; font-size: 19px; }
.legal p, .legal li { color: #c8ccd8; }
.legal ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Lista de servidores ---------- */
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.guild-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; transition: transform .15s, border-color .15s; }
.guild-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.guild-card.is-missing { opacity: .7; }
.guild-icon { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.guild-icon-fallback { display: grid; place-items: center; background: var(--panel-2); font-weight: 700; color: var(--muted); border-radius: 50%; width: 72px; height: 72px; }
.guild-icon-fallback.sm { width: 40px; height: 40px; font-size: 13px; flex: none; }
.guild-name { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout del panel ---------- */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100vh - var(--topbar)); }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.sidebar-guild { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.sidebar-guild:hover { background: var(--panel); }
.sidebar-guild img { width: 40px; height: 40px; border-radius: 50%; }
.sidebar-guild-text { min-width: 0; }
.sidebar-guild-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-group { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 12px 4px; }
.side-nav a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14.5px; }
.side-nav a:hover { background: var(--panel); color: var(--text); }
.side-nav a.active { background: rgba(88, 101, 242, .18); color: #fff; }
.side-ico { width: 18px; height: 18px; flex: none; }
.side-note { padding: 0 12px; margin-top: auto; }
.sidebar-toggle { display: none; }
.content { padding: 28px clamp(16px, 3vw, 40px) 120px; min-width: 0; max-width: 1180px; width: 100%; }

/* ---------- Tarjetas y campos ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; flex-direction: column; gap: 4px; }
.card-head p { font-size: 14px; }
.sub-card { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-2.align-start { align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2.align-start { margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hint { font-size: 12.5px; color: var(--muted); }
.input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(88, 101, 242, .2); }
.input:disabled { opacity: .6; }
.input-sm { padding: 6px 10px; font-size: 14px; width: auto; min-width: 180px; }
textarea.input { resize: vertical; min-height: 64px; }
select.input { cursor: pointer; }
.input-wrap { position: relative; }
.input-wrap .counter { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: var(--muted); pointer-events: none; background: var(--bg); padding: 0 3px; }
.input-wrap input.input { padding-right: 62px; }
.color { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 3px; cursor: pointer; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 10px; }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input > span { display: grid; place-items: center; padding: 0 10px; background: var(--panel-2); border: 1px solid var(--border); border-right: 0; border-radius: 8px 0 0 8px; font-family: var(--mono); }
.prefix-input .input-wrap { flex: 1; }
.prefix-input .input { border-radius: 0 8px 8px 0; }

.note { padding: 12px 16px; border-radius: 10px; border: 1px solid; margin-bottom: 18px; font-size: 14px; }
.note-info { background: rgba(88, 101, 242, .08); border-color: rgba(88, 101, 242, .35); }
.note-warn { background: rgba(250, 166, 26, .08); border-color: rgba(250, 166, 26, .4); }
.note-error { background: rgba(237, 66, 69, .08); border-color: rgba(237, 66, 69, .4); }
.card .note { margin-bottom: 0; }
.error-box { background: rgba(237, 66, 69, .1); border: 1px solid rgba(237, 66, 69, .45); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.error-box ul { margin: 8px 0 0; padding-left: 20px; }
.error-card { text-align: center; padding: 40px 24px; align-items: center; }
.error-code { font-size: 54px; font-weight: 800; color: var(--primary); }

/* Switch */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 22px; border-radius: 22px; background: #4e5058; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--success); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.card > .toggle-row:first-of-type, .card-head + .toggle-row { border-top: 0; }
.toggle-text { display: flex; flex-direction: column; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; cursor: pointer; }

/* Roles */
.role-picker { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; align-items: center; }
.chip { --chip: #99aab5; display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--chip); }
.chip-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 6px; }
.chip-x:hover { color: var(--danger); }

/* Listas editables */
.list-editor { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; gap: 10px; align-items: flex-start; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-actions { display: flex; gap: 2px; }

/* Resumen */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; gap: 12px; align-items: center; transition: border-color .15s; }
a.stat:hover { border-color: var(--primary); }
.stat > div { display: flex; flex-direction: column; }
.stat b { font-size: 22px; line-height: 1.1; }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--panel-2); display: grid; place-items: center; font-size: 20px; flex: none; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar i { width: 100%; min-height: 3px; background: linear-gradient(var(--accent), var(--primary)); border-radius: 5px 5px 2px 2px; transition: height .4s; }
.bar span { font-size: 11px; color: var(--muted); }
.progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 999px; }
.checklist { display: flex; flex-direction: column; gap: 2px; }
.check { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; }
a.check:hover { background: var(--bg); }
.check .muted { margin-left: auto; }
.check.done { color: var(--muted); }
.audit-list { display: flex; flex-direction: column; }
.audit-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--border); font-size: 14px; }
.audit-row:last-child { border-bottom: 0; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.big-number { font-size: 48px; font-weight: 800; line-height: 1; }

/* Módulos y comandos */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.module { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; }
.module > span { display: flex; flex-direction: column; }
.command-list { display: flex; flex-direction: column; gap: 18px; }
.command-group-title { font-weight: 700; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.command-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.command-row:hover { background: var(--bg); }
.command-row > span { display: flex; flex-direction: column; min-width: 0; }
.command-row.is-disabled { opacity: .5; }
.badge { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge-off { background: rgba(237, 66, 69, .15); color: #ff8a8c; }
.badge-on { background: rgba(59, 165, 93, .18); color: #6fdc8c; }
.badge-muted { background: var(--panel-2); color: var(--muted); }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td.wrap { white-space: normal; min-width: 200px; }
.table tr:last-child td { border-bottom: 0; }

/* AutoMod */
.rule-list { display: flex; flex-direction: column; gap: 8px; }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }

/* Historial de tickets */
.ticket-list { display: flex; flex-direction: column; gap: 8px; }
.ticket-row { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.ticket-row summary { list-style: none; display: grid; grid-template-columns: 90px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) 110px; gap: 12px; align-items: center; padding: 11px 14px; cursor: pointer; }
.ticket-row summary::-webkit-details-marker { display: none; }
.ticket-row summary > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-cat { font-weight: 600; }
.ticket-date { text-align: right; }
.ticket-detail { padding: 4px 16px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; padding-top: 14px; align-items: flex-start; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--muted); }
.answers { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.answers > div { background: var(--panel); border-radius: 8px; padding: 10px 12px; }
.answers p { white-space: pre-wrap; color: #d0d4de; margin-top: 4px; }

/* Tickets: editor */
.editor-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.preview-col { position: sticky; top: calc(var(--topbar) + 16px); align-self: start; display: flex; flex-direction: column; gap: 8px; }
.categories { display: flex; flex-direction: column; gap: 10px; }
.cat { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.cat[open] { border-color: var(--border-2); }
.cat summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; user-select: none; }
.cat summary::-webkit-details-marker { display: none; }
.chev { transition: transform .15s; color: var(--muted); }
.cat[open] .chev { transform: rotate(90deg); }
.cat-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-actions { margin-left: auto; display: flex; gap: 2px; }
.cat-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--border); }
.questions { display: flex; flex-direction: column; gap: 10px; }
.question { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.q-num { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 7px; }
.q-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.q-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 8px; align-items: center; }

/* Vista previa de Discord */
.preview { background: #313338; border-radius: 10px; padding: 16px; overflow: hidden; }
.dc-message { display: flex; gap: 14px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--panel-2); }
.dc-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.dc-author { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dc-tag { background: var(--primary); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; font-weight: 700; }
.dc-time { color: #949ba4; font-size: 12px; font-weight: 400; }
.dc-content { color: #dbdee1; white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-embed { background: #2b2d31; border-left: 4px solid var(--primary); border-radius: 4px; padding: 10px 14px 12px; max-width: 520px; display: flex; flex-direction: column; gap: 8px; }
.dc-embed-main { display: flex; gap: 14px; }
.dc-embed-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dc-embed-author { font-size: 13px; font-weight: 600; }
.dc-title { font-weight: 700; color: #fff; }
.dc-desc { white-space: pre-wrap; font-size: 14px; color: #dbdee1; overflow-wrap: anywhere; }
.dc-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.dc-field { flex: 1 1 100%; font-size: 14px; min-width: 0; }
.dc-field.inline { flex: 1 1 28%; }
.dc-field b { display: block; color: #fff; margin-bottom: 2px; }
.dc-field div { white-space: pre-wrap; color: #dbdee1; overflow-wrap: anywhere; }
.dc-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; flex: none; }
.dc-image { max-width: 100%; border-radius: 4px; }
.dc-footer { font-size: 12px; color: #b5bac1; }
.dc-mention { background: rgba(88, 101, 242, .3); color: #c9cdfb; padding: 0 3px; border-radius: 3px; }
.dc-var { background: rgba(250, 166, 26, .2); color: #ffd18a; padding: 0 3px; border-radius: 3px; font-family: var(--mono); font-size: .9em; }
.dc-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.dc-button { background: #4e5058; color: #fff; padding: 6px 14px; border-radius: 4px; font-size: 14px; font-weight: 500; }
.dc-select { max-width: 520px; background: #1e1f22; border-radius: 4px; overflow: hidden; }
.dc-select-head { display: flex; justify-content: space-between; padding: 9px 12px; color: #b5bac1; font-size: 14px; }
.dc-select-options { border-top: 1px solid #111214; max-height: 240px; overflow-y: auto; }
.dc-option { display: flex; gap: 10px; padding: 8px 12px; font-size: 14px; align-items: flex-start; }
.dc-option:hover { background: #2b2d31; }
.dc-option > span:last-child { display: flex; flex-direction: column; }
.dc-option small { color: #b5bac1; }
.dc-emoji { width: 20px; text-align: center; }

/* Barra de guardar + avisos */
.savebar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; width: min(720px, calc(100% - 32px)); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #0a0b0e; border: 1px solid var(--border-2); border-radius: 12px; padding: 10px 12px 10px 18px; box-shadow: var(--shadow); animation: rise .2s ease-out; }
@keyframes rise { from { transform: translate(-50%, 20px); opacity: 0; } }
.toasts { position: fixed; top: calc(var(--topbar) + 12px); right: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: calc(100% - 32px); }
.toast { background: var(--panel-2); border: 1px solid var(--border-2); border-left: 4px solid var(--success); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); opacity: 0; transform: translateX(20px); transition: all .25s; max-width: 400px; }
.toast.show { opacity: 1; transform: none; }
.toast-error { border-left-color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card { display: none; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .editor-split { grid-template-columns: 1fr; }
  .preview-col { position: static; }
}
@media (max-width: 860px) {
  .topnav { display: none; position: absolute; top: var(--topbar); left: 0; right: 0; flex-direction: column; background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 8px; }
  .topnav.open { display: flex; }
  .menu-btn { display: block; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: var(--topbar); left: 0; bottom: 0; width: 280px; height: auto; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .sidebar-toggle { display: block; position: fixed; bottom: 18px; left: 16px; z-index: 45; background: var(--primary); color: #fff; border: 0; border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
  .is-dashboard .savebar { bottom: 70px; }
  .legal-layout { grid-template-columns: 1fr; }
  .legal-nav { position: static; flex-direction: row; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .feature-grid, .steps { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .q-row, .inline-form, .filters { grid-template-columns: 1fr; }
  .ticket-row summary { grid-template-columns: auto minmax(0, 1fr); }
  .ticket-row summary > span:nth-child(n+4) { display: none; }
  .topbar .user-chip span, .hide-sm { display: none; }
  .topbar { gap: 10px; padding: 0 12px; }
  .content { padding: 20px 16px 130px; }
  .input-sm { min-width: 0; width: 100%; }
  .footer-cols { gap: 28px; }
}

/* ---------- Días de la semana (mensajes programados) ---------- */
.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-picker .day { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; font-size: 14px; user-select: none; }
.day-picker .day input { display: none; }
.day-picker .day.on { background: rgba(88, 101, 242, .2); border-color: var(--primary); color: #fff; }

/* ---------- Ranking público ---------- */
.card.rank-head { border-top: 4px solid var(--accent-color, var(--primary)); }
.rank-head h1 { font-size: 24px; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; margin-bottom: 18px; }
.podium-item { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.podium-item img { width: 64px; height: 64px; border-radius: 50%; }
.podium-item b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-1 { padding-top: 30px; border-color: rgba(245, 197, 66, .5); }
.podium-1 img { width: 80px; height: 80px; box-shadow: 0 0 0 3px rgba(245, 197, 66, .6); }
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: grid; grid-template-columns: 44px 40px minmax(0, 1fr) 56px; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.rank-pos { color: var(--muted); font-weight: 700; }
.rank-row img { width: 40px; height: 40px; border-radius: 50%; }
.rank-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rank-name { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.rank-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 999px; }
.rank-level { display: flex; flex-direction: column; align-items: center; }
.rank-level b { font-size: 20px; line-height: 1; }
@media (max-width: 640px) {
  .podium { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 34px 32px minmax(0, 1fr) 44px; padding: 8px 10px; }
  .rank-name span { display: none; }
}
