/* Tienda en linea MHS Supply. Sin recursos externos: tipografia del sistema y SVG en linea. Primero celular. */

:root {
    --blue: #1f3a6e;
    --blue-dark: #162a51;
    --red: #d92d43;
    --red-dark: #b82337;
    --gray: #f1f3f6;
    --gray-line: #d9dde4;
    --text: #1d2433;
    --text-muted: #5b6475;
    --white: #ffffff;
    --success: #1d7a46;
    --radius: 10px;
    --tap: 44px;
    --container: 1400px;
    --gutter: 1rem;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--gray);
    /* Nunca desplazamiento horizontal de la pagina (clip no rompe el encabezado fijo, a diferencia de hidden). */
    overflow-x: clip;
}

/* 16 px o mas en los campos: iPhone no hace zoom al enfocarlos. */
input,
select,
textarea {
    font-size: 16px;
}

img {
    max-width: 100%;
}

a {
    color: var(--blue);
}

h1,
h2 {
    line-height: 1.25;
    margin: 0 0 0.5rem;
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.15rem;
}

p {
    margin: 0 0 1rem;
}

svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    padding: 0.75rem 1rem;
    background: var(--white);
    color: var(--blue);
    z-index: 100;
}

.skip-link:focus {
    left: 0.5rem;
}

:focus-visible {
    outline: 3px solid var(--red);
    outline-offset: 2px;
}

/* Aviso superior */

.announcement {
    margin: 0;
    padding: 0.45rem var(--gutter);
    background: var(--red);
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

/* Encabezado */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--blue);
    color: var(--white);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.header-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0.5rem var(--gutter) 0.75rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "brand actions"
        "search search";
    align-items: center;
    gap: 0.5rem;
}

.brand {
    grid-area: brand;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--white);
    text-decoration: none;
}

.brand span {
    color: #ff8a98;
    margin-left: 0.3rem;
}

/* Logo de 360 px de ancho (720 px en pantallas densas); se muestra a la mitad. */
.brand-logo {
    display: block;
    width: auto;
    max-width: 150px;
    height: 36px;
    object-fit: contain;
}

.header-actions {
    grid-area: actions;
    display: flex;
    gap: 0.125rem;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: var(--tap);
    min-height: var(--tap);
    padding: 0 0.5rem;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--white);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.icon-label {
    display: none;
}

.search {
    grid-area: search;
    display: flex;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
}

.search input {
    flex: 1;
    min-width: 0;
    min-height: var(--tap);
    padding: 0 0.85rem;
    border: 0;
    font: inherit;
    color: var(--text);
    background: transparent;
}

.search input:focus-visible {
    outline: none;
}

.search:focus-within {
    box-shadow: 0 0 0 3px var(--red);
}

.search-button {
    min-width: var(--tap);
    min-height: var(--tap);
    border: 0;
    background: var(--red);
    color: var(--white);
    cursor: pointer;
}

/* Contenido */

.page {
    flex: 1;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 1rem var(--gutter) 2rem;
}

.hero {
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    background: var(--white);
    border-left: 6px solid var(--red);
}

.hero-actions {
    display: grid;
    gap: 0.75rem;
}

.card-grid {
    display: grid;
    gap: 1rem;
}

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

.card p:last-child {
    margin-bottom: 0;
}

.panel {
    max-width: 480px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--gray-line);
}

.panel-intro {
    color: var(--text-muted);
}

/* Formularios */

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.field input {
    width: 100%;
    min-height: var(--tap);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-line);
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: var(--white);
}

.field input:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 0;
    border-color: var(--blue);
}

.field-hint {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.field-error {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--red-dark);
}

.field input[aria-invalid="true"] {
    border-color: var(--red);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--tap);
    padding: 0.6rem 1.25rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--red);
    color: var(--white);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--red-dark);
}

.button-secondary {
    background: var(--blue);
}

.button-secondary:hover {
    background: var(--blue-dark);
}

.button[disabled] {
    opacity: 0.6;
    cursor: wait;
}

.form-links {
    margin-top: 1.25rem;
    text-align: center;
}

.form-links a {
    display: inline-block;
    min-height: var(--tap);
    padding: 0.6rem 0.25rem;
}

