/* BYMETAL FRONTEND LAB PREVIEW
   Capa visual aislada para probar el rediseño sin tocar producción. */

:root {
  --preview-bg: #050b14;
  --preview-panel: rgba(10, 18, 32, 0.88);
  --preview-panel-2: rgba(14, 25, 43, 0.92);
  --preview-border: rgba(126, 164, 202, 0.18);
  --preview-border-strong: rgba(56, 189, 248, 0.32);
  --preview-text: #f8fafc;
  --preview-soft: #cbd5e1;
  --preview-muted: #91a4bb;
  --preview-accent: #26b8f4;
  --preview-accent-2: #7dd3fc;
  --preview-success: #25e083;
  --preview-warning: #ffb020;
  --preview-danger: #ff5a67;
  --transition-fast: 180ms ease;
  --transition-normal: 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-slow: 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --accent: var(--preview-accent);
  --panel-border: var(--preview-border);
  --soft-glow: 0 18px 48px rgba(38, 184, 244, 0.16);
}

html,
body {
  background:
    linear-gradient(90deg, rgba(125, 211, 252, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(125, 211, 252, 0.028) 1px, transparent 1px),
    radial-gradient(circle at 12% 0%, rgba(38, 184, 244, 0.18), transparent 28%),
    radial-gradient(circle at 95% 100%, rgba(249, 115, 22, 0.10), transparent 24%),
    linear-gradient(180deg, #07111f 0%, var(--preview-bg) 48%, #030712 100%) !important;
  background-size: 46px 46px, 46px 46px, auto, auto, auto !important;
  color: var(--preview-text) !important;
  font-family: "DM Sans", "Segoe UI", sans-serif !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(38, 184, 244, 0.10), transparent 38%),
    url("/static/img/bymetal-transition-bg.webp") center / cover no-repeat;
  opacity: 0.20;
  mix-blend-mode: screen;
  z-index: -1;
}

.glass,
.glass-sidebar,
header.glass,
.login-shell,
.login-card,
.modal-overlay + .glass {
  background: linear-gradient(180deg, var(--preview-panel), rgba(5, 11, 20, 0.94)) !important;
  border-color: var(--preview-border) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38) !important;
}

.login-shell,
.login-card,
.login-brand {
  animation: fadeUp var(--transition-slow) both;
}

.login-card {
  animation-delay: 100ms;
}

.brand-hero-logo,
.login-mark,
.brand-mark {
  animation: softFloat 4.8s ease-in-out infinite;
  will-change: transform;
}

.glass-sidebar {
  background:
    linear-gradient(180deg, rgba(4, 10, 19, 0.98), rgba(5, 10, 22, 0.96)),
    radial-gradient(circle at 0 0, rgba(38, 184, 244, 0.14), transparent 34%) !important;
}

aside.glass-sidebar > div:first-child {
  height: 96px !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
}

aside.glass-sidebar > div:first-child > div:first-child {
  width: 54px !important;
  height: 54px !important;
  border-radius: 18px !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(15,23,42,0.14)),
    url("/static/img/bymetal-logo-preview.png") center / cover no-repeat !important;
}

aside.glass-sidebar h1,
.brand-copy h1 {
  font-family: "Bebas Neue", "DM Sans", sans-serif !important;
  font-size: 1.8rem !important;
  letter-spacing: 0.075em !important;
}

aside.glass-sidebar p,
.brand-copy p,
.text-blue-400,
.text-cyan-300 {
  color: var(--preview-accent-2) !important;
}

#sidebar-nav > button,
#sidebar-nav > div > button,
#sidebar-nav .submenu button,
.nav-item {
  border: 1px solid transparent !important;
  color: var(--preview-soft) !important;
}

#sidebar-nav > button:hover,
#sidebar-nav > div > button:hover,
#sidebar-nav .submenu button:hover {
  color: var(--preview-text) !important;
  background: rgba(38, 184, 244, 0.09) !important;
  border-color: rgba(38, 184, 244, 0.18) !important;
}

.bg-blue-600\/10,
.bg-blue-600\/20,
.bg-sky-500\/10 {
  background: rgba(38, 184, 244, 0.14) !important;
}

