/* ============ Base ============ */
:root {
  --bg: #07090f;
  --bg-soft: #0d1119;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf4;
  --text-dim: #cfd8ea;
  --accent: #5b8cff;
  --accent-2: #8a5bff;
  --accent-3: #2dd4bf;
  --grad: linear-gradient(100deg, var(--accent), var(--accent-2));
  --radius: 16px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;

  /* Chrome de la página (varía según el tema) */
  --navbar-bg: rgba(7, 9, 15, 0.65);
  --navbar-border: rgba(255, 255, 255, 0.06);
  --blob-opacity: 0.55;
  --noise-opacity: 0.5;
  --particle-rgb: 160, 180, 255;
  --particle-line-rgb: 140, 160, 255;
  --particle-alpha: 0.5;
  --particle-line-alpha: 0.1;
  --field-bg: rgba(255, 255, 255, 0.05);

  color-scheme: dark;
}

/* ============ Light mode (crema) ============ */
[data-theme="light"] {
  --bg: #f4eee2;
  --bg-soft: #ece4d3;
  --card: rgba(60, 48, 28, 0.04);
  --card-border: rgba(60, 48, 28, 0.14);
  --text: #15120c;
  --text-dim: #37332a;
  --accent: #4459cf;
  --accent-2: #6a3fd0;
  --accent-3: #0c7d6e;

  --navbar-bg: rgba(248, 246, 241, 0.72);
  --navbar-border: rgba(60, 48, 28, 0.1);
  --blob-opacity: 0.32;
  --noise-opacity: 0.25;
  --particle-rgb: 120, 95, 200;
  --particle-line-rgb: 130, 110, 190;
  --particle-alpha: 0.22;
  --particle-line-alpha: 0.07;
  --field-bg: rgba(60, 48, 28, 0.05);

  color-scheme: light;
}

/* Los mockups (ventanas de app, WhatsApp, chatbot, chips del sistema)
   se mantienen oscuros en ambos temas, como screenshots reales. */
.window,
.mini-dash,
.whatsapp-card,
.chatbot {
  --bg-soft: #0d1119;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf4;
  --text-dim: #9aa4b8;
  --accent: #5b8cff;
  --accent-2: #8a5bff;
  --accent-3: #2dd4bf;
  /* Fija el color base claro para que el texto sin color propio
     (nombres, burbujas) sea visible sobre el fondo oscuro del mockup */
  color: var(--text);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px; /* compensa la navbar fija al saltar a anclas */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; }

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

/* ============ Fondo animado (mesh gradient estilo Luma) ============ */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: var(--blob-opacity);
  will-change: transform;
}

.blob-1 {
  background: radial-gradient(circle at 30% 30%, #5b8cff, transparent 65%);
  top: -18%;
  left: -12%;
  animation: blob-drift-1 26s ease-in-out infinite alternate;
}

.blob-2 {
  background: radial-gradient(circle at 60% 40%, #8a5bff, transparent 65%);
  top: 5%;
  right: -18%;
  animation: blob-drift-2 32s ease-in-out infinite alternate;
}

.blob-3 {
  background: radial-gradient(circle at 50% 50%, #2dd4bf, transparent 65%);
  bottom: -22%;
  left: 12%;
  opacity: calc(var(--blob-opacity) * 0.72);
  animation: blob-drift-3 29s ease-in-out infinite alternate;
}

.blob-4 {
  background: radial-gradient(circle at 50% 50%, #ff79c6, transparent 65%);
  bottom: 8%;
  right: 4%;
  width: 38vmax;
  height: 38vmax;
  opacity: calc(var(--blob-opacity) * 0.5);
  animation: blob-drift-4 24s ease-in-out infinite alternate;
}

@keyframes blob-drift-1 {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(10vw, 8vh) scale(1.15); }
  100% { transform: translate(4vw, 14vh) scale(0.95); }
}

@keyframes blob-drift-2 {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-12vw, 10vh) scale(0.9); }
  100% { transform: translate(-6vw, -4vh) scale(1.12); }
}

@keyframes blob-drift-3 {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(14vw, -8vh) scale(1.1); }
  100% { transform: translate(-8vw, -2vh) scale(0.92); }
}

