:root {
  --navy: #0A2F5C;
  --ruta: #0F3F82;
  --cielo: #2A9FDA;
  --rojo: #E8554E;
  --rojo-suave: #FDE7E5;
  --hielo: #F1F6FB;
  --blanco: #FFFFFF;
  --linea: #D5E1EC;
  --texto: #15293F;
  --gris: #5B6F85;
  --verde: #17784E;
  --verde-suave: #E3F4EB;
  --ambar: #9A5B0B;
  --ambar-suave: #FCF0DC;
  --radio: 10px;
  --fuente: "Archivo", Arial, Helvetica, sans-serif;
  /* Curvas de movimiento estilo iOS */
  --suave: cubic-bezier(.22, 1, .36, 1);      /* desaceleración larga */
  --hoja: cubic-bezier(.32, .72, 0, 1);       /* hojas que suben (iOS) */
  --resorte: cubic-bezier(.34, 1.45, .64, 1); /* rebote corto */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--fuente);
  font-size: 16px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--hielo);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ruta); }
:focus-visible { outline: 2px solid var(--cielo); outline-offset: 2px; }

.cargando {
  padding: 32vh 0 0; text-align: center; color: var(--gris); font-size: 14px;
  animation: aparecer .3s .25s both;
}
.cargando::before {
  content: ""; display: block; width: 26px; height: 26px; margin: 0 auto 12px; border-radius: 50%;
  border: 2.5px solid rgba(15,63,130,.15); border-top-color: var(--ruta);
  animation: girar .8s linear infinite;
}

/* ---------- Estructura ---------- */
.marco { min-height: 100%; padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
.barra {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(255,255,255,.78); border-bottom: 1px solid rgba(213,225,236,.7);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.barra img { height: 36px; }
.barra .quien { margin-left: auto; font-size: 13px; color: var(--gris); text-align: right; line-height: 1.25; }
.contenido { max-width: 880px; margin: 0 auto; padding: 18px 16px 32px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: rgba(10,47,92,.9);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; color: #B9CDE3; text-decoration: none; font-size: 12px;
  transition: color .3s var(--suave);
  -webkit-tap-highlight-color: transparent;
}
.nav a svg { width: 22px; height: 22px; transition: transform .45s var(--resorte); }
.nav a:active svg { transform: scale(.82); transition-duration: .1s; }
.nav a.activo { color: var(--blanco); }
.nav a.activo svg { transform: translateY(-1px); }
.nav-ind {
  position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; opacity: 0;
  background: var(--cielo); border-radius: 0 0 3px 3px;
  transition: transform .55s var(--hoja), width .55s var(--hoja), height .55s var(--hoja), opacity .2s;
}
.marco:not(.listo) .nav-ind { transition: none; }

@media (min-width: 900px) {
  .marco { padding-bottom: 0; padding-left: 220px; }
  .nav {
    top: 0; right: auto; width: 220px; flex-direction: column;
    padding: 84px 12px 20px; gap: 4px; background: var(--navy);
  }
  .nav a { flex: none; flex-direction: row; gap: 12px; padding: 11px 14px; font-size: 15px; border-radius: 8px; }
  .nav-ind { background: var(--ruta); border-radius: 8px; box-shadow: inset 3px 0 0 var(--cielo); }
  .barra { padding-left: 24px; }
  .contenido { padding: 28px 32px 48px; }
}

/* ---------- Tipografía ---------- */
h1 { font-size: 26px; line-height: 1.15; margin: 0 0 4px; color: var(--navy); font-weight: 750; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 12px; color: var(--navy); font-weight: 700; }
.sub { color: var(--gris); margin: 0 0 18px; font-size: 15px; }
.chico { font-size: 13px; color: var(--gris); }

/* Placa del número: el sello de la marca, como la marca de un contenedor */
.placa {
  display: inline-flex; align-items: stretch; border-radius: 6px; overflow: hidden;
  font-stretch: 72%; font-weight: 800; letter-spacing: 0.03em; line-height: 1;
}
.placa .cod { background: var(--navy); color: var(--blanco); padding: 7px 10px; font-size: 17px; }
.placa .ver { background: var(--cielo); color: var(--blanco); padding: 7px 8px; font-size: 17px; }
.placa.gris .cod { background: #8193A8; }
.placa.grande .cod, .placa.grande .ver { font-size: 24px; padding: 9px 12px; }

/* ---------- Tarjetas y formularios ---------- */
.bloque {
  background: var(--blanco); border: 1px solid var(--linea); border-radius: 14px;
  padding: 18px 16px; margin-bottom: 14px;
}
.fila { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.fila.tres { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 520px) { .fila.tres { grid-template-columns: minmax(0,1fr) minmax(0,1fr); } }

label.campo { display: block; margin-bottom: 12px; }
label.campo > span { display: block; font-size: 13px; color: var(--gris); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--linea); border-radius: var(--radio); background: var(--blanco);
}
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cielo); box-shadow: 0 0 0 3px rgba(42,159,218,.18); }
input[readonly] { background: var(--hielo); color: var(--gris); }
.obligatorio::after { content: " *"; color: var(--rojo); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--linea); background: var(--blanco); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; font-size: 14px; min-height: 40px;
}
.chip.si { background: var(--navy); border-color: var(--navy); color: var(--blanco); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: var(--radio);
  border: 1px solid var(--linea); background: var(--blanco); color: var(--navy);
  font-weight: 650; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--cielo); }
