/* ================================================================
   MUNDOMÓVIL · Portal Interno
   Aesthetic: Luxury Tech Noir · Editorial × Engineering
   ================================================================ */

/* ---------- DESIGN TOKENS ---------- */
:root {
  /* Color */
  --bg: #08070d;
  --bg-2: #0e0c16;
  --bg-3: #15121f;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-3: rgba(255, 255, 255, 0.08);

  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(167, 139, 250, 0.18);
  --line-3: rgba(167, 139, 250, 0.35);

  --ink: #f5f3fa;
  --ink-2: #c9c4d4;
  --ink-3: #8a8298;
  --ink-4: #524d63;

  --violet: #6d4ee0;
  --violet-2: #9484d7;
  --violet-3: #a78bfa;
  --violet-4: #c4b5fd;
  --gold: #e2c178;
  --rose: #f6a4b8;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;

  /* Type */
  --display: "MADE TOMMY", -apple-system, "Segoe UI", sans-serif;
  --sans: "MADE TOMMY", -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Menlo", "Consolas", monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-snap: cubic-bezier(0.7, 0, 0.3, 1);

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 32px;

  /* Shadows */
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-lg:
    0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(167, 139, 250, 0.08);
  --shadow-glow: 0 0 60px rgba(167, 139, 250, 0.18);
}

[data-theme="light"] {
  --bg: #f8f6f2;
  --bg-2: #ffffff;
  --bg-3: #ebe6dd;
  --surface: rgba(20, 16, 35, 0.025);
  --surface-2: rgba(20, 16, 35, 0.05);
  --surface-3: rgba(20, 16, 35, 0.08);
  --line: rgba(20, 16, 35, 0.08);
  --line-2: rgba(109, 78, 224, 0.22);
  --line-3: rgba(109, 78, 224, 0.45);
  --ink: #15121f;
  --ink-2: #3c3850;
  --ink-3: #6e6880;
  --ink-4: #a59ebb;
  --shadow-sm: 0 2px 12px rgba(60, 40, 100, 0.06);
  --shadow-md: 0 12px 40px rgba(60, 40, 100, 0.1);
  --shadow-lg:
    0 30px 80px rgba(60, 40, 100, 0.18), 0 0 0 1px rgba(109, 78, 224, 0.06);
}

/* ---------- BASE ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background 0.7s var(--ease-out),
    color 0.5s var(--ease-out);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: var(--violet-3);
  text-decoration: none;
}
a:hover {
  color: var(--violet-4);
}

::selection {
  background: var(--violet-3);
  color: var(--bg);
}

/* ---------- GRAIN OVERLAY ---------- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  animation: grainShift 8s steps(8) infinite;
}
@keyframes grainShift {
  0% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-5%, -2%);
  }
  20% {
    transform: translate(3%, -8%);
  }
  30% {
    transform: translate(-7%, 4%);
  }
  40% {
    transform: translate(5%, 7%);
  }
  50% {
    transform: translate(-3%, -5%);
  }
  60% {
    transform: translate(8%, 3%);
  }
  70% {
    transform: translate(-4%, 6%);
  }
  80% {
    transform: translate(2%, -7%);
  }
  90% {
    transform: translate(-6%, 1%);
  }
  100% {
    transform: translate(0, 0);
  }
}
[data-theme="light"] .grain {
  opacity: 0.35;
  mix-blend-mode: multiply;
}

/* ---------- SCENES ---------- */
.scene {
  display: none;
  min-height: 100dvh;
  flex-direction: column;
  position: relative;
}
.scene[data-active="true"] {
  display: flex;
  animation: sceneEnter 0.8s var(--ease-out);
}
@keyframes sceneEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================================================================
   LOGIN SCENE
   ================================================================ */
#sceneLogin {
  overflow: hidden;
}