@keyframes blob-drift-4 {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-10vw, -10vh) scale(1.2); }
  100% { transform: translate(6vw, -4vh) scale(1); }
}

/* Partículas interactivas sobre los blobs */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Grano sutil encima de los blobs, como Luma */
.bg-noise {
  position: absolute;
  inset: 0;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ Navbar ============ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  margin-right: auto; /* empuja el resto a la derecha */
}

/* Botón de cambio de tema */
.theme-toggle {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, transform 0.2s;
}

.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }

.theme-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  color: var(--text);
  transition: opacity 0.3s, transform 0.3s;
}

/* Por defecto (oscuro) se ve el sol, que invita a aclarar */
.theme-icon-moon { opacity: 0; transform: translate(-50%, -50%) rotate(-90deg) scale(0.5); }
.theme-icon-sun { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(1); }

[data-theme="light"] .theme-icon-moon { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(1); }
[data-theme="light"] .theme-icon-sun { opacity: 0; transform: translate(-50%, -50%) rotate(90deg) scale(0.5); }

.logo-dot { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-dim);
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

.nav-cta {
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  background: var(--grad);
  color: #fff !important;
  font-weight: 600;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Hero ============ */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 7.5rem 1.5rem 4rem;
  position: relative;
}

.hero-kicker {
  color: var(--accent-3);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 700;
  margin-bottom: 1.2rem;
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 1.1rem;
  max-width: 32rem;
  margin-bottom: 2rem;
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 30px rgba(91, 140, 255, 0.35);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(91, 140, 255, 0.5); }

.btn-ghost {
  position: relative;
  color: var(--text);
  border: 1px solid rgba(138, 91, 255, 0.4);
  background: linear-gradient(120deg, rgba(91, 140, 255, 0.16), rgba(138, 91, 255, 0.16));
  background-size: 160% 160%;
  box-shadow: 0 6px 22px rgba(91, 140, 255, 0.12);
  animation: btn-float 3.6s ease-in-out infinite, btn-shift 6s ease-in-out infinite;
  transition: border-color 0.2s, box-shadow 0.25s, background 0.25s;
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: linear-gradient(120deg, rgba(91, 140, 255, 0.3), rgba(138, 91, 255, 0.3));
  background-size: 160% 160%;
  box-shadow: 0 12px 34px rgba(91, 140, 255, 0.3);
}

/* Flotado leve y desplazamiento del degradé */
@keyframes btn-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes btn-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ----- Mapa de sistema (hero) ----- */
.hero-visual {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.system-map {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 400 / 340;
  margin: 0 auto;
}

.sys-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sys-lines path {
  stroke: rgba(120, 140, 255, 0.25);
  stroke-width: 1.5;
  stroke-dasharray: 5 6;
  animation: line-flow 1.2s linear infinite;
}

@keyframes line-flow {
  to { stroke-dashoffset: -11; }
}

.sys-pulse {
  fill: var(--accent-3);
  filter: drop-shadow(0 0 6px rgba(45, 212, 191, 0.9));
}

.sys-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(160deg, rgba(91, 140, 255, 0.18), rgba(138, 91, 255, 0.18));
  border: 1px solid rgba(91, 140, 255, 0.5);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 50px rgba(91, 140, 255, 0.35);
  z-index: 2;
}

.sys-core-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid rgba(91, 140, 255, 0.35);
  animation: core-ring 2.6s ease-out infinite;
}

@keyframes core-ring {
  0% { transform: scale(0.85); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}

.sys-core-icon {
  font-size: 1.6rem;
  animation: core-spin 9s linear infinite;
}

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

.sys-core-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
}

.sys-node {
  position: absolute;
  top: var(--y);
  left: var(--x);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  background: rgba(13, 17, 25, 0.85);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-dim);
  z-index: 1;
  animation: node-float 5s ease-in-out infinite;
}

.sys-node span { font-size: 1.05rem; }

.sys-node:nth-of-type(odd) { animation-delay: -2.5s; }
.sys-node:nth-of-type(3n) { animation-duration: 6s; }

/* ----- Mapa de sistema en light mode ----- */
[data-theme="light"] .sys-lines path {
  stroke: rgba(106, 63, 208, 0.4);
}