.border-blue-500\/20,
.border-sky-400\/20 {
  border-color: rgba(38, 184, 244, 0.28) !important;
}

main,
.content-area {
  color: var(--preview-text) !important;
}

main .glass,
main .rounded-3xl,
main .rounded-2xl,
main .rounded-xl {
  border-color: var(--preview-border) !important;
}

main .glass:hover {
  border-color: rgba(126, 164, 202, 0.28) !important;
  box-shadow: var(--soft-glow) !important;
  transform: translateY(-2px);
}

h1, h2, h3, h4,
.font-bold,
.font-semibold {
  color: var(--preview-text);
}

.text-slate-500,
.text-slate-400,
.text-zinc-400,
.text-zinc-500 {
  color: var(--preview-muted) !important;
}

.text-slate-300,
.text-zinc-300 {
  color: var(--preview-soft) !important;
}

input,
select,
textarea {
  min-height: 42px;
  background: rgba(3, 8, 17, 0.72) !important;
  color: var(--preview-text) !important;
  border: 1px solid rgba(126, 164, 202, 0.24) !important;
  border-radius: 12px !important;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast) !important;
}

input::placeholder,
textarea::placeholder {
  color: #95a4b8 !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(125, 211, 252, 0.78) !important;
  box-shadow: 0 0 0 3px rgba(38, 184, 244, 0.14), 0 10px 24px rgba(0, 0, 0, 0.18) !important;
  transform: translateY(-1px);
}

select option {
  background: #07111f;
  color: var(--preview-text);
}

button,
.btn,
a[role="button"] {
  border-radius: 12px !important;
  transition:
    transform var(--transition-fast),
    opacity var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast) !important;
}

button:not(:disabled):hover,
a[role="button"]:hover {
  transform: translateY(-1px);
}

button:not(:disabled):active,
a[role="button"]:active {
  transform: translateY(0) scale(0.985);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 1 !important;
  background: rgba(51, 65, 85, 0.66) !important;
  color: #aebbd0 !important;
  border-color: rgba(126, 164, 202, 0.18) !important;
}

.bg-blue-600,
.bg-sky-600 {
  background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
}

.bg-green-600,
.bg-emerald-600 {
  background: linear-gradient(135deg, #059669, #047857) !important;
}

.bg-orange-600,
.bg-amber-600 {
  background: linear-gradient(135deg, #f97316, #c2410c) !important;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: rgba(4, 10, 19, 0.86) !important;
  color: #9fb2c9 !important;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

tbody td {
  color: #e7edf7 !important;
}

tbody tr:hover {
  background: rgba(38, 184, 244, 0.055) !important;
}

.reveal,
.motion-reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: cardEnter var(--transition-slow) forwards;
}

.delay-1 { animation-delay: 70ms; }
.delay-2 { animation-delay: 140ms; }
.delay-3 { animation-delay: 210ms; }
.delay-4 { animation-delay: 280ms; }
.delay-5 { animation-delay: 350ms; }
.delay-6 { animation-delay: 420ms; }

.subtlePulse {
  animation: subtlePulse 1.8s ease-in-out infinite;
}

.submenu {
  display: block;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-4px);
  transition:
    max-height var(--transition-normal),
    opacity var(--transition-normal),
    transform var(--transition-normal) !important;
}

.submenu.open {
  max-height: 760px;
  opacity: 1;
  transform: translateY(0);
}

.login-shell {
  width: min(1180px, 100%) !important;
  overflow: hidden;
}

.login-brand {
  background:
    linear-gradient(180deg, rgba(14, 25, 43, 0.90), rgba(5, 11, 20, 0.78)),
    radial-gradient(circle at top left, rgba(38, 184, 244, 0.18), transparent 42%) !important;
}

.brand-title {
  letter-spacing: -0.06em !important;
}

.brand-hero-logo img,
.login-mark img {
  content: url("/static/img/bymetal-logo-preview.png");
  object-fit: cover !important;
  object-position: center !important;
}

.login-cta {
  background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
  box-shadow: 0 18px 42px rgba(14, 165, 233, 0.22) !important;
}

.login-cta.is-loading {
  pointer-events: none;
  opacity: 0.82;
}

.login-transition {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(2, 6, 23, 0.96), rgba(7, 17, 31, 0.92)),
    url("/static/img/bymetal-transition-bg.webp") center / cover no-repeat;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.login-transition.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.welcome-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 20%, rgba(38, 184, 244, 0.24), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(249, 115, 22, 0.14), transparent 26%);
}