/* Background */
.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}
.orb-a {
  width: 620px;
  height: 620px;
  top: -15%;
  left: -10%;
  background: radial-gradient(circle, rgba(109, 78, 224, 0.5), transparent 65%);
  animation: orbFloat1 22s ease-in-out infinite;
}
.orb-b {
  width: 500px;
  height: 500px;
  bottom: -15%;
  right: -8%;
  background: radial-gradient(
    circle,
    rgba(167, 139, 250, 0.35),
    transparent 65%
  );
  animation: orbFloat2 28s ease-in-out infinite;
}
.orb-c {
  width: 320px;
  height: 320px;
  top: 35%;
  right: 30%;
  background: radial-gradient(
    circle,
    rgba(226, 193, 120, 0.15),
    transparent 65%
  );
  animation: orbFloat3 18s ease-in-out infinite;
}
.orb-d {
  width: 420px;
  height: 420px;
  top: 0%;
  right: 5%;
  background: radial-gradient(
    circle,
    rgba(109, 78, 224, 0.25),
    transparent 65%
  );
  animation: orbFloat2 24s ease-in-out infinite;
}
@keyframes orbFloat1 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(60px, 40px) scale(1.08);
  }
  66% {
    transform: translate(-30px, 60px) scale(0.95);
  }
}
@keyframes orbFloat2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-50px, -60px) scale(1.1);
  }
}
@keyframes orbFloat3 {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(40px, -40px);
  }
}

.beam {
  position: absolute;
  width: 1px;
  height: 100vh;
  top: 0;
  left: 50%;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(167, 139, 250, 0.4),
    transparent
  );
  transform-origin: top;
  pointer-events: none;
  opacity: 0.6;
  animation: beamSway 8s ease-in-out infinite;
}
@keyframes beamSway {
  0%,
  100% {
    transform: rotate(-2deg) translateX(-10%);
  }
  50% {
    transform: rotate(2deg) translateX(10%);
  }
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    black 30%,
    transparent 80%
  );
  animation: gridDrift 60s linear infinite;
}
@keyframes gridDrift {
  to {
    background-position: 80px 80px;
  }
}

/* Login header */
.login-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px;
  border-bottom: 1px solid var(--line);
}
/* ---------- LOGO ---------- */
.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  box-shadow:
    var(--shadow-md),
    0 0 30px rgba(109, 78, 224, 0.4);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  padding: 0;
}
.logo-mark img {
  width: 110%;
  height: 110%;
  object-fit: cover;
  display: block;
  transform: scale(1.05);
}
.logo-mark.sm {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}
.logo-text {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--ink);
}
.logo-text em {
  font-style: normal;
  font-weight: 700;
  letter-spacing: -0.015em;
  background: linear-gradient(
    95deg,
    var(--violet-3),
    var(--violet-4) 50%,
    #fff 110%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-divider {
  color: var(--ink-4);
  font-weight: 300;
  margin: 0 2px;
}
.logo-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  align-self: center;
  padding-top: 2px;
}
.logo.small .logo-text {
  font-size: 16px;
  gap: 6px;
}
.logo.small .logo-sub {
  display: none;
}

.header-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  font-family: var(--mono);
  padding: 8px 14px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 12px var(--warn);
  animation: tagPulse 2s ease-in-out infinite;
}
@keyframes tagPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Login main stage */
.login-main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  place-items: center;
  padding: 60px 40px;
}
.login-stage {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 80px;
  align-items: center;
  max-width: 1240px;
  width: 100%;
}

/* Left side */
.login-side {
  max-width: 540px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  margin-bottom: 28px;
  opacity: 0;
  animation: revealUp 0.7s var(--ease-out) 0.2s forwards;
}
.eyebrow-line {
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--violet-3);
}

