/* Asistente · sistema visual compartido (web, accesos, paneles). */
:root {
  --bg: #05070f;
  --bg-2: #0a0e1c;
  --surface: rgba(18, 24, 44, 0.66);
  --surface-solid: #10162b;
  --surface-2: rgba(30, 38, 66, 0.55);
  --line: rgba(148, 163, 220, 0.14);
  --line-strong: rgba(148, 163, 220, 0.28);
  --text: #e8ecff;
  --text-2: #a7b0d4;
  --text-3: #6f7aa6;
  --violet: #8b6cff;
  --cyan: #2ee6f0;
  --gold: #ffc261;
  --green: #3ee8a0;
  --red: #ff5f7a;
  --amber: #ffb547;
  --grad: linear-gradient(120deg, var(--cyan), var(--violet) 55%, #ff7ad9);
  --grad-gold: linear-gradient(120deg, #ffe3a3, var(--gold) 40%, #ff8f5a);
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", var(--font);
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.1; margin: 0 0 .5em; letter-spacing: -0.02em; }
p { margin: 0 0 1em; }
::selection { background: rgba(139, 108, 255, .45); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-family: var(--mono); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gold-text { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Fondo ambiental */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ambient::before, .ambient::after { content: ""; position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .22; animation: drift 26s ease-in-out infinite alternate; }
.ambient::before { background: var(--violet); top: -25vmax; left: -15vmax; }
.ambient::after { background: #0f8fb0; bottom: -30vmax; right: -20vmax; animation-delay: -9s; }
.grid-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(ellipse at 50% 0%, #000 10%, transparent 70%); opacity: .35; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.1); } }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 700 1.2rem var(--font-display); color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; }

/* Botones */
.btn { --b: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .72rem 1.25rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--b); color: var(--text); font: 600 .95rem var(--font); cursor: pointer; transition: transform .2s, box-shadow .25s, background .2s, border-color .2s; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: rgba(46, 230, 240, .5); box-shadow: 0 0 0 4px rgba(46, 230, 240, .08); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); border: 0; color: #060814; box-shadow: 0 10px 40px -10px rgba(139, 108, 255, .7); }
.btn-primary:hover { box-shadow: 0 14px 50px -8px rgba(46, 230, 240, .6); }
.btn-gold { background: var(--grad-gold); border: 0; color: #1a1004; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(255, 95, 122, .45); color: #ffb3c0; background: rgba(255, 95, 122, .08); }
.btn-sm { padding: .45rem .85rem; font-size: .85rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--text-2); width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }

/* Tarjetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.glow-card { position: relative; overflow: hidden; }
.glow-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(46, 230, 240, .13), transparent 45%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.glow-card:hover::before { opacity: 1; }

/* Formularios */
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label { font-size: .85rem; color: var(--text-2); font-weight: 500; }
.input, select.input, textarea.input { width: 100%; padding: .75rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: rgba(5, 8, 18, .6); color: var(--text); font: inherit; transition: border-color .2s, box-shadow .2s; }
.input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(46, 230, 240, .12); }
textarea.input { min-height: 110px; resize: vertical; }
.hint { font-size: .8rem; color: var(--text-3); }
.form-error { color: #ffb3c0; background: rgba(255, 95, 122, .1); border: 1px solid rgba(255, 95, 122, .35); padding: .65rem .85rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 1rem; display: none; }
.form-error.show { display: block; }

/* Etiquetas */
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid var(--line-strong); color: var(--text-2); background: rgba(255, 255, 255, .03); white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.pill.ok { color: var(--green); border-color: rgba(62, 232, 160, .35); }
.pill.warn { color: var(--amber); border-color: rgba(255, 181, 71, .35); }
.pill.bad { color: var(--red); border-color: rgba(255, 95, 122, .35); }
.pill.info { color: var(--cyan); border-color: rgba(46, 230, 240, .35); }
.pill.violet { color: #b9a8ff; border-color: rgba(139, 108, 255, .4); }

/* Avisos flotantes */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: grid; gap: .5rem; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface-solid); border: 1px solid var(--line-strong); border-left: 3px solid var(--cyan); padding: .8rem 1rem; border-radius: 12px; box-shadow: var(--shadow); animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.3); font-size: .92rem; }
.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes toast-in { from { transform: translateY(14px) scale(.96); opacity: 0; } }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(2, 4, 10, .7); backdrop-filter: blur(6px); animation: fade .2s; }
.modal-box { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); animation: pop .3s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(12px) scale(.97); opacity: 0; } }

/* Revelado al hacer scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s cubic-bezier(.2, .7, .2, 1), transform .8s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* Páginas de acceso */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { position: relative; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); overflow: hidden; }
.auth-side canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.auth-side > * { position: relative; z-index: 1; }
.auth-main { display: grid; place-items: center; padding: 3rem 16px; }
.auth-card { width: min(440px, 100%); }
.auth-card h1 { font-size: 2rem; }
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
