body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
}

#wrapper {
    overflow-x: hidden;
}

#sidebar-wrapper {
    min-height: 100vh;
    width: 250px;
    flex: 0 0 250px;
    transition: width 0.25s ease, flex-basis 0.25s ease, margin 0.25s ease;
}

#sidebar-wrapper .sidebar-heading {
    padding: 0.875rem 1.25rem;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-logo {
    display: block;
    width: 3.35rem;
    height: 3.35rem;
    margin: 0 auto;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .88);
    box-shadow: 0 3px 10px rgba(0, 52, 16, .25);
}

#page-content-wrapper {
    min-width: 0;
    width: 100%;
    padding-bottom: 50px; /* Espacio para el pie de página fijo */
}

body.sb-sidenav-toggled #wrapper #sidebar-wrapper {
    margin-left: 0;
}

@media (min-width: 992px) {
    #sidebar-wrapper {
        margin-left: 0;
    }

    #page-content-wrapper {
        min-width: 0;
        width: 100%;
    }

    body.sidebar-collapsed #sidebar-wrapper {
        width: 72px;
        flex-basis: 72px;
    }

    body.sidebar-collapsed #sidebar-wrapper:hover {
        width: 250px;
        flex-basis: 250px;
    }

    body.sidebar-collapsed #sidebar-wrapper .sidebar-brand-text,
    body.sidebar-collapsed #sidebar-wrapper .sidebar-link-text {
        display: none !important;
    }

    body.sidebar-collapsed #sidebar-wrapper:hover .sidebar-brand-text,
    body.sidebar-collapsed #sidebar-wrapper:hover .sidebar-link-text {
        display: inline !important;
    }

    body.sidebar-collapsed #sidebar-wrapper .sidebar-heading {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    body.sidebar-collapsed #sidebar-wrapper:hover .sidebar-heading {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    body.sidebar-collapsed #sidebar-wrapper .sidebar-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    body.sidebar-collapsed #sidebar-wrapper:hover .sidebar-link {
        justify-content: flex-start;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    body.sidebar-collapsed #sidebar-wrapper .sidebar-icon {
        margin-right: 0 !important;
        font-size: 1.15rem;
    }

    body.sidebar-collapsed #sidebar-wrapper:hover .sidebar-icon {
        margin-right: 0.75rem !important;
    }

    /* En modo compacto se muestra únicamente el icono del grupo.
       Las subopciones reaparecen al pasar el cursor y expandir la barra. */
    body.sidebar-collapsed #sidebar-wrapper:not(:hover) .sidebar-report-submenu,
    body.sidebar-collapsed #sidebar-wrapper:not(:hover) .sidebar-admin-submenu {
        display: none !important;
    }

    body.sidebar-collapsed #sidebar-wrapper:not(:hover) .sidebar-report-chevron,
    body.sidebar-collapsed #sidebar-wrapper:not(:hover) .sidebar-admin-chevron {
        display: none !important;
    }

    body.sidebar-collapsed .main-footer {
        left: 72px !important;
    }

    body.sidebar-collapsed #sidebar-wrapper:hover ~ #page-content-wrapper .main-footer {
        left: 250px !important;
    }

    body.sb-sidenav-toggled #wrapper #sidebar-wrapper {
        margin-left: -250px;
    }
}

@media (max-width: 991px) {
    #sidebar-wrapper {
        position: fixed;
        inset: 0 auto 0 0;
        margin-left: -250px;
        width: 250px;
        flex-basis: 250px;
        z-index: 1050;
    }

    body.sb-sidenav-toggled #wrapper #sidebar-wrapper {
        margin-left: 0;
    }

    #page-content-wrapper {
        width: 100%;
    }
}

.login-card {
    border-radius: 15px !important;
}

/* Acceso Patio del Majau: una pantalla serena, cálida y pensada para la operación diaria. */
.patio-login {
    --patio-green: #087d28;
    --patio-green-dark: #075b24;
    --patio-leaf: #8ed43e;
    --patio-gold: #f1c94e;
    --patio-ink: #183123;
    --patio-muted: #617067;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(340px, 1fr) minmax(440px, 0.9fr);
    background: #f8faf6;
}