.display {
  font-family: var(--display);
  font-size: clamp(48px, 8vw, 100px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin-bottom: 36px;
}
.display .word {
  display: block;
  opacity: 0;
  transform: translateY(20px);
  animation: revealUp 0.9s var(--ease-out) forwards;
}
.display .w1 {
  animation-delay: 0.25s;
  color: var(--ink);
  font-weight: 400;
}
.display .w2 {
  animation-delay: 0.4s;
  font-weight: 700;
}
.display .w2 em {
  font-style: normal;
  font-weight: 500;
  color: var(--violet-3);
}
.display .w3 {
  animation-delay: 0.55s;
}
.display .sm {
  font-family: var(--mono);
  font-size: 0.18em;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--ink-3);
  vertical-align: super;
}

.lede {
  font-size: 17px;
  color: var(--ink-2);
  max-width: 460px;
  line-height: 1.55;
  margin-bottom: 36px;
  opacity: 0;
  animation: revealUp 0.7s var(--ease-out) 0.7s forwards;
}

.features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  animation: revealUp 0.7s var(--ease-out) 0.85s forwards;
}
.features li {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--ink-2);
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.features li:last-child {
  border-bottom: 1px solid var(--line);
}
.features .bullet {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--violet-3);
  letter-spacing: -0.05em;
}

@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Login card */
.login-card {
  position: relative;
  background: linear-gradient(
    180deg,
    rgba(20, 16, 35, 0.85),
    rgba(8, 7, 13, 0.95)
  );
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 48px 44px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  animation: cardReveal 1s var(--ease-out) 0.3s forwards;
}
[data-theme="light"] .login-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.97),
    rgba(248, 246, 242, 0.95)
  );
}
@keyframes cardReveal {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-glow {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--violet-3), transparent);
  filter: blur(0.5px);
}

.card-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-3);
  pointer-events: none;
}
.card-corner.tl {
  top: 12px;
  left: 12px;
  border-right: none;
  border-bottom: none;
}
.card-corner.tr {
  top: 12px;
  right: 12px;
  border-left: none;
  border-bottom: none;
}
.card-corner.bl {
  bottom: 12px;
  left: 12px;
  border-right: none;
  border-top: none;
}
.card-corner.br {
  bottom: 12px;
  right: 12px;
  border-left: none;
  border-top: none;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--violet-3);
  padding: 6px 12px;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid var(--line-2);
  border-radius: 100px;
}
.badge-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 10px var(--good);
  animation: tagPulse 2s infinite;
}
.card-id {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.1em;
}

.card-title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}
.card-sub {
  color: var(--ink-3);
  font-size: 13px;
  margin-bottom: 32px;
  letter-spacing: 0.01em;
}

.card-foot {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: var(--ink-4);
  font-family: var(--mono);
  letter-spacing: 0.05em;
}

/* Login footer */
.login-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 20px 40px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ================================================================
   FORM ELEMENTS (shared)
   ================================================================ */
.field {
  margin-bottom: 20px;
}
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.field label .opt {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--ink-4);
  font-size: 10px;
  font-family: var(--sans);
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: all 0.3s var(--ease-out);
  overflow: hidden;
}
.input-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(167, 139, 250, 0.05),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s var(--ease-out);
}
.input-shell:focus-within::before {
  transform: translateX(100%);
}
.input-shell:focus-within {
  border-color: var(--line-3);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.1);
}
.input-shell input {
  flex: 1;
  width: 100%;
  padding: 14px 18px;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: var(--sans);
  color: var(--ink);
  letter-spacing: 0.005em;
}
.input-shell input::placeholder {
  color: var(--ink-4);
}
.input-action {
  padding: 0 16px;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--ink-3);
  font-size: 16px;
  transition: color 0.2s;
}
.input-action:hover {
  color: var(--violet-3);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.4s var(--ease-out);
  overflow: hidden;
  user-select: none;
  white-space: nowrap;
}
.btn.primary {
  width: 100%;
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--violet), #4a30b5);
  color: #fff;
  box-shadow:
    0 4px 20px rgba(109, 78, 224, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 36px rgba(109, 78, 224, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn.primary:active {
  transform: translateY(0);
}
.btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  transition: left 0.7s var(--ease-out);
  pointer-events: none;
}
.btn.primary:hover .btn-shine {
  left: 100%;
}
.btn-arrow {
  display: inline-block;
  transition: transform 0.3s var(--ease-spring);
}
.btn.primary:hover .btn-arrow {
  transform: translateX(6px);
}

.btn.ghost {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line-2);
}
.btn.danger {
  background: rgba(248, 113, 113, 0.08);
  color: var(--bad);
  border: 1px solid rgba(248, 113, 113, 0.25);
}
.btn.danger:hover {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.45);
  transform: translateY(-1px);
}