.notice {
    max-width: var(--container);
    margin: 0 auto 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--white);
}

.notice-success {
    border-left: 5px solid var(--success);
}

.notice-error {
    border-left: 5px solid var(--red);
}

.details {
    margin: 0 0 1.5rem;
}

.details dt {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.details dd {
    margin: 0 0 0.85rem;
    font-weight: 600;
    word-break: break-word;
}

/* Pie y avisos */

.site-footer {
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--white);
    background: var(--blue-dark);
}

.site-footer p {
    margin: 0;
}

.toast {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 20;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    background: var(--text);
    color: var(--white);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Catalogo */

.section {
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.section-header a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
}

.chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
}

.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
    padding: 0 1rem;
    border: 1px solid var(--gray-line);
    border-radius: 999px;
    background: var(--white);
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.chip:hover {
    border-color: var(--blue);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--gray-line);
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
}

.product-card-link {
    display: flex;
    flex: 1;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* Subrayado solo al pasar el cursor: en pantallas tactiles :hover se queda pegado despues de tocar. */
@media (hover: hover) {
    a.product-card-link:hover .product-card-name {
        text-decoration: underline;
    }
}

a.product-card-link:focus-visible .product-card-name {
    text-decoration: underline;
}

/* Caja cuadrada fija y blanca: toda foto (y la provisional) se ve completa, centrada y sin deformarse. */
.product-card-image {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    width: 100%;
    padding: 0.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-line);
    overflow: hidden;
}

.product-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.product-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
}

/* Nombre a 3 lineas con puntos suspensivos. */
.product-card-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.3;
    text-decoration: none;
    word-break: break-word;
}

/* Precio y existencia al fondo de la tarjeta. */
.product-card-footer {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.25rem;
}

.product-card-sku {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
}

.tag {
    align-self: flex-start;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--gray);
    color: var(--blue);
    font-size: 0.75rem;
    font-weight: 700;
}

.price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
}

.price-current {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
}

.price-compare {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Con precio normal: tachado arriba, precio de la página debajo y el ahorro al final, uno por renglón. */
.price-with-compare {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.price-with-compare .price-current {
    color: var(--red);
    font-size: 1.3rem;
}

.price-savings {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--success);
}

.price-discount {
    padding: 0.05rem 0.4rem;
    border-radius: 6px;
    background: var(--red);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 700;
}

.stock {
    align-self: flex-start;
    font-size: 0.8rem;
    font-weight: 700;
}

.stock-disponible {
    color: var(--success);
}

.stock-ultimas_piezas {
    color: #a35a00;
}

.stock-agotado,
.stock-no_disponible {
    color: var(--red-dark);
}

.filters {
    display: grid;
    gap: 0.25rem 0.75rem;
    margin: 1rem 0;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--gray-line);
}

.filters .field {
    margin-bottom: 0.5rem;
}

.field select {
    width: 100%;
    min-height: var(--tap);
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-line);
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: var(--white);
}

.results-count {
    color: var(--text-muted);
}

.button-light {
    background: var(--white);
    color: var(--blue);
    border: 1px solid var(--gray-line);
}

.button-light:hover {
    background: var(--gray);
}

.button-light[aria-disabled="true"] {
    color: var(--text-muted);
    cursor: default;
}

.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.pagination-status {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
}

/* Ficha del producto */

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.breadcrumb a {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap);
}

.breadcrumb span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70vw;
}

.product-detail {
    display: grid;
    gap: 1.25rem;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--gray-line);
}

.gallery-main {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 0.75rem;
    border: 1px solid var(--gray-line);
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    overflow-x: auto;
}

.gallery-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    min-width: var(--tap);
    min-height: var(--tap);
    padding: 0;
    border: 2px solid var(--gray-line);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    overflow: hidden;
}

.gallery-thumb[aria-current="true"] {
    border-color: var(--blue);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-info h1 {
    margin: 0;
    word-break: break-word;
}

.product-info .price-current {
    font-size: 1.6rem;
}

.product-specs,
.product-description {
    margin-top: 1rem;
}

.specs {
    width: 100%;
    border-collapse: collapse;
}

.specs th,
.specs td {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-line);
    text-align: left;
    vertical-align: top;
    word-break: break-word;
}