.welcome-line {
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 35%, rgba(125, 211, 252, 0.34), transparent 56%);
  transform: translateX(-42%) translateY(-22%) rotate(0.001deg);
}

.login-transition.is-active .welcome-line {
  animation: diagonalSweep 1.45s ease-in-out both;
}

.welcome-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px;
  animation: blurReveal 700ms 170ms both;
}

.welcome-kicker {
  display: block;
  margin-bottom: 14px;
  font-family: "DM Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.26em;
  color: #7dd3fc;
}

.welcome-content h3 {
  font-family: "Bebas Neue", "DM Sans", sans-serif;
  font-size: clamp(4rem, 10vw, 8rem);
  letter-spacing: 0.05em;
  line-height: 0.92;
  margin: 0;
}

.welcome-content p {
  margin-top: 14px;
  color: #dbeafe;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

body.preview-mode aside .text-red-400,
body.preview-mode aside .text-red-500,
body.preview-mode aside [class*="text-red"] {
  display: none !important;
}

body.preview-mode aside::before {
  content: "Modo preview local: datos simulados";
  display: block;
  margin: 8px 16px;
  padding: 10px 12px;
  border: 1px solid rgba(38, 184, 244, 0.24);
  border-radius: 14px;
  background: rgba(38, 184, 244, 0.08);
  color: #bae6fd;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 1024px) {
  body.h-screen.flex.overflow-hidden {
    overflow: auto !important;
  }

  aside.glass-sidebar {
    width: 232px !important;
  }

  main {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  body {
    padding: 0 !important;
  }

  .login-shell {
    grid-template-columns: 1fr !important;
    border-radius: 0 !important;
    min-height: 100vh;
  }

  .login-brand {
    min-height: auto !important;
    padding: 28px !important;
  }

  .brand-title {
    font-size: clamp(2.6rem, 14vw, 4.6rem) !important;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes softFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes diagonalSweep {
  0% { transform: translateX(-62%) translateY(-32%) rotate(0.001deg); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateX(62%) translateY(32%) rotate(0.001deg); opacity: 0; }
}

@keyframes blurReveal {
  from {
    opacity: 0;
    filter: blur(14px);
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes subtlePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 90, 103, 0.18);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 90, 103, 0);
  }
}

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

  .brand-hero-logo,
  .login-mark,
  .brand-mark {
    animation: none !important;
  }
}

/* === ByMetal motion fidelity pass: basado en el prototipo original === */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 16%, rgba(125, 211, 252, 0.12), transparent 18%),
    radial-gradient(circle at 82% 72%, rgba(249, 115, 22, 0.10), transparent 22%),
    linear-gradient(115deg, transparent 0%, rgba(125, 211, 252, 0.035) 46%, transparent 58%);
  opacity: 0.72;
  animation: bgFloat 16s ease-in-out infinite alternate;
  z-index: -1;
}

.login-brand {
  overflow: hidden;
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.42;
  animation: machineGridMove 14s linear infinite;
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.055), transparent 54%);
  transform: translateX(-115%);
  animation: machineSoftSweep 7.2s ease-in-out infinite;
  pointer-events: none;
}

.login-shell {
  animation: shellEnter 0.95s cubic-bezier(.2,.8,.2,1) both !important;
}

.brand-kicker,
.brand-title,
.brand-text,
.brand-hero-logo,
.brand-point,
.brand-footer,
.login-mark,
.login-heading,
.login-card p,
.login-card .space-y-5 > div,
.login-cta {
  opacity: 0;
  animation: revealUp 0.82s cubic-bezier(.2,.8,.2,1) forwards;
}

