/* Impecable — mobile-first + temas visuales (industrial | fresco) */
:root {
    --bottom-nav-h: 3.75rem;
    --font-ui: "Source Sans 3", "Segoe UI", sans-serif;
    --font-marca: "Sora", "Source Sans 3", sans-serif;
    --radius-ui: 0.75rem;
    --shadow-nav: 0 -2px 14px rgba(15, 23, 42, 0.07);
}

/* Tema A — limpio industrial (B2B / petróleo-teal) */
html[data-tema="industrial"],
html:not([data-tema]) {
    --color-marca: #0f5c4c;
    --color-marca-rgb: 15, 92, 76;
    --color-marca-suave: #e6f2ef;
    --color-marca-borde: #b7d5cd;
    --color-fondo: #eef2f1;
    --color-fondo-grad: linear-gradient(165deg, #e8efed 0%, #f5f7f6 48%, #eef2f1 100%);
    --color-superficie: #ffffff;
    --color-texto: #14221f;
    --color-texto-suave: #5a6b66;
    --color-borde: #d5e0dc;
    --color-topbar: rgba(255, 255, 255, 0.92);
    --bs-primary: #0f5c4c;
    --bs-primary-rgb: 15, 92, 76;
    --bs-link-color: #0f5c4c;
    --bs-link-hover-color: #0a4338;
    --bs-focus-ring-color: rgba(15, 92, 76, 0.35);
}

/* Tema B — claro fresco (higiene / limpieza) */
html[data-tema="fresco"] {
    --color-marca: #1a8f9c;
    --color-marca-rgb: 26, 143, 156;
    --color-marca-suave: #e7f6f8;
    --color-marca-borde: #b5e0e6;
    --color-fondo: #f3fafb;
    --color-fondo-grad: linear-gradient(165deg, #e8f6f8 0%, #f7fcfd 50%, #f3fafb 100%);
    --color-superficie: #ffffff;
    --color-texto: #163038;
    --color-texto-suave: #5c737a;
    --color-borde: #d2e6ea;
    --color-topbar: rgba(255, 255, 255, 0.94);
    --bs-primary: #1a8f9c;
    --bs-primary-rgb: 26, 143, 156;
    --bs-link-color: #1a8f9c;
    --bs-link-hover-color: #147480;
    --bs-focus-ring-color: rgba(26, 143, 156, 0.35);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

body.app-shell {
    background: var(--color-fondo);
    background-image: var(--color-fondo-grad);
    background-attachment: fixed;
    color: var(--color-texto);
    font-family: var(--font-ui);
    margin: 0;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-topbar {
    z-index: 1020;
    background: var(--color-topbar) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom-color: var(--color-borde) !important;
}

.app-topbar .container {
    max-width: 100%;
}

.app-content {
    min-height: 40vh;
    max-width: 100%;
    /* Hueco generoso bajo la barra fija: últimas tarjetas/botones siempre alcanzables */
    padding-bottom: calc(var(--bottom-nav-h) + 5rem + env(safe-area-inset-bottom, 0px));
}

/* Espacio real al final de formularios largos (botón en el flujo, no encima de campos) */
.form-end-spacer,
.page-end-spacer {
    height: calc(var(--bottom-nav-h) + 2rem + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
    pointer-events: none;
}

.brand-btn {
    max-width: calc(100% - 7.5rem);
    min-width: 0;
}

.brand-name {
    display: block;
    font-family: var(--font-marca);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
    color: var(--color-texto) !important;
}

.tema-switch {
    display: inline-flex;
    flex-shrink: 0;
    border: 1px solid var(--color-borde);
    border-radius: 999px;
    overflow: hidden;
    background: var(--color-superficie);
}

.tema-switch button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--color-texto-suave);
    font-family: var(--font-ui);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.28rem 0.5rem;
    line-height: 1.2;
    cursor: pointer;
}

.tema-switch button.is-on {
    background: var(--color-marca);
    color: #fff;
}

.btn-notif {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-superficie) !important;
    border-color: var(--color-borde) !important;
}

#badge-notif-nav {
    font-size: 0.65rem;
    min-width: 1.1rem;
    display: none;
}

#badge-notif-nav.is-on {
    display: inline-block;
}

