/* ==========================================================================
   Electromecánica MKS — Hoja de estilos
   Estilo: oscuro corporativo · Rojo de marca #E11D2E
   Tipografía: Barlow Condensed (títulos) + Barlow (texto)
   Índice:
     1. Variables y base        6. Escena del motor (scroll)
     2. Utilidades y botones    7. Formularios y cotizador
     3. Encabezado y menú       8. Pie de página y barra móvil
     4. Inicio (hero)           9. Páginas de servicio
     5. Secciones de contenido 10. Portal de clientes y panel MKS
   ========================================================================== */

/* 1. Variables y base ===================================================== */
:root {
  --bg: #0B0F14;          /* fondo principal */
  --bg-2: #111821;        /* tarjetas */
  --bg-3: #05080C;        /* paneles hundidos */
  --bg-4: #17212D;        /* hover / campos */
  --line: #1F2A37;        /* bordes */
  --line-2: #334155;
  --text: #F8FAFC;
  --muted: #CBD5E1;       /* texto secundario (contraste AA sobre --bg) */
  --muted-2: #94A3B8;
  --red: #E11D2E;         /* rojo de marca */
  --red-hover: #C8102E;
  --red-soft: rgba(225, 29, 46, .14);
  --blue: #60A5FA;        /* estados "en proceso" */
  --amber: #F59E0B;       /* estados "pendiente del cliente" */
  --green: #22C55E;       /* estados "listo" */
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 68px;
  --container: 1200px;
  --font-head: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: #F87171; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #FCA5A5; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.08; margin: 0 0 .5em; letter-spacing: .2px; }
h1 { font-size: clamp(2.3rem, 5.2vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); font-weight: 700; }
h3 { font-size: 1.45rem; font-weight: 700; }
p { margin: 0 0 1em; }
.num, .tabular { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid #FCA5A5; outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--red); color: #fff; }

/* 2. Utilidades y botones ================================================= */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section--alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: 44px; }
.section-head p { color: var(--muted); font-size: 1.08rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
  font-size: .82rem; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted-2);
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--red); }
.text-red { color: var(--red); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--red); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.placeholder { color: var(--amber); font-style: normal; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 10px; border: 1px solid transparent;
  font: 600 1rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); color: #fff; }