.brand-kicker { animation-delay: 0.10s; }
.brand-title { animation-delay: 0.20s; }
.brand-text { animation-delay: 0.34s; }
.brand-hero-logo { animation-delay: 0.48s; }
.brand-point:nth-child(1) { animation-delay: 0.62s; }
.brand-point:nth-child(2) { animation-delay: 0.74s; }
.brand-point:nth-child(3) { animation-delay: 0.86s; }
.brand-footer { animation-delay: 0.98s; }
.login-mark { animation-delay: 0.34s; }
.login-heading { animation-delay: 0.46s; }
.login-card p { animation-delay: 0.56s; }
.login-card .space-y-5 > div:nth-child(1) { animation-delay: 0.66s; }
.login-card .space-y-5 > div:nth-child(2) { animation-delay: 0.76s; }
.login-card .space-y-5 > div:nth-child(3) { animation-delay: 0.84s; }
.login-cta { animation-delay: 0.92s; }

.brand-hero-logo,
.login-mark {
  position: relative;
  overflow: hidden;
}

.brand-hero-logo::before,
.login-mark::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  top: 18%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.95), transparent);
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.7);
  z-index: 4;
  opacity: 0;
  animation: logoScan 3.1s ease-in-out infinite;
}

.brand-hero-logo::after,
.login-mark::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  right: 28%;
  top: 30%;
  background: #7dd3fc;
  box-shadow:
    18px -10px 0 rgba(125, 211, 252, 0.8),
    34px 8px 0 rgba(125, 211, 252, 0.55),
    0 0 18px rgba(125, 211, 252, 0.95);
  opacity: 0;
  animation: sparkSoft 4.6s ease-in-out infinite;
  z-index: 5;
}

.brand-hero-logo img,
.login-mark img,
.brand-mark img {
  animation: logoBreath 4.2s ease-in-out infinite;
}

.brand-point,
.feature-card {
  transition:
    transform 0.28s cubic-bezier(.2,.8,.2,1),
    border-color 0.28s ease,
    background 0.28s ease,
    box-shadow 0.28s ease !important;
}

.brand-point:hover,
.feature-card:hover {
  transform: translateY(-3px);
  border-color: rgba(125, 211, 252, 0.28) !important;
  background: rgba(15, 23, 42, 0.78) !important;
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.28);
}

.motion-reveal {
  animation-name: revealUp !important;
  animation-duration: 0.84s !important;
  animation-timing-function: cubic-bezier(.2,.8,.2,1) !important;
}

main .glass {
  transition:
    transform 0.28s cubic-bezier(.2,.8,.2,1),
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    background 0.28s ease !important;
}

main .glass::before {
  transition: opacity 0.28s ease;
}

#sidebar-nav > button,
#sidebar-nav > div > button,
#sidebar-nav .submenu button,
.submenu-link {
  transition:
    transform 0.22s cubic-bezier(.2,.8,.2,1),
    background 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease,
    padding-left 0.22s ease !important;
}

#sidebar-nav > button:hover,
#sidebar-nav > div > button:hover,
#sidebar-nav .submenu button:hover,
.submenu-link:hover {
  padding-left: 1rem !important;
}

#sidebar-nav > div > button[aria-expanded="true"] {
  position: relative;
  color: #e0f2fe !important;
  background: rgba(14, 165, 233, 0.10) !important;
  border-color: rgba(125, 211, 252, 0.24) !important;
}

#sidebar-nav > div > button[aria-expanded="true"]::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 999px;
  background: #7dd3fc;
  box-shadow: 0 0 16px rgba(125, 211, 252, 0.7);
}

.submenu {
  transition:
    max-height 0.42s cubic-bezier(.2,.8,.2,1),
    opacity 0.34s ease,
    transform 0.42s cubic-bezier(.2,.8,.2,1),
    padding 0.34s ease !important;
}

.submenu.open {
  animation: submenuReveal 0.42s cubic-bezier(.2,.8,.2,1) both;
}

.welcome-transition {
  background:
    radial-gradient(circle at 18% 18%, rgba(14, 165, 233, 0.22), transparent 30%),
    radial-gradient(circle at 82% 82%, rgba(125, 211, 252, 0.10), transparent 34%),
    linear-gradient(135deg, rgba(2, 6, 23, 0.96), rgba(3, 7, 18, 0.99)),
    url("/static/img/bymetal-transition-bg.webp") center / cover no-repeat !important;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease,
    backdrop-filter 0.55s ease !important;
}

