@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=Barlow:wght@400;500;600;700&display=swap");

@media screen {
    :root {
        --almacen-ink: #1b2835;
        --almacen-bg: #e9edf1;
        --almacen-line: #cdd6df;
        --almacen-accent: #245b96;
        --almacen-hover: #194775;
        --almacen-font: "Barlow", "Segoe UI", system-ui, sans-serif;
        --almacen-heading: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
    }

    body.almacen-panel,
    body.almacen-acceso {
        background: var(--almacen-bg);
        color: var(--almacen-ink);
        font-family: var(--almacen-font);
    }

    .almacen-panel {
        --bg: var(--almacen-bg);
        --border: var(--almacen-line);
        --text: var(--almacen-ink);
        --sidebar-bg: var(--almacen-ink);
        --sidebar-t: #c5d0da;
    }

    .almacen-panel #main { min-height: 0; }
    .almacen-panel #topbar { min-height: 54px; }
    .almacen-panel #topbar h1,
    .almacen-acceso h1,
    .almacen-acceso h2,
    .almacen-acceso h3 {
        font-family: var(--almacen-heading);
        font-size: 1.45rem;
    }

    .almacen-panel .card,
    .almacen-acceso .card,
    .almacen-acceso .login-box {
        border: 1px solid var(--almacen-line);
        border-radius: 8px;
        box-shadow: 0 2px 8px rgb(27 40 53 / 8%);
    }

    .almacen-panel .btn-primary,
    .almacen-acceso .btn-submit-login,
    .almacen-acceso .card > .btn {
        background: var(--almacen-accent);
        color: #fff;
        border-radius: 6px;
        box-shadow: none;
    }

    .almacen-panel .btn-primary:hover,
    .almacen-acceso .btn-submit-login:hover,
    .almacen-acceso .card > .btn:hover {
        background: var(--almacen-hover);
    }

    .almacen-panel :focus-visible,
    .almacen-acceso :focus-visible {
        outline: 2px solid #4087d0;
        outline-offset: 2px;
    }

    .almacen-panel .sidebar-logo span {
        font-family: var(--almacen-heading);
        font-size: 1.25rem;
    }

    .almacen-panel .sidebar-logo small { font-family: var(--almacen-font); }
    .almacen-panel .btn-logout {
        background: transparent;
        border: 1px solid #78899a;
        color: #fff;
        white-space: nowrap;
    }
    .almacen-panel .btn-logout:hover { background: #354657; }
    .almacen-panel .nav-item.active {
        background: #354d64;
        border-color: #81b7eb;
        color: #fff;
    }

    .almacen-acceso { padding: 1rem; }
    .almacen-acceso .card { padding: 1.75rem; }
    .almacen-acceso .badge-erp { display: none; }
    .almacen-acceso.almacen-login { padding: 0; }
    .almacen-login .navbar,
    .almacen-login .hero-info,
    .almacen-login .features-section,
    .almacen-login .hero ~ section,
    .almacen-login footer:not(.almacen-footer) { display: none; }
    .almacen-login .hero {
        min-height: 100svh;
        display: grid;
        align-items: center;
        padding: 1rem;
        background: none;
    }
    .almacen-login .hero::before,
    .almacen-login .hero::after { display: none; }
    .almacen-login .hero-container {
        display: block;
        width: min(100%, 400px);
        margin: auto;
    }
    .almacen-login .login-box { background: #fff; color: var(--almacen-ink); }

    .almacen-login .acceso-info {
        margin-top: 1rem;
        padding: clamp(1rem, 2vw, 1.5rem);
        border: 1px solid var(--almacen-line);
        border-top: 3px solid var(--almacen-accent);
        border-radius: 8px;
        background: #f7f9fb;
        color: var(--almacen-ink);
    }

    .almacen-login .acceso-info h2 { margin: 0 0 .35rem; }
    .almacen-login .acceso-info p,
    .almacen-login .acceso-info dd {
        margin: 0;
        color: #46586a;
        font-size: .95rem;
        line-height: 1.45;
    }
    .almacen-login .acceso-info dl { margin: 1rem 0 0; }
    .almacen-login .acceso-info dt { margin-top: .65rem; font-weight: 700; }

    .almacen-panel .almacen-footer,
    .almacen-acceso .almacen-footer {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        width: 100%;
        box-sizing: border-box;
        gap: .25rem .65rem;
        margin: 1rem auto 0;
        padding: .75rem .5rem;
        border: 0;
        border-top: 1px solid var(--almacen-line);
        background: #dce3ea;
        color: #33465a;
        font-size: .8rem;
        text-align: center;
    }

    .almacen-footer a {
        color: var(--almacen-accent);
        font-weight: 700;
        text-underline-offset: .15em;
    }
}

@media screen and (max-width: 540px) {
    .almacen-panel .almacen-footer,
    .almacen-acceso .almacen-footer { flex-direction: column; }
    .almacen-footer-separador { display: none; }
}

@media print {
    .almacen-footer { display: none; }
}

.venta-pestanas:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-bottom: .85rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--border);
}
.venta-pestana { display: inline-flex; }
.venta-pestana button:first-child { border-radius: 5px 0 0 5px; }
.venta-pestana button:last-child { border-radius: 0 5px 5px 0; }
.venta-pestana button[aria-pressed="true"] { background: #245b96; color: #fff; }

.almacen-icon { width: 1.35rem; height: 1.35rem; flex: none; vertical-align: middle; }
@media screen {
    .almacen-login .hero { background: #e9eff5; }
    .almacen-login .acceso-marca {
        grid-area: marca;
        display: flex;
        align-items: center;
        gap: .7rem;
        margin-bottom: .7rem;
        color: #183451;
        font-size: 1.05rem;
        font-weight: 700;
    }
    .almacen-login .acceso-marca img {
        width: 46px;
        height: 38px;
        object-fit: contain;
        border-radius: 6px;
        background: #fff;
    }
    .almacen-login .acceso-presentacion { grid-area: presentacion; }
    .almacen-login .acceso-presentacion-encabezado {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        min-height: clamp(215px, 20vw, 290px);
        padding: clamp(1.2rem, 3vw, 2.25rem);
        border-radius: 14px;
        color: #fff;
        background:
            linear-gradient(90deg, rgb(12 29 48 / 95%), rgb(12 29 48 / 78%) 52%, rgb(12 29 48 / 14%)),
            #102941 url("/img/almacen-acceso.png") center 48% / cover no-repeat;
    }
    .almacen-login .acceso-presentacion-encabezado h2 {
        max-width: 16ch;
        margin: 0 0 .65rem;
        font-size: clamp(2rem, 3.5vw, 3.3rem);
        line-height: 1;
    }
    .almacen-login .acceso-presentacion-encabezado > p:last-child {
        max-width: 53ch;
        margin: 0;
        color: #d5e4f2;
        line-height: 1.5;
    }
    .almacen-login .acceso-capacidades {
        display: grid;
        gap: .65rem 1.25rem;
        margin-top: .8rem;
    }
    .almacen-login .acceso-info {
        margin: 0;
        padding: .75rem .85rem;
        border: 0;
        border-radius: 10px;
        background: #fff;
        color: #183451;
    }
    .almacen-login .acceso-info h2 { color: #183451; font-size: 1.25rem; }
    .almacen-login .acceso-info dl { margin-top: .5rem; }
    .almacen-login .acceso-info dt {
        display: flex;
        align-items: center;
        gap: .55rem;
    }
    .almacen-login .acceso-info dt .almacen-icon { color: #245b96; }
    .almacen-login .acceso-info dd { padding-inline-start: 1.9rem; color: #46586a; font-size: .87rem; }
    .almacen-login .login-box { border-radius: 14px; padding: clamp(1.3rem, 3vw, 2rem); }
    .almacen-login .login-box-logo { display: none; }
    .almacen-login .login-box-header { text-align: left; }
    .almacen-login .login-box-header h3 { font-size: 2.15rem; }
    .almacen-login .acceso-presentacion { margin-top: 1rem; }
    .almacen-login .login-box-footer .almacen-icon,
    .almacen-login .input-icon .almacen-icon { width: 1rem; height: 1rem; color: #385d80; }
}

@media screen and (min-width: 760px) {
    .almacen-login .hero-container {
        display: grid;
        width: min(100%, 1180px);
        grid-template-columns: minmax(0, 1fr) minmax(310px, 380px);
        grid-template-areas: "marca marca" "presentacion acceso" "pie pie";
        align-items: center;
        gap: 1rem clamp(1rem, 2.5vw, 2.5rem);
    }
    .almacen-login .acceso-presentacion { margin-top: 0; }
    .almacen-login .acceso-marca { margin-bottom: 0; }
    .almacen-login .login-box { grid-area: acceso; }
    .almacen-login .almacen-footer { grid-area: pie; margin-top: 0; }
}

@media screen and (min-width: 1050px) {
    .almacen-login .acceso-capacidades { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen {
    #modal-venta { padding: .5rem; }

    #modal-venta .venta-ventana {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 1320px;
        max-height: calc(100dvh - 1rem) !important;
        overflow: hidden;
        padding: clamp(.65rem, 1.5vw, 1.15rem);
    }

    #modal-venta .venta-contenido {
        min-height: 0;
        overflow-y: auto;
        padding: .15rem .25rem .3rem;
        overscroll-behavior: contain;
    }

    #modal-venta .venta-cierre {
        flex: none;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: .55rem 1rem;
        margin-top: .25rem;
        padding-top: .65rem;
        border-top: 1px solid var(--border);
    }

    #modal-venta .venta-totales { font-size: .95rem; }
    #modal-venta .modal-footer { flex: 1 1 auto; margin: 0; gap: .4rem; }

    #modal-venta .venta-productos-barra,
    #modal-venta .venta-pagos-barra {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: .4rem;
        margin-bottom: .3rem;
        font-size: .86rem;
    }

    #modal-venta .venta-formas-pago {
        padding: .35rem .65rem .4rem;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 6px;
    }

    #modal-venta .venta-formas-pago :is(th, td) { padding-block: .2rem; }
    #modal-venta #venta-pagos-restante {
        margin-top: .25rem;
        text-align: right;
        font-size: .8rem;
        color: var(--muted);
    }

    #modal-venta .venta-entrega {
        min-inline-size: 0;
        margin: .35rem 0 .65rem;
        padding: .25rem .65rem .4rem;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: var(--bg);
    }

    #modal-venta .venta-entrega legend {
        padding-inline: .25rem;
        font-size: .85rem;
        font-weight: 700;
    }

    #modal-venta .venta-entrega-opciones {
        display: inline-flex;
        flex-wrap: wrap;
        gap: .2rem .65rem;
    }

    #modal-venta .venta-entrega-opciones label {
        display: inline-flex;
        align-items: center;
        gap: .25rem;
        min-height: 28px;
        padding-inline: .45rem;
        border: 1px solid transparent;
        border-radius: 5px;
        font-weight: 600;
        cursor: pointer;
    }

    #modal-venta .venta-entrega-opciones label:has(input:checked) {
        background: #edf5ff;
        border-color: #98b5d4;
        color: #174574;
    }
    #modal-venta .venta-entrega-opciones input { width: auto; margin: 0; accent-color: #245b96; }
    #modal-venta #venta-aviso-despacho { color: var(--muted); margin-inline-start: .65rem; }
}