[data-theme="light"] .sys-node {
  background: rgba(255, 252, 246, 0.9);
  border-color: rgba(60, 48, 28, 0.12);
  color: var(--text-dim);
  box-shadow: 0 10px 24px rgba(90, 70, 130, 0.14);
}

[data-theme="light"] .sys-core {
  background: linear-gradient(160deg, rgba(68, 89, 207, 0.16), rgba(106, 63, 208, 0.16));
  border-color: rgba(68, 89, 207, 0.55);
  box-shadow: 0 0 45px rgba(106, 63, 208, 0.22);
}

[data-theme="light"] .sys-core-label {
  color: var(--text);
}

[data-theme="light"] .sys-core-ring {
  border-color: rgba(68, 89, 207, 0.45);
}

@keyframes node-float {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -7px; }
}

/* ----- Sección Problema → Solución ----- */
.ps-block {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 3rem;
  align-items: center;
  padding: 2.5rem 0;
}

.ps-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1rem;
}

.ps-label-problem {
  color: #ff9d97;
  border: 1px solid rgba(255, 123, 114, 0.4);
  background: rgba(255, 123, 114, 0.07);
}

.ps-label-solution {
  color: var(--accent-3);
  border: 1px solid rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.07);
}

/* En light mode las píldoras necesitan fondo más sólido y texto oscuro */
[data-theme="light"] .ps-label-problem {
  color: #b13a30;
  border-color: rgba(177, 58, 48, 0.35);
  background: rgba(214, 90, 80, 0.16);
}

[data-theme="light"] .ps-label-solution {
  color: #08665a;
  border-color: rgba(8, 102, 90, 0.35);
  background: rgba(20, 158, 140, 0.18);
}

[data-theme="light"] .project-badge {
  background: rgba(68, 89, 207, 0.14);
  border-color: rgba(68, 89, 207, 0.4);
}

.ps-text h3 {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  margin-bottom: 0.8rem;
}

.ps-text > p {
  color: var(--text-dim);
  margin-bottom: 1.2rem;
}

.ps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ps-list li {
  padding-left: 1.5rem;
  position: relative;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.ps-list-problem li::before {
  content: "✕";
  position: absolute;
  left: 0;
  color: #ff7b72;
  font-weight: 700;
}

.ps-list-solution li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-3);
  font-weight: 700;
}

.ps-visual { min-width: 0; }

.ps-visual .chaos-stack {
  max-width: 480px;
  margin: 0 auto;
}

/* Composición: dashboard con el chatbot superpuesto abajo a la derecha */
.ps-visual-solution {
  display: flex;
  flex-direction: column;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.ps-visual-solution .new-window {
  width: 100%;
}

.ps-sub-row {
  display: flex;
  gap: 1.6rem;
  align-items: flex-start;
  margin-top: 1.6rem;
  padding: 0 0.4rem;
  position: relative;
  z-index: 2;
}

.ps-sub-row > * { flex: 1; min-width: 0; }

.ps-visual-solution .chatbot {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(138, 91, 255, 0.25);
}

/* ----- Tarjeta WhatsApp ----- */
.whatsapp-card {
  background: #0b141a;
  border: 1px solid rgba(37, 211, 102, 0.35);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(37, 211, 102, 0.08);
}

.wa-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #1f2c34;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wa-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #25d366;
  color: #06281a;
  font-family: var(--font-display);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.wa-name { display: block; font-weight: 600; font-size: 0.8rem; }

.wa-status {
  display: block;
  font-size: 0.62rem;
  color: #8696a0;
}

.wa-icons {
  margin-left: auto;
  font-size: 0.7rem;
  color: #8696a0;
  letter-spacing: 0.3em;
}

.wa-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  height: 170px;
  overflow: hidden;
  justify-content: flex-end;
  background:
    radial-gradient(circle at 20% 30%, rgba(37, 211, 102, 0.03), transparent 40%),
    #0b141a;
}

.wa-msg {
  align-self: flex-start;
  max-width: 92%;
  background: #1f2c34;
  border-radius: 10px;
  border-top-left-radius: 3px;
  padding: 6px 9px;
  font-size: 0.72rem;
  line-height: 1.4;
  animation: msg-in 0.3s ease;
}

.wa-msg .wa-total {
  color: #25d366;
  font-weight: 700;
  font-family: var(--font-display);
}

