/* ==========================================================================
   TWINS CREDITS CONNECT — Design System "Nebula RED" (fintech premium)
   Paleta: rojo → rosa → naranja | Glassmorphism | Dark/Light theming
   ========================================================================== */

/* ---------- 1. THEME TOKENS ---------- */
:root {
    /* RGB triplets (para utilidades Tailwind con <alpha-value>) — escala roja */
    --brand-50: 254 242 242;  --brand-100: 254 226 226; --brand-200: 254 202 202;
    --brand-300: 252 165 165; --brand-400: 248 113 113; --brand-500: 239 68 68;
    --brand-600: 220 38 38;   --brand-700: 185 28 28;   --brand-800: 153 27 27;
    --brand-900: 127 29 29;   --brand-950: 69 10 10;
    /* Aliases legacy (violet→rosa, cyan→naranja) para no romper referencias */
    --violet-400: 251 113 133; --violet-500: 244 63 94; --violet-600: 225 29 72;
    --cyan-300: 253 186 116;   --cyan-400: 251 146 60;  --cyan-500: 249 115 22;
    --gold-400: 251 191 36;    --gold-500: 245 158 11;

    /* Superficies cálidas (light por defecto) */
    --bg: #fdf4f4;
    --bg-soft: #f8eaea;
    --card: rgba(255, 255, 255, .74);
    --card-solid: #ffffff;
    --surface-rgb: 255 255 255;
    --text: #241014;
    --text-muted: #6d4952;
    --text-faint: #a5878e;
    --border: rgba(66, 14, 24, .10);
    --border-strong: rgba(66, 14, 24, .18);
    --input-bg: rgba(255, 255, 255, .88);

    /* Marca y efectos */
    --accent-grad: linear-gradient(135deg, #dc2626 0%, #e11d48 45%, #f97316 100%);
    --accent-grad-soft: linear-gradient(135deg, rgba(239,68,68,.16), rgba(225,29,72,.12) 50%, rgba(249,115,22,.14));
    --glow-brand: rgba(239, 68, 68, .32);
    --glow-cyan: rgba(249, 115, 22, .22);
    --shadow-card: 0 8px 30px rgba(66, 14, 24, .08);
    --shadow-card-hover: 0 18px 50px rgba(220, 38, 38, .20);
    --navbar-bg: rgba(255, 255, 255, .68);
    --hero-grid: rgba(66, 14, 24, .055);
    --orb-opacity: .34;
}

html.dark {
    --bg: #0b0609;
    --bg-soft: #140a10;
    --card: rgba(28, 15, 21, .55);
    --card-solid: #180d14;
    --surface-rgb: 28 15 21;
    --text: #f6ebec;
    --text-muted: #b9a2aa;
    --text-faint: #7e6a72;
    --border: rgba(255, 255, 255, .09);
    --border-strong: rgba(255, 255, 255, .16);
    --input-bg: rgba(255, 255, 255, .045);

    --glow-brand: rgba(239, 68, 68, .42);
    --glow-cyan: rgba(249, 115, 22, .26);
    --shadow-card: 0 8px 30px rgba(0, 0, 0, .38);
    --shadow-card-hover: 0 18px 55px rgba(239, 68, 68, .30);
    --navbar-bg: rgba(14, 7, 11, .62);
    --hero-grid: rgba(255, 255, 255, .045);
    --orb-opacity: .5;
}

/* ---------- 2. BASE ---------- */
html { scroll-behavior: smooth; }
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .35s ease, color .35s ease;
}
.font-display, h1.display, .display { font-family: 'Space Grotesk', 'Inter', sans-serif; }
::selection { background: rgba(239, 68, 68, .35); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(239,68,68,.35); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(225,29,72,.5); }
a { transition: color .2s ease; }
:focus-visible { outline: 2px solid rgb(var(--brand-500)); outline-offset: 2px; border-radius: 6px; }