/* Message */
.msg {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  display: none;
  font-family: var(--mono);
  letter-spacing: 0.005em;
}
.msg.error {
  display: block;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--bad);
}
.msg.success {
  display: block;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--good);
}
.msg.warn {
  display: block;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  color: var(--warn);
}

/* ================================================================
   HOME SCENE
   ================================================================ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 40px;
  background: rgba(8, 7, 13, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
}
[data-theme="light"] .topnav {
  background: rgba(255, 255, 255, 0.85);
}
.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.crumb {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--violet-3);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--r-xs);
  transition: all 0.2s;
}
.back-btn:hover {
  background: var(--surface);
  color: var(--violet-4);
}
.back-btn span:first-child {
  transition: transform 0.2s;
}
.back-btn:hover span:first-child {
  transform: translateX(-3px);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-btn {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s var(--ease-out);
}
.nav-btn:hover {
  border-color: var(--line-3);
  color: var(--violet-3);
  background: var(--surface-2);
}
.nav-btn.admin {
  background: linear-gradient(
    135deg,
    rgba(109, 78, 224, 0.15),
    rgba(167, 139, 250, 0.08)
  );
  border-color: var(--line-2);
  color: var(--violet-3);
}
.nav-btn.admin:hover {
  background: linear-gradient(
    135deg,
    rgba(109, 78, 224, 0.25),
    rgba(167, 139, 250, 0.15)
  );
}
.nav-btn.ghost {
  background: none;
  border: none;
  color: var(--ink-3);
}
.nav-btn.ghost:hover {
  color: var(--bad);
  background: rgba(248, 113, 113, 0.06);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), #2a1c5a);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(109, 78, 224, 0.3);
}
.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  gap: 2px;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
}
.user-role {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* Home Hero */
.home-hero {
  position: relative;
  overflow: hidden;
  padding: 56px 40px 48px;
  border-bottom: 1px solid var(--line);
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero-dot {
  color: var(--good);
  animation: tagPulse 2s infinite;
}

.hero-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
}
.hero-left {
  min-width: 0;
}

.hero-title {
  font-family: var(--display);
  font-size: clamp(32px, 5.5vw, 56px);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
  opacity: 0;
  transform: translateY(20px);
  animation: heroLineUp 0.9s var(--ease-out) 0.1s forwards;
}
@keyframes heroLineUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.hero-title .greeting {
  font-weight: 400;
  color: var(--ink-2);
}
.hero-name {
  font-style: normal;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(
    95deg,
    var(--violet-3),
    var(--violet-4) 50%,
    var(--rose)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.55;
  opacity: 0;
  animation: revealUp 0.7s var(--ease-out) 0.3s forwards;
}

/* HERO STATS PANEL */
.hero-stats {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 14px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  animation: revealUp 0.7s var(--ease-out) 0.5s forwards;
}
.hstat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 22px;
  min-width: 120px;
}
.hstat-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}
.hstat-value {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.hstat-value.mono {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0;
  font-size: 20px;
}
.hstat-of {
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 400;
}
.hstat-divider {
  width: 1px;
  background: var(--line);
  margin: 4px 0;
}

/* Home main */
.home-main {
  flex: 1;
  padding: 36px 40px 60px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.section-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  font-weight: 500;
}
.section-title {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.section-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

/* TOOLS GRID */
.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
  min-height: 240px;
}

.empty-tools {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 30px;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  text-align: center;
  gap: 16px;
}
.empty-tools-icon {
  font-size: 42px;
  opacity: 0.4;
}
.empty-tools-text {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-2);
}
.empty-tools-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  max-width: 420px;
  line-height: 1.6;
}