.patio-login__brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3.5rem clamp(3rem, 7vw, 7.5rem);
    color: #fff;
    background:
        radial-gradient(circle at 86% 12%, rgba(142, 212, 62, 0.82) 0 2%, transparent 2.4%),
        radial-gradient(circle at 12% 89%, rgba(241, 201, 78, 0.92) 0 0.45%, transparent 0.75%),
        linear-gradient(145deg, var(--patio-green-dark) 0%, var(--patio-green) 54%, #0a6a27 100%);
}

.patio-login__brand::before,
.patio-login__brand::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.patio-login__brand::before {
    width: 30rem;
    height: 30rem;
    right: -15rem;
    top: -12rem;
    border: 2.6rem solid rgba(142, 212, 62, 0.16);
}

.patio-login__brand::after {
    width: 22rem;
    height: 22rem;
    left: -14rem;
    bottom: -11rem;
    border: 1px solid rgba(241, 201, 78, 0.45);
}

.patio-login__brand-content {
    position: relative;
    z-index: 1;
    max-width: 30rem;
}

.patio-login__eyebrow,
.patio-login__section-label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .72rem;
    letter-spacing: .14em;
    font-weight: 700;
}

.patio-login__eyebrow { color: #fff2b1; }

.patio-login__logo {
    display: block;
    width: min(16rem, 55%);
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    margin: 1.4rem 0 1.75rem;
    border: 5px solid rgba(255, 255, 255, .92);
    box-shadow: 0 18px 40px rgba(0, 39, 11, .35);
}

.patio-login__brand h1 {
    margin: 0;
    font-size: clamp(2rem, 3.1vw, 3.1rem);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -.04em;
}

.patio-login__brand h1 strong { font-weight: 800; color: #fff8ce; }

.patio-login__brand p {
    max-width: 24rem;
    margin: 1.25rem 0 0;
    color: rgba(255, 255, 255, .83);
    font-size: 1rem;
    line-height: 1.6;
}

.patio-login__brand-footer {
    position: absolute;
    z-index: 1;
    bottom: 2rem;
    left: clamp(3rem, 7vw, 7.5rem);
    margin: 0 !important;
    font-size: .8rem !important;
    letter-spacing: .04em;
}

.patio-login__access {
    display: grid;
    align-items: center;
    justify-items: center;
    padding: 2rem;
    background: #fbfcf8;
}

.patio-login__form-wrap { width: min(100%, 25.5rem); }
.patio-login__section-label { color: var(--patio-green); margin-bottom: .8rem; }
.patio-login__form-wrap h2 { color: var(--patio-ink); font-size: 2rem; letter-spacing: -.04em; font-weight: 800; margin: 0; }
.patio-login__intro { color: var(--patio-muted); margin: .55rem 0 2rem; font-size: .95rem; }
.patio-login__form .form-label { color: var(--patio-ink); font-size: .88rem; font-weight: 700; margin-bottom: .5rem; }

.patio-login__input-group {
    display: flex;
    align-items: center;
    min-height: 3.4rem;
    border: 1px solid #d9e2d9;
    border-radius: .8rem;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.patio-login__input-group:focus-within {
    border-color: var(--patio-green);
    box-shadow: 0 0 0 .22rem rgba(8, 125, 40, .12);
}

.patio-login__input-group > i { color: var(--patio-green); font-size: 1.05rem; padding-left: 1rem; }
.patio-login__input-group input { flex: 1; width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; padding: .85rem .85rem; color: var(--patio-ink); font-size: 1rem; }
.patio-login__input-group input::placeholder { color: #99a59c; }

.patio-login__password-toggle {
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: #6b786f;
    min-width: 3rem;
    min-height: 3rem;
    margin-right: .2rem;
    border-radius: .6rem;
}

.patio-login__password-toggle:hover { color: var(--patio-green); background: #f0f6ed; }
.patio-login__password-toggle:focus-visible { outline: 2px solid var(--patio-green); outline-offset: 1px; }

.patio-login__submit {
    width: 100%;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    border: 0;
    border-radius: .8rem;
    color: #fff;
    background: linear-gradient(135deg, var(--patio-green-dark), var(--patio-green));
    font-weight: 800;
    box-shadow: 0 10px 22px rgba(8, 125, 40, .22);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.patio-login__submit:hover { transform: translateY(-1px); background: linear-gradient(135deg, #06491c, #087d28); box-shadow: 0 13px 26px rgba(8, 125, 40, .28); }
.patio-login__submit:focus-visible { outline: 3px solid rgba(241, 201, 78, .8); outline-offset: 3px; }

.patio-login__help { display: flex; align-items: center; justify-content: center; gap: .45rem; color: #78857c; text-align: center; font-size: .78rem; line-height: 1.5; margin: 1.6rem 0 0; }
.patio-login__servitech-logo { display: block; max-width: 4.75rem; max-height: 1.35rem; object-fit: contain; }
.patio-login__alert { display: flex; align-items: flex-start; gap: .55rem; border: 0; border-radius: .7rem; font-size: .84rem; line-height: 1.4; margin-bottom: 1.25rem; padding: .8rem .9rem; }
.patio-login__mobile-brand { display: none; }

@media (max-width: 820px) {
    .patio-login { display: block; min-height: 100svh; background: linear-gradient(145deg, #075b24, #087d28); }
    .patio-login__brand { display: none; }
    .patio-login__access { min-height: 100svh; align-items: start; padding: 2.75rem 1.35rem 2rem; background: linear-gradient(180deg, transparent 0, transparent 8rem, #fbfcf8 8rem); }
    .patio-login__form-wrap { padding: 1.55rem; background: #fff; border-radius: 1.25rem; box-shadow: 0 18px 40px rgba(0, 55, 18, .18); }
    .patio-login__mobile-brand { display: flex; justify-content: center; margin-top: -4.25rem; margin-bottom: 1.25rem; }
    .patio-login__mobile-brand img { width: 7.5rem; height: 7.5rem; object-fit: cover; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 8px 22px rgba(0, 52, 16, .25); }
    .patio-login__form-wrap h2 { font-size: 1.75rem; }
}

.cursor-pointer {
    cursor: pointer;
}

.rounded-4 { border-radius: 1rem !important; }
.rounded-5 { border-radius: 1.5rem !important; }

.transition-all { transition: all 0.3s ease; }

/* Premium Glassmorphism */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Sidebar Shadow */
#sidebar-wrapper {
    box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    z-index: 1000;
}

#sidebar-wrapper .sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
}

#sidebar-wrapper .sidebar-icon {
    width: 20px;
    text-align: center;
    flex: 0 0 20px;
}

#sidebar-wrapper .sidebar-report-toggle,
#sidebar-wrapper .sidebar-admin-toggle {
    cursor: pointer;
    text-align: left;
    width: 100%;
}

#sidebar-wrapper .sidebar-report-chevron,
#sidebar-wrapper .sidebar-admin-chevron {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

#sidebar-wrapper .sidebar-report-toggle[aria-expanded="true"] .sidebar-report-chevron,
#sidebar-wrapper .sidebar-admin-toggle[aria-expanded="true"] .sidebar-admin-chevron {
    transform: rotate(180deg);
}

#sidebar-wrapper .sidebar-report-submenu,
#sidebar-wrapper .sidebar-admin-submenu {
    border-left: 2px solid rgba(255, 193, 7, 0.36);
    margin: 0.15rem 0 0.25rem 1.2rem;
}

#sidebar-wrapper .sidebar-report-submenu .sidebar-link,
#sidebar-wrapper .sidebar-admin-submenu .sidebar-link {
    font-size: 0.88rem;
    padding-left: 0.75rem;
}

/* El grupo y la opción actual se distinguen sin depender solo del color del texto. */
#sidebar-wrapper > .list-group > .sidebar-link.text-warning {
    background-color: rgba(255, 193, 7, 0.14) !important;
    box-shadow: inset 3px 0 0 #ffc107;
}

#sidebar-wrapper .sidebar-admin-toggle.text-warning,
#sidebar-wrapper .sidebar-report-toggle.text-warning {
    background-color: rgba(255, 193, 7, 0.14) !important;
    box-shadow: inset 3px 0 0 #ffc107;
}

#sidebar-wrapper .sidebar-admin-submenu .sidebar-link.text-warning,
#sidebar-wrapper .sidebar-report-submenu .sidebar-link.text-warning {
    background-color: rgba(255, 193, 7, 0.18) !important;
    box-shadow: inset 3px 0 0 #ffc107;
}

.historial-vista-tabs {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.9rem;
    gap: 0.45rem;
    padding: 0.45rem;
    width: fit-content;
}

.historial-vista-tabs .nav-link {
    border-radius: 0.65rem;
    color: #59636c;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.55rem 0.9rem;
}

.historial-vista-tabs .nav-link.active {
    background: #26363d;
    box-shadow: 0 4px 10px rgba(38, 54, 61, 0.18);
    color: #fff;
}

/* Tablas Responsivas Mejoradas */
.table-responsive {
    border-radius: 12px;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Forzar que las tablas no se compriman demasiado en movil */
@media (max-width: 768px) {
    .table:not(.table-sm) {
        min-width: 600px; /* Asegura que aparezca el scroll horizontal para ver las acciones */
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent; 
}
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1); 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2); 
}

/* Footer Fijo con Respeto al Sidebar */
.main-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0;
    right: 0 !important;
    z-index: 1030 !important;
    background-color: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: left 0.3s ease;
    border-top: 1px solid #dee2e6;
}

@media (min-width: 992px) {
    /* Si el sidebar esta visible (desktop), el footer empieza despues de 250px */
    .main-footer {
        left: 250px !important;
    }
    
    /* Si el sidebar se oculta en desktop */
    body.sb-sidenav-toggled .main-footer {
        left: 0 !important;
    }
}

/* Mobile specific paddings */
@media (max-width: 992px) {
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    .p-5 {
        padding: 1.5rem !important;
    }
}

@media (max-width: 575.98px) {
    .container-fluid > .d-flex.justify-content-between.align-items-center.mb-4 {
        align-items: flex-start !important;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .navbar {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .navbar .nav-link > .text-white.fw-bold {
        display: inline-block;
        max-width: 9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: bottom;
        white-space: nowrap;
    }

    .navbar .nav-link > .badge {
        display: none;
    }

    .main-footer {
        font-size: 0.72rem;
    }
}

/* El POS prioriza el carrito y el cobro en pantallas táctiles; el pie fijo no
   debe cubrir esos controles cuando la altura disponible es reducida. */
@media (max-width: 1199.98px) {
    body.pos-page #page-content-wrapper {
        padding-bottom: 0;
    }

    body.pos-page .main-footer {
        display: none !important;
    }
}

/* Dashboard Patio del Majau */
.dashboard-page {
    --dash-ink: #26363d;
    --dash-cream: #fff8ef;
    --dash-orange: #e67a22;
    --dash-green: #157a6e;
    --dash-purple: #6d4c9f;
    --dash-red: #c94c4c;
    --dash-gold: #b7791f;
    padding-bottom: 1.5rem;
}

.dashboard-hero {
    align-items: center;
    background: linear-gradient(122deg, #26363d 0%, #31575a 55%, #c86423 150%);
    border-radius: 1.25rem;
    box-shadow: 0 14px 30px rgba(38, 54, 61, 0.2);
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 135px;
    overflow: hidden;
    padding: 1.75rem 2rem;
    position: relative;
}

.dashboard-hero::after {
    background: rgba(255, 190, 107, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 50%;
    content: '';
    height: 180px;
    position: absolute;
    right: 8%;
    top: -88px;
    width: 180px;
}

.dashboard-hero > * { position: relative; z-index: 1; }

.dashboard-eyebrow {
    color: #ffc078;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.dashboard-subtitle { color: rgba(255, 255, 255, 0.77); }

.dashboard-role {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.65rem 1rem;
    white-space: nowrap;
}

.dashboard-metric {
    border-radius: 1rem;
    box-shadow: 0 10px 22px rgba(35, 51, 57, 0.13);
    color: #fff;
    min-height: 177px;
    overflow: hidden;
    padding: 1.25rem;
    position: relative;
}

.dashboard-metric::after {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    content: '';
    height: 135px;
    position: absolute;
    right: -45px;
    top: -42px;
    width: 135px;
}

.metric-sales { background: linear-gradient(135deg, #2266a8, #174b7e); }
.metric-cash { background: linear-gradient(135deg, #238c78, #136354); }
.metric-qr { background: linear-gradient(135deg, #8062ad, #5b3d87); }
.metric-expenses { background: linear-gradient(135deg, #d15b52, #a93e45); }
.metric-net { background: linear-gradient(135deg, #cf901e, #9e6714); }
.metric-net-negative { background: linear-gradient(135deg, #a84343, #7b3038); }

.metric-icon {
    font-size: 1.55rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.metric-label {
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    margin: 0.85rem 0 0.22rem;
    position: relative;
    text-transform: uppercase;
    z-index: 1;
}

.metric-value {
    font-size: 1.38rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 0.58rem;
    position: relative;
    z-index: 1;
}

.metric-note {
    color: rgba(255, 255, 255, 0.77);
    font-size: 0.76rem;
    line-height: 1.35;
    position: relative;
    z-index: 1;
}

.dashboard-panel {
    background: var(--dash-cream);
    border: 1px solid #f0dfcb;
    border-radius: 1rem;
    box-shadow: 0 8px 20px rgba(55, 45, 37, 0.09);
    overflow: hidden;
}

.dashboard-panel-heading {
    align-items: center;
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 85px;
    padding: 1.2rem 1.5rem;
}

.panel-heading-products { background: linear-gradient(110deg, #db6927, #f09a32); }
.panel-heading-today { background: linear-gradient(110deg, #31575a, #157a6e); }
.panel-heading-month { background: linear-gradient(110deg, #544275, #8062ad); }

.panel-kicker {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.panel-period {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.42rem 0.7rem;
}

.panel-heading-icon { font-size: 1.7rem; opacity: 0.85; }

.product-ranking-item {
    align-items: center;
    background: #fffdf9;
    border: 1px solid #f3e4d3;
    border-radius: 0.75rem;
    display: flex;
    gap: 0.7rem;
    margin-bottom: 0.58rem;
    min-height: 52px;
    padding: 0.55rem 0.7rem;
}

.product-ranking-item:last-child { margin-bottom: 0; }

.product-place {
    align-items: center;
    background: #fbe3c6;
    border-radius: 50%;
    color: #a84d13;
    display: inline-flex;
    flex: 0 0 27px;
    font-size: 0.78rem;
    font-weight: 700;
    height: 27px;
    justify-content: center;
}

.product-name { color: var(--dash-ink); font-size: 0.9rem; font-weight: 600; min-width: 0; }

.product-quantity {
    background: #e0f1eb;
    border-radius: 999px;
    color: #146557;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: auto;
    padding: 0.3rem 0.55rem;
    white-space: nowrap;
}

.dashboard-empty { color: #7b6756; padding: 1.25rem 0.2rem; }

.dashboard-chart { background: #fffdf9; padding: 1.15rem 1.35rem 1rem; }

@media (max-width: 575px) {
    .dashboard-hero { align-items: flex-start; flex-direction: column; gap: 1rem; padding: 1.5rem; }
    .dashboard-role { align-self: flex-start; }
    .dashboard-panel-heading { padding: 1.1rem; }
    .panel-period { font-size: 0.65rem; }
    .dashboard-chart { padding: 1rem 0.55rem; }
}