#modal-venta .venta-productos-lista {
    overflow-x: auto;
}

@media screen and (max-width: 620px) {
    #modal-venta .venta-entrega-opciones label { min-height: 36px; }
    #modal-venta #venta-aviso-despacho { display: block; margin: .2rem 0 0; }
}

@media screen and (min-width: 769px) {
    body.almacen-panel { flex-direction: column; }
    .almacen-panel #content {
        width: 100%;
        max-width: 1600px;
        margin: 0 auto;
    }
}

@media screen {
    .almacen-menu-visible #sidebar {
        position: static !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "marca salida" "modulos modulos";
        width: 100% !important;
        height: auto !important;
        padding: .4rem .65rem .55rem;
        gap: .25rem .65rem;
    }

    .almacen-menu-visible .sidebar-logo {
        grid-area: marca;
        border: 0;
        padding: .25rem 0;
    }

    .almacen-menu-visible .sidebar-footer {
        grid-area: salida;
        border: 0;
        padding: 0;
    }

    .almacen-menu-visible #sidebar nav {
        grid-area: modulos;
        align-items: stretch;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: .25rem;
        padding: 0;
        overflow: visible;
    }

    .almacen-menu-visible .nav-item {
        border: 0;
        border-bottom: 2px solid transparent;
        border-radius: 4px;
        padding: .35rem .45rem;
        min-height: 38px;
        gap: .35rem;
        font-size: .85rem;
        line-height: 1.15;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .almacen-menu-visible .nav-section { display: none; }
    .almacen-menu-visible #main { height: auto !important; }
    .almacen-menu-visible #sidebar-backdrop { display: none !important; }
    .almacen-menu-visible .sidebar-footer .user-chip { margin-bottom: .25rem; }
    .almacen-menu-visible #hamburger-btn { display: none !important; }
}