.btn-outline { border-color: var(--line-2); color: var(--text); background: transparent; }
.btn-outline:hover { border-color: var(--muted-2); background: var(--bg-4); color: var(--text); }
.btn-ghost { color: var(--muted); background: transparent; padding: 0 12px; }
.btn-ghost:hover { color: var(--text); background: var(--bg-4); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .92rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Logo (estator minimalista + letras con rayo) */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.logo:hover { color: var(--text); }
.logo-mark { width: 38px; height: 38px; flex: none; color: #fff; }
.logo-word { font-family: var(--font-head); font-size: 1.45rem; font-weight: 600; line-height: 1; white-space: nowrap; }
.logo-word b { color: var(--red); font-weight: 800; }
.i-bolt { position: relative; }
.i-bolt svg { position: absolute; left: 50%; top: -.2em; width: .3em; height: .42em; transform: translateX(-50%); }

/* 3. Encabezado y menú ==================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(11, 15, 20, .88); backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--line);
}
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a:not(.btn) {
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: .98rem;
  padding: 10px 12px; border-radius: 8px;
}
.nav a:not(.btn):hover, .nav a[aria-current="page"] { color: var(--text); background: var(--bg-4); }
.nav .btn { margin-left: 8px; }
.nav-toggle {
  display: none; width: 48px; height: 48px; border-radius: 10px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text); cursor: pointer; align-items: center; justify-content: center;
}
.nav-toggle svg { width: 24px; height: 24px; }
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px 20px 24px; background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: .2s;
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .nav.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav a:not(.btn) { padding: 14px 12px; font-size: 1.05rem; }
  .nav .btn { margin: 10px 0 0; }
  .logo-word { font-size: 1.25rem; }
}

/* 4. Inicio (hero) ======================================================== */
.hero { position: relative; padding: clamp(48px, 8vw, 96px) 0 clamp(56px, 8vw, 88px); overflow: hidden; }
.hero::before { /* retícula técnica sutil, sin degradados llamativos */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}
.hero .container { position: relative; display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.hero h1 { margin-bottom: 20px; }
.hero-lead { font-size: 1.15rem; color: var(--muted); max-width: 620px; margin-bottom: 30px; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 36px; }
.hero-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 18px 12px; margin: 0; padding: 0; list-style: none; }
.hero-facts li { border-left: 2px solid var(--red); padding: 2px 0 2px 12px; }
.hero-facts strong { display: block; font-family: var(--font-head); font-size: 1.5rem; line-height: 1.1; }
.hero-facts span { font-size: .88rem; color: var(--muted-2); }

/* Tarjeta de ejemplo del portal en el hero */
.status-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.status-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.status-card__code { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; }
.status-card__meta { font-size: .9rem; color: var(--muted-2); }
.status-card__tag { font-size: .72rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px; }
.mini-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.mini-steps li { position: relative; display: flex; gap: 12px; align-items: center; padding: 7px 0; font-size: .95rem; color: var(--muted-2); }
.mini-steps li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; background: var(--bg-2); z-index: 1; }
.mini-steps li:not(:last-child)::after { content: ""; position: absolute; left: 5px; top: 22px; bottom: -8px; width: 2px; background: var(--line-2); }
.mini-steps li.done { color: var(--muted); }
.mini-steps li.done::before { background: var(--red); border-color: var(--red); }
.mini-steps li.done::after { background: var(--red); }
.mini-steps li.current { color: var(--text); font-weight: 600; }
.mini-steps li.current::before { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.status-card__foot { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .9rem; color: var(--muted-2); }

@media (max-width: 960px) {
  .hero .container { grid-template-columns: 1fr; gap: 40px; }
  .hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
}

/* 5. Secciones de contenido =============================================== */
/* 3 tarjetas arriba y 2 anchas abajo; 2 por fila en tableta; 1 en celular */
.services-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
.services-grid > .service-card { grid-column: span 2; }
.services-grid > .service-card:nth-child(n+4) { grid-column: span 3; }
@media (max-width: 1024px) {
  .services-grid > .service-card, .services-grid > .service-card:nth-child(n+4) { grid-column: span 3; }
  .services-grid > .service-card:last-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .services-grid > .service-card, .services-grid > .service-card:nth-child(n+4) { grid-column: 1 / -1; }
}
.service-card {
  display: flex; flex-direction: column; gap: 12px; padding: 26px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px solid var(--line); transition: border-color .2s, transform .2s;
}
.service-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.service-card h3 { margin: 0; }
.service-card p { color: var(--muted); margin: 0; font-size: .98rem; }
.service-card ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .94rem; color: var(--muted); }
.service-card li { display: flex; gap: 8px; }
.service-card li::before { content: ""; width: 6px; height: 6px; margin-top: .62em; background: var(--red); border-radius: 1px; flex: none; }
.service-card .more { margin-top: auto; padding-top: 10px; font-weight: 600; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.icon-box { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--red-soft); color: #FCA5A5; }
.icon-box svg { width: 26px; height: 26px; }

/* --- Animaciones de cada servicio ------------------------------------------
   Corren solo cuando la tarjeta está en pantalla (.is-playing lo pone main.js).
   Cada ciclo usa la misma duración, así las piezas quedan sincronizadas. */
.svc-anim { border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line); overflow: hidden; margin-bottom: 4px; }
.svc-anim svg { display: block; width: 100%; height: auto; }
.svc-anim:not(.is-playing) * { animation-play-state: paused !important; }
@keyframes giro { to { transform: rotate(360deg); } }

/* Motor: el bobinado se enrolla, el rotor gira y luego pasa la prueba */
/* Cada bobina se enrolla 0.2 s después de la anterior (misma duración = siguen en sincronía) */
.m-coil { stroke-dasharray: 16; stroke-dashoffset: 16; animation: m-bobinar 7s linear infinite; animation-delay: calc(var(--i) * .2s); }
@keyframes m-bobinar { 0% { stroke-dashoffset: 16; } 4%, 70% { stroke-dashoffset: 0; } 74%, 100% { stroke-dashoffset: 16; } }
.m-rotor { transform-box: fill-box; transform-origin: center; animation: giro 1.1s linear infinite; }
.m-bar { transform-box: fill-box; transform-origin: left center; animation: m-barra 7s linear infinite; }
@keyframes m-barra { 0% { transform: scaleX(0); } 50%, 88% { transform: scaleX(1); } 96%, 100% { transform: scaleX(0); } }
.m-ok { animation: m-ok 7s step-end infinite; }
.m-wait { animation: m-espera 7s step-end infinite; }
@keyframes m-ok { 0% { opacity: 0; } 55% { opacity: 1; } 92% { opacity: 0; } }
@keyframes m-espera { 0% { opacity: 1; } 55% { opacity: 0; } 92% { opacity: 1; } }

/* Bomba: agua circulando, impulsor girando y manómetro subiendo */
.p-flow { stroke-dasharray: 6 10; animation: flujo .7s linear infinite; }
@keyframes flujo { to { stroke-dashoffset: -16; } }
.p-imp { transform-box: fill-box; transform-origin: center; animation: giro .9s linear infinite; }
.p-needle { transform-box: fill-box; transform-origin: center; animation: aguja 4s ease-in-out infinite; }
@keyframes aguja { 0%, 8% { transform: rotate(-80deg); } 40% { transform: rotate(30deg); } 50% { transform: rotate(22deg); } 60%, 80% { transform: rotate(26deg); } 100% { transform: rotate(-80deg); } }

/* Transformador: onda de entrada y de salida, flujo magnético en el núcleo */
.t-wave { animation: onda 1.2s linear infinite; }
@keyframes onda { to { transform: translateX(32px); } }
.t-flux { stroke-dasharray: 6 8; animation: flujo-nucleo 1s linear infinite; }
@keyframes flujo-nucleo { to { stroke-dashoffset: -28; } }

/* Tablero: la lógica la simula main.js (MARCHA, PARO y enclavamiento de K1).
   Aquí solo se definen los colores: verde = cerrado / energizado. */
[data-tablero] [data-k] { transition: stroke .12s, opacity .12s; }
[data-tablero] [data-k].on { stroke: #22C55E; }
[data-tablero] .barra { stroke: #22C55E; stroke-width: 2.5; opacity: 0; }
[data-tablero] .barra.on { opacity: 1; }
[data-tablero] .tb-arm { transition: transform .12s; }
[data-tablero] .tb-arm.on { transform: translateY(-5px); }
[data-tablero] .tb-btn-marcha, [data-tablero] .tb-btn-paro { transform-box: fill-box; transform-origin: center; transition: transform .1s; }
[data-tablero] .pulsado { transform: scale(.78); }
.plc-led { fill: #334155; animation: parpadeo 1.6s steps(1) infinite; animation-delay: calc(var(--d) * .27s); }
@keyframes parpadeo { 0% { fill: #22C55E; } 50% { fill: #334155; } }

@media (prefers-reduced-motion: reduce) {
  .svc-anim * { animation: none !important; }
  .m-coil { stroke-dashoffset: 0; }
  .m-wait { display: none; }
}

.why-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.why-item { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); }
.why-item h3 { font-size: 1.3rem; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.why-item h3 svg { width: 22px; height: 22px; color: var(--red); flex: none; }
.why-item p { color: var(--muted); margin: 0; font-size: .98rem; }
@media (max-width: 960px) { .why-grid { grid-template-columns: 1fr; } }

.steps { counter-reset: paso; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: paso; position: relative; padding: 24px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line); }
.steps li::before {
  content: counter(paso, decimal-leading-zero); display: block; margin-bottom: 12px;
  font-family: var(--font-head); font-size: 2.2rem; font-weight: 800; color: var(--red); line-height: 1;
}
.steps h3 { font-size: 1.3rem; margin-bottom: 6px; }
.steps p { color: var(--muted); margin: 0; font-size: .97rem; }
@media (max-width: 960px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

.brands { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.brand-group h3 { font-size: 1.15rem; color: var(--muted-2); font-family: var(--font-body); font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-2); font-family: var(--font-head); font-size: 1.2rem; font-weight: 600; letter-spacing: .5px; }
@media (max-width: 760px) { .brands { grid-template-columns: 1fr; } }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; gap: 36px; } }
.check-list { margin: 0 0 28px; padding: 0; list-style: none; display: grid; gap: 12px; }
.check-list li { display: flex; gap: 12px; color: var(--muted); }
.check-list svg { width: 22px; height: 22px; color: var(--red); flex: none; margin-top: 2px; }

.faq { max-width: 860px; display: grid; gap: 12px; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.faq summary {
  list-style: none; cursor: pointer; padding: 18px 54px 18px 20px; position: relative;
  font-weight: 600; font-size: 1.05rem; min-height: 48px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 22px; top: 50%; width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--muted-2); border-bottom: 2px solid var(--muted-2); transform: rotate(45deg); transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq details p { padding: 0 20px 18px; margin: 0; color: var(--muted); }

.cta-band { padding: 40px; border-radius: 18px; background: var(--bg-2); border: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }
.cta-band h2 { margin: 0 0 6px; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.cta-band p { margin: 0; color: var(--muted); }
.cta-band .actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* 6. Escena del motor (se desarma con el scroll) ========================== */
.motor-scene { position: relative; height: 420vh; background: var(--bg-3); border-block: 1px solid var(--line); }
.motor-sticky {
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); min-height: 520px;
  display: grid; grid-template-columns: .62fr 1.38fr; gap: 36px; align-items: center;
  max-width: var(--container); margin: 0 auto; padding: 24px 20px;
}
.motor-copy h2 { margin-bottom: 14px; }
.motor-copy > p { color: var(--muted); }
.motor-steps { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 10px; }
.motor-steps li {
  padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2);
  opacity: .45; transition: opacity .3s, border-color .3s, transform .3s;
}
.motor-steps li.is-active { opacity: 1; border-color: var(--red); transform: translateX(4px); }
.motor-steps strong { display: block; font-family: var(--font-head); font-size: 1.2rem; }
.motor-steps span { display: block; font-size: .94rem; color: var(--muted); margin-top: 4px; }
.motor-steps li:not(.is-active) span { display: none; } /* solo el paso activo muestra su detalle */
.motor-figure { margin: 0; }
.motor-figure svg { width: 100%; height: auto; display: block; overflow: visible; }
.motor-part { transition: transform .08s linear; }
.motor-label { opacity: var(--labels, 0); transition: opacity .2s; }
.motor-label text {
  font-family: var(--font-body); font-size: 25px; font-weight: 600; fill: #E2E8F0; letter-spacing: .3px;
  paint-order: stroke; stroke: #05080C; stroke-width: 7px; stroke-linejoin: round; /* contorno para que se lea sobre cualquier pieza */
}
.motor-label line { stroke: var(--muted-2); stroke-width: 1.5; stroke-dasharray: 3 4; }
/* Fondo tipo estudio: una luz suave detrás del motor */
.motor-figure { background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(148, 163, 184, .10), transparent 70%); border-radius: 24px; }
.motor-label circle { fill: var(--red); }
.motor-progress { height: 3px; background: var(--line); border-radius: 2px; margin-top: 18px; overflow: hidden; }
.motor-progress span { display: block; height: 100%; width: 0; background: var(--red); }
@media (max-width: 960px) {
  .motor-scene { height: 380vh; }
  .motor-sticky { grid-template-columns: 1fr; grid-template-rows: auto auto; gap: 8px; align-content: center; padding-top: 12px; }
  .motor-figure { order: -1; }
  .motor-copy h2 { font-size: 1.7rem; margin-bottom: 4px; }
  .motor-copy > p { display: none; }
  .motor-steps { margin-top: 8px; }
  .motor-steps li { display: none; }
  .motor-steps li.is-active { display: block; transform: none; }
  .motor-label text { font-size: 36px; }
  .motor-label.secundaria { display: none; } /* en celular solo las etiquetas principales */
  .motor-label line, .motor-label circle { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .motor-scene { height: auto; }
  .motor-sticky { position: relative; top: 0; height: auto; }
  .motor-steps li { opacity: 1; display: block; }
  .motor-steps li span { display: block; }
  .motor-part { transition: none; }
}

/* 7. Formularios y cotizador ============================================== */
.quote { display: grid; grid-template-columns: .85fr 1.15fr; gap: 48px; align-items: start; }
@media (max-width: 960px) { .quote { grid-template-columns: 1fr; } }
.form-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 3vw, 32px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; }
.field label, .field legend { font-weight: 600; font-size: .95rem; color: var(--text); }
.field .hint { font-size: .85rem; color: var(--muted-2); font-weight: 400; }
.req { color: #FCA5A5; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="date"],
input[type="search"], select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text);
  font: 400 1rem/1.4 var(--font-body);
}
textarea { min-height: 110px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--muted-2) 50%), linear-gradient(135deg, var(--muted-2) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: #64748B; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; border-color: transparent; }
input[type="date"] { color-scheme: dark; }
input[type="file"] { width: 100%; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--bg-3); color: var(--muted); font: inherit; }
.inline-pair { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); color: var(--muted); font-weight: 500; cursor: pointer; transition: .15s;
}
.choice input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--text); }
.choice input:focus-visible + span { outline: 3px solid #FCA5A5; outline-offset: 2px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
/* Galería de trabajos reales */
.galeria { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 220px; gap: 12px; margin-top: 32px; }
.galeria-item { position: relative; margin: 0; overflow: hidden; border-radius: 12px; background: #0B0F14; border: 1px solid rgba(255,255,255,.08); }
.galeria-item--grande { grid-column: span 2; grid-row: span 2; }
.galeria-item--ancho { grid-column: span 2; }
.galeria-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.galeria-item:hover img { transform: scale(1.04); }
.galeria-item figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 14px 12px; font-size: .9rem; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.82)); }
@media (max-width: 900px) { .galeria { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 170px; } }
@media (max-width: 520px) { .galeria { grid-auto-rows: 150px; gap: 8px; } .galeria-item--grande { grid-row: span 2; } .galeria-item figcaption { font-size: .8rem; padding: 22px 10px 8px; } }
@media (prefers-reduced-motion: reduce) { .galeria-item img { transition: none; } }
/* Lema de la empresa en el pie */
.lema { font-style: italic; color: var(--muted); }