/* ---------- 3. UTILIDADES DE MARCA ---------- */
.text-gradient {
    background: var(--accent-grad);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.text-gradient-animated { animation: tw-gradient-shift 7s ease infinite; }
.bg-brand-gradient { background: var(--accent-grad); }
.bg-brand-soft { background: var(--accent-grad-soft); }
.border-brand-soft { border-color: rgba(239, 68, 68, .30); }

/* Orbes de fondo flotantes */
.tw-orb { position: absolute; border-radius: 9999px; filter: blur(90px); opacity: var(--orb-opacity); pointer-events: none; }
.tw-orb-indigo { background: radial-gradient(circle, rgba(239,68,68,.55), transparent 65%); }
.tw-orb-violet { background: radial-gradient(circle, rgba(225,29,72,.45), transparent 65%); }
.tw-orb-cyan   { background: radial-gradient(circle, rgba(249,115,22,.40), transparent 65%); }

/* Rejilla futurista de fondo */
.tw-grid-bg {
    background-image:
        linear-gradient(var(--hero-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
}

/* ---------- 4. COMPONENTES NUEVOS (.tw-*) ---------- */
/* Botones */
.tw-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    padding: .8rem 1.7rem; border-radius: 1rem; font-weight: 600; font-size: .95rem;
    line-height: 1; cursor: pointer; border: 1px solid transparent; text-decoration: none;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease, background .25s ease, border-color .25s ease, color .25s ease;
    will-change: transform;
}
.tw-btn:active { transform: scale(.97); }
.tw-btn-primary {
    background: var(--accent-grad); background-size: 160% 160%; color: #fff;
    box-shadow: 0 6px 24px var(--glow-brand), inset 0 1px 0 rgba(255,255,255,.22);
}
.tw-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 36px var(--glow-brand), 0 0 0 1px rgba(225,29,72,.35), inset 0 1px 0 rgba(255,255,255,.25); background-position: 90% 50%; }
.tw-btn-outline {
    background: transparent; color: var(--text); border-color: var(--border-strong);
}
.tw-btn-outline:hover { border-color: rgb(var(--brand-400)); color: rgb(var(--brand-400)); background: rgba(239,68,68,.07); transform: translateY(-2px); }
.tw-btn-ghost { background: rgba(239,68,68,.08); color: rgb(var(--brand-400)); }
.tw-btn-ghost:hover { background: rgba(239,68,68,.16); transform: translateY(-2px); }

/* Cards glass */
.tw-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.4rem;
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-card);
    transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s ease, border-color .35s ease;
}
.tw-card-hover:hover { transform: translateY(-6px); box-shadow: var(--shadow-card-hover); border-color: rgba(239,68,68,.35); }

/* Icono con halo de gradiente */
.tw-icon-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 3.25rem; height: 3.25rem; border-radius: 1.1rem;
    background: var(--accent-grad-soft);
    border: 1px solid rgba(239,68,68,.25);
    color: rgb(var(--brand-400)); font-size: 1.25rem;
    box-shadow: 0 0 22px var(--glow-brand);
}

/* Inputs */
.tw-input {
    width: 100%; padding: .8rem 1.05rem; border-radius: .9rem;
    background: var(--input-bg); border: 1px solid var(--border);
    color: var(--text); font-size: .95rem;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.tw-input::placeholder { color: var(--text-faint); }
.tw-input:focus { outline: none; border-color: rgb(var(--brand-500)); box-shadow: 0 0 0 4px rgba(239,68,68,.18); }

/* Badges */
.tw-badge {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .35rem .95rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
    background: rgba(239,68,68,.10); color: rgb(var(--brand-400));
    border: 1px solid rgba(239,68,68,.28);
}
.tw-badge .dot { width: .45rem; height: .45rem; border-radius: 99px; background: var(--accent-grad); box-shadow: 0 0 10px var(--glow-brand); }

/* Navbar */
.tw-navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    transition: background .3s ease, box-shadow .3s ease, border-color .3s ease, backdrop-filter .3s ease;
    border-bottom: 1px solid transparent;
}
.tw-navbar.scrolled {
    background: var(--navbar-bg);
    backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom-color: var(--border);
    box-shadow: 0 6px 30px rgba(0,0,0,.08);
}
.tw-navlink {
    position: relative; padding: .45rem .9rem; border-radius: .7rem;
    font-size: .92rem; font-weight: 500; color: var(--text-muted); text-decoration: none;
    transition: color .2s ease, background .2s ease;
}
.tw-navlink:hover { color: var(--text); background: rgba(239,68,68,.08); }
.tw-navlink.active { color: rgb(var(--brand-400)); }