@media screen and (max-width: 950px) {
    .almacen-menu-visible #sidebar nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media screen and (max-width: 620px) {
    .almacen-menu-visible #sidebar nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .almacen-menu-visible .nav-item { min-height: 44px; font-size: .8rem; }
    .almacen-menu-visible .sidebar-logo span { font-size: 1.05rem; }
    .almacen-menu-visible .sidebar-logo img { width: 28px; height: 28px; }
}

@media screen {
    .almacen-sede #sidebar {
        padding-inline: clamp(.65rem, 2vw, 1.5rem);
    }

    .almacen-sede .sidebar-footer {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: .4rem;
        min-width: 0;
    }

    .almacen-sede .sidebar-footer .user-chip {
        min-width: 0;
        margin: 0 .35rem 0 0;
        overflow-wrap: anywhere;
    }

    .almacen-sede .sidebar-footer .btn-logout {
        width: auto;
        margin: 0;
        padding: .35rem .6rem;
    }

    .almacen-sede #sidebar nav {
        padding-top: .35rem;
        border-top: 1px solid #405063;
    }
}

@media screen and (min-width: 1250px) {
    .almacen-sede #sidebar nav {
        grid-template-columns: repeat(9, minmax(0, 1fr));
    }
}

@media screen and (max-width: 620px) {
    .almacen-sede #sidebar {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "marca" "salida" "modulos";
    }

    .almacen-sede .sidebar-footer { justify-content: flex-start; }
    .almacen-sede .sidebar-footer .user-avatar { display: none; }
    .almacen-sede .sidebar-footer .btn-logout { min-height: 36px; }
    .almacen-sede .nav-item { justify-content: center; text-align: center; }
    .almacen-sede .nav-item .icon { display: none; }
}