.welcome-transition.is-active {
  backdrop-filter: blur(18px);
}

.welcome-gradient {
  inset: -35%;
  background:
    linear-gradient(
      135deg,
      transparent 0%,
      rgba(14, 165, 233, 0.00) 30%,
      rgba(14, 165, 233, 0.18) 43%,
      rgba(255, 255, 255, 0.12) 50%,
      rgba(125, 211, 252, 0.13) 58%,
      rgba(14, 165, 233, 0.00) 70%,
      transparent 100%
    ) !important;
  transform: translate(-46%, -46%);
  opacity: 0;
}

.welcome-transition.is-active .welcome-gradient {
  animation: welcomeDiagonalSweep 1.65s cubic-bezier(.2,.8,.2,1) forwards !important;
}

.welcome-line {
  width: 150vw !important;
  height: 1px !important;
  top: 50% !important;
  left: 50% !important;
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(125, 211, 252, 0.75),
      rgba(255, 255, 255, 0.55),
      rgba(14, 165, 233, 0.75),
      transparent
    ) !important;
  box-shadow: 0 0 28px rgba(14, 165, 233, 0.50);
  transform: translate(-120%, -120%) rotate(45deg);
  opacity: 0;
}

.welcome-transition.is-active .welcome-line {
  animation: welcomeLineMove 1.55s cubic-bezier(.2,.8,.2,1) forwards !important;
}

.welcome-content {
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  filter: blur(8px);
  animation: none;
}

.welcome-transition.is-active .welcome-content {
  animation: welcomeTextIn 0.85s cubic-bezier(.2,.8,.2,1) 0.28s forwards !important;
}

.welcome-content h3 {
  font-size: clamp(44px, 6vw, 82px) !important;
  line-height: 1 !important;
  font-weight: 860 !important;
  letter-spacing: -0.035em !important;
  color: #f8fafc !important;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.08);
  text-shadow:
    0 2px 0 rgba(2, 6, 23, 0.70),
    0 18px 44px rgba(0, 0, 0, 0.82),
    0 0 34px rgba(14, 165, 233, 0.22);
}

.welcome-content p {
  font-size: clamp(20px, 2.3vw, 32px) !important;
  font-weight: 650;
  letter-spacing: -0.025em;
}

@keyframes bgFloat {
  from {
    transform: scale(1) translate3d(0, 0, 0);
    opacity: 0.52;
  }
  to {
    transform: scale(1.035) translate3d(-18px, -12px, 0);
    opacity: 0.78;
  }
}

@keyframes shellEnter {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes revealUp {
  0% {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes machineGridMove {
  to { background-position: 28px 28px; }
}

@keyframes machineSoftSweep {
  0%, 38% {
    transform: translateX(-115%);
    opacity: 0;
  }
  55% { opacity: 1; }
  78%, 100% {
    transform: translateX(115%);
    opacity: 0;
  }
}

@keyframes logoScan {
  0%, 100% {
    top: 18%;
    opacity: 0.12;
  }
  45%, 60% {
    opacity: 1;
  }
  50% {
    top: 78%;
  }
}

@keyframes logoBreath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

@keyframes sparkSoft {
  0%, 38%, 100% {
    opacity: 0;
    transform: translate(0, 0) scale(0.6);
  }
  46% {
    opacity: 1;
    transform: translate(8px, -8px) scale(1);
  }
  58% {
    opacity: 0;
    transform: translate(18px, -15px) scale(0.4);
  }
}

@keyframes submenuReveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes welcomeDiagonalSweep {
  0% {
    opacity: 0;
    transform: translate(-48%, -48%);
  }
  22% {
    opacity: 1;
  }
  100% {
    opacity: 0.55;
    transform: translate(48%, 48%);
  }
}

@keyframes welcomeLineMove {
  0% {
    opacity: 0;
    transform: translate(-120%, -120%) rotate(45deg);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0.18;
    transform: translate(20%, 20%) rotate(45deg);
  }
}

@keyframes welcomeTextIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Motion polish: replica la sensacion del prototipo sin tocar la estructura. */
.login-shell {
  transform-origin: 50% 46%;
  animation: shellEnter 1.02s cubic-bezier(.16, 1, .3, 1) both !important;
}

.login-brand,
.login-panel {
  position: relative;
  isolation: isolate;
}

.login-brand::before {
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.18));
}

.brand-kicker,
.brand-title,
.brand-text,
.brand-hero-logo,
.brand-point,
.brand-footer,
.login-mark,
.login-heading,
.login-card p,
.login-card .space-y-5 > div,
.login-cta {
  animation-duration: 0.92s !important;
  animation-timing-function: cubic-bezier(.16, 1, .3, 1) !important;
}

.brand-hero-logo,
.login-mark {
  filter:
    drop-shadow(0 18px 34px rgba(0, 0, 0, 0.44))
    drop-shadow(0 0 22px rgba(14, 165, 233, 0.12));
}

.brand-hero-logo::before,
.login-mark::before {
  left: 6%;
  right: 6%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(186, 230, 253, 0.96), rgba(14, 165, 233, 0.92), transparent);
  animation: logoScan 2.75s cubic-bezier(.45, 0, .2, 1) infinite;
}