/* Tablas modernas */
.tw-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.tw-table thead th {
    text-align: left; padding: .85rem 1rem; font-size: .74rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint);
    border-bottom: 1px solid var(--border);
}
.tw-table tbody td { padding: 1rem; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.tw-table tbody tr { transition: background .2s ease; }
.tw-table tbody tr:hover { background: rgba(239,68,68,.05); }

/* Toggle de tema (sol/luna animado) */
.theme-toggle {
    position: relative; width: 2.6rem; height: 2.6rem; border-radius: .9rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(239,68,68,.08); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; overflow: hidden;
    transition: color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.theme-toggle:hover { color: rgb(var(--brand-400)); border-color: rgba(239,68,68,.4); box-shadow: 0 0 18px var(--glow-brand); transform: translateY(-1px); }
.theme-toggle svg { position: absolute; width: 1.15rem; height: 1.15rem; transition: transform .5s cubic-bezier(.34,1.56,.64,1), opacity .3s ease; }
.theme-toggle .icon-sun { transform: translateY(150%) rotate(90deg); opacity: 0; }
.theme-toggle .icon-moon { transform: translateY(0) rotate(0); opacity: 1; }
html:not(.dark) .theme-toggle .icon-sun { transform: translateY(0) rotate(0); opacity: 1; }
html:not(.dark) .theme-toggle .icon-moon { transform: translateY(-150%) rotate(-90deg); opacity: 0; }

/* ---------- 5. ANIMACIONES ---------- */
@keyframes tw-fade-up { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tw-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tw-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
@keyframes tw-gradient-shift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes tw-pulse-glow { 0%,100% { box-shadow: 0 0 22px var(--glow-brand); } 50% { box-shadow: 0 0 44px var(--glow-brand), 0 0 70px var(--glow-cyan); } }
@keyframes tw-drift { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(36px,-44px) scale(1.12); } 66% { transform: translate(-28px,26px) scale(.92); } }
@keyframes tw-shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }

.tw-animate-fade-up { animation: tw-fade-up .7s cubic-bezier(.22,1,.36,1) both; }
.tw-animate-fade-in { animation: tw-fade-in .8s ease both; }
.tw-animate-float { animation: tw-float 6s ease-in-out infinite; }
.tw-animate-drift { animation: tw-drift 12s ease-in-out infinite; }
.tw-animate-pulse-glow { animation: tw-pulse-glow 3.2s ease-in-out infinite; }
.tw-animate-shimmer {
    background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.14) 50%, transparent 70%);
    background-size: 200% 100%; animation: tw-shimmer 2.6s linear infinite;
}
.tw-delay-1 { animation-delay: .12s !important; } .tw-delay-2 { animation-delay: .24s !important; }
.tw-delay-3 { animation-delay: .36s !important; } .tw-delay-4 { animation-delay: .48s !important; }

/* Reveals al hacer scroll (IntersectionObserver en twins-ui.js) */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .8s cubic-bezier(.22,1,.36,1), transform .8s cubic-bezier(.22,1,.36,1); will-change: opacity, transform; }
.reveal.reveal-visible { opacity: 1; transform: translateY(0); }
.reveal[data-delay="1"] { transition-delay: .12s; } .reveal[data-delay="2"] { transition-delay: .22s; }
.reveal[data-delay="3"] { transition-delay: .32s; } .reveal[data-delay="4"] { transition-delay: .42s; }
.reveal[data-delay="5"] { transition-delay: .52s; }

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

