/**
 * TECSA E-MAIL V7.0 · Motion System narrativo
 * Envío, recepción, sincronización y SweetAlert2 corporativo.
 */
:root{
  --motion-green:#0B4D3A;
  --motion-green-dark:#031b13;
  --motion-green-mid:#168461;
  --motion-mint:#45d4a3;
  --motion-gold:#F2C200;
  --motion-red:#f06464;
  --motion-panel:rgba(7,31,23,.94);
  --motion-line:rgba(145,233,199,.22);
  --motion-text:#f4fff9;
  --motion-muted:#a7c8bc;
}

/* Oculta el loader manual antiguo; permanece en DOM para compatibilidad con recarga. */
.cv-refresh-overlay{display:none!important}

/* Evita duplicar toasts antiguos: el runtime los convierte a SweetAlert2. */
.cv-toast.tecsa-toast-captured,
.toast.tecsa-toast-captured,
.toast-v11.tecsa-toast-captured,
.toast12.tecsa-toast-captured,
.cv-autosync-toast.tecsa-toast-captured{display:none!important}

/* Overlay narrativo principal */
.tecsa-motion-overlay{
  position:fixed;
  z-index:2147483642;
  inset:0;
  display:grid;
  place-items:center;
  padding:max(18px,env(safe-area-inset-top))
          max(16px,env(safe-area-inset-right))
          max(18px,env(safe-area-inset-bottom))
          max(16px,env(safe-area-inset-left));
  background:
    radial-gradient(circle at 12% 6%,rgba(69,212,163,.20),transparent 34rem),
    radial-gradient(circle at 88% 92%,rgba(242,194,0,.08),transparent 27rem),
    rgba(2,14,10,.86);
  color:var(--motion-text);
  font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:opacity .25s ease,visibility .25s ease;
}
.tecsa-motion-overlay.is-visible{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}
.tecsa-motion-card{
  position:relative;
  width:min(820px,100%);
  overflow:hidden;
  border:1px solid var(--motion-line);
  border-radius:30px;
  background:
    linear-gradient(145deg,rgba(8,38,28,.97),rgba(3,24,17,.97));
  box-shadow:0 42px 130px rgba(0,0,0,.60);
}
.tecsa-motion-head{
  display:flex;
  align-items:center;
  gap:13px;
  padding:22px 25px 0;
}
.tecsa-motion-head img{
  width:47px;
  height:47px;
  filter:drop-shadow(0 8px 14px rgba(0,0,0,.25));
}
.tecsa-motion-head strong,
.tecsa-motion-head small{display:block}
.tecsa-motion-head strong{
  font-family:Georgia,"Times New Roman",serif;
  font-size:20px;
  letter-spacing:.10em;
}
.tecsa-motion-head small{
  margin-top:3px;
  color:var(--motion-muted);
  font-size:10px;
}
.tecsa-motion-scene{
  position:relative;
  height:310px;
  overflow:hidden;
  isolation:isolate;
}
.tecsa-motion-sky{
  position:absolute;
  inset:0 0 78px;
  background:
    radial-gradient(circle at 82% 35%,rgba(69,212,163,.11),transparent 11rem),
    linear-gradient(180deg,rgba(255,255,255,.015),transparent);
}
.tecsa-motion-road{
  position:absolute;
  left:-8%;
  right:-8%;
  bottom:25px;
  height:76px;
  border-top:4px solid #69776f;
  border-bottom:5px solid #030604;
  background:linear-gradient(#29332e,#121915);
  transform:perspective(500px) rotateX(5deg);
}
.tecsa-motion-road:after{
  content:"";
  position:absolute;
  left:-55%;
  right:-20%;
  top:32px;
  height:6px;
  background:repeating-linear-gradient(
    90deg,
    transparent 0 56px,
    #f8f1c8 56px 122px
  );
  animation:tecsa-motion-road 1s linear infinite;
}
.tecsa-motion-truck{
  position:absolute;
  z-index:5;
  left:50%;
  bottom:49px;
  width:min(440px,72vw);
  transform:translateX(-50%);
  filter:drop-shadow(0 20px 17px rgba(0,0,0,.42));
  transition:transform .8s cubic-bezier(.3,.7,.2,1),opacity .25s ease;
}
.tecsa-motion-overlay[data-stage="prepare"] .tecsa-motion-truck{
  transform:translateX(-108%);
}
.tecsa-motion-overlay[data-stage="load"] .tecsa-motion-truck{
  transform:translateX(-50%);
}
.tecsa-motion-overlay[data-stage="transport"] .tecsa-motion-truck{
  animation:tecsa-motion-truck-trip 2.15s cubic-bezier(.45,.02,.55,.98) both;
}
.tecsa-motion-overlay[data-stage="delivered"] .tecsa-motion-truck{
  transform:translateX(65%);
}
.tecsa-motion-overlay[data-stage="error"] .tecsa-motion-truck{
  transform:translateX(-50%) rotate(-1deg);
  filter:grayscale(.25) drop-shadow(0 20px 17px rgba(0,0,0,.42));
}
.tecsa-motion-envelope{
  position:absolute;
  z-index:7;
  left:17%;
  bottom:142px;
  width:80px;
  height:58px;
  border:4px solid var(--motion-green-mid);
  border-radius:10px;
  background:#f9fffc;
  box-shadow:0 15px 28px rgba(0,0,0,.24);
  opacity:0;
  transform:translateY(14px) scale(.78);
}
.tecsa-motion-envelope:before,
.tecsa-motion-envelope:after{
  content:"";
  position:absolute;
  top:6px;
  width:43px;
  height:4px;
  background:var(--motion-green-mid);
  transform-origin:left center;
}
.tecsa-motion-envelope:before{
  left:5px;
  transform:rotate(34deg);
}
.tecsa-motion-envelope:after{
  right:5px;
  transform-origin:right center;
  transform:rotate(-34deg);
}
.tecsa-motion-overlay[data-kind="send"][data-stage="prepare"] .tecsa-motion-envelope,
.tecsa-motion-overlay[data-kind="send"][data-stage="load"] .tecsa-motion-envelope{
  opacity:1;
}
.tecsa-motion-overlay[data-kind="send"][data-stage="load"] .tecsa-motion-envelope{
  animation:tecsa-envelope-load 1.15s ease-in both;
}
.tecsa-motion-mail-stack{
  position:absolute;
  z-index:4;
  left:13%;
  bottom:126px;
  width:105px;
  height:72px;
  opacity:0;
  transform:translateY(15px);
}
.tecsa-motion-mail-stack i{
  position:absolute;
  width:72px;
  height:50px;
  border:3px solid var(--motion-green-mid);
  border-radius:9px;
  background:#f8fffb;
  box-shadow:0 9px 18px rgba(0,0,0,.16);
}
.tecsa-motion-mail-stack i:nth-child(1){left:0;top:19px;transform:rotate(-8deg)}
.tecsa-motion-mail-stack i:nth-child(2){left:17px;top:9px;transform:rotate(3deg)}
.tecsa-motion-mail-stack i:nth-child(3){left:32px;top:0;transform:rotate(9deg)}
.tecsa-motion-overlay[data-kind="sync"] .tecsa-motion-mail-stack{
  opacity:1;
}
.tecsa-motion-overlay[data-kind="sync"][data-stage="load"] .tecsa-motion-mail-stack{
  animation:tecsa-mail-load 1.1s ease-in both;
}
.tecsa-motion-company{
  position:absolute;
  z-index:3;
  right:8%;
  bottom:98px;
  width:130px;
  height:112px;
  border:4px solid rgba(145,233,199,.32);
  border-radius:18px 18px 8px 8px;
  background:
    linear-gradient(180deg,rgba(11,77,58,.86),rgba(3,27,19,.94));
  box-shadow:0 20px 42px rgba(0,0,0,.28);
}
.tecsa-motion-company:before{
  content:"TECSA";
  position:absolute;
  left:50%;
  top:13px;
  transform:translateX(-50%);
  color:#fff;
  font:800 17px/1 Georgia,serif;
  letter-spacing:.12em;
}
.tecsa-motion-company:after{
  content:"";
  position:absolute;
  left:43px;
  bottom:-1px;
  width:43px;
  height:56px;
  border:3px solid rgba(145,233,199,.35);
  border-bottom:0;
  border-radius:8px 8px 0 0;
  background:rgba(2,18,13,.55);
}
.tecsa-motion-company-window{
  position:absolute;
  left:14px;
  right:14px;
  top:45px;
  height:19px;
  background:repeating-linear-gradient(
    90deg,
    rgba(242,194,0,.78) 0 18px,
    transparent 18px 28px
  );
  opacity:.60;
}
.tecsa-motion-copy{
  padding:0 28px 27px;
  text-align:center;
}
.tecsa-motion-copy h2{
  margin:0;
  font-size:clamp(20px,4vw,28px);
  letter-spacing:-.02em;
}
.tecsa-motion-copy p{
  min-height:20px;
  margin:8px 0 17px;
  color:var(--motion-muted);
  font-size:12px;
}
.tecsa-motion-progress{
  position:relative;
  height:7px;
  overflow:hidden;
  border-radius:999px;
  background:rgba(255,255,255,.07);
}
.tecsa-motion-progress span{
  display:block;
  height:100%;
  width:18%;
  border-radius:inherit;
  background:linear-gradient(
    90deg,
    var(--motion-green-mid),
    var(--motion-mint),
    var(--motion-gold)
  );
  box-shadow:0 0 20px rgba(69,212,163,.34);
  transition:width .55s ease;
}
.tecsa-motion-overlay[data-stage="prepare"] .tecsa-motion-progress span{width:16%}
.tecsa-motion-overlay[data-stage="load"] .tecsa-motion-progress span{width:39%}
.tecsa-motion-overlay[data-stage="transport"] .tecsa-motion-progress span{width:76%}
.tecsa-motion-overlay[data-stage="delivered"] .tecsa-motion-progress span{width:100%}
.tecsa-motion-overlay[data-stage="error"] .tecsa-motion-progress span{
  width:100%;
  background:var(--motion-red);
}
.tecsa-motion-stage-list{
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
  margin-top:15px;
}
.tecsa-motion-stage-list span{
  padding:6px 9px;
  border:1px solid rgba(145,233,199,.11);
  border-radius:999px;
  color:#799c8e;
  background:rgba(255,255,255,.025);
  font-size:8px;
  font-weight:850;
}
.tecsa-motion-stage-list span.active{
  color:var(--motion-mint);
  border-color:rgba(69,212,163,.26);
  background:rgba(69,212,163,.08);
}
.tecsa-motion-stage-list span.complete{
  color:#a9d7c5;
  border-color:rgba(69,212,163,.16);
}

/* Sincronización automática discreta */
.tecsa-sync-mini{
  position:fixed;
  z-index:2147483639;
  right:max(16px,env(safe-area-inset-right));
  bottom:max(18px,calc(env(safe-area-inset-bottom) + 10px));
  width:min(340px,calc(100vw - 32px));
  display:grid;
  grid-template-columns:62px 1fr 22px;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--motion-line);
  border-radius:16px;
  background:rgba(6,35,25,.94);
  color:var(--motion-text);
  box-shadow:0 24px 70px rgba(0,0,0,.40);
  backdrop-filter:blur(17px);
  -webkit-backdrop-filter:blur(17px);
  transform:translateY(130%);
  opacity:0;
  transition:transform .3s ease,opacity .3s ease;
}
.tecsa-sync-mini.is-visible{transform:none;opacity:1}
.tecsa-sync-mini img{
  width:62px;
  animation:tecsa-mini-truck 1.45s ease-in-out infinite;
}
.tecsa-sync-mini strong,
.tecsa-sync-mini small{display:block}
.tecsa-sync-mini strong{font-size:10px}
.tecsa-sync-mini small{margin-top:3px;color:var(--motion-muted);font-size:8px}
.tecsa-sync-mini i{
  width:10px;
  height:10px;
  border-radius:50%;
  background:var(--motion-mint);
  box-shadow:0 0 0 5px rgba(69,212,163,.08);
}

