:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --line: #e2e5ea;
  --brand: #1f5fd6;
  --brand-ink: #ffffff;
  --accent: #f59e0b;
  --danger: #d92d20;
  --ok: #12805c;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #e6e8ec;
    --muted: #98a2b3;
    --line: #2a2f3a;
    --brand: #4d8dff;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --text: #e6e8ec;
  --muted: #98a2b3;
  --line: #2a2f3a;
  --brand: #4d8dff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.num { text-align: right; white-space: nowrap; }

/* ---------- botones y campos ---------- */

.btn, .ghost {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn { background: var(--brand); color: var(--brand-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.ghost { background: transparent; color: var(--brand); border-color: var(--line); }
.ghost.danger { color: var(--danger); }
.ghost:hover, .btn:hover { filter: brightness(1.08); }

input, select, textarea {
  width: 100%; padding: .5rem .6rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
textarea { resize: vertical; }
label span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}

.form-grid {
  display: grid; gap: .9rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

/* ---------- tablas y badges ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--bg); }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: .25rem; padding: .3rem .6rem; font-size: .85rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }

.badge {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; background: var(--line); color: var(--muted);
}
.badge.s-enviada { background: #dbeafe; color: #1e40af; }
.badge.s-aceptada { background: #d1fae5; color: #065f46; }
.badge.s-rechazada, .badge.s-cancelada { background: #fee4e2; color: #912018; }

.page-head {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  justify-content: space-between; margin-bottom: 1rem;
}
.back { font-size: .9rem; text-decoration: none; }
.search { max-width: 360px; margin-bottom: 1rem; }

.cards {
  display: grid; gap: .75rem; margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.stat span { display: block; color: var(--muted); font-size: .85rem; }
.stat b { font-size: 1.35rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.totals { margin: 1rem 0; text-align: right; }
.totals div { margin: .15rem 0; }
.totals .grand { font-size: 1.15rem; font-weight: 700; }

.steps li { margin-bottom: .4rem; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50;
}
.modal {
  background: var(--surface); border-radius: var(--radius); padding: 1.25rem;
  width: min(720px, 100%); max-height: 90vh; overflow: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.modal-head button { background: none; border: 0; font-size: 1.5rem; color: var(--muted); cursor: pointer; }

.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; z-index: 60;
}

/* ---------- panel administrador ---------- */

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 1rem; display: flex; flex-direction: column; gap: .25rem;
}
.sidebar .brand { font-weight: 800; font-size: 1.1rem; margin-bottom: 1rem; color: var(--text); text-decoration: none; }
.nav a {
  display: block; padding: .5rem .75rem; border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--brand); color: var(--brand-ink); }
.sidebar .logout { margin-top: auto; }
.content { padding: 1.5rem; min-width: 0; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .card { width: min(380px, 100%); }
.login .form-grid { grid-template-columns: 1fr; }

.steps-list { list-style: none; padding: 0; margin: 0; }
.quick { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- landing ---------- */

.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; max-width: 1100px; margin: 0 auto;
}
.site-header .brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.hero {
  background: linear-gradient(135deg, #1f5fd6 0%, #0b2f73 100%);
  color: #fff; padding: 4.5rem 1.25rem; text-align: center;
}
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); max-width: 820px; margin: 0 auto .75rem; }
.hero p { font-size: 1.1rem; max-width: 640px; margin: 0 auto 1.75rem; opacity: .92; }
.hero .btn { background: #fff; color: #0b2f73; }
.hero .ghost { color: #fff; border-color: rgba(255, 255, 255, .5); }
.hero .actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

.section { max-width: 1100px; margin: 0 auto; padding: 3rem 1.25rem; }
.section h2 { font-size: 1.6rem; text-align: center; margin-bottom: 1.5rem; }
.features {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.features .card { margin: 0; }
.features .icon { font-size: 1.6rem; }
.audiences { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.audiences .card { margin: 0; }
.flow { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); counter-reset: step; }
.flow div { counter-increment: step; }
.flow div::before {
  content: counter(step); display: inline-grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700;
  margin-bottom: .5rem;
}
.site-footer { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .9rem; }

/* ---------- landing avanzada: WhatsApp, animaciones 3D y bloques ---------- */

.nav-links { display: flex; gap: 1.25rem; }
.nav-links a { color: var(--text); text-decoration: none; font-weight: 600; }
.nav-links a:hover { color: var(--brand); }

.btn-wa, .hero .btn-wa { background: #25d366; color: #fff; }
.wa-float {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 40;
  display: inline-flex; align-items: center; gap: .5rem;
  background: #25d366; color: #fff; font-weight: 700; text-decoration: none;
  padding: .7rem 1.1rem; border-radius: 999px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .25);
  animation: wa-pulse 2.4s infinite;
}
.wa-float svg { width: 22px; height: 22px; fill: currentColor; }
@keyframes wa-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, .55), 0 10px 25px rgba(0, 0, 0, .25); }
  70% { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0), 0 10px 25px rgba(0, 0, 0, .25); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0), 0 10px 25px rgba(0, 0, 0, .25); }
}