/* Campo trampa anti-robots: fuera de la vista y del lector de pantalla */
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.check.consent { align-items: flex-start; margin-top: 20px; line-height: 1.5; font-size: .95rem; }
.check.consent input { margin-top: 2px; flex: none; }
/* Página de aviso de privacidad */
.legal { max-width: 820px; }
.legal h2 { font-size: 1.6rem; margin-top: 2.2em; }
.legal p, .legal li { color: var(--muted); }
.legal ul { padding-left: 1.2em; display: grid; gap: 6px; }
.form-note { font-size: .88rem; color: var(--muted-2); margin: 14px 0 0; }
.form-status { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: .95rem; display: none; }
.form-status.is-ok { display: block; background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .4); color: #BBF7D0; }
.form-status.is-error { display: block; background: var(--red-soft); border: 1px solid rgba(225, 29, 46, .5); color: #FECACA; }
.form-status.is-info { display: block; background: rgba(96, 165, 250, .12); border: 1px solid rgba(96, 165, 250, .4); color: #BFDBFE; }

.contact-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 14px; }
.contact-list li { display: flex; gap: 14px; align-items: flex-start; }
.contact-list svg { width: 22px; height: 22px; color: var(--red); flex: none; margin-top: 3px; }
.contact-list strong { display: block; font-size: .85rem; letter-spacing: 1px; text-transform: uppercase; color: var(--muted-2); font-weight: 600; }
.contact-list a, .contact-list span.val { color: var(--text); text-decoration: none; font-size: 1.05rem; }

/* 8. Pie de página y barra móvil ========================================== */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 32px; background: var(--bg-3); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { font-family: var(--font-body); font-size: .85rem; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted-2); margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.site-footer p { color: var(--muted-2); font-size: .95rem; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--muted-2); font-size: .88rem; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

.wa-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; background: #25D366; color: #06290f; box-shadow: var(--shadow);
}
.wa-float:hover { color: #06290f; transform: scale(1.04); }
.wa-float svg { width: 32px; height: 32px; }
.mobile-bar { display: none; }
@media (max-width: 760px) {
  .wa-float { display: none; }
  .mobile-bar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: rgba(5, 8, 12, .96); border-top: 1px solid var(--line);
  }
  .mobile-bar .btn { min-height: 50px; }
  body { padding-bottom: 76px; }
}