.specs th {
    width: 35%;
    padding-right: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.plain-text {
    white-space: pre-line;
    word-break: break-word;
}

/* Carrito */

.cart-button {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--red);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.add-to-cart {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
}

.add-to-cart .field-error {
    grid-column: 1 / -1;
    margin: 0;
}

.stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--gray-line);
    border-radius: var(--radius);
    background: var(--white);
}

.stepper form {
    display: contents;
}

.stepper-button {
    min-width: var(--tap);
    min-height: var(--tap);
    border: 0;
    background: transparent;
    color: var(--blue);
    font: inherit;
    font-size: 1.35rem;
    font-weight: 700;
    cursor: pointer;
}

.stepper-button[disabled] {
    color: var(--gray-line);
    cursor: default;
}

.stepper-input {
    width: 3.25rem;
    min-height: var(--tap);
    border: 0;
    font: inherit;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    background: transparent;
    -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stepper-value {
    min-width: 2.5rem;
    text-align: center;
    font-weight: 700;
}

.link-button {
    min-height: var(--tap);
    padding: 0 0.5rem;
    border: 0;
    background: transparent;
    color: var(--red-dark);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.cart-layout {
    display: grid;
    gap: 1rem;
}

.cart-lines {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.75rem;
}

.cart-line {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--gray-line);
}

.cart-line-unavailable {
    border-color: var(--red);
    background: #fff7f8;
}

.cart-line-image {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--gray);
}

.cart-line-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.cart-line-name {
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}

.cart-line-issue {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--red-dark);
}

.cart-line-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.cart-line-total {
    grid-column: 2;
    font-weight: 800;
    text-align: right;
}

.cart-summary {
    align-self: start;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--gray-line);
}

.totals {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.4rem 1rem;
    margin: 0 0 1rem;
}

.totals dd {
    margin: 0;
    text-align: right;
    font-weight: 600;
}

.totals-discount {
    color: var(--success);
}

.totals .totals-total {
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-line);
    font-size: 1.15rem;
    font-weight: 800;
}

.cart-note {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.cart-summary .button {
    width: 100%;
}

/* Confirmar pedido */

.checkout-steps {
    display: grid;
    gap: 1rem;
}

.checkout-steps form {
    display: grid;
    gap: 1rem;
}

.checkout-lines {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
}

.checkout-line {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.25rem 0.75rem;
    align-items: baseline;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--gray-line);
}

.checkout-line .cart-line-issue {
    grid-column: 1 / -1;
}

.checkout-line-qty {
    color: var(--text-muted);
    white-space: nowrap;
}

.checkout-line-total {
    font-weight: 700;
    white-space: nowrap;
}

.choice-group {
    display: grid;
    gap: 0.6rem;
    margin: 0;
}

.choice-group legend {
    padding: 0;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.choice {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    min-height: var(--tap);
    padding: 0.75rem;
    border: 2px solid var(--gray-line);
    border-radius: var(--radius);
    cursor: pointer;
}

.choice:has(input:checked) {
    border-color: var(--blue);
    background: #f4f7fc;
}

.choice input {
    width: 1.2rem;
    height: 1.2rem;
    margin-top: 0.15rem;
    accent-color: var(--blue);
}

.choice-body {
    display: grid;
    gap: 0.15rem;
}

.choice-title {
    font-weight: 700;
}

.choice-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.choice-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Pedidos */

.order-head {
    display: grid;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.order-folio {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--blue);
}

.order-status {
    font-size: 1.05rem;
    font-weight: 700;
}

.order-status-success {
    color: var(--success);
}

.order-status-muted {
    color: var(--text-muted);
}

.barcode {
    margin: 1rem 0;
    padding: 0.75rem;
    border: 1px solid var(--gray-line);
    border-radius: var(--radius);
    background: var(--white);
    text-align: center;
}

.barcode svg {
    width: 100%;
    max-width: 420px;
    height: 80px;
}

.barcode-caption {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.table-scroll {
    overflow-x: auto;
}

.order-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.order-table th,
.order-table td {
    padding: 0.55rem 0.4rem;
    border-bottom: 1px solid var(--gray-line);
    text-align: left;
    vertical-align: top;
}

.order-table .num {
    text-align: right;
    white-space: nowrap;
}

.order-table .missing {
    color: var(--red-dark);
    font-weight: 700;
}

.countdown {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: #fff4e5;
    border: 1px solid #f0c27a;
}

.countdown strong {
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
}

.order-actions {
    display: grid;
    gap: 0.6rem;
    margin-top: 1rem;
}

.order-actions form,
.order-actions .button {
    width: 100%;
}

.pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--gray);
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.pill-success {
    background: #e3f4ea;
    color: var(--success);
}

.pill-danger {
    background: #fde8eb;
    color: var(--red-dark);
}

.pill-warning {
    background: #fff4e5;
    color: #8a5300;
}

.order-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.order-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--gray-line);
}