/* SweetAlert2 TECSA */
.swal2-container{font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif!important}
.swal2-popup.tecsa-swal-popup{
  border:1px solid var(--motion-line)!important;
  border-radius:25px!important;
  background:
    radial-gradient(circle at 90% 0,rgba(69,212,163,.08),transparent 14rem),
    #09271e!important;
  color:var(--motion-text)!important;
  box-shadow:0 40px 120px rgba(0,0,0,.58)!important;
}
.swal2-popup.tecsa-swal-popup .swal2-title{
  color:var(--motion-text)!important;
  font-size:21px!important;
}
.swal2-popup.tecsa-swal-popup .swal2-html-container{
  color:var(--motion-muted)!important;
  font-size:12px!important;
  line-height:1.6!important;
}
.swal2-popup.tecsa-swal-popup .swal2-confirm{
  border-radius:12px!important;
  background:linear-gradient(135deg,var(--motion-green-mid),var(--motion-green))!important;
  box-shadow:0 10px 26px rgba(11,77,58,.30)!important;
  font-weight:850!important;
}
.swal2-popup.tecsa-swal-popup .swal2-cancel{
  border:1px solid var(--motion-line)!important;
  border-radius:12px!important;
  background:#132d22!important;
  color:var(--motion-text)!important;
  font-weight:800!important;
}
.swal2-popup.tecsa-swal-toast{
  border:1px solid rgba(69,212,163,.22)!important;
  border-radius:16px!important;
  background:rgba(6,35,25,.97)!important;
  color:var(--motion-text)!important;
  box-shadow:0 25px 70px rgba(0,0,0,.48)!important;
}
.swal2-popup.tecsa-swal-toast .swal2-title{
  color:var(--motion-text)!important;
  font-size:12px!important;
}
.swal2-popup.tecsa-swal-toast .swal2-html-container{
  color:var(--motion-muted)!important;
  font-size:9px!important;
}