.wa-meta {
  display: block;
  text-align: right;
  font-size: 0.55rem;
  color: #8696a0;
  margin-top: 2px;
}

.wa-meta .wa-check { color: #53bdeb; }

.wa-msg.typing-dots {
  display: flex;
  gap: 4px;
  padding: 9px 12px;
}

.wa-msg.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8696a0;
  animation: dot-bounce 1s ease-in-out infinite;
}

.wa-msg.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.wa-msg.typing-dots i:nth-child(3) { animation-delay: 0.3s; }

.ps-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--accent);
  padding: 0.5rem 0 1.5rem;
}

.ps-divider svg { width: 26px; height: 60px; }

.ps-divider-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.window {
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.window-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--card-border);
}

.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.window-title {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-left: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-badge {
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--accent-3);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.35; } }

/* Planilla vieja (caos) */
.chaos-stack {
  position: relative;
  padding: 26px 18px 0;
}

.old-window {
  position: relative;
  z-index: 1;
  filter: saturate(0.65);
  animation: window-wobble 7s ease-in-out infinite;
}

@keyframes window-wobble {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-0.7deg); }
  60% { transform: rotate(0.6deg); }
}

.unsaved-badge {
  margin-left: auto;
  font-size: 0.58rem;
  color: #febc2e;
  animation: pulse 1.2s ease-in-out infinite;
  white-space: nowrap;
}

.sheet { padding: 10px; display: flex; flex-direction: column; gap: 5px; }

.sheet-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.sheet-row span {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  min-height: 18px;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: monospace;
  overflow: hidden;
  white-space: nowrap;
}

.sheet-head span { background: rgba(255, 255, 255, 0.1); font-weight: 700; }

.sheet-error span {
  color: #ff7b72;
  animation: error-blink 2.4s steps(1) infinite;
}

@keyframes error-blink { 0%, 70% { opacity: 1; } 75%, 95% { opacity: 0.25; } }

/* Celdas marcadas como conflicto (se aplican por JS) */
.sheet-row span.cell-bad {
  color: #ff7b72;
  border-color: rgba(255, 123, 114, 0.5);
  background: rgba(255, 123, 114, 0.08);
}

.sheet-row span.cell-warn {
  color: #febc2e;
  border-color: rgba(254, 188, 46, 0.45);
  background: rgba(254, 188, 46, 0.07);
}

/* Diálogo de error que aparece sobre la planilla */
.error-dialog {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2a1215;
  border: 1px solid rgba(255, 95, 87, 0.6);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.62rem;
  color: #ff9d97;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 3;
}

.error-dialog.show {
  animation: dialog-pop 0.35s ease forwards, dialog-shake 0.4s ease 0.35s;
}

@keyframes dialog-pop {
  to { transform: translateX(-50%) scale(1); }
}

@keyframes dialog-shake {
  0%, 100% { transform: translateX(-50%) scale(1); }
  25% { transform: translateX(calc(-50% - 4px)) scale(1); }
  75% { transform: translateX(calc(-50% + 4px)) scale(1); }
}

/* Notas adhesivas (fuera de la ventana para que no se recorten) */
.sticky-note {
  position: absolute;
  font-family: "Comic Sans MS", "Marker Felt", cursive;
  font-size: 0.62rem;
  color: #4a3b00;
  background: #ffe66d;
  padding: 8px 10px;
  border-radius: 2px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
  z-index: 2;
  line-height: 1.35;
  max-width: 110px;
  text-align: center;
}

.sticky-1 {
  top: 0;
  right: 4px;
  transform: rotate(6deg);
  animation: sticky-sway 4s ease-in-out infinite;
}

.sticky-2 {
  top: 42%;
  left: -8px;
  transform: rotate(-5deg);
  background: #ffb3c1;
  color: #5c0a1e;
  animation: sticky-sway 5s ease-in-out infinite reverse;
}

@keyframes sticky-sway {
  0%, 100% { rotate: 0deg; }
  50% { rotate: 3deg; }
}

.paper {
  position: relative;
  z-index: 1;
  margin: 8px 4px 0;
  padding: 6px 8px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-size: 0.62rem;
  color: var(--text-dim);
  background: rgba(13, 17, 25, 0.8);
}