.hero-inner {
  max-width: 1100px; margin: 0 auto; display: grid;
  grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: center; text-align: left;
}
.hero-inner h1 { margin: 0 0 .75rem; }
.hero-inner p { margin: 0 0 1.5rem; max-width: none; }
.hero-inner .actions { justify-content: flex-start; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; background: rgba(255, 255, 255, .15);
  padding: .3rem .7rem; border-radius: 999px; margin-bottom: 1rem;
}
.rotor {
  display: inline-block; color: var(--accent);
  transition: opacity .35s ease, transform .35s ease;
}
.rotor.out { opacity: 0; transform: translateY(-10px); }

.marquee { overflow: hidden; background: var(--text); color: var(--bg); padding: .8rem 0; white-space: nowrap; }
.marquee-track { display: inline-block; font-weight: 700; animation: marquee 30s linear infinite; }
.marquee-track span { margin: 0 1.5rem; }
.marquee-track span::after { content: "✦"; margin-left: 3rem; color: var(--accent); }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* escenas 3D */
.scene {
  position: relative; height: 340px; perspective: 900px;
  display: flex; align-items: center; justify-content: center;
}
.washer {
  position: relative; width: 220px; height: 250px; border-radius: 18px;
  background: linear-gradient(145deg, #ffffff, #cfd8e3);
  transform-style: preserve-3d;
  transform: rotateX(6deg) rotateY(-24deg);
  box-shadow: 18px 24px 0 rgba(0, 0, 0, .18);
  animation: sway 6s ease-in-out infinite;
}
.washer .panel {
  position: absolute; top: 18px; left: 18px; right: 18px; height: 18px;
  border-radius: 6px; background: #1f5fd6; opacity: .85;
}
.washer .panel::after {
  content: ""; position: absolute; right: 10px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: #f59e0b; box-shadow: -18px 0 0 #12805c;
}
.washer .door {
  position: absolute; left: 50%; top: 56%; width: 150px; height: 150px;
  margin: -75px 0 0 -75px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #e0f2fe, #0b2f73 80%);
  border: 10px solid #9aa7b8; box-shadow: inset 0 0 20px rgba(0, 0, 0, .4);
}
.washer .drum {
  position: absolute; inset: 8px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .12) 0 18deg, transparent 18deg 36deg);
  animation: spin 1.6s linear infinite;
}
.washer .cloth { position: absolute; width: 26px; height: 20px; border-radius: 6px; }
.washer .c1 { top: 18px; left: 40px; background: #f59e0b; }
.washer .c2 { top: 80px; left: 14px; background: #f04438; }
.washer .c3 { top: 74px; left: 90px; background: #12805c; }
.washer .bubble {
  position: absolute; bottom: -10px; width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, .6); animation: rise 2.6s linear infinite;
}
.washer .b1 { left: 40px; }
.washer .b2 { left: 80px; animation-delay: -1s; }
.washer .b3 { left: 110px; animation-delay: -1.9s; }

.tool {
  position: absolute; font-size: 3.2rem; line-height: 1;
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .3));
  animation: tool-spin 4s ease-in-out infinite;
}
.tool-a { top: 10px; left: 0; }
.tool-b { bottom: 20px; right: 0; animation-delay: -2s; font-size: 2.6rem; }
.tool-c { top: 40%; right: 10px; animation-delay: -1s; font-size: 2.2rem; }

