/*
 * Control de lotes por almacén — Inventarios.
 * Concepto: la historia del lote. La tarjeta del lote L-2310 se lee como una línea de tiempo: cada movimiento
 * con su fecha, su almacén y el saldo que deja, hasta la existencia de hoy repartida entre almacenes.
 * (Distinto de pedimento-importacion-inventario, que usa el hilo dorado, y de control-inventario-lotes, que usa conteos dirigidos.)
 * Colores por estado del lote: verde = libre, ámbar = reservado, morado = cuarentena; teal = traspaso; rojo = ajuste.
 * Display Rethink Sans; cuerpo Inter.
 * Momento animado único: en el hero se traza la línea del tiempo y los movimientos aparecen en orden hasta el saldo de hoy.
 */
[data-function-layout="lotes"] {
    --lt-ink: #041f49;
    --lt-gold: #fac63f;
    --lt-free: #1f7a4a;
    --lt-free-tint: #e1f1e8;
    --lt-reserved: #9a5f00;
    --lt-reserved-tint: #fdf0d6;
    --lt-quarantine: #7a3fa8;
    --lt-quarantine-tint: #f1e7f8;
    --lt-transfer: #1f7a8c;
    --lt-adjust: #b42b26;
    --lt-adjust-tint: #fbe7e5;
    --lt-paper: #f1f4f6;
    --lt-line: #dde3ea;
    --lt-muted: #46505e;
    --lt-text: #1f2a3d;
    --lt-display: "Rethink Sans", "Hanken Grotesk", ui-sans-serif, sans-serif;
    --lt-ease: cubic-bezier(.2, .7, .2, 1);
}

[data-function-layout="lotes"] .cv-hero-title,
[data-function-layout="lotes"] .cv-section-title,
[data-function-layout="lotes"] .cv-form-title { font-family: var(--lt-display); font-weight: 800; letter-spacing: -.02em; }
[data-function-layout="lotes"] .cv-section-title { font-size: clamp(1.75rem, 2.8vw, 2.6rem); line-height: 1.1; }
[data-function-layout="lotes"] .lt-narrow { max-width: 48rem; }
[data-function-layout="lotes"] .lt-subtitle { margin: 0 0 1rem; color: var(--lt-ink); font-family: var(--lt-display); font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }

/* ---------- Superficies ---------- */
[data-function-layout="lotes"] .lt-paper { background: var(--lt-paper); }
[data-function-layout="lotes"] .lt-navy { background: var(--lt-ink); color: #fff; }
[data-function-layout="lotes"] .lt-navy .cv-section-title { color: #fff; }
[data-function-layout="lotes"] .lt-split { display: grid; gap: 2.5rem 4rem; align-items: center; }
[data-function-layout="lotes"] .lt-split--top { align-items: start; }
[data-function-layout="lotes"] .lt-lead { max-width: 42rem; margin-top: 1.25rem; color: var(--lt-text); font-size: clamp(1.0625rem, 1.4vw, 1.1875rem); line-height: 1.75; }
[data-function-layout="lotes"] .lt-lead--strong { color: var(--lt-ink); font-family: var(--lt-display); font-size: clamp(1.2rem, 1.7vw, 1.4rem); font-weight: 700; line-height: 1.5; }
[data-function-layout="lotes"] .lt-lead--light { color: rgb(255 255 255 / .88); }
[data-function-layout="lotes"] .lt-text { margin: 0; color: var(--lt-text); font-size: 1.0625rem; line-height: 1.75; }

/* ---------- Hero ---------- */
[data-function-layout="lotes"] #inicio { background: linear-gradient(160deg, #041f49 0%, #062c55 60%, #0a3a5e 100%); color: #fff; }
[data-function-layout="lotes"] #inicio .function-hero__media img { object-position: 65% 50%; }
[data-function-layout="lotes"] #inicio .function-hero__overlay {
    background:
        linear-gradient(180deg, transparent 65%, rgb(4 31 73 / .7) 100%),
        linear-gradient(90deg, rgb(4 31 73 / .97) 0%, rgb(4 31 73 / .9) 42%, rgb(6 44 85 / .74) 70%, rgb(10 58 94 / .55) 100%);
}
[data-function-layout="lotes"] .rh-hero-layout { position: relative; z-index: 1; align-items: center; }
[data-function-layout="lotes"] #inicio .cv-hero-title { max-width: 12ch; color: #fff; font-size: clamp(2.4rem, 4.7vw, 4.2rem); line-height: 1.02; }
[data-function-layout="lotes"] #inicio .cv-hero-description { max-width: 32rem; margin-top: 1.5rem; color: rgb(255 255 255 / .86); }
[data-function-layout="lotes"] .lt-hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
[data-function-layout="lotes"] #inicio .cv-primary-button { border-color: var(--lt-gold); background: var(--lt-gold); color: var(--lt-ink); box-shadow: 0 14px 30px rgb(0 0 0 / .3); }
[data-function-layout="lotes"] #inicio .cv-primary-button:hover,
[data-function-layout="lotes"] #inicio .cv-primary-button:focus-visible { background: #ffd666; }
[data-function-layout="lotes"] #inicio .cv-secondary-button { border-color: rgb(255 255 255 / .7); background: transparent; color: #fff; }
[data-function-layout="lotes"] #inicio .cv-secondary-button:hover,
[data-function-layout="lotes"] #inicio .cv-secondary-button:focus-visible { background: #fff; color: var(--lt-ink); }
[data-function-layout="lotes"] #inicio .cv-primary-button:focus-visible,
[data-function-layout="lotes"] #inicio .cv-secondary-button:focus-visible { outline: 3px solid var(--lt-gold); outline-offset: 3px; }

/* Historia del lote: el estilo base es el estado final. */
[data-function-layout="lotes"] .lt-history { justify-self: center; width: 100%; max-width: 33rem; margin: 0; padding: 1.3rem 1.3rem 1rem; border-radius: .5rem; background: #fff; box-shadow: 0 24px 50px rgb(0 0 0 / .35); color: var(--lt-text); }
[data-function-layout="lotes"] .lt-history .cv-icon { width: 16px; height: 16px; flex-basis: 16px; }
[data-function-layout="lotes"] .lt-history__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .6rem 1.2rem; padding-bottom: 1rem; border-bottom: 2px dashed var(--lt-line); }
[data-function-layout="lotes"] .lt-history__lot { display: grid; margin: 0; color: var(--lt-muted); font-size: .78rem; font-weight: 700; }
[data-function-layout="lotes"] .lt-history__lot b { color: var(--lt-ink); font-family: var(--lt-display); font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
[data-function-layout="lotes"] .lt-history__facts { display: flex; gap: 1.1rem; margin: 0; }
[data-function-layout="lotes"] .lt-history__facts dt { color: var(--lt-muted); font-size: .7rem; font-weight: 600; }
[data-function-layout="lotes"] .lt-history__facts dd { margin: 0; color: var(--lt-ink); font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Línea del tiempo: cada punto es un movimiento; la línea los une en orden. */
[data-function-layout="lotes"] .lt-history__steps { position: relative; display: grid; margin: 0; padding: .4rem 0 0; list-style: none; }
[data-function-layout="lotes"] .lt-history__steps::before { content: ""; position: absolute; top: 1.4rem; bottom: 1.4rem; left: calc(1rem - 1px); width: 2px; background: var(--lt-line); transform-origin: top; animation: lt-line 1.4s var(--lt-ease) .2s both; }
[data-function-layout="lotes"] .lt-history__steps li { position: relative; display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto 5.6rem; gap: .75rem; align-items: center; padding: .6rem 0; animation: lt-step .45s var(--lt-ease) both; }
[data-function-layout="lotes"] .lt-history__steps li:not(:last-child) { border-bottom: 1px solid var(--lt-paper); }
[data-function-layout="lotes"] .lt-history__steps li:nth-child(1) { animation-delay: .25s; }
[data-function-layout="lotes"] .lt-history__steps li:nth-child(2) { animation-delay: .6s; }
[data-function-layout="lotes"] .lt-history__steps li:nth-child(3) { animation-delay: .95s; }
[data-function-layout="lotes"] .lt-history__steps li:nth-child(4) { animation-delay: 1.3s; }
[data-function-layout="lotes"] .lt-history__dot { position: relative; z-index: 1; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--lt-ink); box-shadow: 0 0 0 3px #fff; color: #fff; }
[data-function-layout="lotes"] .lt-history__steps .is-in .lt-history__dot { background: var(--lt-free); }
[data-function-layout="lotes"] .lt-history__steps .is-transfer .lt-history__dot { background: var(--lt-transfer); }
[data-function-layout="lotes"] .lt-history__steps .is-adjust .lt-history__dot { background: var(--lt-adjust); }
[data-function-layout="lotes"] .lt-history__what { display: grid; min-width: 0; line-height: 1.3; }
[data-function-layout="lotes"] .lt-history__what b { color: var(--lt-ink); font-size: .92rem; }
[data-function-layout="lotes"] .lt-history__what small { color: var(--lt-muted); font-size: .76rem; font-weight: 500; }
[data-function-layout="lotes"] .lt-history__qty { color: var(--lt-ink); font-family: var(--lt-display); font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; }
[data-function-layout="lotes"] .lt-history__steps .is-in .lt-history__qty { color: var(--lt-free); }
[data-function-layout="lotes"] .lt-history__steps .is-adjust .lt-history__qty { color: var(--lt-adjust); }
[data-function-layout="lotes"] .lt-history__balance { justify-self: end; padding: .2rem .5rem; border-radius: .3rem; background: var(--lt-paper); color: var(--lt-muted); font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
[data-function-layout="lotes"] .lt-history__now { display: grid; gap: .1rem; margin: .8rem 0 0; padding: .75rem .9rem; border-radius: .4rem; background: var(--lt-free-tint); box-shadow: inset 4px 0 0 var(--lt-free); animation: lt-step .45s var(--lt-ease) 1.75s both; }
[data-function-layout="lotes"] .lt-history__now span { color: #165c37; font-size: .74rem; font-weight: 700; }
[data-function-layout="lotes"] .lt-history__now b { color: var(--lt-ink); font-family: var(--lt-display); font-size: 1.02rem; font-weight: 800; line-height: 1.3; }
[data-function-layout="lotes"] .lt-history figcaption { margin-top: .8rem; color: var(--lt-muted); font-size: .74rem; }

/* ---------- Definición: preguntas concretas ---------- */
[data-function-layout="lotes"] .lt-note { display: grid; gap: 1rem; padding: clamp(1.4rem, 3vw, 2rem); border: 2px solid var(--lt-ink); border-radius: .5rem; background: #fff; }
[data-function-layout="lotes"] .lt-note__title { margin: 0; color: var(--lt-ink); font-family: var(--lt-display); font-size: 1.35rem; font-weight: 800; line-height: 1.25; }
[data-function-layout="lotes"] .lt-note__text { margin: 0; color: var(--lt-text); line-height: 1.7; }
[data-function-layout="lotes"] .lt-asks { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 1.1rem 0 0; border-top: 1px solid var(--lt-line); list-style: none; }
[data-function-layout="lotes"] .lt-asks li { padding: .4rem .75rem; border-radius: 1rem; background: var(--lt-paper); color: var(--lt-ink); font-size: .9rem; font-weight: 600; line-height: 1.35; }

/* ---------- Información por lote ---------- */
[data-function-layout="lotes"] .lt-attrs { display: grid; margin: 0; padding: 0; list-style: none; border-top: 3px solid var(--lt-ink); }
[data-function-layout="lotes"] .lt-attrs li { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--lt-line); color: var(--lt-text); font-size: 1.0625rem; line-height: 1.6; }
[data-function-layout="lotes"] .lt-attrs__icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .4rem; background: #fff; box-shadow: inset 0 0 0 1px var(--lt-line); color: var(--lt-ink); }

/* ---------- Matriz lote × almacén ---------- */
[data-function-layout="lotes"] .lt-matrix { display: grid; gap: .4rem; margin: 0; font-variant-numeric: tabular-nums; }
[data-function-layout="lotes"] .lt-matrix__row { display: grid; grid-template-columns: minmax(7rem, 1.1fr) repeat(2, minmax(0, 1fr)); gap: .4rem; }
[data-function-layout="lotes"] .lt-matrix__row.is-head span { padding: 0 .2rem .3rem; color: var(--lt-muted); font-size: .82rem; font-weight: 700; }
[data-function-layout="lotes"] .lt-matrix__lot { display: grid; align-content: center; padding: .7rem .8rem; border-radius: .35rem; background: var(--lt-ink); color: #fff; }
[data-function-layout="lotes"] .lt-matrix__lot b { font-family: var(--lt-display); font-size: 1.05rem; font-weight: 800; }
[data-function-layout="lotes"] .lt-matrix__lot small { color: rgb(255 255 255 / .75); font-size: .72rem; }
[data-function-layout="lotes"] .lt-matrix__cell { display: grid; align-content: center; gap: .1rem; padding: .7rem .8rem; border-radius: .35rem; color: var(--lt-ink); font-family: var(--lt-display); font-size: 1.4rem; font-weight: 800; line-height: 1.1; }
[data-function-layout="lotes"] .lt-matrix__cell small { font-family: Inter, ui-sans-serif, sans-serif; font-size: .74rem; font-weight: 700; }
[data-function-layout="lotes"] .lt-matrix__cell.is-free { background: var(--lt-free-tint); box-shadow: inset 4px 0 0 var(--lt-free); }
[data-function-layout="lotes"] .lt-matrix__cell.is-reserved { background: var(--lt-reserved-tint); box-shadow: inset 4px 0 0 var(--lt-reserved); }
[data-function-layout="lotes"] .lt-matrix__cell.is-reserved small { color: var(--lt-reserved); }
[data-function-layout="lotes"] .lt-matrix__cell.is-quarantine { background: var(--lt-quarantine-tint); box-shadow: inset 4px 0 0 var(--lt-quarantine); }
[data-function-layout="lotes"] .lt-matrix__cell.is-quarantine small { color: var(--lt-quarantine); }
[data-function-layout="lotes"] .lt-matrix__cell.is-empty { border: 1.5px dashed #b8c2ce; color: #8a95a3; }

/* ---------- Cómo revisar ---------- */
[data-function-layout="lotes"] .lt-pair { display: grid; gap: 2rem 4rem; margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid rgb(255 255 255 / .2); }
[data-function-layout="lotes"] .lt-pair__icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .4rem; background: rgb(255 255 255 / .1); color: var(--lt-gold); }
[data-function-layout="lotes"] .lt-pair__item h3 { margin: .9rem 0 .5rem; color: #fff; font-family: var(--lt-display); font-size: 1.25rem; font-weight: 800; line-height: 1.3; }
[data-function-layout="lotes"] .lt-pair__item p { margin: 0; color: rgb(255 255 255 / .88); line-height: 1.75; }
[data-function-layout="lotes"] .lt-goal { max-width: 46rem; margin: 2.25rem 0 0; padding-left: 1rem; border-left: 3px solid var(--lt-gold); color: #fff; font-family: var(--lt-display); font-size: 1.2rem; font-weight: 700; line-height: 1.5; }

/* ---------- Diferencias: pasos en orden ---------- */
[data-function-layout="lotes"] .lt-steps { display: grid; margin: 0; padding: 0; list-style: none; border-top: 3px solid var(--lt-ink); }
[data-function-layout="lotes"] .lt-steps li { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 1rem; align-items: start; padding: 1rem 0; border-bottom: 1px solid var(--lt-line); }
[data-function-layout="lotes"] .lt-steps__num { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--lt-ink); color: #fff; font-family: var(--lt-display); font-size: .95rem; font-weight: 800; }
[data-function-layout="lotes"] .lt-steps p { margin: .2rem 0 0; color: var(--lt-text); font-size: 1.0625rem; line-height: 1.6; }

/* Fecha de movimiento: el ajuste con fecha anterior se acomoda antes en la secuencia. */
[data-function-layout="lotes"] .lt-date { display: grid; gap: 2rem 4rem; align-items: center; margin-top: 3.5rem; padding-top: 2.5rem; border-top: 1px solid var(--lt-line); }
[data-function-layout="lotes"] .lt-backdate { display: grid; gap: .4rem; margin: 0; padding: 1.1rem; border-radius: .5rem; background: var(--lt-paper); font-variant-numeric: tabular-nums; }
[data-function-layout="lotes"] .lt-backdate__row { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr) auto; gap: .8rem; align-items: center; margin: 0; padding: .65rem .8rem; border-radius: .35rem; background: #fff; color: var(--lt-text); font-size: .92rem; line-height: 1.4; }
[data-function-layout="lotes"] .lt-backdate__row span:first-child { color: var(--lt-muted); font-weight: 700; white-space: nowrap; }
[data-function-layout="lotes"] .lt-backdate__row b { color: var(--lt-ink); font-family: var(--lt-display); font-size: 1.1rem; font-weight: 800; }
[data-function-layout="lotes"] .lt-backdate__row.is-backdated { outline: 2px dashed var(--lt-adjust); outline-offset: -2px; background: var(--lt-adjust-tint); }
[data-function-layout="lotes"] .lt-backdate__row.is-backdated span:first-child,
[data-function-layout="lotes"] .lt-backdate__row.is-backdated b { color: var(--lt-adjust); }
[data-function-layout="lotes"] .lt-backdate__note { display: flex; gap: .5rem; align-items: start; margin: .5rem 0 0; color: var(--lt-text); font-size: .9rem; font-weight: 600; line-height: 1.5; }
[data-function-layout="lotes"] .lt-backdate__note .cv-icon { width: 18px; height: 18px; flex-basis: 18px; margin-top: .1rem; color: var(--lt-adjust); }

/* ---------- Dónde aporta valor ---------- */
[data-function-layout="lotes"] .lt-cases { display: grid; gap: 1.75rem 3rem; margin-top: 2.25rem; }
[data-function-layout="lotes"] .lt-case { padding-top: 1.25rem; border-top: 3px solid var(--lt-ink); }
[data-function-layout="lotes"] .lt-case__icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: .4rem; background: #fff; box-shadow: inset 0 0 0 1px var(--lt-line); color: var(--lt-ink); }
[data-function-layout="lotes"] .lt-case h3 { margin: .9rem 0 .5rem; color: var(--lt-ink); font-family: var(--lt-display); font-size: 1.2rem; font-weight: 800; line-height: 1.3; }
[data-function-layout="lotes"] .lt-case p { margin: 0; color: var(--lt-text); line-height: 1.75; }

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
    [data-function-layout="lotes"] .lt-attrs { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; }
    [data-function-layout="lotes"] .lt-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    [data-function-layout="lotes"] .lt-cases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    [data-function-layout="lotes"] .rh-hero-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    [data-function-layout="lotes"] .lt-split,
    [data-function-layout="lotes"] .lt-date { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    [data-function-layout="lotes"] .lt-cases { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
    [data-function-layout="lotes"] #inicio .function-hero__overlay { background: linear-gradient(180deg, rgb(4 31 73 / .95) 0%, rgb(4 31 73 / .86) 50%, rgb(6 44 85 / .7) 100%); }
    [data-function-layout="lotes"] #inicio .cv-hero-title { max-width: none; }
}
@media (max-width: 767px) {
    [data-function-layout="lotes"] .lt-hero__actions > * { width: 100%; }
    [data-function-layout="lotes"] .lt-history { padding: 1.1rem .9rem .9rem; }
    [data-function-layout="lotes"] .lt-history__steps li { grid-template-columns: 2rem minmax(0, 1fr) auto; grid-template-areas: "dot what qty" "dot what balance"; row-gap: .2rem; }
    [data-function-layout="lotes"] .lt-history__dot { grid-area: dot; }
    [data-function-layout="lotes"] .lt-history__what { grid-area: what; }
    [data-function-layout="lotes"] .lt-history__qty { grid-area: qty; justify-self: end; }
    [data-function-layout="lotes"] .lt-history__balance { grid-area: balance; }
    [data-function-layout="lotes"] .lt-matrix__row { grid-template-columns: minmax(5.5rem, 1fr) repeat(2, minmax(0, 1fr)); }
    [data-function-layout="lotes"] .lt-matrix__lot,
    [data-function-layout="lotes"] .lt-matrix__cell { padding: .6rem; }
    [data-function-layout="lotes"] .lt-matrix__cell { font-size: 1.2rem; }
    [data-function-layout="lotes"] .lt-backdate__row { grid-template-columns: minmax(0, 1fr) auto; }
    [data-function-layout="lotes"] .lt-backdate__row span:nth-child(2) { grid-row: 2; grid-column: 1 / -1; }
}

/* ---------- Keyframes ---------- */
@keyframes lt-line { from { transform: scaleY(0); } }
@keyframes lt-step { from { opacity: 0; transform: translateY(.5rem); } }

@media (prefers-reduced-motion: reduce) {
    [data-function-layout="lotes"] *,
    [data-function-layout="lotes"] *::before,
    [data-function-layout="lotes"] *::after { animation: none !important; transition: none !important; }
}