#badge-stock-nav.is-on {
    display: inline-block;
}

/* Bootstrap primary alineado al tema */
.btn-primary {
    --bs-btn-bg: var(--color-marca);
    --bs-btn-border-color: var(--color-marca);
    --bs-btn-hover-bg: color-mix(in srgb, var(--color-marca) 88%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--color-marca) 88%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--color-marca) 80%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--color-marca) 80%, #000);
    --bs-btn-disabled-bg: var(--color-marca);
    --bs-btn-disabled-border-color: var(--color-marca);
}

.btn-outline-primary {
    --bs-btn-color: var(--color-marca);
    --bs-btn-border-color: var(--color-marca);
    --bs-btn-hover-bg: var(--color-marca);
    --bs-btn-hover-border-color: var(--color-marca);
    --bs-btn-active-bg: var(--color-marca);
    --bs-btn-active-border-color: var(--color-marca);
}

.text-bg-primary {
    background-color: var(--color-marca) !important;
}

.btn-link {
    color: var(--color-marca);
}

.btn-link:hover {
    color: var(--bs-link-hover-color);
}

.rastreo-pasos {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.rastreo-dot {
    flex: 1;
    height: 0.28rem;
    border-radius: 999px;
    background: #e2e8f0;
}

.rastreo-dot.is-on {
    background: var(--color-marca);
}

.notif-item {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    cursor: pointer;
}

.notif-unread {
    border-color: var(--color-marca-borde) !important;
    background: var(--color-marca-suave) !important;
}

/* Registro / auth compacto */
.auth-compact {
    max-width: 22rem;
    font-size: 0.82rem;
}

.auth-compact .auth-title {
    font-size: 1.05rem;
    font-weight: 650;
    margin: 0 0 0.65rem;
}

.auth-compact .auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.auth-compact .auth-field .form-label {
    font-size: 0.68rem;
    margin-bottom: 0.05rem;
    color: var(--color-texto-suave);
    line-height: 1.15;
}

.auth-compact .form-control,
.auth-compact .form-select {
    font-size: 0.78rem;
    padding: 0.22rem 0.45rem;
    min-height: 1.85rem;
}

.auth-compact textarea.form-control {
    min-height: 2.2rem;
}

.auth-compact .auth-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.28rem;
}

.auth-compact .auth-section {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--color-texto-suave);
    margin: 0.35rem 0 0;
    padding-top: 0.2rem;
    border-top: 1px solid var(--color-borde);
}

.auth-compact .auth-footer {
    font-size: 0.75rem;
    margin: 0.65rem 0 0;
    color: var(--color-texto-suave);
}

.auth-compact .alert {
    font-size: 0.78rem;
    margin-bottom: 0.5rem;
}

.btn-buscar-cat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.375rem;
}

#modalReportarPago .modal-content {
    font-size: 0.82rem;
}

#modalReportarPago .modal-header {
    border-bottom-color: #eef2f7;
}

#modalReportarPago .auth-title {
    font-size: 0.95rem;
}

.datos-pago-box {
    font-size: 0.75rem;
    line-height: 1.35;
    padding: 0.55rem 0.65rem;
    border-radius: 0.45rem;
    background: var(--color-marca-suave);
    border: 1px solid var(--color-marca-borde);
    color: var(--color-texto);
}

.app-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    min-height: var(--bottom-nav-h);
    padding: 0.3rem 0.2rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
    background: var(--color-superficie);
    border-top: 1px solid var(--color-borde);
    box-shadow: var(--shadow-nav);
}