.tool-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 28px 26px 24px;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.5s var(--ease-out);
  opacity: 0;
  transform: translateY(24px);
  animation: cardStagger 0.7s var(--ease-out) forwards;
}
.tool-card:nth-child(1) {
  animation-delay: 0.1s;
}
.tool-card:nth-child(2) {
  animation-delay: 0.18s;
}
.tool-card:nth-child(3) {
  animation-delay: 0.26s;
}
.tool-card:nth-child(4) {
  animation-delay: 0.34s;
}
.tool-card:nth-child(5) {
  animation-delay: 0.42s;
}
.tool-card:nth-child(6) {
  animation-delay: 0.5s;
}
.tool-card:nth-child(7) {
  animation-delay: 0.58s;
}
.tool-card:nth-child(8) {
  animation-delay: 0.66s;
}
@keyframes cardStagger {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent, var(--violet-3));
  transform: scaleX(0.3);
  transform-origin: left;
  transition:
    transform 0.6s var(--ease-out),
    opacity 0.3s;
  opacity: 0.6;
}
.tool-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in srgb, var(--accent, var(--violet-3)) 12%, transparent),
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
}
.tool-card:hover {
  transform: translateY(-6px);
  border-color: var(--line-2);
  box-shadow: var(--shadow-md);
}
.tool-card:hover::before {
  transform: scaleX(1);
  opacity: 1;
}
.tool-card:hover::after {
  opacity: 1;
}

.tool-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.1em;
  margin-bottom: 18px;
}

.tool-icon {
  font-size: 28px;
  line-height: 1;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(
    in srgb,
    var(--accent, var(--violet-3)) 10%,
    transparent
  );
  border: 1px solid
    color-mix(in srgb, var(--accent, var(--violet-3)) 15%, transparent);
  border-radius: 14px;
  margin-bottom: 22px;
  transition: all 0.5s var(--ease-spring);
}
.tool-card:hover .tool-icon {
  transform: scale(1.08) rotate(-2deg);
  background: color-mix(
    in srgb,
    var(--accent, var(--violet-3)) 18%,
    transparent
  );
  border-color: color-mix(
    in srgb,
    var(--accent, var(--violet-3)) 30%,
    transparent
  );
  box-shadow: 0 0 24px
    color-mix(in srgb, var(--accent, var(--violet-3)) 20%, transparent);
}

.tool-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.tool-desc {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.5;
  margin-bottom: auto;
  padding-bottom: 18px;
}

.tool-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.tool-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tool-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}
.tool-status.locked .dot {
  background: var(--ink-4);
  box-shadow: none;
}
.tool-status.locked {
  color: var(--ink-4);
}
.tool-cta {
  font-size: 12px;
  color: var(--violet-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: gap 0.3s;
}
.tool-card:hover .tool-cta {
  gap: 10px;
}

/* LOCKED CARD — el candado enorme */
.tool-card.locked {
  cursor: not-allowed;
}
.tool-card.locked:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--line);
}
.tool-card.locked:hover::before {
  transform: scaleX(0.3);
}
.tool-card.locked:hover::after {
  opacity: 0;
}
.tool-card.locked .tool-name,
.tool-card.locked .tool-desc,
.tool-card.locked .tool-num,
.tool-card.locked .tool-foot,
.tool-card.locked .tool-icon {
  filter: blur(2px);
  opacity: 0.4;
  transition:
    filter 0.4s,
    opacity 0.4s;
}