.order-card-folio {
    font-weight: 800;
}

.order-card-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.order-card-total {
    font-weight: 800;
    text-align: right;
}

/* Busqueda por auto: barra debajo del encabezado (W15) */

.vehicle-search {
    display: grid;
    gap: 0.6rem;
}

.vehicle-search .field {
    margin: 0;
}

.vehicle-search select {
    width: 100%;
}

.vehicle-search select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.vehicle-search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: end;
}

.vehicle-search-actions .button {
    flex: 1 1 auto;
}

.vehicle-search-empty {
    grid-column: 1 / -1;
    margin: 0;
}

.vehicle-bar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-line);
}

.vehicle-bar-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0.6rem var(--gutter);
}

/* Celular: un boton ancho que despliega los selectores apilados. */
.vehicle-bar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: var(--tap);
    padding: 0 1rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--blue);
    color: var(--white);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.vehicle-bar-toggle svg {
    width: 20px;
    height: 20px;
}

.vehicle-bar-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}

.vehicle-bar-toggle[aria-expanded="true"] .vehicle-bar-chevron {
    transform: rotate(180deg);
}

/* Sin JavaScript el boton no sirve: se oculta y los selectores se ven siempre. */
.no-js .vehicle-bar-toggle {
    display: none;
}

.vehicle-bar-panel {
    padding-top: 0.75rem;
}

.js .vehicle-bar-panel:not(.is-open) {
    display: none;
}

.vehicle-bar-title {
    display: none;
}

.vehicle-active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    background: #eef3fb;
    font-weight: 700;
    color: var(--blue);
}

.vehicle-active .button {
    width: auto;
}

/* Carrusel de banners (W15): fila con scroll-snap, deslizable con el dedo. */

.carousel {
    position: relative;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
}

.carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

/* Proporcion de los banners (16:9); los de otra proporcion se ven completos, centrados sobre blanco. */
.carousel-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: var(--white);
}

.carousel-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.carousel-arrow {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.carousel-arrow-prev {
    left: 0.75rem;
}

.carousel-arrow-next {
    right: 0.75rem;
}

.carousel-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
}

/* Cada punto es un area tactil de 44 px con el punto visible al centro. */
.carousel-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.carousel-dot::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.carousel-dot[aria-current="true"]::before {
    width: 22px;
    background: var(--red);
}

/* Tipos (W15): una fila con desplazamiento; en celular se ve media tarjeta de la siguiente. */

.scroller {
    position: relative;
}

.type-row {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0 0.5rem;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 2 * 0.75rem) / 2.5);
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 0.25rem;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.type-row > li {
    scroll-snap-align: start;
    min-width: 0;
}

.scroller-arrow {
    display: none;
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    z-index: 1;
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    border: 1px solid var(--gray-line);
    border-radius: 999px;
    background: var(--white);
    color: var(--blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.scroller-arrow-prev {
    left: -0.5rem;
}

.scroller-arrow-next {
    right: -0.5rem;
}

.category-card {
    display: grid;
    gap: 0.25rem;
    justify-items: center;
    height: 100%;
    padding: 0.6rem;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--gray-line);
    color: var(--text);
    text-align: center;
    text-decoration: none;
}

.category-card:hover {
    border-color: var(--blue);
}

.category-card-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 120px;
    aspect-ratio: 1 / 1;
    background: var(--white);
    overflow: hidden;
}

.category-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.category-card-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
}

.category-card-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Ficha en celular: el boton de agregar queda fijo abajo y la pagina deja su espacio. */