.app-bottom-nav button.nav-item {
    -webkit-appearance: none !important;
    appearance: none !important;
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    border: 0 !important;
    border-radius: 0.5rem;
    background: transparent !important;
    color: var(--color-texto-suave);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.25rem;
    font-size: 0.7rem;
    line-height: 1.1;
    font-weight: 500;
}

.app-bottom-nav button.nav-item.active {
    color: var(--color-marca);
    font-weight: 600;
}

.app-bottom-nav .nav-icon-wrap {
    position: relative;
    display: inline-flex;
    line-height: 0;
}

#badge-carrito-nav {
    position: absolute;
    top: -0.35rem;
    right: -0.65rem;
    font-size: 0.65rem;
    min-width: 1.1rem;
    display: none;
}

#badge-carrito-nav.is-on {
    display: inline-block;
}

.producto-foto {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
}

.producto-foto-modal {
    max-height: 200px;
    width: 100%;
    object-fit: cover;
}

#btn-vista-lista.active,
#btn-vista-mosaico.active {
    background: var(--color-marca);
    color: #fff;
    border-color: var(--color-marca);
}

.catalogo {
    max-width: 72rem;
    margin-inline: auto;
    overflow-x: hidden;
}

.tabla-productos-wrap {
    width: 100%;
    max-width: 36rem;
    margin-inline: auto;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
}

@media (min-width: 768px) {
    .tabla-productos {
        font-size: 0.95rem;
    }

    .tabla-productos th.col-precio,
    .tabla-productos td.col-precio {
        width: 7.5rem;
        padding: 0.85rem 0;
    }

    .tabla-productos td.col-info {
        padding: 0.85rem 0.75rem 0.85rem 0;
    }

    .prod-desc {
        font-size: 0.8rem;
        white-space: normal;
    }
}

.tabla-productos {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 0;
}

.tabla-productos thead {
    display: none;
}

.tabla-productos th.col-precio,
.tabla-productos td.col-precio {
    width: 5.5rem;
    text-align: right;
    white-space: nowrap;
    vertical-align: middle;
    padding: 0.85rem 0;
}

.tabla-productos th.col-num,
.tabla-productos td.col-num {
    display: none;
}

.tabla-productos td.col-info {
    width: auto;
    max-width: 0;
    padding: 0.85rem 0.75rem 0.85rem 0;
    vertical-align: middle;
    overflow: hidden;
}

.tabla-productos tbody tr {
    cursor: pointer;
    border-bottom: 1px solid var(--color-borde);
    background: transparent !important;
}

.tabla-productos tbody tr:nth-child(odd),
.tabla-productos tbody tr:nth-child(even) {
    background: transparent !important;
}

.tabla-productos tbody tr:last-child {
    border-bottom: 0;
}

.tabla-productos tbody tr:active,
.tabla-productos tbody tr:hover {
    background: color-mix(in srgb, var(--color-marca-suave) 55%, transparent) !important;
}

.prod-nombre {
    display: block;
    font-family: var(--font-marca);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-texto);
    line-height: 1.25;
}

.prod-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--color-texto-suave);
    margin-top: 0.15rem;
    line-height: 1.3;
}

.prod-precio {
    font-family: var(--font-marca);
    font-weight: 700;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: var(--color-texto);
    letter-spacing: -0.02em;
}

.tabla-leyenda {
    display: none;
}

.btn-toggle-pass {
    min-width: 3rem;
}

.qty-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.qty-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.qty-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.qty-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    font-size: 1.35rem;
    line-height: 1;
    border-radius: 0.5rem !important;
    font-weight: 600;
}

