/* ========================================
   BEM PENSADO.
   LAYOUT
   ======================================== */

html,
* {
    scrollbar-width: thin;
    scrollbar-color: var(--bp-blue) var(--bp-paper);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--bp-paper);
}

*::-webkit-scrollbar-thumb {
    border: 1px solid var(--bp-paper);
    border-radius: 0;
    background: var(--bp-blue);
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--bp-black);
}

.bp-sidebar,
.bp-sidebar__body {
    scrollbar-width: thin;
    scrollbar-color: var(--bp-blue) var(--bp-black);
}

.bp-sidebar::-webkit-scrollbar,
.bp-sidebar__body::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.bp-sidebar::-webkit-scrollbar-track,
.bp-sidebar__body::-webkit-scrollbar-track {
    background: var(--bp-black);
}

.bp-sidebar::-webkit-scrollbar-thumb,
.bp-sidebar__body::-webkit-scrollbar-thumb {
    border-color: var(--bp-black);
}


/* ========================================
   APP
   ======================================== */

.bp-app {
    min-height: 100vh;

    background: var(--bp-white);
}


/* ========================================
   SIDEBAR
   ======================================== */

.bp-sidebar {
    position: fixed;
    z-index: 100;

    top: 0;
    left: 0;
    bottom: 0;

    width: var(--bp-sidebar-width);
    height: 100vh;

    display: flex;
    flex-direction: column;

    overflow-y: auto;

    background: var(--bp-paper);
    border-right: 1px solid var(--bp-black);
}


/* ========================================
   SIDEBAR — BRAND
   ======================================== */

.bp-sidebar__brand {
    flex-shrink: 0;

    padding: 28px 24px 32px;

    border-bottom: 1px solid var(--bp-black);
}

.bp-sidebar__brand a {
    display: block;
    width: fit-content;
}

.bp-sidebar__logo {
    display: block;

    width: 170px;
    height: auto;
}


/* ========================================
   SIDEBAR — NAVIGATION
   ======================================== */

.bp-sidebar__nav {
    display: flex;
    flex-direction: column;

    flex-shrink: 0;
}

.bp-sidebar__link {
    min-height: 50px;

    display: flex;
    align-items: center;

    padding: 0 24px;

    border-bottom: 1px solid var(--bp-border);

    font-family: "Archivo", Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;

    transition:
        background var(--bp-transition-fast),
        color var(--bp-transition-fast);
}

.bp-sidebar__link:hover,
.bp-sidebar__link.is-active {
    background: var(--bp-blue);
    color: var(--bp-black);
}


/* ========================================
   SIDEBAR — BOTTOM
   ======================================== */

.bp-sidebar__bottom {
    margin-top: auto;

    flex-shrink: 0;
}

.bp-sidebar__bottom > .bp-sidebar__link {
    border-top: 1px solid var(--bp-black);
    border-bottom: 0;
}


/* ========================================
   SIDEBAR — ACCOUNT
   ======================================== */

.bp-sidebar__account {
    min-height: 96px;

    display: flex;
    flex-direction: column;
    justify-content: center;

    padding: 16px 24px;

    background: var(--bp-black);
    color: var(--bp-white);
}