/* ---------- 6. UNIFICACIÓN LEGACY (override de clases del build antiguo) ----------
   twins.css se carga DESPUÉS del CSS compilado de Vite, por lo que estas
   reglas ganan y actualizan las vistas antiguas al nuevo sistema. */
.glass-card, .glass-strong, .glass-ultra {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-card);
    border-radius: 1.25rem;
}
.btn-primary {
    background: var(--accent-grad) !important;
    color: #fff !important; border: none !important;
    border-radius: .9rem !important;
    box-shadow: 0 6px 22px var(--glow-brand) !important;
    transition: transform .25s ease, box-shadow .25s ease !important;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px var(--glow-brand) !important; }
.btn-secondary {
    background: rgba(239,68,68,.10) !important; color: rgb(var(--brand-400)) !important;
    border: 1px solid rgba(239,68,68,.28) !important; border-radius: .9rem !important;
}
.glass-input, .glass-select {
    background: var(--input-bg) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: .85rem !important;
}
.glass-input:focus, .glass-select:focus { border-color: rgb(var(--brand-500)) !important; box-shadow: 0 0 0 4px rgba(239,68,68,.18) !important; outline: none !important; }
.sidebar-brand { background: var(--card-solid) !important; border-right: 1px solid var(--border) !important; }

/* ==========================================================================
   EXTENSIÓN FASE FINAL — puente de tema para vistas legacy + extras
   ========================================================================== */

/* Delays de entrada usados por vistas auth/admin */
.animate-delay-100 { animation-delay: .10s !important; }
.animate-delay-200 { animation-delay: .20s !important; }
.animate-delay-300 { animation-delay: .30s !important; }
.animate-delay-400 { animation-delay: .40s !important; }
.animate-delay-500 { animation-delay: .50s !important; }

/* Gradiente de marca para títulos legacy (antes rojo) */
.text-gradient-premium {
    background: var(--accent-grad);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: tw-gradient-shift 7s ease infinite;
}

/* Superficie premium legacy (login admin) */
.glass-premium {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.75rem;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
}
.border-glow { box-shadow: 0 0 40px var(--glow-brand), var(--shadow-card); }

/* Tablas dentro de glass-cards: look moderno */
.glass-card table thead th, .glass-strong table thead th, .tw-card table thead th {
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: var(--text-faint); border-bottom: 1px solid var(--border); padding: .8rem 1rem;
}
.glass-card table tbody td, .glass-strong table tbody td, .tw-card table tbody td {
    border-bottom: 1px solid var(--border);
}
.glass-card table tbody tr, .glass-strong table tbody tr, .tw-card table tbody tr { transition: background .2s ease; }
.glass-card table tbody tr:hover, .glass-strong table tbody tr:hover, .tw-card table tbody tr:hover { background: rgba(239,68,68,.05); }

/* ---------- PUENTE MODO CLARO para clases hardcodeadas legacy ----------
   Las vistas internas antiguas usan text-white / text-gray-* / bg-white/[x]
   / border-white/[x]. En modo claro se remapean a las variables del sistema. */
html:not(.dark) .text-white { color: var(--text) !important; }
html:not(.dark) [class*="text-white/["] { color: var(--text-faint) !important; }
html:not(.dark) .text-gray-300 { color: var(--text) !important; }
html:not(.dark) .text-gray-400 { color: var(--text-muted) !important; }
html:not(.dark) .text-gray-500 { color: var(--text-muted) !important; }
html:not(.dark) .text-gray-600 { color: var(--text-faint) !important; }
html:not(.dark) .text-gray-700 { color: var(--text-faint) !important; }
html:not(.dark) .placeholder\:text-gray-700::placeholder,
html:not(.dark) .placeholder\:text-gray-600::placeholder,
html:not(.dark) .placeholder\:text-gray-500::placeholder { color: var(--text-faint) !important; }