#modulos-movil { display: none; }

@media screen and (max-width: 1024px) {
    body.almacen-menu-visible {
        display: block;
        height: auto;
        min-height: 100dvh;
        overflow: visible !important;
    }

    .almacen-menu-visible #sidebar {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "marca abrir" "modulos modulos" "salida salida";
        padding: .45rem .75rem;
        gap: .35rem .65rem;
    }

    .almacen-menu-visible #modulos-movil {
        grid-area: abrir;
        display: block;
        min-height: 42px;
        padding: .4rem .8rem;
        border: 1px solid #8299b0;
        border-radius: 6px;
        background: #294764;
        color: #fff;
        font: 600 .9rem var(--almacen-font);
        cursor: pointer;
    }

    .almacen-menu-visible #sidebar:not(.menu-movil-abierto) :is(nav, .sidebar-footer) {
        display: none;
    }

    .almacen-menu-visible #sidebar .sidebar-footer { justify-content: flex-start; }
    .almacen-menu-visible #sidebar .nav-item { min-height: 44px; align-items: center; }

    .almacen-menu-visible #main,
    .almacen-menu-visible #content {
        width: 100%;
        min-width: 0;
        height: auto !important;
        overflow: visible;
    }

    .almacen-menu-visible #content { padding: clamp(.65rem, 2vw, 1.25rem); }
    .almacen-menu-visible #topbar { padding: .65rem .85rem; }
    .almacen-menu-visible :is(.module, .card, .form-group, .table-wrap, .items-table-wrap) {
        min-width: 0;
        max-width: 100%;
    }

    .almacen-menu-visible :is(#content, .modal-box) div[style*="grid-template-columns"] > * { min-width: 0; }
    .almacen-menu-visible :is(.card-header, .tabs-nav, #topbar, .modal-footer) { flex-wrap: wrap; }
    .almacen-menu-visible :is(.modal-box, #content) :is(input, select, textarea, canvas) { max-width: 100%; }
    .almacen-menu-visible canvas { max-height: 350px; }
}

@media screen and (max-width: 900px) {
    .almacen-menu-visible #sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .almacen-menu-visible #sidebar .nav-item { justify-content: flex-start; text-align: left; }

    .almacen-menu-visible :is(#content, .modal-box)
        div[style*="grid-template-columns"]:not([style*="auto-fit"]):not([style*="auto-fill"]) {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .almacen-menu-visible :is(#content, .modal-box) .form-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .almacen-menu-visible :is(#content, .modal-box) :is(table, [style*="overflow-x:auto"]) {
        max-width: 100%;
    }

    .almacen-menu-visible :is(#content, .modal-box) table {
        display: block;
        min-width: 0 !important;
        overflow-x: auto;
    }

    .almacen-menu-visible :is(#content, .modal-box) :is(th, td) { overflow-wrap: anywhere; }
    .almacen-menu-visible :is(#content, .modal-box) .form-group > :is(input, select, textarea) { min-width: 0 !important; }
    .almacen-menu-visible .card-header { gap: .5rem; }
    .almacen-menu-visible .modal-overlay { padding: .4rem; }
    .almacen-menu-visible .modal-box { max-height: calc(100dvh - .8rem) !important; }
    .almacen-menu-visible .tabs-nav { overflow-x: visible; }

    #modal-venta :is(.venta-productos-lista, .venta-formas-pago) :is(table, tbody) {
        display: block;
        width: 100%;
        overflow: visible;
    }
    #modal-venta :is(.venta-productos-lista, .venta-formas-pago) thead { display: none; }
    #modal-venta :is(#venta-items, #venta-pagos-body) tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .4rem;
        padding: .55rem;
        margin-bottom: .4rem;
        border: 1px solid var(--border);
        border-radius: 7px;
        background: #fff;
    }
    #modal-venta :is(#venta-items, #venta-pagos-body) td {
        min-width: 0;
        padding: 0;
        border: 0;
    }
    #modal-venta #venta-items td:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
    #modal-venta :is(#venta-items, #venta-pagos-body) td[data-campo]::before {
        content: attr(data-campo);
        display: block;
        margin-bottom: .15rem;
        color: var(--muted);
        font-size: .75rem;
        font-weight: 600;
    }
    #modal-venta :is(#venta-items, #venta-pagos-body) :is(input:not([type="hidden"]), select) {
        min-height: 38px;
        width: 100%;
        font-size: 16px;
    }
    #modal-venta #venta-items td:last-child { text-align: right; }
}