.btn.principal { background: var(--ruta); border-color: var(--ruta); color: var(--blanco); }
.btn.principal:hover { background: var(--navy); }
.btn.peligro { color: var(--rojo); }
.btn.texto { border: none; background: none; padding: 8px 4px; min-height: 36px; color: var(--ruta); }
.btn[disabled] { opacity: .6; cursor: wait; }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; }
.acciones.fijas {
  position: sticky; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 4;
  background: var(--hielo); padding: 12px 0 14px; margin-top: 8px;
}
@media (min-width: 900px) { .acciones.fijas { bottom: 0; } }
.acciones.fijas .btn { flex: 1; }

/* ---------- Conceptos ---------- */
.concepto {
  border: 1px solid var(--linea); border-radius: 12px; padding: 12px; margin-bottom: 10px;
  background: var(--blanco);
}
.concepto.cond { border-style: dashed; background: #FBFDFF; }
.concepto .top { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.concepto .top input { flex: 1; }
.concepto .num { display: grid; grid-template-columns: 0.8fr 1.2fr 1fr 1fr; gap: 8px; }
@media (max-width: 520px) { .concepto .num { grid-template-columns: minmax(0,1fr) minmax(0,1fr); } }
.concepto .num label span { font-size: 12px; color: var(--gris); display: block; margin-bottom: 2px; }
.concepto .pie { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 14px; }
.interruptor { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.interruptor input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; cursor: pointer;
  width: 46px; height: 28px; min-height: 28px; padding: 0; margin: 0; border: none; border-radius: 28px;
  background: #DCE3EC; transition: background .3s var(--suave);
}
.interruptor input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(10,47,92,.18), 0 1px 1px rgba(10,47,92,.14);
  transition: transform .42s var(--resorte), width .2s var(--suave);
}
.interruptor input[type="checkbox"]:active::after { width: 30px; }
.interruptor input[type="checkbox"]:checked { background: var(--cielo); }
.interruptor input[type="checkbox"]:checked::after { transform: translateX(18px); }
.interruptor input[type="checkbox"]:checked:active::after { transform: translateX(12px); }
.interruptor input[type="checkbox"]:focus-visible { outline: 2px solid var(--cielo); outline-offset: 2px; box-shadow: none; }
.icono-btn {
  width: 40px; height: 40px; min-height: 40px; flex: none; border-radius: 8px;
  border: 1px solid var(--linea); background: var(--blanco); color: var(--gris); cursor: pointer;
}

.totales .linea { display: flex; justify-content: space-between; padding: 6px 0; }
.totales .linea.total { border-top: 2px solid var(--navy); margin-top: 6px; padding-top: 10px; font-size: 20px; font-weight: 750; color: var(--navy); }
.interno {
  background: var(--navy); color: var(--blanco); border-radius: 14px; padding: 16px; margin-bottom: 14px;
}
.interno .chico { color: #B9CDE3; }
.interno .linea { display: flex; justify-content: space-between; padding: 4px 0; }
.interno .utilidad { font-size: 22px; font-weight: 750; }
.interno .utilidad.mala { color: #FFB3AE; }
.interno .utilidad.buena { color: #9EE0BE; }

/* ---------- Listas ---------- */
.buscador { display: flex; gap: 10px; margin-bottom: 12px; }
.tarjeta {
  display: block; background: var(--blanco); border: 1px solid var(--linea); border-radius: 14px;
  padding: 14px; margin-bottom: 10px; color: inherit; text-decoration: none;
}
.tarjeta:hover { border-color: var(--cielo); }
.tarjeta .arriba { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.tarjeta .cliente { font-weight: 650; }
.tarjeta .ruta { color: var(--gris); font-size: 14px; }
.tarjeta .abajo { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.tarjeta .monto { font-weight: 750; color: var(--navy); font-size: 17px; }

.estado { font-size: 12px; font-weight: 650; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.e-Borrador { background: #E8EEF5; color: var(--gris); }
.e-Enviada { background: #E1F1FB; color: var(--ruta); }
.e-Aprobada { background: var(--verde-suave); color: var(--verde); }
.e-Rechazada, .e-Anulada { background: var(--rojo-suave); color: #B23A34; }
.e-Sin { background: var(--ambar-suave); color: var(--ambar); }
.alerta { font-size: 12px; font-weight: 650; color: var(--ambar); background: var(--ambar-suave); padding: 3px 8px; border-radius: 6px; }

.vacio { text-align: center; padding: 40px 16px; color: var(--gris); }
.vacio h2 { color: var(--navy); }

.aviso-caja { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.aviso-caja.info { background: #E1F1FB; color: var(--ruta); }
.aviso-caja.error { background: var(--rojo-suave); color: #B23A34; }

#aviso {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translate(-50%, 24px) scale(.9);
  background: rgba(10,47,92,.92); color: var(--blanco); padding: 11px 20px; border-radius: 999px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(10,47,92,.25);
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; z-index: 60;
  max-width: calc(100vw - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform .35s var(--suave), opacity .25s;
}
#aviso.ver { opacity: 1; transform: translate(-50%, 0) scale(1); transition: transform .6s var(--resorte), opacity .2s; }
#aviso.error { background: rgba(178,58,52,.95); }

/* ---------- Ingreso ---------- */
.clave { position: relative; }
.clave input { padding-right: 86px; }
.ver-clave {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: var(--hielo); color: var(--ruta); font-weight: 650; font-size: 13px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
}

/* ---------- Movimientos ---------- */
h2.dia { font-size: 15px; margin: 22px 0 8px; }
ol.tiempo { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--linea); }
ol.tiempo li { position: relative; display: flex; gap: 12px; padding: 8px 0 8px 14px; font-size: 15px; }
ol.tiempo li::before {
  content: ""; position: absolute; left: -21px; top: 14px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--blanco); border: 3px solid var(--cielo);
}
ol.tiempo li.t-sesion::before { border-color: #8193A8; }
ol.tiempo li.t-cliente::before { border-color: var(--verde); }
ol.tiempo li.t-equipo::before, ol.tiempo li.t-ajustes::before { border-color: var(--ambar); }
ol.tiempo li.t-pdf::before { border-color: var(--ruta); }
ol.tiempo .hora { flex: none; width: 64px; color: var(--gris); font-size: 13px; padding-top: 2px; font-variant-numeric: tabular-nums; }
@media (max-width: 899px) {
  .nav a.solo-escritorio { display: none; }

  /* ---------- Barra flotante de vidrio líquido ---------- */
  .nav {
    left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom));
    padding: 6px; gap: 2px; border-radius: 32px;
    background: linear-gradient(180deg, rgba(255,255,255,.62) 0%, rgba(240,246,252,.38) 100%);
    -webkit-backdrop-filter: blur(24px) saturate(200%) brightness(1.06);
    backdrop-filter: blur(24px) saturate(200%) brightness(1.06);
    border: 1px solid rgba(255,255,255,.7);
    box-shadow:
      0 12px 32px rgba(10,47,92,.18),
      0 2px 6px rgba(10,47,92,.08),
      inset 0 1px 1px rgba(255,255,255,.95),
      inset 0 -1px 1px rgba(255,255,255,.35),
      inset 0 0 18px rgba(255,255,255,.25);
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  }
  .nav a { -webkit-user-drag: none; -webkit-touch-callout: none; }
  /* Reflejo de luz arriba del vidrio */
  .nav::before {
    content: ""; position: absolute; inset: 1px 18px auto; height: 45%; border-radius: 30px 30px 60% 60% / 30px 30px 20px 20px;
    background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0));
    pointer-events: none; z-index: 0;
  }
  .nav a {
    padding: 8px 2px 7px; font-size: 11px; font-weight: 600; letter-spacing: .01em;
    color: #3C5573; border-radius: 26px;
    transition: color .35s var(--suave), transform .45s var(--resorte);
  }
  .nav a svg { width: 23px; height: 23px; }
  .nav a.activo { color: var(--ruta); }
  .nav a.bajo { color: var(--ruta); transform: scale(1.06); }
  /* Burbuja de vidrio que marca la sección activa */
  .nav-ind {
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.62));
    box-shadow:
      0 4px 14px rgba(10,47,92,.14),
      inset 0 1px 1px rgba(255,255,255,1),
      inset 0 -2px 4px rgba(42,159,218,.12),
      0 0 0 .5px rgba(15,63,130,.08);
    transition: transform .6s var(--hoja), width .5s var(--hoja), height .5s var(--hoja), opacity .25s, scale .35s var(--resorte);
  }
  .nav.arrastrando .nav-ind { transition: width .3s var(--hoja), opacity .2s, scale .35s var(--resorte); scale: 1.12 1.08; }
  .nav.arrastrando a.activo:not(.bajo) { color: #3C5573; }

  .acciones.fijas { bottom: calc(86px + env(safe-area-inset-bottom)); background: transparent; }
  .acciones.fijas::before {
    content: ""; position: absolute; inset: -8px -16px -94px; z-index: -1; pointer-events: none;
    background: linear-gradient(180deg, rgba(241,246,251,0), var(--hielo) 22%);
  }
  #aviso { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
@media (min-width: 900px) { .nav a.solo-movil { display: none; } }

/* ---------- Hoja "Más" ---------- */
.mas-cab { display: flex; align-items: center; gap: 14px; padding: 4px 2px 16px; border-bottom: 1px solid var(--linea); margin-bottom: 12px; }
.avatar {
  flex: none; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--cielo), var(--ruta)); color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.4), 0 4px 12px rgba(15,63,130,.25);
}
.mas-cab .chico { overflow-wrap: anywhere; }
.mas-lista { background: var(--hielo); border-radius: 16px; overflow: hidden; margin-bottom: 12px; }
.mas-op {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; cursor: pointer;
  background: transparent; border: none; padding: 12px 14px; color: var(--texto); font: inherit;
  animation: entra .5s var(--suave) backwards; animation-delay: calc(.08s + var(--i, 0) * 45ms);
  transition: background-color .2s; -webkit-tap-highlight-color: transparent;
}
.mas-lista .mas-op + .mas-op { border-top: 1px solid rgba(213,225,236,.8); }
.mas-op:active { background: rgba(42,159,218,.1); }
.mas-op > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.mas-op b { font-weight: 650; }
.mas-ico {
  flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ruta); color: #fff;
}
.mas-ico svg { width: 20px; height: 20px; }
.mas-op .flecha { width: 18px; height: 18px; color: #A3B3C4; flex: none; }
.mas-op.salir { background: var(--rojo-suave); border-radius: 16px; color: #B23A34; }
.mas-op.salir .mas-ico { background: var(--rojo); }
.ingreso { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.ingreso .caja { width: 100%; max-width: 380px; background: var(--blanco); border: 1px solid var(--linea); border-radius: 18px; padding: 28px 22px; }
.ingreso img { display: block; width: 150px; margin: 0 auto 18px; }

/* ---------- Diálogo ---------- */
.fondo-dialogo {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: end center;
  background: rgba(10,47,92,.38); animation: aparecer .35s var(--suave) both;
}
.dialogo {
  background: var(--blanco); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; overscroll-behavior: contain;
  border-radius: 20px 20px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(10,47,92,.18);
  animation: hojaSube .55s var(--hoja) both; transition: transform .45s var(--hoja);
  touch-action: pan-y;
}
.agarre { width: 38px; height: 5px; border-radius: 3px; background: #D5DEE8; margin: 0 auto 14px; cursor: grab; }
.fondo-dialogo.sale { animation: desaparecer .3s ease both; }
.fondo-dialogo.sale .dialogo { animation: hojaBaja .32s var(--hoja) both; }
body.con-dialogo { overflow: hidden; }
@media (min-width: 600px) {
  .fondo-dialogo { place-items: center; }
  .dialogo { border-radius: 20px; padding-top: 22px; animation-name: ventanaEntra; box-shadow: 0 30px 80px rgba(10,47,92,.28); }
  .fondo-dialogo.sale .dialogo { animation-name: ventanaSale; }
  .agarre { display: none; }
}

/* ---------- Hoja de la cotización (PDF) ---------- */
.hoja-barra { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.hoja {
  background: var(--blanco); width: 100%; max-width: 794px; margin: 0 auto;
  padding: 44px 48px; color: #1A2533; font-family: Arial, Helvetica, sans-serif; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 1px 3px rgba(10,47,92,.12);
}
@media (max-width: 600px) { .hoja { padding: 24px 18px; font-size: 12px; } }
.hoja .cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.hoja .cab img { width: 220px; max-width: 100%; }
.hoja .empresa { font-size: 11px; color: #4A5B6E; margin-top: 6px; }
.hoja .numero { text-align: right; }
.hoja .numero .n { font-size: 22px; font-weight: 800; color: var(--navy); letter-spacing: .01em; }
.hoja .datos { margin-top: 8px; border-collapse: collapse; margin-left: auto; }
.hoja .datos td { padding: 1px 0 1px 12px; text-align: right; }
.hoja .datos td:first-child { color: #4A5B6E; }
.hoja .regla { height: 3px; background: var(--navy); margin: 16px 0 4px; }
.hoja .regla2 { height: 1px; background: var(--cielo); margin-bottom: 18px; }
.hoja h3 { font-size: 12.5px; color: var(--navy); margin: 16px 0 6px; font-weight: 700; }
.hoja .titulo { font-size: 15px; font-weight: 700; color: var(--navy); margin: 4px 0 10px; }
.hoja ul { margin: 0; padding-left: 18px; }
.hoja table.cost { width: 100%; border-collapse: collapse; margin-top: 6px; }
.hoja table.cost th { background: var(--navy); color: #fff; text-align: left; padding: 6px 8px; font-size: 11.5px; }
.hoja table.cost td { padding: 6px 8px; border-bottom: 1px solid #DDE6EF; vertical-align: top; }
.hoja table.cost .d { text-align: right; white-space: nowrap; }
.hoja table.cost tr.tot td { border-bottom: none; font-weight: 700; }
.hoja table.cost tr.gran td { font-size: 14px; color: var(--navy); border-top: 2px solid var(--navy); }
.hoja .valida { margin-top: 10px; font-weight: 700; }
.hoja .legal { font-size: 10.5px; color: #33475C; white-space: pre-line; }
.hoja .pie { margin-top: 22px; padding-top: 8px; border-top: 1px solid var(--cielo); font-size: 10.5px; color: #4A5B6E; text-align: center; }
.hoja .libre { white-space: pre-line; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .nav, .barra, .hoja-barra, #aviso, .no-imprimir { display: none !important; }
  .marco { padding: 0 !important; }
  .contenido { padding: 0 !important; max-width: none; }
  .hoja { box-shadow: none; padding: 0; max-width: none; font-size: 11.5px; }
  .hoja h3, .hoja table.cost tr { break-inside: avoid; }
  .hoja .bloque-legal { break-inside: avoid; }
  .hoja .salto { break-before: page; }
  .hoja .salto h3 { margin-top: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ================= Movimiento estilo Apple ================= */
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes desaparecer { from { opacity: 1; } to { opacity: 0; } }
@keyframes girar { to { transform: rotate(360deg); } }
@keyframes entra { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hojaSube { from { transform: translateY(100%); } to { transform: none; } }
@keyframes hojaBaja { from { transform: none; } to { transform: translateY(100%); } }
@keyframes ventanaEntra { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ventanaSale { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(.96); } }
@keyframes brota { from { opacity: 0; transform: scale(.94) translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes estreno {
  0% { transform: scale(.55) rotate(-4deg); opacity: 0; }
  55% { transform: scale(1.08) rotate(1deg); opacity: 1; }
  75% { transform: scale(.97); }
  100% { transform: none; }
}
@keyframes brillo { from { transform: translateX(-120%) skewX(-18deg); } to { transform: translateX(260%) skewX(-18deg); } }
@keyframes flota { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

/* Cada pantalla entra deslizándose, sus bloques uno tras otro */
.contenido.entra > * { animation: entra .55s var(--suave) backwards; }
.contenido.entra > *:nth-child(2) { animation-delay: .04s; }
.contenido.entra > *:nth-child(3) { animation-delay: .08s; }
.contenido.entra > *:nth-child(4) { animation-delay: .12s; }
.contenido.entra > *:nth-child(5) { animation-delay: .16s; }
.contenido.entra > *:nth-child(n+6) { animation-delay: .2s; }

/* Listas: las tarjetas caen en cascada */
.tarjeta.aparece { animation: entra .6s var(--suave) backwards; animation-delay: calc(.06s + var(--i, 0) * 38ms); }

/* Todo lo que se toca responde: se hunde y rebota */
.btn, .chip, .tarjeta, .icono-btn, .opcion {
  transition: transform .5s var(--resorte), background-color .25s, border-color .25s, color .25s, box-shadow .25s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active, .chip:active, .icono-btn:active { transform: scale(.95); transition-duration: .12s; }
.tarjeta:active, .opcion:active { transform: scale(.975); transition-duration: .12s; }
@media (hover: hover) {
  .tarjeta:hover { box-shadow: 0 8px 24px rgba(10,47,92,.08); transform: translateY(-2px); }
  .btn.principal:hover { box-shadow: 0 6px 18px rgba(15,63,130,.28); }
}

/* Conceptos e impuestos: entran brotando y salen encogiéndose */
.concepto.nuevo { animation: brota .5s var(--resorte) backwards; }
.concepto.sale {
  overflow: hidden; opacity: 0; transform: scale(.92); margin-bottom: 0; padding-top: 0; padding-bottom: 0;
  transition: opacity .2s, transform .3s var(--suave), height .3s var(--suave), margin .3s, padding .3s;
}

/* El momento en que una cotización recibe su número */
.estrena { display: inline-block; animation: estreno .9s var(--suave) backwards; }
.estrena .placa { position: relative; }
.estrena .placa::after {
  content: ""; position: absolute; inset: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: brillo .9s .55s var(--suave) both;
}

/* Ingreso */
.ingreso .caja { animation: flota .8s var(--suave) both; }
.ingreso img { animation: ventanaEntra .9s .1s var(--suave) both; }

/* Estados y enfoque con transición suave */
input, select, textarea { transition: border-color .2s, box-shadow .25s var(--suave), background-color .2s; }
.estado { transition: background-color .3s, color .3s; }

/* Detalles que se abren con suavidad (navegadores recientes) */
@supports (interpolate-size: allow-keywords) {
  :root { interpolate-size: allow-keywords; }
  details::details-content { height: 0; overflow: clip; transition: height .45s var(--suave), content-visibility .45s allow-discrete; }
  details[open]::details-content { height: auto; }
}

/* Exportar */
.opciones-exp { display: grid; gap: 10px; }
.opcion {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; cursor: pointer;
  background: var(--blanco); border: 1px solid var(--linea); border-radius: 14px; padding: 14px; color: var(--texto);
}
.opcion:hover { border-color: var(--cielo); }
.opcion[disabled] { opacity: .55; cursor: wait; }
.ico-exp { flex: none; display: grid; place-items: center; width: 48px; height: 56px; border-radius: 8px; color: #fff; font-weight: 800; font-size: 12px; font-stretch: 80%; letter-spacing: .04em; }
.ico-exp.xls { background: #1E7A4C; }
.ico-exp.zip { background: var(--rojo); }
.progreso { margin-top: 16px; }
.barra-prog { height: 8px; border-radius: 8px; background: var(--hielo); overflow: hidden; }
.barra-prog span { display: block; height: 100%; background: var(--cielo); border-radius: 8px; transform-origin: left; transform: scaleX(.02); transition: transform .5s var(--suave); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