.paper-1 { transform: rotate(-1.5deg); }
.paper-2 { transform: rotate(1.2deg); margin-top: 4px; }

.paper-note { color: #ff7b72; }

/* Flecha animada (divisor problema → solución) */
.arrow-path {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: draw-arrow 2.2s ease-in-out infinite;
}

.arrow-head {
  opacity: 0;
  animation: show-head 2.2s ease-in-out infinite;
}

@keyframes draw-arrow {
  0% { stroke-dashoffset: 48; }
  45%, 100% { stroke-dashoffset: 0; }
}

@keyframes show-head {
  0%, 35% { opacity: 0; }
  50%, 100% { opacity: 1; }
}

/* Dashboard nuevo */
.new-window {
  border-color: rgba(91, 140, 255, 0.35);
  box-shadow: 0 20px 60px rgba(91, 140, 255, 0.18);
}

.dash-layout { display: flex; }

.dash-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 8px;
  border-right: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.02);
  min-width: 96px;
}

.side-item {
  font-size: 0.6rem;
  color: var(--text-dim);
  padding: 5px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.side-item.active {
  background: rgba(91, 140, 255, 0.18);
  color: var(--text);
  border: 1px solid rgba(91, 140, 255, 0.35);
}

.dashboard {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Toast de regla de negocio aplicada */
.rule-toast {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6rem;
  color: var(--accent-3);
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 8px;
  padding: 5px 10px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  height: 28px;
  overflow: hidden;
  white-space: nowrap;
}

.rule-toast .rule-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.rule-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.rule-icon { flex-shrink: 0; }

.rule-text { font-family: monospace; }

.dash-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.kpi {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
}

.kpi-label { font-size: 0.55rem; color: var(--text-dim); }

.kpi-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-3);
}

.dash-chart {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 54px;
  flex-shrink: 0;
  padding: 0 4px;
}

.dash-chart .bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  background: var(--grad);
  height: var(--h);
  transform-origin: bottom;
  animation: bar-grow 2.8s ease-in-out infinite alternate;
}

.dash-chart .bar:nth-child(2) { animation-delay: 0.25s; }
.dash-chart .bar:nth-child(3) { animation-delay: 0.5s; }
.dash-chart .bar:nth-child(4) { animation-delay: 0.75s; }
.dash-chart .bar:nth-child(5) { animation-delay: 1s; }
.dash-chart .bar:nth-child(6) { animation-delay: 1.25s; }

@keyframes bar-grow {
  0% { transform: scaleY(0.55); opacity: 0.7; }
  100% { transform: scaleY(1); opacity: 1; }
}

.dash-rows { display: flex; flex-direction: column; gap: 5px; }

.dash-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.62rem;
  color: var(--text-dim);
  height: 16px;
  overflow: hidden;
  white-space: nowrap;
}

.dash-row .row-icon { color: var(--accent-3); opacity: 0; transition: opacity 0.3s; }
.dash-row.done .row-icon { opacity: 1; }

.row-text { font-family: monospace; }

/* Cursor de tipeo */
.typing-cursor::after {
  content: "▌";
  animation: blink 0.8s steps(1) infinite;
  color: var(--accent);
}

@keyframes blink { 50% { opacity: 0; } }

/* ----- Chatbot ----- */
.chatbot {
  background: var(--bg-soft);
  border: 1px solid rgba(138, 91, 255, 0.3);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(138, 91, 255, 0.15);
  max-width: 420px;
  align-self: flex-end;
  width: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--card-border);
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.chat-name { display: block; font-weight: 600; font-size: 0.85rem; }

.chat-status {
  display: block;
  font-size: 0.68rem;
  color: var(--accent-3);
}

.chat-status::before { content: "● "; }

.chat-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 170px;
  overflow: hidden;
  justify-content: flex-end;
}

.msg {
  max-width: 85%;
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 0.78rem;
  line-height: 1.45;
  animation: msg-in 0.3s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
  border-bottom-left-radius: 4px;
}

.msg.typing-dots {
  display: flex;
  gap: 4px;
  padding: 10px 13px;
}

.msg.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: dot-bounce 1s ease-in-out infinite;
}