html:not(.dark) .bg-white { background-color: var(--card-solid) !important; }
html:not(.dark) [class*="bg-white/["] { background-color: rgba(13, 17, 48, .05) !important; }
html:not(.dark) [class*="hover:bg-white/["]:hover { background-color: rgba(13, 17, 48, .08) !important; }
html:not(.dark) .border-white,
html:not(.dark) [class*="border-white/["] { border-color: var(--border) !important; }
html:not(.dark) [class*="divide-white/["] > * + * { border-color: var(--border) !important; }
html:not(.dark) [class*="ring-white/["] { --tw-ring-color: var(--border) !important; }

/* Excepciones: elementos sobre gradiente de marca conservan texto blanco */
html:not(.dark) a.btn-primary, html:not(.dark) button.btn-primary,
html:not(.dark) .btn-primary, html:not(.dark) .tw-btn-primary,
html:not(.dark) .file\:bg-brand-500::file-selector-button { color: #fff !important; }
html:not(.dark) .bg-brand-gradient, html:not(.dark) .bg-brand-gradient *,
html:not(.dark) .from-brand-500, html:not(.dark) .from-brand-500 *,
html:not(.dark) .bg-brand-500, html:not(.dark) .bg-brand-500 * { color: #fff !important; }
html:not(.dark) .bg-emerald-500, html:not(.dark) .bg-emerald-500 *,
html:not(.dark) .bg-red-500, html:not(.dark) .bg-red-500 * { color: #fff !important; }

/* Badges de estado semánticos en modo claro (legibilidad) */
html:not(.dark) .text-emerald-300 { color: #047857 !important; }
html:not(.dark) .text-emerald-400 { color: #059669 !important; }
html:not(.dark) .text-amber-300 { color: #b45309 !important; }
html:not(.dark) .text-amber-400 { color: #d97706 !important; }
html:not(.dark) .text-rose-300, html:not(.dark) .text-red-300 { color: #be123c !important; }
html:not(.dark) .text-rose-400, html:not(.dark) .text-red-400 { color: #e11d48 !important; }
input[type=file]::file-selector-button { background: var(--accent-grad); color: #fff; border: none; border-radius: .75rem; padding: .6rem 1.1rem; font-weight: 600; cursor: pointer; transition: opacity .2s ease, box-shadow .2s ease; }
input[type=file]::file-selector-button:hover { box-shadow: 0 6px 20px var(--glow-brand); }

/* Clases legacy extra (panel de usuario y similares) */
.glass-card-strong {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
    box-shadow: var(--shadow-card);
}
.glass-card-hover {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-card);
    transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s ease, border-color .3s ease;
}
.glass-card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); border-color: rgba(239,68,68,.35); }

/* ==========================================================================
   FUTURISTIC ENHANCEMENTS — Nebula RED v2
   Animaciones avanzadas, bordes con glow, micro-interacciones
   ========================================================================== */

/* ---------- ANIMATED GRADIENT BORDER ---------- */
.tw-border-glow {
    position: relative;
    border-radius: 1.25rem;
    overflow: hidden;
}
.tw-border-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: conic-gradient(from var(--angle, 0deg),
        rgba(239,68,68,.6), rgba(249,115,22,.4),
        rgba(239,68,68,.2), rgba(225,29,72,.5),
        rgba(239,68,68,.6));
    z-index: -1;
    animation: tw-border-spin 4s linear infinite;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    padding: 2px;
}
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
@keyframes tw-border-spin {
    to { --angle: 360deg; }
}

/* ---------- FUTURISTIC CARD WITH CORNER ACCENTS ---------- */
.tw-card-futuristic {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .4s ease, border-color .35s ease;
}
.tw-card-futuristic::before,
.tw-card-futuristic::after {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    border-color: rgba(239,68,68,.5);
    border-style: solid;
    opacity: 0;
    transition: opacity .4s ease, width .4s ease, height .4s ease;
}
.tw-card-futuristic::before {
    top: -1px;
    left: -1px;
    border-width: 2px 0 0 2px;
    border-radius: 1.25rem 0 0 0;
}
.tw-card-futuristic::after {
    bottom: -1px;
    right: -1px;
    border-width: 0 2px 2px 0;
    border-radius: 0 0 1.25rem 0;
}
.tw-card-futuristic:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 60px rgba(239,68,68,.25), 0 0 40px rgba(239,68,68,.12);
    border-color: rgba(239,68,68,.35);
}
.tw-card-futuristic:hover::before,
.tw-card-futuristic:hover::after {
    opacity: 1;
    width: 48px;
    height: 48px;
}

/* ---------- 3D HOVER LIFT ---------- */
.tw-hover-lift {
    transition: transform .35s cubic-bezier(.22,1,.36,1),
                box-shadow .35s ease,
                filter .35s ease;
    will-change: transform;
}
.tw-hover-lift:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 24px 48px rgba(239,68,68,.18), 0 0 30px rgba(239,68,68,.08);
    filter: brightness(1.08);
}

/* ---------- ENHANCED GLOW ON BUTTONS ---------- */
.tw-btn-glow {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.tw-btn-glow::after {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
        rgba(255,255,255,.25) 0%,
        transparent 60%);
    opacity: 0;
    transition: opacity .4s ease;
    pointer-events: none;
    z-index: -1;
}
.tw-btn-glow:hover::after {
    opacity: 1;
}

/* ---------- MICRO RIPPLE ON CLICK ---------- */
.tw-ripple {
    position: relative;
    overflow: hidden;
}
.tw-ripple .ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.3);
    transform: scale(0);
    animation: tw-ripple-anim .6s ease-out;
    pointer-events: none;
}
@keyframes tw-ripple-anim {
    to { transform: scale(4); opacity: 0; }
}

/* ---------- FLOATING PARTICLES BG ---------- */
.tw-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}
.tw-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(239,68,68,.35);
    border-radius: 50%;
    animation: tw-float-particle var(--duration, 8s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    left: var(--x, 50%);
    top: var(--y, 50%);
}
@keyframes tw-float-particle {
    0%, 100% { transform: translateY(0) translateX(0) scale(1); opacity: .3; }
    25% { transform: translateY(-60px) translateX(30px) scale(1.3); opacity: .7; }
    50% { transform: translateY(-120px) translateX(-20px) scale(.9); opacity: .4; }
    75% { transform: translateY(-40px) translateX(40px) scale(1.1); opacity: .6; }
}

/* ---------- SCANLINE OVERLAY EFFECT ---------- */
.tw-scanline {
    position: relative;
    overflow: hidden;
}
.tw-scanline::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(239,68,68,.03) 2px,
        rgba(239,68,68,.03) 4px
    );
    pointer-events: none;
    animation: tw-scanline-move 8s linear infinite;
}
@keyframes tw-scanline-move {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* ---------- PULSE RING EFFECT ---------- */
.tw-pulse-ring {
    position: relative;
}
.tw-pulse-ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 2px solid rgba(239,68,68,.4);
    animation: tw-pulse-ring 2s cubic-bezier(.22,1,.36,1) infinite;
}
@keyframes tw-pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.25); opacity: 0; }
}