.fridge { perspective: 800px; }
.fridge-body {
  position: relative; width: 180px; height: 240px; border-radius: 14px;
  background: radial-gradient(circle at 30% 20%, #e0f2fe, #7dd3fc);
  transform-style: preserve-3d; transform: rotateY(-18deg);
  box-shadow: 16px 20px 0 rgba(0, 0, 0, .18);
}
.fridge-body::before {
  content: "❄️"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 3rem; opacity: .35; animation: spin 8s linear infinite;
}
.fridge-door {
  position: absolute; inset: 0; border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, #cfd8e3);
  transform-origin: left center; animation: door-open 5s ease-in-out infinite;
}
.fridge-door .handle {
  position: absolute; right: 14px; top: 40px; width: 6px; height: 70px;
  border-radius: 4px; background: #64748b;
}
.fridge-scene { flex-direction: column; gap: 1rem; }
.temp { width: 180px; font-size: .85rem; color: var(--muted); }
.temp-bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: .3rem; }
.temp-bar i {
  display: block; height: 100%; width: 20%;
  background: linear-gradient(90deg, #1f5fd6, #12805c);
  animation: temp-fill 5s ease-in-out infinite;
}

.split-section { max-width: 1100px; }
.split {
  display: grid; gap: 2rem; align-items: center;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.checks { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.checks li { padding-left: 1.75rem; position: relative; margin-bottom: .6rem; }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }

/* tarjetas con profundidad */
.features .card, .flow .card, .audiences .card {
  transition: transform .35s ease, box-shadow .35s ease, opacity .6s ease;
}
.features .card:hover {
  transform: translateY(-6px) rotateX(4deg) rotateY(-4deg);
  box-shadow: 0 18px 30px rgba(0, 0, 0, .12);
}
.features .card:hover .icon { animation: icon-spin .9s ease; display: inline-block; }
@keyframes icon-spin { from { transform: rotateY(0); } to { transform: rotateY(360deg); } }

.contact-card { max-width: 560px; margin: 0 auto; text-align: center; }
.contact-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 1rem 0; }
.chip {
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  padding: .45rem .9rem; border-radius: 999px; font: inherit; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

.footer-admin { margin-top: .5rem; }

@keyframes sway {
  0%, 100% { transform: rotateX(6deg) rotateY(-24deg); }
  50% { transform: rotateX(3deg) rotateY(-12deg); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise {
  from { transform: translateY(0) scale(1); opacity: 0; }
  20% { opacity: 1; }
  to { transform: translateY(-190px) scale(.5); opacity: 0; }
}
@keyframes tool-spin {
  0%, 100% { transform: translateZ(0) rotateY(0) rotate(0); }
  50% { transform: translateZ(60px) rotateY(180deg) rotate(20deg); }
}
@keyframes door-open {
  0%, 15% { transform: rotateY(0); }
  45%, 70% { transform: rotateY(-70deg); }
  100% { transform: rotateY(0); }
}
@keyframes temp-fill {
  0%, 100% { width: 20%; }
  50% { width: 85%; }
}

@media (max-width: 760px) {
  .nav-links { display: none; }
  .site-header .btn-wa { padding: .45rem .8rem; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-inner .actions { justify-content: center; }
  .hero-inner p { margin-left: auto; margin-right: auto; }
  .scene { height: 300px; }
  .wa-float span { display: none; }
  .wa-float { padding: .8rem; }
}

/* ---------- landing dinámica: entradas, fondos vivos y microinteracciones ---------- */

.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 70;
  background: linear-gradient(90deg, #1f5fd6, #f59e0b, #25d366);
  transform-origin: 0 50%; transform: scaleX(0);
}

.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(-45deg, #1f5fd6, #0b2f73, #1d4fbf, #0b2f73);
  background-size: 300% 300%;
  animation: hero-shift 14s ease infinite;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, .18), transparent 65%);
}
@keyframes hero-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.orbs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.orbs i {
  position: absolute; border-radius: 50%; opacity: .45; filter: blur(40px);
  animation: float-orb 12s ease-in-out infinite;
}
.orbs i:nth-child(1) { width: 260px; height: 260px; background: #f59e0b; top: -60px; left: -80px; }
.orbs i:nth-child(2) { width: 220px; height: 220px; background: #25d366; bottom: -60px; right: 8%; animation-delay: -4s; }
.orbs i:nth-child(3) { width: 160px; height: 160px; background: #7dd3fc; top: 30%; left: 45%; animation-delay: -8s; }
@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -40px) scale(1.12); }
}

.spark {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px #fff; opacity: 0; pointer-events: none;
  animation: twinkle 3.5s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.4) translateY(0); }
  50% { opacity: .9; transform: scale(1) translateY(-14px); }
}

.hero-inner { position: relative; z-index: 1; }
.hero-inner > div > * { animation: fade-up .8s ease both; }
.hero-inner > div > *:nth-child(2) { animation-delay: .12s; }
.hero-inner > div > *:nth-child(3) { animation-delay: .24s; }
.hero-inner > div > *:nth-child(4) { animation-delay: .36s; }
.hero-inner > div > *:nth-child(5) { animation-delay: .48s; }
.hero-inner > .scene { animation: fade-up 1s ease .3s both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

.scene::before {
  content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  animation: ring 3s ease-out infinite;
}
@keyframes ring {
  from { transform: scale(.6); opacity: .8; }
  to { transform: scale(1.4); opacity: 0; }
}

.scroll-cue {
  position: absolute; bottom: .5rem; left: 50%; margin-left: -12px; z-index: 1;
  color: #fff; font-size: 1.6rem; line-height: 1; text-decoration: none; opacity: .85;
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

.btn-wa { position: relative; overflow: hidden; transition: transform .2s ease, filter .2s ease; }
.btn-wa::after {
  content: ""; position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
  transition: left .6s ease;
}
.btn-wa:hover::after { left: 120%; }
.btn-big { padding: .8rem 1.5rem; font-size: 1.05rem; }
.bounce { animation: bounce 2s ease-in-out infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.features .card { position: relative; overflow: hidden; }
.features .card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  transition: opacity .3s ease;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(31, 95, 214, .14), transparent 70%);
}
.features .card:hover::after { opacity: 1; }
.card-link { display: inline-block; margin-top: .6rem; color: #12805c; font-weight: 700; text-decoration: none; }
.card-link span { display: inline-block; transition: transform .25s ease; }
.card-link:hover span { transform: translateX(6px); }

.flow div::before { animation: pulse-ring 2.2s ease-out infinite; }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(31, 95, 214, .5); }
  100% { box-shadow: 0 0 0 14px rgba(31, 95, 214, 0); }
}

.checks li {
  opacity: 0; transform: translateX(-20px);
  transition: opacity .5s ease, transform .5s ease;
  transition-delay: calc(var(--i, 0) * .15s + .2s);
}
.checks.in li { opacity: 1; transform: none; }

.contact-card { position: relative; isolation: isolate; overflow: hidden; }
.contact-card::before {
  content: ""; position: absolute; z-index: -1; inset: -60%; opacity: .18;
  background: conic-gradient(from 0deg, #1f5fd6, #f59e0b, #25d366, #1f5fd6);
  animation: spin 8s linear infinite;
}

.cta-band {
  position: relative; overflow: hidden; text-align: center; color: #fff;
  padding: 4rem 1.25rem;
  background: linear-gradient(120deg, #0b2f73, #1f5fd6, #0b2f73);
  background-size: 200% 200%;
  animation: hero-shift 10s ease infinite;
}
.cta-band h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.2rem); margin-bottom: .5rem; }
.cta-band p { opacity: .9; margin: 0 0 1.5rem; }

.wa-float { animation: wa-pulse 2.4s infinite, wa-bob 3s ease-in-out infinite; }
@keyframes wa-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ---------- personajes y escena de reparación (SVG animado, ciclo de 8 s) ---------- */

.section h2::after {
  content: ""; display: block; width: 72px; height: 4px; margin: .6rem auto 0; border-radius: 4px;
  background: linear-gradient(90deg, #1f5fd6, #f59e0b);
}
@supports (animation-timeline: view()) {
  .section h2::after {
    transform-origin: center;
    animation: grow-x linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 35%;
  }
}
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.theater { max-width: 760px; margin: 0 auto; }
.theater-svg { display: block; width: 100%; height: auto; overflow: visible; }

.t-floor { fill: var(--line); }
.t-body { fill: url(#brushed); stroke: #94a3b8; stroke-width: 4; }
.t-panel { fill: #1f5fd6; }
.t-knob { fill: url(#chrome); }
.t-door { fill: url(#glass); stroke: url(#chrome); stroke-width: 10; }
.t-glint { opacity: .5; animation: glint 4s ease-in-out infinite; }
@keyframes glint {
  0%, 100% { opacity: .25; }
  50% { opacity: .85; }
}
.t-eye { fill: #fff; }
.t-mouth { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; }
.t-smoke circle { fill: #94a3b8; }
.t-legs { fill: #1e3a8a; }
.t-overall { fill: #1f5fd6; }
.t-skin { fill: #f1c79a; }
.t-cap { fill: #1f5fd6; }
.t-logo { fill: #f59e0b; font: 800 11px system-ui, sans-serif; }
.t-face { fill: #1d2330; }
.t-smile { fill: none; stroke: #1d2330; stroke-width: 2.5; stroke-linecap: round; }
.t-bubble { fill: #fff; stroke: #cbd5e1; stroke-width: 2; }
.t-say-text { fill: #1d2330; font: 700 15px system-ui, sans-serif; }
.t-wrench { font-size: 40px; transform-box: fill-box; transform-origin: 50% 80%; animation: tap 8s ease-in-out infinite; }

.t-washer {
  transform-box: fill-box; transform-origin: center bottom;
  animation: wash 8s ease-in-out infinite;
}
.t-sad { animation: show-before 8s linear infinite; }
.t-happy, .t-check { animation: show-after 8s linear infinite; }
.t-smoke circle {
  transform-box: fill-box; transform-origin: center;
  opacity: 0; animation: smoke 8s ease-out infinite;
}
.t-sparks circle {
  transform-box: fill-box; transform-origin: center;
  fill: #f59e0b; opacity: 0; animation: spark 8s ease-out infinite;
}
.t-confetti {
  transform-box: fill-box; transform-origin: center;
  opacity: 0; animation: confetti 8s ease-out infinite;
}
.t-tech { animation: tech-walk 8s ease-in-out infinite; }
.t-say { animation: say 8s linear infinite; }

@keyframes wash {
  0%, 21%, 100% { transform: translate(0, 0); }
  3%, 9%, 15% { transform: translate(-4px, 0); }
  6%, 12%, 18% { transform: translate(4px, 0); }
  61% { transform: scale(1); }
  65% { transform: scale(1.06); }
  70% { transform: scale(1); }
}
@keyframes show-before {
  0%, 58% { opacity: 1; }
  59%, 100% { opacity: 0; }
}
@keyframes show-after {
  0%, 59% { opacity: 0; }
  61%, 94% { opacity: 1; }
  95%, 100% { opacity: 0; }
}
@keyframes smoke {
  0% { opacity: 0; transform: translateY(0) scale(.6); }
  4% { opacity: .8; }
  22% { opacity: .6; transform: translateY(-50px) scale(1.4); }
  26%, 100% { opacity: 0; transform: translateY(-70px) scale(1.6); }
}
@keyframes tech-walk {
  0%, 25% { transform: translate(900px, 0); }
  38%, 60% { transform: translate(530px, 0); }
  72%, 100% { transform: translate(900px, 0); }
}
@keyframes tap {
  0%, 36%, 60%, 100% { transform: rotate(0deg); }
  40%, 48%, 56% { transform: rotate(-30deg); }
  44%, 52% { transform: rotate(15deg); }
}
@keyframes spark {
  0%, 38% { opacity: 0; transform: scale(.2); }
  42% { opacity: 1; transform: scale(1.4); }
  50% { opacity: .6; transform: scale(.8); }
  56%, 100% { opacity: 0; transform: scale(.2); }
}
@keyframes confetti {
  0%, 60% { opacity: 0; transform: translate(0, 0) scale(0) rotate(0deg); }
  64% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
  80% { opacity: 1; transform: translate(var(--dx), var(--dy)) scale(1) rotate(260deg); }
  92%, 100% { opacity: 0; transform: translate(calc(var(--dx) * 1.2), calc(var(--dy) + 60px)) scale(1) rotate(400deg); }
}
@keyframes say {
  0%, 36% { opacity: 0; }
  40%, 60% { opacity: 1; }
  63%, 100% { opacity: 0; }
}

.cast { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cast .card { margin: 0; text-align: center; }
.cast-card svg {
  display: block; width: 120px; height: 120px; margin: 0 auto .5rem;
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.cast-card:hover svg { transform: translateY(-8px) rotate(-4deg); }
.arm-wave {
  transform-box: fill-box; transform-origin: top center;
  animation: wave 2.4s ease-in-out infinite;
}
@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-28deg); }
}
.wrench-face {
  transform-box: fill-box; transform-origin: center;
  animation: wiggle 3s ease-in-out infinite;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
}
.gear-teeth {
  transform-box: fill-box; transform-origin: center;
  animation: spin 10s linear infinite;
}
.blink {
  transform-box: fill-box; transform-origin: center;
  animation: blink 4s infinite;
}
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.1); }
}

/* ---------- intro, interacciones y escena ligada al scroll ---------- */

.intro {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  background: var(--bg); color: var(--text);
  animation: intro-out .7s ease 1s forwards;
}
.intro svg { width: 110px; height: 110px; animation: spin 1.2s linear infinite; }
.intro p {
  margin: 0; font-weight: 800; font-size: 1.2rem; text-transform: uppercase;
  animation: letters 1.2s ease both;
}
@keyframes intro-out { to { opacity: 0; visibility: hidden; } }
@keyframes letters {
  from { opacity: 0; letter-spacing: .4em; }
  to { opacity: 1; letter-spacing: .08em; }
}

.hero-inner > .scene { animation: fade-up 1s ease .3s backwards; }
.hero .scene { transition: transform .4s ease; }
.washer { cursor: pointer; }
.washer .drum.turbo { animation-duration: .45s; }

.trail {
  position: absolute; width: 10px; height: 10px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0%, #f59e0b 60%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: trail .8s ease-out forwards;
}
@keyframes trail {
  0% { opacity: .9; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(.2); }
}

.marquee:hover .marquee-track { animation-play-state: paused; }

@supports (animation-timeline: view()) {
  /* La reparación avanza al hacer scroll por la sección, en vez de ir en bucle. */
  .theater { view-timeline: --theater block; }
  .theater-svg *, .theater-svg *::before {
    animation-timeline: --theater !important;
    animation-range: cover 0% cover 100% !important;
  }
}

/* ---------- metales, vidrio y circuitos ---------- */

.tool { width: 72px; height: 72px; display: block; }
.tool-b { width: 60px; height: 60px; }
.tool-c { width: 56px; height: 56px; }

.washer {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .12) 0 1px, transparent 1px 4px),
    linear-gradient(120deg, #f8fafc 0%, #cbd5e1 28%, #94a3b8 48%, #e2e8f0 70%, #94a3b8 100%);
  box-shadow: 18px 24px 0 rgba(0, 0, 0, .18), inset 0 0 0 2px rgba(255, 255, 255, .5);
}
.washer .panel { background: linear-gradient(180deg, #334155, #0f172a); opacity: 1; }
.washer .door {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .75) 0 7%, transparent 16%),
    radial-gradient(circle at 35% 30%, #bae6fd, #0c4a6e 65%, #082f49);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, .45), 0 0 0 6px #cbd5e1, 0 0 0 8px #64748b;
}
.fridge-door {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .08) 0 1px, transparent 1px 3px),
    linear-gradient(100deg, #e2e8f0 0%, #94a3b8 30%, #f8fafc 50%, #94a3b8 72%, #cbd5e1 100%);
}
.fridge-door .handle { background: linear-gradient(90deg, #64748b, #f8fafc, #64748b); }

.circuit-band {
  position: relative; overflow: hidden; min-height: 420px;
  display: flex; align-items: center; justify-content: center;
  padding: 5rem 1.25rem; text-align: center;
  background: radial-gradient(ellipse at center, #13604a 0%, #0b3d2e 70%);
}
.pcb { position: absolute; inset: 0; width: 100%; height: 100%; }
.traces path {
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: draw 2.4s ease-out forwards;
}
.traces path:nth-child(2) { animation-delay: .2s; }
.traces path:nth-child(3) { animation-delay: .4s; }
.traces path:nth-child(4) { animation-delay: .6s; }
.traces path:nth-child(5) { animation-delay: .8s; }
.traces path:nth-child(6) { animation-delay: 1s; }
.traces path:nth-child(7) { animation-delay: 1.2s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.flow-path {
  stroke-dasharray: 6 94;
  animation: flow 2.4s linear infinite;
}
.current path:nth-child(2) { animation-delay: -.6s; }
.current path:nth-child(3) { animation-delay: -1.2s; }
.current path:nth-child(4) { animation-delay: -1.8s; }
.current path:nth-child(5) { animation-delay: -.3s; }
.current path:nth-child(6) { animation-delay: -1.5s; }
.current path:nth-child(7) { animation-delay: -.9s; }
@keyframes flow { to { stroke-dashoffset: -100; } }
.pad {
  fill: #fbbf24; stroke: #92400e; stroke-width: 2;
  animation: pad-glow 2.4s ease-in-out infinite;
}
@keyframes pad-glow {
  0%, 100% { filter: none; }
  50% { filter: drop-shadow(0 0 6px #fbbf24); }
}
.led { animation: led-blink 1.6s steps(2, jump-none) infinite; }
.led-2 { animation-delay: -.5s; }
.led-3 { animation-delay: -1s; }
@keyframes led-blink {
  0%, 100% { opacity: 1; filter: drop-shadow(0 0 6px currentColor); }
  50% { opacity: .15; filter: none; }
}
.circuit-copy {
  position: relative; z-index: 1; max-width: 560px; padding: 1.5rem;
  background: rgba(6, 30, 22, .72); border: 1px solid rgba(125, 211, 252, .25);
  border-radius: var(--radius); backdrop-filter: blur(4px);
}
.circuit-copy h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.circuit-copy p { color: #bfe9d6; }

@media (prefers-reduced-motion: reduce) {
  .traces path { stroke-dasharray: none; stroke-dashoffset: 0; }
  .flow-path { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .t-tech, .t-happy, .intro, .trail { display: none; }
}

/* ---------- cotización pública ---------- */

.quote { max-width: 860px; margin: 1.5rem auto; padding: 0 1rem; }
.quote-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.quote-head .biz { font-size: 1.2rem; font-weight: 800; }
.quote-footer { color: var(--muted); font-size: .9rem; margin-top: 1.5rem; white-space: pre-line; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: .6rem; }
  .sidebar .brand { margin: 0 .5rem 0 0; }
  .nav { display: flex; gap: .25rem; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  .sidebar .logout { margin: 0 0 0 auto; }
  .content { padding: 1rem; }
}

@media print {
  body { background: #fff; color: #000; }
  .no-print { display: none !important; }
  .card { border: 0; }
  .quote { margin: 0; }
}