.lock-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(8, 7, 13, 0.85),
    rgba(20, 16, 35, 0.92)
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 20px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-radius: var(--r-md);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
[data-theme="light"] .lock-overlay {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.85),
    rgba(248, 246, 242, 0.92)
  );
}
.tool-card.locked .lock-overlay {
  opacity: 1;
}
.tool-card.locked:hover .lock-overlay {
  opacity: 1;
}

.lock-icon {
  font-size: 84px;
  line-height: 1;
  margin-bottom: 16px;
  color: #fff;
  filter: drop-shadow(0 4px 20px rgba(255, 255, 255, 0.2));
  animation: lockFloat 3s ease-in-out infinite;
}
[data-theme="light"] .lock-icon {
  color: var(--ink);
}
@keyframes lockFloat {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-6px) rotate(-2deg);
  }
}
.lock-text {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  max-width: 220px;
  letter-spacing: -0.005em;
}
[data-theme="light"] .lock-text {
  color: var(--ink);
}
.lock-sub {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
[data-theme="light"] .lock-sub {
  color: var(--ink-3);
}

/* Bottom bar */
.bottom-bar {
  border-top: 1px solid var(--line);
  padding: 18px 40px;
  display: flex;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ================================================================
   ADMIN SCENE
   ================================================================ */
.admin-main {
  flex: 1;
  padding: 48px 40px 60px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.admin-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 28px;
}
.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 32px 30px;
  position: relative;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.panel-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
}
.panel-head h2 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.count-pill {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--violet-3);
  background: rgba(167, 139, 250, 0.1);
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0;
}

/* ROLE PICKER */
.role-picker {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.role-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: all 0.25s var(--ease-out);
  gap: 3px;
}
.role-opt .ro-icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 4px;
}
.role-opt .ro-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.role-opt .ro-desc {
  font-size: 10px;
  color: var(--ink-3);
  line-height: 1.35;
}
.role-opt:hover {
  border-color: var(--line-2);
  background: var(--surface-2);
}
.role-opt.active {
  background: linear-gradient(
    135deg,
    rgba(109, 78, 224, 0.15),
    rgba(167, 139, 250, 0.06)
  );
  border-color: var(--line-3);
}
.role-opt.active .ro-name {
  color: var(--violet-3);
}

/* CHIPS (permissions) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.25s var(--ease-out);
  user-select: none;
}
.chip:hover {
  border-color: var(--line-2);
  background: var(--surface-2);
}
.chip.active {
  background: rgba(167, 139, 250, 0.12);
  border-color: var(--line-3);
  color: var(--violet-3);
}
.chip-ico {
  font-size: 14px;
}

/* USERS LIST */
.users {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.loading {
  padding: 28px;
  text-align: center;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.user-row {
  display: grid;
  grid-template-columns: 44px 1fr auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: all 0.25s var(--ease-out);
}
.user-row:hover {
  border-color: var(--line-2);
  background: var(--surface-2);
  transform: translateX(2px);
}
.user-row.you {
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.06), transparent);
  border-color: var(--line-2);
}
.user-row .avatar {
  width: 44px;
  height: 44px;
  font-size: 15px;
}
.user-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.user-info .u-name {
  font-size: 14px;
  font-weight: 600;
}
.user-info .u-email {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
}
.role-badge.owner {
  background: rgba(226, 193, 120, 0.12);
  color: var(--gold);
}
.role-badge.developer {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}
.role-badge.comercial {
  background: rgba(244, 114, 182, 0.12);
  color: #f472b6;
}
.role-badge.instalador {
  background: rgba(52, 211, 153, 0.12);
  color: var(--good);
}
.role-badge.trabajador {
  background: rgba(167, 139, 250, 0.1);
  color: var(--violet-3);
}
.role-badge.worker {
  background: rgba(167, 139, 250, 0.1);
  color: var(--violet-3);
}

.perm-icons {
  display: flex;
  gap: 4px;
  font-size: 14px;
}
.perm-icons span {
  display: inline-block;
}