/* ---------- SHIMMER TEXT ---------- */
.tw-text-shimmer {
    background: linear-gradient(90deg,
        var(--text) 0%,
        rgb(var(--brand-400)) 25%,
        rgb(var(--brand-300)) 50%,
        rgb(var(--brand-400)) 75%,
        var(--text) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: tw-gradient-shift 4s ease infinite;
}

/* ---------- BORDER GLOW CARD ---------- */
.tw-border-glow-card {
    position: relative;
    border-radius: 1.25rem;
}
.tw-border-glow-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg,
        rgba(239,68,68,.5), rgba(249,115,22,.3),
        rgba(225,29,72,.5), rgba(239,68,68,.5));
    background-size: 300% 300%;
    z-index: -1;
    animation: tw-gradient-shift 6s ease infinite;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    padding: 1px;
}

/* ---------- ENHANCED ORB ANIMATIONS ---------- */
.tw-orb-enhanced {
    animation: tw-drift 15s ease-in-out infinite,
               tw-orb-pulse 4s ease-in-out infinite;
}
@keyframes tw-orb-pulse {
    0%, 100% { opacity: var(--orb-opacity); filter: blur(90px); }
    50% { opacity: calc(var(--orb-opacity) * 1.4); filter: blur(100px); }
}

/* ---------- STAGGERED ENTRY ANIMATIONS ---------- */
.tw-stagger > * {
    opacity: 0;
    transform: translateY(20px) scale(.97);
    animation: tw-stagger-in .6s cubic-bezier(.22,1,.36,1) forwards;
}
.tw-stagger > *:nth-child(1) { animation-delay: .05s; }
.tw-stagger > *:nth-child(2) { animation-delay: .1s; }
.tw-stagger > *:nth-child(3) { animation-delay: .15s; }
.tw-stagger > *:nth-child(4) { animation-delay: .2s; }
.tw-stagger > *:nth-child(5) { animation-delay: .25s; }
.tw-stagger > *:nth-child(6) { animation-delay: .3s; }
.tw-stagger > *:nth-child(7) { animation-delay: .35s; }
.tw-stagger > *:nth-child(8) { animation-delay: .4s; }
@keyframes tw-stagger-in {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- GLASS ENHANCED ---------- */
.glass-premium, .glass-card, .glass-strong, .glass-ultra {
    backdrop-filter: blur(24px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(24px) saturate(1.4) !important;
}
.tw-card, .tw-card-hover {
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
}

/* ---------- ENHANCED THEME TOGGLE ---------- */
.theme-toggle {
    transition: color .25s ease, border-color .25s ease,
                box-shadow .25s ease, transform .25s ease,
                background .25s ease !important;
}
.theme-toggle:active {
    transform: scale(.88) !important;
}

/* ---------- SMOOTH SECTION DIVIDERS ---------- */
.tw-section-divider {
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(239,68,68,.25) 25%,
        rgba(249,115,22,.25) 50%,
        rgba(239,68,68,.25) 75%,
        transparent 100%);
    border: none;
    margin: 2rem 0;
}

/* ---------- ENHANCED BADGE GLOW ---------- */
.tw-badge {
    position: relative;
    overflow: hidden;
}
.tw-badge .dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgb(var(--brand-400));
    margin-right: 6px;
    animation: tw-pulse-dot 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(239,68,68,.5);
}
@keyframes tw-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .6; transform: scale(.8); }
}