@keyframes tecsa-motion-road{to{transform:translateX(-178px)}}
@keyframes tecsa-motion-truck-trip{
  0%{transform:translateX(-50%) translateY(0)}
  12%{transform:translateX(-50%) translateY(-3px)}
  88%{transform:translateX(55%) translateY(0)}
  100%{transform:translateX(65%)}
}
@keyframes tecsa-envelope-load{
  0%{opacity:1;transform:translate(0,0) scale(1)}
  65%{opacity:1;transform:translate(265px,62px) scale(.62)}
  100%{opacity:0;transform:translate(300px,86px) scale(.25)}
}
@keyframes tecsa-mail-load{
  0%{opacity:1;transform:translate(0,0) scale(1)}
  70%{opacity:1;transform:translate(255px,69px) scale(.66)}
  100%{opacity:0;transform:translate(290px,91px) scale(.28)}
}
@keyframes tecsa-mini-truck{
  0%,100%{transform:translateX(-4px)}
  50%{transform:translateX(8px) translateY(-1px)}
}

@media(max-width:620px){
  .tecsa-motion-card{border-radius:23px}
  .tecsa-motion-head{padding:18px 18px 0}
  .tecsa-motion-scene{height:260px}
  .tecsa-motion-truck{width:min(390px,96vw);bottom:46px}
  .tecsa-motion-road{bottom:22px}
  .tecsa-motion-company{right:3%;transform:scale(.80);transform-origin:right bottom}
  .tecsa-motion-envelope,.tecsa-motion-mail-stack{left:4%}
  .tecsa-motion-copy{padding:0 18px 22px}
}
@media(prefers-reduced-motion:reduce){
  .tecsa-motion-road:after,
  .tecsa-motion-truck,
  .tecsa-motion-envelope,
  .tecsa-motion-mail-stack,
  .tecsa-sync-mini img{
    animation:none!important;
  }
}