.brand-hero-logo::after,
.login-mark::after {
  animation: sparkSoft 3.9s cubic-bezier(.45, 0, .2, 1) infinite;
}

.brand-point i {
  transition:
    transform 0.28s cubic-bezier(.2,.8,.2,1),
    color 0.28s ease,
    text-shadow 0.28s ease;
}

.brand-point:hover i {
  transform: translateY(-1px) scale(1.08);
  color: #e0f2fe;
  text-shadow: 0 0 18px rgba(125, 211, 252, 0.42);
}

.motion-reveal {
  opacity: 0 !important;
  transform: translateY(18px) scale(0.992) !important;
  filter: blur(8px) !important;
  animation: none !important;
  will-change: transform, opacity, filter;
}

.motion-reveal.motion-entered {
  animation: revealUp 0.86s cubic-bezier(.16, 1, .3, 1) var(--motion-delay, 0ms) forwards !important;
}

.delay-1 { --motion-delay: 80ms; }
.delay-2 { --motion-delay: 145ms; }
.delay-3 { --motion-delay: 220ms; }
.delay-4 { --motion-delay: 300ms; }
.delay-5 { --motion-delay: 390ms; }
.delay-6 { --motion-delay: 480ms; }
.delay-7 { --motion-delay: 570ms; }
.delay-8 { --motion-delay: 660ms; }
.delay-9 { --motion-delay: 750ms; }
.delay-10 { --motion-delay: 840ms; }

main .glass {
  transform-origin: 50% 48%;
}

main .glass:hover {
  transform: translateY(-3px);
  border-color: rgba(125, 211, 252, 0.28) !important;
  box-shadow:
    0 26px 68px rgba(0, 0, 0, 0.30),
    0 0 0 1px rgba(125, 211, 252, 0.055) inset;
}

button,
.btn,
.login-cta,
[role="button"],
select,
input,
textarea {
  transition:
    transform 0.18s cubic-bezier(.2,.8,.2,1),
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease !important;
}

button:not(:disabled):active,
.btn:not(:disabled):active,
.login-cta:not(:disabled):active,
[role="button"]:active {
  transform: translateY(1px) scale(0.99);
}

select:focus,
input:focus,
textarea:focus {
  box-shadow:
    0 0 0 1px rgba(125, 211, 252, 0.42),
    0 0 0 5px rgba(14, 165, 233, 0.12) !important;
}

.welcome-transition {
  background:
    linear-gradient(135deg, rgba(2, 6, 23, 0.18), rgba(2, 6, 23, 0.70)),
    url("/static/img/bymetal-transition-bg.webp") center center / cover no-repeat !important;
}

.welcome-transition::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(14, 165, 233, 0.10), transparent 34%),
    linear-gradient(135deg, rgba(2, 6, 23, 0.82), rgba(2, 6, 23, 0.42) 42%, rgba(2, 6, 23, 0.88));
  pointer-events: none;
}