/* ---------- COUNTER ENTRY ---------- */
.tw-count-up {
    display: inline-block;
    animation: tw-count-in .6s cubic-bezier(.22,1,.36,1) both;
}
@keyframes tw-count-in {
    from { opacity: 0; transform: translateY(16px) scale(.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- CUSTOM SCROLLBAR ENHANCED ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgb(var(--brand-500)), rgb(var(--brand-600)));
    border-radius: 99px;
    border: 1px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, rgb(var(--brand-400)), rgb(var(--brand-500))); }

/* ---------- NAVBAR ENHANCED ---------- */
.tw-navbar {
    backdrop-filter: blur(28px) saturate(1.5) !important;
    -webkit-backdrop-filter: blur(28px) saturate(1.5) !important;
    border-bottom: 1px solid var(--border) !important;
    transition: background .35s ease, box-shadow .35s ease !important;
}


/* ---------- BIND CORNER ACCENTS TO EXISTING CARDS ---------- */
.tw-card, .tw-card-hover, .glass-card, .glass-strong, .glass-premium {
    position: relative;
    transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .4s ease, border-color .35s ease;
}
.tw-card::before, .tw-card-hover::before,
.glass-card::before, .glass-strong::before, .glass-premium::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 24px;
    height: 24px;
    border-width: 2px 0 0 2px;
    border-style: solid;
    border-color: rgba(239,68,68,.35);
    border-radius: inherit 0 0 0;
    opacity: 0;
    transition: opacity .4s ease, width .4s ease, height .4s ease;
    pointer-events: none;
}
.tw-card::after, .tw-card-hover::after,
.glass-card::after, .glass-strong::after, .glass-premium::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 24px;
    height: 24px;
    border-width: 0 2px 2px 0;
    border-style: solid;
    border-color: rgba(239,68,68,.35);
    border-radius: 0 0 inherit 0;
    opacity: 0;
    transition: opacity .4s ease, width .4s ease, height .4s ease;
    pointer-events: none;
}
.tw-card:hover::before, .tw-card-hover:hover::before,
.glass-card:hover::before, .glass-strong:hover::before, .glass-premium:hover::before,
.tw-card:hover::after, .tw-card-hover:hover::after,
.glass-card:hover::after, .glass-strong:hover::after, .glass-premium:hover::after {
    opacity: 1;
    width: 32px;
    height: 32px;
}