@media (max-width: 767px) {
    .add-to-cart-sticky {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 15;
        margin: 0;
        padding: 0.6rem var(--gutter) calc(0.6rem + env(safe-area-inset-bottom));
        background: var(--white);
        border-top: 1px solid var(--gray-line);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
    }

    /* El espacio va en body (no en .page) para que tampoco el pie quede debajo de la barra. */
    body:has(.add-to-cart-sticky) {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }

    body:has(.add-to-cart-sticky) .toast {
        bottom: 5.5rem;
    }

    .product-detail {
        padding: 0;
        border: 0;
        background: transparent;
    }

    .product-info {
        padding: 0 0.25rem;
    }
}

/* Escritorio */

@media (min-width: 768px) {
    :root {
        --gutter: 24px;
    }

    .cart-layout {
        grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
        align-items: start;
    }

    .cart-line {
        grid-template-columns: 80px 1fr auto;
    }

    .cart-line-image {
        width: 80px;
        height: 80px;
    }

    .cart-line-total {
        grid-column: auto;
    }

    .add-to-cart {
        grid-template-columns: auto minmax(0, 260px);
    }

    .product-detail {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 2rem;
        padding: 1.5rem;
    }

    .product-grid {
        gap: 1rem;
    }

    .filters {
        grid-template-columns: repeat(3, 1fr) auto;
        align-items: end;
    }

    .filters .button {
        margin-bottom: 0.5rem;
    }

    .pagination {
        grid-template-columns: max-content auto max-content;
        justify-content: center;
    }

    h1 {
        font-size: 1.85rem;
    }

    .header-inner {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "brand search actions";
        gap: 1.5rem;
        padding: 0.75rem var(--gutter);
    }

    .brand-logo {
        max-width: 180px;
        height: 40px;
    }

    /* Barra del auto en una fila: titulo, Marca, Modelo, Año y Buscar. */
    .vehicle-bar-toggle {
        display: none;
    }

    .vehicle-bar-panel,
    .js .vehicle-bar-panel:not(.is-open) {
        display: flex;
        align-items: flex-end;
        gap: 1rem;
        padding-top: 0;
    }

    .vehicle-bar-title {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        flex: 0 0 auto;
        min-height: var(--tap);
        margin: 0;
        font-weight: 800;
        color: var(--blue);
        white-space: nowrap;
    }

    .vehicle-bar-title svg {
        width: 22px;
        height: 22px;
    }

    .vehicle-bar .vehicle-search {
        flex: 1;
        grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
        align-items: end;
        gap: 0.75rem;
    }

    .vehicle-bar .field label {
        margin-bottom: 0.15rem;
        font-size: 0.85rem;
    }

    .vehicle-search-actions .button {
        width: auto;
        min-width: 7rem;
    }

    .carousel-arrow {
        display: inline-flex;
    }

    /* Con 1400 px un banner 16:9 mediria casi 800 px de alto: se limita y se ve completo. */
    .carousel-slide {
        max-height: 520px;
    }

    .carousel-track {
        max-height: 520px;
    }

    .scroller-arrow {
        display: inline-flex;
    }

    .scroller-arrow[hidden] {
        display: none;
    }

    .type-row {
        grid-auto-columns: 150px;
        gap: 1rem;
    }

    .icon-label {
        display: inline;
    }

    .page {
        padding: 1.5rem var(--gutter) 3rem;
    }

    .hero {
        padding: 2rem;
    }

    .hero-actions {
        grid-template-columns: repeat(2, max-content);
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .panel {
        padding: 2rem;
    }

    .order-actions {
        grid-template-columns: repeat(2, max-content);
    }

    .order-actions form,
    .order-actions .button {
        width: auto;
    }

    .toast {
        left: auto;
        right: 1.5rem;
        max-width: 360px;
    }
}

/* Rejilla de productos: 2 columnas en celular, 3 desde 800 px, 4 desde 1100 px y 5 desde 1400 px. */

@media (min-width: 800px) {
    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .product-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* Movimiento reducido: sin desplazamientos animados. */

@media (prefers-reduced-motion: reduce) {
    .carousel-track,
    .type-row {
        scroll-behavior: auto;
    }

    .vehicle-bar-chevron {
        transition: none;
    }
}