/* Insignia "Powered by Netlify" (plan gratis): Netlify la inyecta como
   <iframe id="nl-badge-frame"> fija en la esquina inferior derecha (~200×64 px)
   y no se puede quitar sin plan pago. Si está presente, corremos nuestros
   botones para que no queden tapados. Sin la insignia, todo queda como antes. */
body:has(#nl-badge-frame) .wa-float { bottom: 92px; }
@media (max-width: 760px) {
  body:has(#nl-badge-frame) .mobile-bar { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  body:has(#nl-badge-frame) { padding-bottom: 136px; }
}

/* 9. Páginas de servicio ================================================== */
.page-hero { padding: clamp(40px, 7vw, 80px) 0 clamp(32px, 5vw, 56px); border-bottom: 1px solid var(--line); }
.breadcrumb { font-size: .9rem; color: var(--muted-2); margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.page-hero .hero-lead { margin-bottom: 26px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-card { padding: 28px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-2); }
.detail-card h2 { font-size: 1.7rem; }
.detail-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; color: var(--muted); }
.detail-card li { display: flex; gap: 10px; }
.detail-card li::before { content: ""; width: 7px; height: 7px; margin-top: .6em; background: var(--red); border-radius: 1px; flex: none; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }

/* 10. Portal de clientes y panel MKS ====================================== */
.portal-body { min-height: 100vh; display: flex; flex-direction: column; }
.portal-header .container { max-width: 1320px; }
.portal-user { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .95rem; }
.portal-user strong { color: var(--text); font-weight: 600; }
.demo-banner { background: rgba(245, 158, 11, .12); border-bottom: 1px solid rgba(245, 158, 11, .4); color: #FDE68A; font-size: .92rem; padding: 10px 0; }
.demo-banner .container { max-width: 1320px; }
.portal-main { flex: 1; padding: 32px 0 56px; }
.portal-main > .container { max-width: 1320px; }
.auth-wrap { max-width: 440px; margin: 6vh auto 0; }
.auth-wrap h1 { font-size: 2.3rem; }
.auth-wrap .form-card { display: grid; gap: 16px; }
.link-btn { background: none; border: 0; padding: 0; color: #F87171; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: #FCA5A5; }

.portal-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 960px) {
  .portal-grid { grid-template-columns: 1fr; }
  .portal-grid.show-detail .equipos-col { display: none; }
  .portal-grid:not(.show-detail) .detail-col { display: none; }
}
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel + .panel { margin-top: 20px; }
.panel h2 { font-size: 1.6rem; margin-bottom: 14px; }
.panel h3 { font-size: 1.25rem; margin-bottom: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
.empty { color: var(--muted-2); padding: 18px; text-align: center; border: 1px dashed var(--line-2); border-radius: 12px; }

.equipo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.equipo-item {
  width: 100%; text-align: left; display: grid; gap: 6px; padding: 16px; border-radius: 12px; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text); font: inherit;
}
.equipo-item:hover { border-color: var(--line-2); }
.equipo-item[aria-current="true"] { border-color: var(--red); }
.equipo-item .row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.equipo-item .code { font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; }
.equipo-item .desc { color: var(--muted); font-size: .95rem; }
.equipo-item .date { color: var(--muted-2); font-size: .85rem; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; border: 1px solid; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--proceso { color: var(--blue); border-color: rgba(96, 165, 250, .4); background: rgba(96, 165, 250, .1); }
.badge--cliente { color: var(--amber); border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .1); }
.badge--listo { color: var(--green); border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .1); }
.badge--fin { color: var(--muted-2); border-color: var(--line-2); background: transparent; }

.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.spec-grid div { padding: 12px 14px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); }
.spec-grid dt { font-size: .78rem; letter-spacing: 1px; text-transform: uppercase; color: var(--muted-2); }
.spec-grid dd { margin: 2px 0 0; font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 14px; padding-bottom: 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .dot { width: 18px; height: 18px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--bg-2); z-index: 1; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 8px; top: 24px; bottom: 0; width: 2px; background: var(--line-2); }
.timeline li.done .dot { background: var(--red); border-color: var(--red); }
.timeline li.done:not(:last-child)::after { background: var(--red); }
.timeline li.current .dot { border-color: var(--red); box-shadow: 0 0 0 5px var(--red-soft); }
.timeline .t-title { font-weight: 600; }
.timeline li:not(.done):not(.current) .t-title { color: var(--muted-2); font-weight: 500; }
.timeline .t-meta { font-size: .88rem; color: var(--muted-2); }
.timeline .t-note { font-size: .94rem; color: var(--muted); margin-top: 4px; }

.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.doc-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); flex-wrap: wrap; }
.doc-list .doc-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.doc-list .doc-name svg { width: 22px; height: 22px; color: var(--red); flex: none; }
.doc-list small { display: block; color: var(--muted-2); font-weight: 400; }