.msg.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.msg.typing-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce { 40% { transform: translateY(-5px); opacity: 1; } }

.chat-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--card-border);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.chat-send { color: var(--accent); }

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 1.6rem;
  left: 50%;
  transform: translateX(-50%);
}

.mouse {
  display: block;
  width: 24px;
  height: 38px;
  border: 2px solid var(--text-dim);
  border-radius: 14px;
  position: relative;
}

.wheel {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 3px;
  height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--accent);
  animation: wheel 1.6s ease-in-out infinite;
}

@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { opacity: 0; }
}

/* ============ Secciones ============ */
.section { padding: 6rem 1.5rem; }

.section-inner { max-width: 1180px; margin: 0 auto; }

.section-kicker {
  color: var(--accent-3);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 0.6rem;
}

.section h2 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  margin-bottom: 2.5rem;
}

/* ----- Clientes (casos destacados, estilo editorial) ----- */
.cases-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 1.2rem;
}

.case-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  padding: 1.8rem;
  border-radius: var(--radius);
  background: var(--card-strong, rgba(255, 255, 255, 0.035));
  border: 1px solid var(--card-border);
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.case-card:hover {
  transform: translateY(-6px);
  border-color: rgba(91, 140, 255, 0.5);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.3);
}

/* Caso destacado: relleno con degradé de acento */
.case-featured {
  background:
    linear-gradient(160deg, rgba(91, 140, 255, 0.14), rgba(138, 91, 255, 0.1)),
    var(--card-strong, rgba(255, 255, 255, 0.035));
  border-color: rgba(91, 140, 255, 0.4);
}

.case-featured::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -30%;
  width: 70%;
  height: 80%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.18), transparent 70%);
  pointer-events: none;
}

.case-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}

/* Logo del cliente (o monograma de respaldo) */
.case-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--field-bg);
  border: 1px solid var(--card-border);
  overflow: hidden;
  flex-shrink: 0;
}

.case-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

/* El monograma se ve por defecto; si el <img> carga, queda detrás y tapado.
   Si el <img> falla, se elimina (onerror) y el monograma queda visible. */
.case-logo img + .case-monogram { display: none; }