/* ---------- BIND HOVER LIFT TO EXISTING CARDS ---------- */
.tw-card-hover:hover, .glass-card:hover, .glass-premium:hover, .glass-strong:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 20px 50px rgba(239,68,68,.18), 0 0 30px rgba(0,0,0,.1) !important;
    border-color: rgba(239,68,68,.35) !important;
}

/* ---------- BIND GLOW TO EXISTING BUTTONS ---------- */
.btn-primary, .tw-btn-primary {
    position: relative;
    overflow: hidden;
}
.btn-primary::after, .tw-btn-primary::after {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(ellipse at center, rgba(255,255,255,.18), transparent 60%);
    opacity: 0;
    transition: opacity .4s ease;
    pointer-events: none;
}
.btn-primary:hover::after, .tw-btn-primary:hover::after {
    opacity: 1;
}

/* ---------- BIND STAGGER TO GRID SECTIONS ---------- */
.tw-grid-stagger > * {
    opacity: 0;
    transform: translateY(20px) scale(.97);
    animation: tw-stagger-in .6s cubic-bezier(.22,1,.36,1) forwards;
}
.tw-grid-stagger > *:nth-child(1) { animation-delay: .05s; }
.tw-grid-stagger > *:nth-child(2) { animation-delay: .1s; }
.tw-grid-stagger > *:nth-child(3) { animation-delay: .15s; }
.tw-grid-stagger > *:nth-child(4) { animation-delay: .2s; }
.tw-grid-stagger > *:nth-child(5) { animation-delay: .25s; }
.tw-grid-stagger > *:nth-child(6) { animation-delay: .3s; }
.tw-grid-stagger > *:nth-child(7) { animation-delay: .35s; }
.tw-grid-stagger > *:nth-child(8) { animation-delay: .4s; }
@keyframes tw-stagger-in {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- ENHANCED HERO ORBS ---------- */
.tw-orb {
    animation: tw-drift 18s ease-in-out infinite,
               tw-orb-pulse 5s ease-in-out infinite !important;
}

/* ---------- ENHANCED tw-btn-outline ---------- */
.tw-btn-outline {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    transition: all .3s cubic-bezier(.22,1,.36,1) !important;
}
.tw-btn-outline::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-grad);
    opacity: 0;
    transition: opacity .35s ease;
    z-index: -1;
    border-radius: inherit;
}
.tw-btn-outline:hover {
    color: #fff !important;
    border-color: transparent !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--glow-brand);
}
.tw-btn-outline:hover::before {
    opacity: 1;
}

/* ---------- CARD GLOW ON MOUSE FOLLOW ---------- */
.tw-card-glow {
    position: relative;
}
.tw-card-glow .glow-follow {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
        rgba(239,68,68,.12) 0%,
        transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity .4s ease;
}
.tw-card-glow:hover .glow-follow {
    opacity: 1;
}

/* ---------- MEGA TITLE GLOW ---------- */
.tw-title-glow {
    text-shadow: 0 0 40px rgba(239,68,68,.15),
                 0 0 80px rgba(239,68,68,.08),
                 0 0 120px rgba(239,68,68,.04);
}