.thread { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; padding: 4px; margin-bottom: 14px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; background: var(--bg-3); border: 1px solid var(--line); }
.msg.mine { margin-left: auto; background: rgba(225, 29, 46, .12); border-color: rgba(225, 29, 46, .35); }
.msg .who { font-size: .8rem; color: var(--muted-2); margin-bottom: 2px; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-form { display: grid; gap: 10px; }
.msg-form textarea { min-height: 80px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 12px 14px; min-height: 48px; font: 600 1rem var(--font-body); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--red); }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: .78rem; display: inline-grid; place-items: center; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar > * { flex: 1 1 200px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: .78rem; letter-spacing: 1px; text-transform: uppercase; color: var(--muted-2); font-weight: 600; background: var(--bg-3); white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover, table.data tbody tr[aria-selected="true"] { background: var(--bg-4); }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--red); }

.admin-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.admin-cols .panel + .panel { margin-top: 20px; }
.admin-cols .panel { margin-top: 0; }
.admin-cols > div > .panel + .panel { margin-top: 20px; }
@media (max-width: 960px) { .admin-cols { grid-template-columns: 1fr; } }
@media (min-width: 961px) { .volver-lista { display: none; } }
.doc-list small { display: block; color: var(--muted-2); font-weight: 400; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translateX(-50%) translateY(20px); opacity: 0;
  padding: 12px 18px; border-radius: 10px; background: var(--bg-4); border: 1px solid var(--line-2); color: var(--text);
  box-shadow: var(--shadow); transition: .25s; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { border-color: rgba(225, 29, 46, .6); }
[hidden] { display: none !important; }