.case-monogram {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.case-label,
.case-code,
.case-tags {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.case-code { letter-spacing: 0.1em; opacity: 0.7; }

.case-title {
  font-size: clamp(1.4rem, 2.4vw, 1.95rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 1.6rem 0 0.9rem;
}

.case-desc {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 1.6rem;
}

.case-tags {
  margin-top: auto;
  color: var(--accent-3);
}

/* Tira de miniaturas */
.case-thumbs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.2rem;
  margin-top: 1.2rem;
}

.thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background-size: 180% 180%;
  animation: thumb-shimmer 8s ease-in-out infinite;
}

.thumb-1 { background-image: linear-gradient(135deg, #1b2a4a, #2d3f6e); }
.thumb-2 { background-image: linear-gradient(135deg, #2a1b4a, #5b8cff); animation-delay: -1.5s; }
.thumb-3 { background-image: linear-gradient(135deg, #14463f, #2dd4bf); animation-delay: -3s; }
.thumb-4 { background-image: linear-gradient(135deg, #3a1f4d, #8a5bff); animation-delay: -4.5s; }
.thumb-5 { background-image: linear-gradient(135deg, #1b2a4a, #2dd4bf); animation-delay: -6s; }

@keyframes thumb-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.thumb-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  color: #fff;
}

.thumb-ico { font-size: 1.8rem; }

[data-theme="light"] .case-card {
  --card-strong: rgba(255, 252, 246, 0.85);
  box-shadow: 0 10px 30px rgba(90, 70, 130, 0.08);
}

[data-theme="light"] .case-card:hover { box-shadow: 0 22px 50px rgba(90, 70, 130, 0.16); }

/* ----- Proyectos ----- */
.project {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 3rem 0;
}

.project + .project { border-top: 1px solid rgba(255, 255, 255, 0.06); }

.project-alt .project-visual { order: 2; }
.project-alt .project-info { order: 1; }

.project-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(91, 140, 255, 0.4);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  margin-bottom: 1rem;
}

.project h3 { font-size: 1.9rem; margin-bottom: 0.3rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; }

.hackathon-tag { font-size: 0.55rem; font-weight: 500; background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.35); border-radius: 6px; padding: 0.35rem 0.7rem; color: #fbbf24; letter-spacing: 0.05em; }

[data-theme="light"] .hackathon-tag {
  background: rgba(180, 120, 4, 0.12);
  border-color: rgba(146, 102, 10, 0.45);
  color: #7a5406;
  font-weight: 600;
}

.project-tagline { color: var(--accent-3); font-weight: 500; margin-bottom: 1rem; }

.project-info > p { color: var(--text-dim); margin-bottom: 1.2rem; }

.project-features {
  list-style: none;
  margin-bottom: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.project-features li {
  padding-left: 1.4rem;
  position: relative;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.project-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-3);
  font-weight: 700;
}

.tech-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tech-tags span {
  font-size: 0.75rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text-dim);
}

/* Visual de proyectos */
.project-visual .mini-dash {
  background: var(--bg-soft);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding-bottom: 14px;
}

.vency-visual .mini-dash { border-color: rgba(45, 212, 191, 0.3); }
.notaria-visual .mini-dash { border-color: rgba(34, 197, 94, 0.35); }

.mini-dash-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 14px;
}

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 14px;
  margin-bottom: 12px;
}

.mini-kpi {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.62rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
}

.mini-kpi strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--accent-3);
}

.mini-line { width: 100%; height: 60px; padding: 0 14px; margin-bottom: 10px; }

.line-path {
  stroke: var(--accent-3);
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: draw-line 3.4s ease-out infinite;
}

@keyframes draw-line {
  0% { stroke-dashoffset: 400; }
  60%, 100% { stroke-dashoffset: 0; }
}

.mini-pie {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
}

.pie {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0 40%, var(--accent-2) 40% 70%, var(--accent-3) 70% 100%);
  animation: pie-spin 9s linear infinite;
  flex-shrink: 0;
}

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

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.pie-legend .sw {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 6px;
}

.sw1 { background: var(--accent); }
.sw2 { background: var(--accent-2); }
.sw3 { background: var(--accent-3); }

/* Notaria visual */
.audit-demo { padding: 4px 16px 12px; }

.audit-text {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: monospace;
  min-height: 36px;
}

.audit-arrow {
  text-align: center;
  padding: 6px 0;
  font-size: 1.4rem;
  color: #22c55e;
  animation: checkmark-bounce 1.8s ease-in-out infinite;
}

@keyframes checkmark-bounce {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.audit-hash {
  font-size: 0.72rem;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: monospace;
  color: #22c55e;
  min-height: 34px;
  word-break: break-all;
}

.arkiv-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 8px 16px 2px;
}

.arkiv-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #22c55e;
  animation: node-verify 2s ease-in-out infinite;
}

.arkiv-node:nth-child(3) { animation-delay: 0.4s; }
.arkiv-node:nth-child(5) { animation-delay: 0.8s; }
.arkiv-node:nth-child(7) { animation-delay: 1.2s; }

@keyframes node-verify {
  50% { background: #22c55e; box-shadow: 0 0 12px rgba(34, 197, 94, 0.7); }
}

.arkiv-link {
  width: 28px;
  height: 2px;
  background: rgba(34, 197, 94, 0.4);
}

.arkiv-label {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}


/* ----- Contacto ----- */
.contact-lead {
  font-size: clamp(1.1rem, 2.2vw, 1.5rem);
  line-height: 1.5;
  color: var(--text);
  max-width: 720px;
  margin-bottom: 2.5rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 620px;
}

.contact-info p { color: var(--text-dim); margin-bottom: 1.6rem; }

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  margin-bottom: 0.9rem;
  background: var(--card);
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}

.contact-item:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  background: linear-gradient(110deg, rgba(91, 140, 255, 0.07), transparent 70%);
}

.contact-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--field-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  flex-shrink: 0;
}

.contact-icon-box svg { width: 22px; height: 22px; }

.contact-item:hover .contact-icon-box {
  color: var(--accent);
  border-color: rgba(91, 140, 255, 0.45);
}

.contact-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.contact-label {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.contact-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

/* ============ Footer ============ */
.footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--card-border);
}