.welcome-transition::after {
  content: "";
  position: absolute;
  inset: -18%;
  background:
    linear-gradient(135deg, transparent 0%, transparent 34%, rgba(125, 211, 252, 0.08) 48%, transparent 62%, transparent 100%),
    radial-gradient(circle at center, transparent 26%, rgba(0, 0, 0, 0.34) 72%);
  opacity: 0;
  transform: translate(-12%, -12%);
  pointer-events: none;
}

.welcome-transition.is-active::after {
  animation: transitionVeil 1.55s cubic-bezier(.16, 1, .3, 1) forwards;
}

.welcome-transition.is-active .welcome-gradient {
  animation-duration: 1.8s !important;
  animation-timing-function: cubic-bezier(.16, 1, .3, 1) !important;
}

.welcome-transition.is-active .welcome-line {
  animation-duration: 1.72s !important;
  animation-timing-function: cubic-bezier(.16, 1, .3, 1) !important;
}

.welcome-transition.is-active .welcome-content {
  animation: welcomeTextIn 0.92s cubic-bezier(.16, 1, .3, 1) 0.32s forwards !important;
}

.welcome-content {
  padding: clamp(20px, 3vw, 34px) clamp(24px, 4vw, 58px);
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% 0%, rgba(125, 211, 252, 0.12), transparent 58%),
    linear-gradient(135deg, rgba(2, 6, 23, 0.48), rgba(2, 6, 23, 0.20));
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(3px);
}

.welcome-kicker {
  color: #bae6fd !important;
  text-shadow: 0 0 18px rgba(14, 165, 233, 0.55);
}

.welcome-content p {
  color: #f1f5f9 !important;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.72);
}

/* Escena industrial del login, reemplaza el logo estatico grande del lateral. */
.machine-scene {
  display: block !important;
  position: relative;
  width: min(520px, 100%) !important;
  height: 245px !important;
  min-height: 245px !important;
  margin: 30px 0 26px !important;
  padding: 18px;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 24%, rgba(14, 165, 233, 0.18), transparent 34%),
    radial-gradient(circle at 80% 74%, rgba(249, 115, 22, 0.12), transparent 38%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
  filter: none !important;
}

.machine-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.045), transparent);
  transform: translateX(-110%);
  animation: machineSoftSweep 7s ease-in-out infinite;
  pointer-events: none;
  z-index: 4;
}

.machine-scene::after {
  display: none !important;
}

.machine-topbar {
  position: relative;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #bae6fd;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.machine-topbar strong {
  color: #f8fafc;
}

.machine-stage {
  position: absolute;
  inset: 0;
}

.machine-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(148, 163, 184, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.70;
  animation: machineGridMove 12s linear infinite;
}

.gear-cluster {
  position: absolute;
  left: 30px;
  top: 56px;
  width: 150px;
  height: 110px;
}

.gear {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    repeating-conic-gradient(
      from 0deg,
      rgba(125, 211, 252, 0.95) 0deg 8deg,
      rgba(15, 23, 42, 0.92) 8deg 16deg
    );
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34), 0 0 26px rgba(14, 165, 233, 0.13);
}

.gear::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.13), rgba(15, 23, 42, 0.95) 62%);
  border: 1px solid rgba(125, 211, 252, 0.28);
}

.gear span {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #020617;
  border: 2px solid rgba(125, 211, 252, 0.7);
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.26);
}

.gear-large {
  width: 74px;
  height: 74px;
  left: 0;
  top: 22px;
  animation: gearRotate 13s linear infinite;
}

.gear-small {
  width: 46px;
  height: 46px;
  left: 68px;
  top: 6px;
  animation: gearRotateReverse 8s linear infinite;
}

.gear-mid {
  width: 58px;
  height: 58px;
  left: 88px;
  top: 58px;
  animation: gearRotate 10s linear infinite;
}

.press-machine {
  position: absolute;
  left: 238px;
  top: 48px;
  width: 145px;
  height: 120px;
}

.press-column {
  position: absolute;
  top: 10px;
  width: 10px;
  height: 104px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(203, 213, 225, 0.38), rgba(71, 85, 105, 0.20));
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.press-column.left { left: 16px; }
.press-column.right { right: 16px; }

.press-head {
  position: absolute;
  left: 36px;
  top: 16px;
  width: 73px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.28), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(125, 211, 252, 0.24);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.26), 0 0 22px rgba(14, 165, 233, 0.10);
  animation: pressMove 4.6s ease-in-out infinite;
}