.row-arrow {
  font-size: 16px;
  color: var(--ink-4);
  transition:
    transform 0.25s,
    color 0.25s;
}
.user-row:hover .row-arrow {
  color: var(--violet-3);
  transform: translateX(4px);
}

/* ================================================================
   MODAL
   ================================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.open {
  display: flex;
  animation: fadeIn 0.3s var(--ease-out);
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  animation: modalUp 0.4s var(--ease-out);
}
@keyframes modalUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-xs);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-3);
  display: grid;
  place-items: center;
  transition: all 0.2s;
}
.icon-btn:hover {
  color: var(--bad);
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.06);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

/* ================================================================
   TOASTS
   ================================================================ */
.toasts {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
}
.toast {
  pointer-events: auto;
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  animation: toastIn 0.5s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.toast::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: currentColor;
  opacity: 0.4;
  width: 100%;
  animation: toastBar 4s linear forwards;
}
.toast.success {
  color: var(--good);
  border-color: rgba(52, 211, 153, 0.3);
}
.toast.error {
  color: var(--bad);
  border-color: rgba(248, 113, 113, 0.3);
}
.toast.warn {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.3);
}
.toast.info {
  color: var(--violet-3);
  border-color: var(--line-3);
}
.toast.out {
  animation: toastOut 0.4s var(--ease-out) forwards;
}
.toast-icon {
  font-size: 16px;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}
@keyframes toastBar {
  to {
    width: 0;
  }
}

/* ================================================================
   CONFIRM
   ================================================================ */
.confirm {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm.open {
  display: flex;
  animation: fadeIn 0.3s var(--ease-out);
}
.confirm-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 36px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalUp 0.4s var(--ease-out);
}
.confirm-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.confirm-text {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.confirm-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 26px;
  line-height: 1.5;
}
.confirm-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ================================================================
   ENHANCED POLISH · Added improvements
   ================================================================ */

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--ink-4);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--violet-2);
}
html {
  scrollbar-width: thin;
  scrollbar-color: var(--ink-4) transparent;
}

/* Tool card glow border on hover */
.tool-card:not(.locked):hover {
  border-color: color-mix(
    in srgb,
    var(--accent, var(--violet-3)) 40%,
    transparent
  );
  box-shadow:
    var(--shadow-md),
    0 0 30px color-mix(in srgb, var(--accent, var(--violet-3)) 15%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Locked card shake on click attempt */
.tool-card.locked:active {
  animation: lockShake 0.4s var(--ease-out);
}
@keyframes lockShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(2px);
  }
}