/* ============ Botón flotante de WhatsApp ============ */
.wa-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 90;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(37, 211, 102, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wa-float svg { width: 30px; height: 30px; }

.wa-float::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #25d366;
  z-index: -1;
  animation: wa-ping 2.4s ease-out infinite;
}

@keyframes wa-ping {
  0% { transform: scale(1); opacity: 0.5; }
  80%, 100% { transform: scale(1.7); opacity: 0; }
}

.wa-float:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 32px rgba(37, 211, 102, 0.6);
}

/* ============ Reveal on scroll ============ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 6.5rem;
    gap: 2.5rem;
    text-align: center;
  }

  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  .chatbot { align-self: center; }

  .ps-block,
  .ps-block-solution { grid-template-columns: 1fr; gap: 2rem; }
  .ps-block .ps-visual { order: 2; }
  .ps-block .ps-text { order: 1; }

  /* En mobile, primero la info del proyecto y luego el gráfico */
  .project,
  .project-alt { grid-template-columns: 1fr; gap: 1.8rem; }
  .project .project-visual,
  .project-alt .project-visual { order: 2; }
  .project .project-info,
  .project-alt .project-info { order: 1; }

  .contact-grid { grid-template-columns: 1fr; }

  /* Casos: el destacado ocupa todo el ancho, los otros dos a la par */
  .cases-grid { grid-template-columns: 1fr 1fr; }
  .case-featured { grid-column: 1 / -1; }
  .case-card { min-height: 240px; }
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--navbar-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--card-border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-links.open { max-height: 300px; }

  .nav-links li { width: 100%; text-align: center; }
  .nav-links a { display: block; padding: 1rem; }
  .nav-cta { border-radius: 0; }

  .system-map { max-width: min(340px, 88vw); }

  .dash-sidebar { min-width: 64px; padding: 10px 5px; }

  .side-item { font-size: 0.52rem; padding: 4px 5px; }

  .dash-kpis { gap: 4px; }

  .kpi { padding: 5px 6px; }

  .kpi-label { font-size: 0.5rem; }

  .kpi-value { font-size: 0.72rem; }

  /* KPIs de los proyectos (Vency) */
  .mini-kpis { gap: 5px; padding: 0 10px; }

  .mini-kpi { padding: 6px 7px; font-size: 0.56rem; }

  .mini-kpi strong { font-size: 0.8rem; }

  /* WhatsApp + Asistente IA quedan uno al lado del otro, compactos */
  .ps-sub-row {
    flex-direction: row;
    gap: 0.7rem;
    margin-top: 1.2rem;
    padding: 0;
  }

  .ps-sub-row > * { flex: 1; min-width: 0; }

  .wa-header,
  .chat-header { padding: 8px 9px; gap: 7px; }

  .wa-avatar,
  .chat-avatar { width: 26px; height: 26px; font-size: 0.78rem; }

  .wa-name,
  .chat-name { font-size: 0.68rem; }

  .wa-status,
  .chat-status { font-size: 0.55rem; }

  .wa-icons { display: none; }

  .wa-body,
  .chat-body { padding: 9px; height: 150px; gap: 6px; }

  .wa-msg,
  .msg { font-size: 0.64rem; padding: 5px 8px; }

  .chat-input { padding: 8px 9px; font-size: 0.64rem; }

  /* Casos en una sola columna y miniaturas en dos filas */
  .cases-grid { grid-template-columns: 1fr; }
  .case-featured { grid-column: auto; }
  .case-card { min-height: 0; }
  .case-thumbs { grid-template-columns: repeat(3, 1fr); }

  .wa-float {
    width: 50px;
    height: 50px;
    bottom: 1.1rem;
    right: 1.1rem;
  }
  .wa-float svg { width: 26px; height: 26px; }

  .contact-item { padding: 0.85rem 1rem; gap: 0.8rem; }
  .contact-icon-box { width: 40px; height: 40px; }
  .contact-value { font-size: 0.92rem; }

  .section { padding: 4rem 1.2rem; }
}

/* Pantallas muy chicas: las dos tarjetas de chat se apilan */
@media (max-width: 400px) {
  .ps-sub-row {
    flex-direction: column;
    gap: 1.1rem;
  }

  .ps-sub-row > * { width: 100%; }

  .wa-icons { display: block; }
}

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