.press-head::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -30px;
  width: 18px;
  height: 30px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.34), rgba(148, 163, 184, 0.18));
  transform: translateX(-50%);
}

.press-base {
  position: absolute;
  left: 26px;
  bottom: 0;
  width: 93px;
  height: 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.30), rgba(15, 23, 42, 0.92));
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.press-light {
  position: absolute;
  left: 52px;
  top: 70px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.20);
  filter: blur(16px);
  opacity: 0.3;
  animation: pressGlow 4.6s ease-in-out infinite;
}

.conveyor {
  position: absolute;
  left: 54px;
  right: 54px;
  bottom: 38px;
  height: 30px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.16);
  background: rgba(2, 6, 23, 0.52);
}

.belt {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(125, 211, 252, 0.15) 0 12px, rgba(15, 23, 42, 0.24) 12px 24px);
  animation: beltMove 1.8s linear infinite;
}

.metal-piece {
  position: absolute;
  top: 7px;
  width: 42px;
  height: 14px;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(226, 232, 240, 0.78), rgba(100, 116, 139, 0.38));
  border: 1px solid rgba(203, 213, 225, 0.32);
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.08);
}

.piece-one { animation: pieceTravel 6.8s linear infinite; }
.piece-two { animation: pieceTravel 6.8s linear infinite; animation-delay: -3.4s; }

.signal-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.75), transparent);
  opacity: 0.35;
  animation: signalPulse 3.4s ease-in-out infinite;
}

.signal-one {
  width: 145px;
  left: 160px;
  top: 74px;
}

.signal-two {
  width: 120px;
  right: 28px;
  top: 118px;
  animation-delay: 1.3s;
}

.spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #7dd3fc;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.85);
  opacity: 0;
  animation: sparkSoft 4.6s ease-in-out infinite;
}

.spark-one { left: 308px; top: 122px; }
.spark-two { left: 327px; top: 113px; animation-delay: 0.16s; }
.spark-three { left: 293px; top: 109px; animation-delay: 0.32s; }

@keyframes gearRotate {
  to { transform: rotate(360deg); }
}

@keyframes gearRotateReverse {
  to { transform: rotate(-360deg); }
}

@keyframes pressMove {
  0%, 100% { transform: translateY(0); }
  42%, 58% { transform: translateY(24px); }
}

@keyframes pressGlow {
  0%, 30%, 100% {
    opacity: 0.18;
    transform: scale(0.8);
  }
  45%, 60% {
    opacity: 0.88;
    transform: scale(1.2);
  }
}

@keyframes beltMove {
  to { background-position: 48px 0; }
}

@keyframes pieceTravel {
  from {
    left: -55px;
    opacity: 0;
  }
  10%, 88% { opacity: 1; }
  to {
    left: calc(100% + 30px);
    opacity: 0;
  }
}

@keyframes signalPulse {
  0%, 100% {
    opacity: 0.18;
    transform: scaleX(0.82);
  }
  50% {
    opacity: 0.72;
    transform: scaleX(1);
  }
}

@media (max-width: 560px) {
  .machine-scene {
    height: 230px !important;
    min-height: 230px !important;
  }

  .gear-cluster {
    left: 20px;
    transform: scale(0.85);
    transform-origin: left top;
  }

  .press-machine {
    left: auto;
    right: 18px;
    transform: scale(0.9);
    transform-origin: right top;
  }

  .signal-one,
  .signal-two {
    display: none;
  }
}

@keyframes transitionVeil {
  0% {
    opacity: 0;
    transform: translate(-18%, -18%) rotate(0.001deg);
    filter: blur(8px);
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0.46;
    transform: translate(14%, 14%) rotate(0.001deg);
    filter: blur(0);
  }
}

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

  .motion-reveal,
  .motion-reveal.motion-entered,
  .brand-kicker,
  .brand-title,
  .brand-text,
  .brand-hero-logo,
  .brand-point,
  .brand-footer,
  .login-mark,
  .login-heading,
  .login-card p,
  .login-card .space-y-5 > div,
  .login-cta {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