/* Status dot pulsing ring */
.tool-status:not(.locked) .dot {
  position: relative;
}
.tool-status:not(.locked) .dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--good);
  opacity: 0;
  animation: dotPulseRing 2s ease-out infinite;
}
@keyframes dotPulseRing {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Hero stats glassmorphism enhanced */
.hero-stats {
  background: rgba(14, 12, 22, 0.6);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border-color: var(--line-2);
  box-shadow:
    var(--shadow-sm),
    0 0 40px rgba(109, 78, 224, 0.06);
}
[data-theme="light"] .hero-stats {
  background: rgba(255, 255, 255, 0.65);
}

/* Login card breathing glow */
.login-card {
  animation:
    cardReveal 1s var(--ease-out) 0.3s forwards,
    cardBreathe 6s ease-in-out 2s infinite;
}
@keyframes cardBreathe {
  0%,
  100% {
    box-shadow: var(--shadow-lg);
  }
  50% {
    box-shadow:
      var(--shadow-lg),
      0 0 50px rgba(167, 139, 250, 0.12);
  }
}

/* Navbar glassmorphism stronger */
.topnav {
  background: rgba(8, 7, 13, 0.75);
  backdrop-filter: blur(30px) saturate(1.5);
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  box-shadow: 0 1px 0 var(--line);
}
[data-theme="light"] .topnav {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(30px) saturate(1.3);
  -webkit-backdrop-filter: blur(30px) saturate(1.3);
}

/* User row avatar colors by role */
.user-row .avatar[data-role="owner"] {
  background: linear-gradient(135deg, #e2c178, #c4a24a);
}
.user-row .avatar[data-role="developer"] {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
}
.user-row .avatar[data-role="comercial"] {
  background: linear-gradient(135deg, #f472b6, #db2777);
}
.user-row .avatar[data-role="instalador"] {
  background: linear-gradient(135deg, #34d399, #059669);
}
.user-row .avatar[data-role="trabajador"] {
  background: linear-gradient(135deg, var(--violet), #4a30b5);
}

/* Primary button idle shimmer */
.btn.primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
  transform: skewX(-20deg);
  animation: btnShimmer 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes btnShimmer {
  0%,
  100% {
    left: -80%;
  }
  50% {
    left: 120%;
  }
}

/* Nav admin button glow */
.nav-btn.admin {
  position: relative;
  overflow: hidden;
}
.nav-btn.admin::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(109, 78, 224, 0.3),
    rgba(167, 139, 250, 0.1)
  );
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.nav-btn.admin:hover::after {
  opacity: 1;
}

/* Panel cards subtle top glow */
.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--violet-3), transparent);
  opacity: 0.4;
}

/* Modal backdrop blur transition */
.modal.open .modal-card {
  animation: modalUp 0.5s var(--ease-spring);
}

/* Chip active pulse on toggle */
.chip.active {
  animation: chipPop 0.3s var(--ease-spring);
}
@keyframes chipPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

/* Role option hover lift */
.role-opt:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.role-opt.active {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(109, 78, 224, 0.15);
}

/* Toast slide + bounce */
@keyframes toastIn {
  0% {
    opacity: 0;
    transform: translateX(60px) scale(0.95);
  }
  70% {
    transform: translateX(-4px) scale(1.01);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Smooth focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--violet-3);
  outline-offset: 2px;
}
input:focus-visible,
button:focus-visible {
  outline: none;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1100px) {
  .login-stage {
    grid-template-columns: 1fr;
    gap: 50px;
    max-width: 540px;
  }
  .login-side {
    text-align: center;
  }
  .eyebrow {
    justify-content: center;
  }
  .features {
    max-width: 400px;
    margin: 0 auto;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .login-header,
  .login-footer {
    padding: 18px 24px;
  }
  .login-main {
    padding: 40px 24px;
  }
  .login-card {
    padding: 36px 28px;
  }
  .topnav {
    padding: 14px 20px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .nav-user .user-meta {
    display: none;
  }
  .home-hero {
    padding: 36px 24px 32px;
  }
  .home-main,
  .admin-main {
    padding: 28px 24px 40px;
  }
  .hero-row {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .hero-stats {
    flex-wrap: wrap;
    padding: 12px 0;
  }
  .hstat {
    padding: 6px 18px;
    flex: 1;
    min-width: 100px;
  }
  .hstat-value {
    font-size: 18px;
  }
  .hstat-value.mono {
    font-size: 17px;
  }
  .tools {
    grid-template-columns: 1fr;
  }
  .role-picker {
    grid-template-columns: 1fr;
  }
  .user-row {
    grid-template-columns: 40px 1fr auto;
  }
  .perm-icons,
  .row-arrow {
    display: none;
  }
  .login-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .header-tag {
    display: none;
  }
  .features li {
    font-size: 13px;
  }
  .display {
    font-size: 50px;
  }
  .hero-title {
    font-size: 30px;
  }
  .modal-card {
    padding: 26px 22px;
  }
  .bottom-bar {
    padding: 14px 24px;
    flex-wrap: wrap;
  }
}
@media (max-width: 420px) {
  .login-card {
    padding: 28px 20px;
  }
  .display {
    font-size: 44px;
  }
  .hero-title {
    font-size: 36px;
  }
  .login-header {
    flex-wrap: wrap;
    gap: 12px;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