.bp-sidebar__account strong {
    font-family: "Archivo", Arial, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.bp-sidebar__account span {
    color: var(--bp-gray-300);

    font-family: "Archivo", Arial, sans-serif;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ========================================
   SIDEBAR — LOGOUT
   ======================================== */

.bp-sidebar__account-info {
    display: flex;
    flex-direction: column;

    gap: 5px;
}


.bp-sidebar__logout {
    margin-top: 12px;
}


.bp-sidebar__logout-button {
    padding: 0;

    border: 0;
    background: transparent;

    color: var(--bp-gray-300);

    font-family: "Archivo", Arial, sans-serif;
    font-size: 10px;
    font-weight: 600;

    line-height: 1;

    letter-spacing: .08em;

    text-transform: uppercase;

    cursor: pointer;

    transition:
        color var(--bp-transition-fast);
}


.bp-sidebar__logout-button:hover {
    color: var(--bp-white);
}

/* ========================================
   MAIN
   ======================================== */

.bp-app__main {
    min-width: 0;
    min-height: 100vh;

    margin-left: var(--bp-sidebar-width);

    background: var(--bp-white);
}


/* ========================================
   TOPBAR
   ======================================== */

.bp-topbar {
    width: 100%;
    height: 64px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 var(--bp-page-padding);

    background: var(--bp-white);
    border-bottom: 1px solid var(--bp-black);
}

.bp-topbar__right {
    margin-left: auto;

    font-family: "Archivo", Arial, sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bp-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;

    font-family: "Archivo", Arial, sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bp-breadcrumbs a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.bp-breadcrumbs a:hover {
    text-decoration-thickness: 2px;
}

.bp-breadcrumbs__separator {
    flex-shrink: 0;
}

.bp-breadcrumbs__current {
    text-decoration: none;
}

/* ========================================
   MOBILE MENU BUTTON
   ======================================== */

.bp-menu-toggle {
    display: none;

    padding: 0;

    border: 0;
    background: transparent;

    color: var(--bp-black);

    font-family: "Archivo", Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bp-menu-toggle .bp-icon {
    width: 20px;
    height: 20px;
}


/* ========================================
   CONTENT
   ======================================== */

.bp-content {
    width: 100%;

    padding: var(--bp-page-padding);
}


/* ========================================
   SIDEBAR V1.1
   ======================================== */

.bp-sidebar {
    overflow: visible;

    transition:
        width var(--bp-transition-fast);
}

.bp-sidebar__brand {
    min-height: 88px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 18px 16px 18px 22px;
}

.bp-sidebar__brand-link {
    min-width: 0;

    display: flex;
    align-items: center;
}

.bp-sidebar__logo--expanded {
    width: 154px;
}

.bp-sidebar__logo--compact {
    display: none;

    width: 38px;
    height: 38px;
}

.bp-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.bp-sidebar__collapse {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid var(--bp-border);
    background: var(--bp-white);
    color: var(--bp-black);

    cursor: pointer;
}

.bp-sidebar__collapse:hover {
    border-color: var(--bp-black);
    background: var(--bp-blue-light);
}

.bp-sidebar__collapse > span {
    display: inline-flex;
}

.bp-sidebar__collapse > span[hidden] {
    display: none;
}

.bp-sidebar__cta {
    min-height: 50px;

    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 13px;

    margin: 16px;
    padding: 0 15px;

    border: 1px solid var(--bp-black);
    background: var(--bp-blue);
    color: var(--bp-black);

    font-family: "Archivo", Arial, sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.025em;
    text-transform: uppercase;

    transition:
        background var(--bp-transition-fast),
        color var(--bp-transition-fast),
        transform var(--bp-transition-fast);
}

.bp-sidebar__cta:hover {
    background: var(--bp-black);
    color: var(--bp-white);
}

.bp-sidebar__body {
    min-height: 0;
    flex: 1;

    display: flex;
    flex-direction: column;

    overflow-x: hidden;
    overflow-y: auto;
}

.bp-sidebar__link {
    gap: 14px;
    padding: 0 22px;
}

.bp-sidebar__link .bp-icon {
    color: currentColor;
}

.bp-sidebar__label {
    min-width: 0;
}

.bp-sidebar__account {
    min-height: 104px;

    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 8px 12px;

    padding: 16px 20px;
}

.bp-sidebar__account-icon {
    display: inline-flex;
    grid-row: 1;
    grid-column: 1;
}

.bp-sidebar__account-info {
    min-width: 0;
    grid-row: 1;
    grid-column: 2;
}

.bp-sidebar__account-info strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bp-sidebar__logout {
    grid-row: 2;
    grid-column: 1 / -1;

    margin-top: 4px;
}

.bp-sidebar__logout-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.bp-sidebar__logout-button .bp-icon {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
}

.bp-sidebar__collapse:focus-visible,
.bp-sidebar__cta:focus-visible,
.bp-sidebar__link:focus-visible,
.bp-sidebar__logout-button:focus-visible {
    outline: 2px solid var(--bp-blue);
    outline-offset: -3px;
}

.bp-app__main {
    transition:
        margin-left var(--bp-transition-fast);
}

.bp-sidebar-backdrop {
    position: fixed;
    z-index: 90;
    inset: 0;

    display: none;

    padding: 0;
    border: 0;
    background: rgba(10, 10, 10, 0.42);
}

.bp-sidebar-backdrop[hidden] {
    display: none;
}


/* ========================================
   SIDEBAR V1.1 — COLLAPSED DESKTOP
   ======================================== */

html[data-sidebar-collapsed="true"]
.bp-sidebar {
    width: var(--bp-sidebar-collapsed-width);
}

html[data-sidebar-collapsed="true"]
.bp-app__main {
    margin-left: var(--bp-sidebar-collapsed-width);
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__brand {
    min-height: 112px;

    flex-direction: column;
    justify-content: center;
    gap: 10px;

    padding: 12px 10px;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__logo--expanded {
    display: none;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__logo--compact {
    display: block;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__cta {
    width: 52px;
    height: 52px;
    min-height: 52px;

    justify-content: center;

    margin: 10px;
    padding: 0;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__body {
    overflow: visible;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__link {
    justify-content: center;
    padding: 0;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__label,
html[data-sidebar-collapsed="true"]
.bp-sidebar__account-info {
    position: absolute;

    width: 1px;
    height: 1px;

    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);

    white-space: nowrap;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__account {
    min-height: 112px;

    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 12px;

    padding: 14px 10px;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__account-icon {
    display: inline-flex;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__logout {
    margin: 0;
}

html[data-sidebar-collapsed="true"]
.bp-sidebar__logout-button {
    width: 36px;
    height: 36px;

    justify-content: center;
}

html[data-sidebar-collapsed="true"]
[data-sidebar-tooltip] {
    position: relative;
}

html[data-sidebar-collapsed="true"]
[data-sidebar-tooltip]::after {
    position: absolute;
    z-index: 120;
    top: 50%;
    left: calc(100% + 10px);

    padding: 8px 10px;

    border: 1px solid var(--bp-black);
    background: var(--bp-black);
    color: var(--bp-white);

    content: attr(data-sidebar-tooltip);

    font-family: "Archivo", Arial, sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;

    opacity: 0;
    pointer-events: none;
    transform: translate(4px, -50%);

    transition:
        opacity var(--bp-transition-fast),
        transform var(--bp-transition-fast);
}

html[data-sidebar-collapsed="true"]
[data-sidebar-tooltip]:hover::after,
html[data-sidebar-collapsed="true"]
[data-sidebar-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%);
}


@media (prefers-reduced-motion: reduce) {
    .bp-sidebar,
    .bp-app__main,
    .bp-sidebar__cta,
    html[data-sidebar-collapsed="true"]
    [data-sidebar-tooltip]::after {
        transition: none;
    }
}


/* ========================================
   PANEL POLISH — COMPACT DESKTOP
   ======================================== */

@media (min-width: 769px) and (max-height: 820px) {
    .bp-sidebar__brand {
        min-height: 76px;
        padding-block: 12px;
    }

    .bp-sidebar__cta {
        min-height: 46px;
        margin-block: 12px;
    }

    .bp-sidebar__link {
        min-height: 46px;
    }

    .bp-sidebar__account {
        min-height: 92px;
        padding-block: 12px;
    }

    html[data-sidebar-collapsed="true"]
    .bp-sidebar__brand,
    html[data-sidebar-collapsed="true"]
    .bp-sidebar__account {
        min-height: 96px;
    }
}


/* ========================================
   PANEL POLISH — MOBILE DRAWER SAFE AREA
   ======================================== */

@media (max-width: 768px) {
    .bp-sidebar {
        padding-top: calc(68px + env(safe-area-inset-top));
    }
}