.qty-value {
    min-width: 2rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.sucursal-card {
    width: 100%;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.sucursal-card:active {
    background: #f1f5f9 !important;
}

.form-sucursal-alta {
    margin-top: 0;
}

/* Panel de cuenta — mosaico de accesos */
.cuenta-panel {
    max-width: 28rem;
}

.cuenta-saludo {
    font-size: 0.85rem;
    color: #64748b;
}

.cuenta-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (min-width: 480px) {
    .cuenta-menu {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.cuenta-tile {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 6.25rem;
    padding: 0.85rem 0.5rem;
    margin: 0;
    border: 1px solid var(--color-borde);
    border-radius: 0.85rem;
    background: var(--color-superficie);
    color: var(--color-texto);
    text-align: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cuenta-tile:active,
.cuenta-tile:hover {
    background: var(--color-marca-suave);
    border-color: var(--color-marca-borde);
    color: var(--color-marca);
}

.cuenta-tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    background: var(--color-marca-suave);
    color: var(--color-marca);
}

.cuenta-tile-label {
    font-size: 0.72rem;
    line-height: 1.25;
    font-weight: 500;
    color: inherit;
    max-width: 7.5rem;
}

.cuenta-tile-danger {
    color: #b42318;
}

.cuenta-tile-danger .cuenta-tile-icon {
    background: #fef3f2;
    color: #b42318;
}

.cuenta-tile-danger:hover,
.cuenta-tile-danger:active {
    background: #fff5f5;
    border-color: #f9c6c1;
    color: #912018;
}

.pedido-card {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    cursor: default;
    background: #fff;
}

.pedido-card:active {
    background: #fff !important;
}

.producto-card-tap {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.producto-card-tap:hover,
.producto-card-tap:focus-visible {
    border-color: var(--color-marca-borde) !important;
    box-shadow: 0 0 0 2px rgba(var(--color-marca-rgb), 0.14);
    outline: none;
}

.cat-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin: 0.65rem auto 0;
    max-width: 36rem;
}

.cat-pager-info {
    font-size: 0.75rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.inv-card {
    font-size: 0.78rem;
}

.inv-card-foto {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    max-height: 5.5rem;
}

.inv-card-titulo {
    font-size: 0.78rem !important;
    font-weight: 600;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    color: #0f172a;
}

.inv-lista-row {
    cursor: pointer;
}

#inv-vista-lista.active,
#inv-vista-mosaico.active {
    background: var(--color-marca);
    color: #fff;
    border-color: var(--color-marca);
}

.crop-viewport {
    width: min(100%, 280px);
    aspect-ratio: 1;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    background: #0f172a;
    border-radius: 0.4rem;
    touch-action: none;
    cursor: grab;
    border: 1px solid #334155;
}

.crop-viewport:active {
    cursor: grabbing;
}

.crop-viewport img {
    position: absolute;
    max-width: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

#modalCropImg {
    z-index: 1060;
}

.inv-precio-usd {
    font-weight: 600;
    color: #0f172a;
}

.inv-precio-ves {
    color: #64748b;
}

.inv-lista-row .prod-desc {
    white-space: normal;
}

/* Descuento cliente (admin): slider tipo volumen 0–5 % */
.cli-desc-range {
    width: 100%;
    height: 1.35rem;
    margin: 0.15rem 0 0;
    cursor: pointer;
}

.cli-desc-range:focus {
    outline: none;
}

.cli-desc-range::-webkit-slider-runnable-track {
    height: 0.35rem;
    border-radius: 999px;
    background: #dee2e6;
}

.cli-desc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: -0.375rem;
    border-radius: 50%;
    background: var(--color-marca);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(var(--color-marca-rgb), 0.35);
}

.cli-desc-range::-moz-range-track {
    height: 0.35rem;
    border-radius: 999px;
    background: #dee2e6;
}

.cli-desc-range::-moz-range-thumb {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    background: var(--color-marca);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(var(--color-marca-rgb), 0.35);
}

/* Dashboard admin — KPIs compactos */
.dash-admin .dash-chart {
    height: 5.5rem;
}

.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.dash-kpi {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.1rem;
    min-height: 4.25rem;
    margin: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--color-borde);
    border-radius: 0.75rem;
    background: var(--color-superficie);
    color: var(--color-texto);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.dash-kpi:hover,
.dash-kpi:active {
    background: var(--color-marca-suave);
    border-color: var(--color-marca-borde);
}

.dash-kpi-n {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-texto);
}

.dash-kpi-l {
    font-size: 0.7rem;
    line-height: 1.25;
    color: var(--color-texto-suave);
}

.dash-kpi-warn {
    border-color: #f0d48a;
    background: #fffbeb;
}

.dash-kpi-warn .dash-kpi-n { color: #b45309; }

.dash-kpi-info {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.dash-kpi-info .dash-kpi-n { color: #1d4ed8; }

.dash-kpi-danger {
    border-color: #f5c2c7;
    background: #fff5f5;
}

.dash-kpi-danger .dash-kpi-n { color: #b42318; }

.dash-modal-row {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: transparent;
    padding: 0.55rem 0;
    margin: 0;
    cursor: pointer;
    color: inherit;
}

.dash-modal-row:last-child { border-bottom: 0; }

.dash-modal-row:hover { background: #f8fafc; }

/* Detalle de pedido — documento, no tarjetas */
.doc {
    max-width: 26rem;
    padding: 0 0.15rem;
}

.doc-back {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--color-texto-suave);
    font-size: 0.78rem;
    padding: 0;
    margin: 0 0 1rem;
    cursor: pointer;
}

.doc-head {
    margin-bottom: 1.35rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-borde);
}

.doc-kicker {
    font-family: var(--font-marca);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-texto-suave);
    margin-bottom: 0.2rem;
}

.doc-title {
    font-family: var(--font-marca);
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0 0 0.35rem;
    color: var(--color-texto);
}

.doc-meta {
    margin: 0 0 0.65rem;
    font-size: 0.8rem;
    color: var(--color-texto-suave);
}

.doc-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.doc-pill {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.2rem 0.45rem;
    color: var(--color-texto-suave);
    border: 1px solid var(--color-borde);
    background: transparent;
}

.doc-pill-reportado {
    color: #92400e;
    border-color: #f0d48a;
}

.doc-pill-pagado {
    color: var(--color-marca);
    border-color: var(--color-marca-borde);
    background: var(--color-marca-suave);
}

.doc-block {
    margin-bottom: 1.25rem;
    padding-bottom: 1.15rem;
    border-bottom: 1px solid var(--color-borde);
}

.doc-block:last-of-type {
    border-bottom: 0;
}

.doc-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-texto-suave);
    margin-bottom: 0.35rem;
}

.doc-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-texto);
    line-height: 1.3;
}

.doc-sub {
    font-size: 0.82rem;
    color: var(--color-texto-suave);
    line-height: 1.4;
    margin-top: 0.15rem;
}

.doc-list {
    margin: 0.4rem 0 0;
    padding-left: 1rem;
    font-size: 0.82rem;
    color: var(--color-texto-suave);
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.doc-table td {
    padding: 0.45rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--color-borde) 70%, transparent);
    vertical-align: top;
}

.doc-table tr:last-child td {
    border-bottom: 0;
}

.doc-qty {
    width: 2rem;
    color: var(--color-texto-suave);
    font-variant-numeric: tabular-nums;
}

.doc-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.doc-totales {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--color-texto);
}

.doc-tot-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.86rem;
    padding: 0.15rem 0;
}

.doc-tot-row.strong {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-marca);
}

.doc-tot-row.muted {
    color: var(--color-texto-suave);
    font-size: 0.78rem;
}

.doc-tot-row.end span:last-child {
    font-variant-numeric: tabular-nums;
}

.doc-link {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: var(--color-marca);
    text-decoration: none;
    font-weight: 600;
}

.doc-actions {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0.5rem 0 1rem;
}

.doc-btn {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.65rem 0.85rem;
    border-radius: 0.2rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.doc-btn-ghost {
    background: transparent;
    border-color: var(--color-borde);
    color: var(--color-texto);
}

.doc-btn-ghost:hover {
    border-color: var(--color-marca);
    color: var(--color-marca);
}

.doc-btn-main {
    background: var(--color-marca);
    border-color: var(--color-marca);
    color: #fff;
}

.doc-admin {
    margin-top: 0.25rem;
}

.doc-seg {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
}

.doc-seg-btn {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    border: 1px solid var(--color-borde);
    background: transparent;
    color: var(--color-texto-suave);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.55rem 0.4rem;
    border-radius: 0.2rem;
    cursor: pointer;
}

.doc-seg-btn.is-on {
    background: var(--color-texto);
    border-color: var(--color-texto);
    color: #fff;
}

/* ——— Anti-Excel: lenguaje de producto en toda la app ——— */
.app-content h1.h5,
.app-content .h5.mb-3,
.app-content .h5.mb-2,
.app-content .h5.mb-0,
.app-content .h5.mb-1 {
    font-family: var(--font-marca);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-texto);
    line-height: 1.15;
}

.page-kicker {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-texto-suave);
    margin: 0 0 0.2rem;
}

.producto-item.producto-card-tap,
.inv-card.producto-card-tap {
    border: 0 !important;
    border-radius: 0.15rem !important;
    background: var(--color-superficie) !important;
    box-shadow: none;
    padding: 0 !important;
    overflow: hidden;
}

.producto-item .producto-foto,
.inv-card .inv-card-foto,
div.producto-foto {
    border-radius: 0 !important;
    margin: 0 !important;
    max-height: none;
    height: auto;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: color-mix(in srgb, var(--color-borde) 55%, #fff);
    display: block;
}

.producto-item h2,
.inv-card-titulo {
    font-family: var(--font-marca) !important;
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.02em;
    padding: 0.55rem 0.65rem 0.1rem;
    margin: 0 !important;
    line-height: 1.25;
}

.producto-item > p,
.inv-card > p,
.inv-card > .d-flex {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.producto-item > p:last-child,
.inv-card > .d-flex:last-child {
    padding-bottom: 0.65rem;
}

.producto-card-tap:hover,
.producto-card-tap:focus-visible {
    border-color: transparent !important;
    box-shadow: 0 8px 24px rgba(20, 34, 31, 0.08) !important;
    outline: none;
    transform: translateY(-1px);
}

.pedido-card.border.rounded.bg-white,
.pedido-card.border.rounded,
article.border.rounded.bg-white.p-3,
.carrito-linea.border.rounded.bg-white,
.sucursal-card.border.rounded,
div.border.rounded.bg-white.p-3:not(.modal-content):not(.auth-compact) {
    border: 0 !important;
    border-radius: 0 !important;
    border-bottom: 1px solid var(--color-borde) !important;
    background: transparent !important;
    box-shadow: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.pedido-card {
    text-align: left;
    width: 100%;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: transparent !important;
}

.pedido-card:active {
    background: color-mix(in srgb, var(--color-marca-suave) 40%, transparent) !important;
}

.carrito .border.rounded.bg-white.d-flex {
    border: 0 !important;
    border-top: 1px solid var(--color-texto) !important;
    border-radius: 0 !important;
    background: transparent !important;
    margin-top: 0.5rem;
    padding: 1rem 0 !important;
}

.carrito .fs-5.fw-bold,
.carrito .fw-bold {
    font-family: var(--font-marca);
    letter-spacing: -0.02em;
}

.cuenta-header {
    margin-bottom: 1.5rem !important;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-borde);
}

.cuenta-saludo {
    font-size: 0.65rem !important;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-texto-suave) !important;
}

.cuenta-header .h5 {
    font-family: var(--font-marca);
    font-size: 1.5rem !important;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.cuenta-tile {
    border-radius: 0.2rem !important;
    min-height: 5.5rem;
    border-color: transparent !important;
    background: var(--color-superficie) !important;
    box-shadow: 0 1px 0 var(--color-borde);
}

.cuenta-tile-icon {
    border-radius: 0.35rem !important;
    background: transparent !important;
    color: var(--color-marca) !important;
}

.auth-title {
    font-family: var(--font-marca) !important;
    font-size: 1.45rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.03em;
}

.auth-compact .form-control,
.auth-compact .form-select,
.form-control-sm,
.form-select-sm {
    border-radius: 0.15rem !important;
    border-color: var(--color-borde) !important;
    min-height: 2.15rem;
}

.btn-sm,
.btn {
    border-radius: 0.15rem !important;
}

.badge.text-bg-light.border {
    background: transparent !important;
    border-color: var(--color-borde) !important;
    color: var(--color-texto-suave) !important;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.62rem !important;
    border-radius: 0.15rem !important;
}

.dash-ventas.border.rounded {
    border: 0 !important;
    border-bottom: 1px solid var(--color-borde) !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.dash-kpi {
    border-radius: 0.2rem !important;
}

.app-topbar {
    border-bottom-width: 1px !important;
}

.brand-name {
    font-size: 1.05rem !important;
}

.tema-switch {
    transform: scale(0.92);
    opacity: 0.7;
}

.qty-control .qty-btn {
    border-radius: 0.15rem !important;
}

#app > .text-muted {
    font-family: var(--font-marca);
    letter-spacing: -0.02em;
    color: var(--color-texto-suave) !important;
}

/* CCS — catálogo más cercano a la landing */
html[data-tema="ccs"] {
    --font-marca: 'Plus Jakarta Sans', system-ui, sans-serif;
    --color-primario: #3d8aa8;
    --color-texto: #16294a;
    --color-texto-suave: #5b6b82;
    --color-borde: #e3eaf0;
    --color-superficie: #fff;
    --color-fondo: #f2f8fb;
}
html[data-tema="ccs"] body.app-shell {
    background: var(--color-fondo);
}
html[data-tema="ccs"] .producto-item.producto-card-tap,
html[data-tema="ccs"] .inv-card.producto-card-tap {
    border: 1px solid var(--color-borde) !important;
    border-radius: 1rem !important;
    background: #fff !important;
    box-shadow: 0 10px 28px -22px rgba(22, 41, 74, 0.35);
    padding: 0.75rem !important;
}
html[data-tema="ccs"] .producto-item .producto-foto,
html[data-tema="ccs"] div.producto-foto {
    border-radius: 0.75rem !important;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: linear-gradient(160deg, #f4f9fb, #eaf4ee);
}
html[data-tema="ccs"] .app-bottom-nav {
    border-top: 1px solid var(--color-borde);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}







/* —— Drawer carrito (app SPA): encima de topbar (1020) y bottom-nav (1040) —— */
.app-shell .cart-overlay{
  position:fixed;inset:0;
  background:rgba(9,20,35,.5);
  backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);
  z-index:2100;
  opacity:0;pointer-events:none;transition:.3s;
}
.app-shell .cart-overlay.open{opacity:1;pointer-events:auto}
.app-shell .cart-drawer{
  position:fixed;top:0;right:0;bottom:0;
  width:min(430px,100%);
  max-width:100%;
  height:100%;
  height:100dvh;
  background:#fff;
  z-index:2110;
  transform:translateX(102%);
  transition:transform .38s cubic-bezier(.4,0,.2,1);
  display:flex;flex-direction:column;
  box-shadow:-24px 0 60px -24px rgba(0,0,0,.35);
  padding:0;
  margin:0;
}
.app-shell .cart-drawer[hidden],
.app-shell .cart-overlay[hidden]{display:none !important}
.app-shell .cart-drawer:not([hidden]){display:flex}
.app-shell .cart-drawer.open{transform:none}
.app-shell .cart-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:20px 22px;
  border-bottom:1px solid #e6edf3;
  flex-shrink:0;
}
.app-shell .cart-head h3{
  font-size:1.15rem;font-weight:800;letter-spacing:-.02em;
  margin:0;color:#16294a;font-family:'Plus Jakarta Sans',system-ui,sans-serif;
}
.app-shell .cart-close{
  width:38px;height:38px;border:0;border-radius:50%;
  background:#f3f6f9;color:#6b7c90;font-size:1.4rem;line-height:1;
  display:grid;place-items:center;cursor:pointer;transition:.2s;
}
.app-shell .cart-close:hover{background:#ffe8e8;color:#e5484d}
.app-shell .cart-body{
  flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;
  padding:16px 22px;
}
.app-shell .cart-empty{text-align:center;padding:60px 20px;color:#6b7c90;font-size:.88rem}
.app-shell .cart-empty b{display:block;color:#16294a;font-size:1rem;margin-bottom:4px}
.app-shell .cart-item{
  display:flex;gap:12px;padding:14px 0;
  border-bottom:1px solid #e6edf3;
}
.app-shell .cart-item-img{
  width:60px;height:60px;flex:0 0 60px;border-radius:12px;
  background:#f3f6f9;display:grid;place-items:center;overflow:hidden;
}
.app-shell .cart-item-img img{max-height:48px;max-width:48px;object-fit:contain}
.app-shell .cart-item-info{flex:1;min-width:0}
.app-shell .cart-item-info b{
  display:block;font-size:.9rem;font-weight:700;margin-bottom:2px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#16294a;
}
.app-shell .cart-item-info > span{font-size:.78rem;color:#6b7c90}
.app-shell .cart-item-actions{
  display:flex;align-items:center;justify-content:space-between;
  margin-top:8px;gap:10px;
}
.app-shell .qty{
  display:flex;align-items:center;gap:0;
  border:1px solid #d5dee8;border-radius:10px;overflow:hidden;
}
.app-shell .qty button{
  width:30px;height:30px;border:0;background:#fff;color:#6b7c90;
  font-weight:800;display:grid;place-items:center;cursor:pointer;
}
.app-shell .qty button:hover{background:#f3f6f9;color:#3d8aa8}
.app-shell .qty span{min-width:30px;text-align:center;font-size:.85rem;font-weight:700;color:#16294a}
.app-shell .cart-item-price{font-weight:800;color:#16294a;font-size:.95rem}
.app-shell .cart-remove{
  border:0;background:none;padding:0;font-size:.75rem;
  color:#b0bccb;font-weight:700;margin-top:6px;cursor:pointer;
}
.app-shell .cart-remove:hover{color:#e5484d}
.app-shell .cart-foot{
  padding:18px 22px calc(22px + env(safe-area-inset-bottom,0px));
  border-top:1px solid #e6edf3;
  background:#f7fafc;
  flex-shrink:0;
}
.app-shell .cart-total{
  display:flex;justify-content:space-between;align-items:baseline;
  margin-bottom:4px;
}
.app-shell .cart-total span{font-size:.88rem;color:#6b7c90;font-weight:600}
.app-shell .cart-total b{
  font-size:1.5rem;font-weight:800;letter-spacing:-.03em;color:#16294a;
}
.app-shell .cart-foot .cart-usd{
  margin:-2px 0 14px;font-size:.78rem;color:#6b7c90;font-weight:600;
}
.app-shell .cart-foot .btn-cart-pay{
  display:block;width:100%;border:0;border-radius:14px;
  padding:.9rem 1rem;font-size:.95rem;font-weight:800;color:#fff;
  background:linear-gradient(135deg,#3d8aa8 0%,#7cb85c 100%);
  box-shadow:0 10px 24px -12px rgba(61,138,168,.55);
  cursor:pointer;
}
.app-shell .cart-foot .btn-cart-pay:hover{filter:brightness(1.03)}
.app-shell.cart-is-open .app-topbar,
.app-shell.cart-is-open .app-bottom-nav{
  visibility:hidden;
  pointer-events:none;
}
@media(max-width:520px){
  .app-shell .cart-drawer{width:100%}
}
