/* DATAxis Client Portal — screenshot-led mega menu.
 * Additive only: the accepted Explorer layout remains untouched underneath. */

.dataxis-portal-header {
    overflow: visible;
}

[data-dataxis-mega-menu-trigger] .dataxis-portal-nav__chevron {
    display: inline-block;
    transition: transform 140ms ease;
    transform-origin: 50% 50%;
}

[data-dataxis-mega-menu-trigger][aria-expanded="true"] .dataxis-portal-nav__chevron {
    transform: rotate(180deg);
}

.dataxis-mega-menu {
    --mega-border: #dce5ee;
    --mega-text: #12243a;
    --mega-muted: #6e8094;
    --mega-panel: #ffffff;
    --mega-rail: #f6f9fc;
    position: absolute;
    z-index: 1200;
    top: 100%;
    left: var(--mega-menu-left, 0px);
    /* M6-R2: on wide screens JS computes a width that mirrors the Explore
     * Data trigger's viewport-left gutter on the right edge. */
    width: var(--mega-menu-width, 1224px);
    max-width: calc(100vw - var(--mega-menu-viewport-left, 0px) - 12px);
    height: min(410px, calc(100vh - 110px));
    min-height: min(380px, calc(100vh - 110px));
    transform: none;
    color: var(--mega-text);
    background: var(--mega-panel);
    border: 1px solid var(--mega-border);
    border-top: 0;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 16px 34px rgba(25, 47, 71, .17);
    overflow: hidden;
    font-family: "Roboto", Arial, sans-serif;
}

.dataxis-mega-menu[hidden] {
    display: none !important;
}

.dataxis-mega-menu__grid {
    display: grid;
    grid-template-columns: 204px 205px minmax(0, 1fr);
    width: 100%;
    height: 100%;
}

.dataxis-mega-menu__column {
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
}

.dataxis-mega-menu__column h2 {
    margin: 0;
    padding: 17px 18px 9px;
    color: #60758d;
    font-size: 9px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: .05em;
}

.dataxis-mega-menu__column--modules {
    background: var(--mega-rail);
    border-right: 1px solid var(--mega-border);
}

.dataxis-mega-menu__column--submodules {
    background: #fff;
    border-right: 1px solid var(--mega-border);
}

.dataxis-mega-menu__module-list,
.dataxis-mega-menu__submodule-list {
    padding: 0 10px 12px;
    overflow-y: auto;
    max-height: calc(100% - 36px);
    scrollbar-width: thin;
}

.dataxis-mega-menu__module,
.dataxis-mega-menu__submodule {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 100%;
    border: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.dataxis-mega-menu__module {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 34px;
    margin: 1px 0;
    padding: 7px 9px;
    color: #1d2e43;
    background: transparent;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
}

.dataxis-mega-menu__module:hover,
.dataxis-mega-menu__module:focus-visible {
    background: #eef4f9;
    outline: none;
}

.dataxis-mega-menu__module[aria-current="true"] {
    color: #fff;
    background: #10395d;
}

.dataxis-mega-menu__module-label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.dataxis-mega-menu__module-label > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dataxis-mega-menu__bookmark {
    flex: 0 0 auto;
    display: inline-flex;
    width: 10px;
    height: 12px;
    color: var(--module-accent, #60758a);
}

.dataxis-mega-menu__bookmark svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.dataxis-mega-menu__module[aria-current="true"] .dataxis-mega-menu__bookmark {
    color: var(--module-accent, #c8dcf0);
}

.dataxis-mega-menu__count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    box-sizing: border-box;
    padding: 0 5px;
    border: 1px solid #d9e3ec;
    border-radius: 999px;
    color: #5d7084;
    background: #fff;
    font-size: 9.5px;
    font-weight: 700;
}

.dataxis-mega-menu__module[aria-current="true"] .dataxis-mega-menu__count {
    border-color: rgba(255,255,255,.12);
    color: #fff;
    background: rgba(255,255,255,.24);
}

.dataxis-mega-menu__submodule {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 48px;
    margin: 1px 0 5px;
    padding: 8px 10px;
    color: #1e3047;
    background: transparent;
    border-radius: 7px;
}

.dataxis-mega-menu__submodule::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    border-radius: 4px;
    background: transparent;
}

.dataxis-mega-menu__submodule:hover,
.dataxis-mega-menu__submodule:focus-visible,
.dataxis-mega-menu__submodule[aria-current="true"] {
    background: color-mix(in srgb, var(--module-accent, #8b5ccf) 10%, white);
    outline: none;
}

.dataxis-mega-menu__submodule[aria-current="true"]::before {
    background: var(--module-accent, #8b5ccf);
}

.dataxis-mega-menu__submodule-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.dataxis-mega-menu__submodule-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.15;
    font-weight: 600;
}

.dataxis-mega-menu__submodule-copy span {
    color: var(--mega-muted);
    font-size: 9.5px;
    line-height: 1.1;
}

.dataxis-mega-menu__submodule-arrow {
    flex: 0 0 auto;
    color: var(--module-accent, #8b5ccf);
    font-size: 18px;
    line-height: 1;
}

.dataxis-mega-menu__column--workbooks {
    display: flex;
    flex-direction: column;
    padding: 13px 15px 11px;
    background: #fff;
}

.dataxis-mega-menu__breadcrumb {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 22px;
    margin-bottom: 5px;
    color: #455c73;
    font-size: 10.5px;
}

.dataxis-mega-menu__breadcrumb strong:first-child {
    color: var(--module-accent, #8b5ccf);
}

.dataxis-mega-menu__status {
    min-height: 16px;
    color: var(--mega-muted);
    font-size: 10px;
    line-height: 16px;
}

.dataxis-mega-menu__status:empty {
    min-height: 0;
}

.dataxis-mega-menu__status[data-state="error"] {
    color: #b42318;
}

.dataxis-mega-menu__status[data-state="warning"] {
    color: #9a6700;
}

.dataxis-mega-menu__workbook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    align-content: start;
    gap: 9px;
    min-height: 0;
    overflow-y: auto;
    padding: 1px 1px 8px;
    scrollbar-width: thin;
}

.dataxis-mega-menu__workbook {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 52px;
    box-sizing: border-box;
    padding: 10px 30px 9px 11px;
    color: #14253a;
    background: #fff;
    border: 1px solid #dbe4ed;
    border-left: 2px solid var(--module-accent, #8b5ccf);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(17, 42, 67, .03);
    text-decoration: none;
}

.dataxis-mega-menu__workbook[href]:hover,
.dataxis-mega-menu__workbook[href]:focus-visible {
    border-color: color-mix(in srgb, var(--module-accent, #8b5ccf) 45%, #dbe4ed);
    box-shadow: 0 5px 14px rgba(21, 49, 76, .08);
    outline: none;
    transform: translateY(-1px);
}

.dataxis-mega-menu__workbook[aria-disabled="true"] {
    cursor: default;
}

.dataxis-mega-menu__workbook strong {
    font-size: 11px;
    line-height: 1.25;
    font-weight: 600;
}

.dataxis-mega-menu__workbook > span:not(.dataxis-mega-menu__lock) {
    color: #78899c;
    font-size: 9.5px;
    line-height: 1.2;
}

.dataxis-mega-menu__workbook .dataxis-mega-menu__workbook-description {
    display: -webkit-box;
    overflow: hidden;
    color: #4f6479;
    font-size: 10px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.dataxis-mega-menu__workbook .dataxis-mega-menu__workbook-meta {
    margin-top: auto;
}

.dataxis-mega-menu__lock {
    position: absolute;
    top: 10px;
    right: 9px;
    display: inline-flex;
    width: 13px;
    height: 13px;
    color: #ef9a20;
}

.dataxis-mega-menu__lock svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* A lock means no entitlement. Owned cards never show a lock, even when
 * launch is temporarily unavailable or a dashboard URL is not configured. */
.dataxis-mega-menu__workbook[data-owned="true"] .dataxis-mega-menu__lock {
    opacity: 0;
    visibility: hidden;
}

.dataxis-mega-menu__selection {
    flex: 0 0 auto;
    min-height: 16px;
    margin-top: auto;
    padding-top: 8px;
    color: #6e8094;
    font-size: 9.5px;
    line-height: 1.35;
}

.dataxis-mega-menu__selection strong {
    color: #364e66;
    font-weight: 600;
}

@media (max-width: 1100px) {
    .dataxis-mega-menu {
        /* Keep the narrower tablet safety behavior; equal-gutter geometry is
         * a wide-screen treatment where all three columns have useful room. */
        width: min(1224px, calc(100vw - var(--mega-menu-viewport-left, 0px) - 12px));
        max-width: none;
        height: min(410px, calc(100vh - 130px));
        min-height: min(380px, calc(100vh - 130px));
    }

    .dataxis-mega-menu__grid {
        grid-template-columns: 180px 190px minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .dataxis-mega-menu {
        position: fixed;
        top: 76px;
        left: 8px;
        width: calc(100vw - 16px);
        height: calc(100vh - 84px);
        min-height: 0;
        transform: none;
        border-top: 1px solid var(--mega-border);
        border-radius: 10px;
    }

    body.admin-bar .dataxis-mega-menu {
        top: 108px;
        height: calc(100vh - 116px);
    }

    .dataxis-mega-menu__grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(220px, 1fr);
        overflow-y: auto;
    }

    .dataxis-mega-menu__column--modules,
    .dataxis-mega-menu__column--submodules {
        border-right: 0;
        border-bottom: 1px solid var(--mega-border);
    }

    .dataxis-mega-menu__module-list,
    .dataxis-mega-menu__submodule-list {
        display: flex;
        gap: 6px;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 10px;
    }

    .dataxis-mega-menu__module,
    .dataxis-mega-menu__submodule {
        flex: 0 0 auto;
        width: auto;
        max-width: 220px;
        margin: 0;
    }

    .dataxis-mega-menu__count {
        margin-left: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-dataxis-mega-menu-trigger] .dataxis-portal-nav__chevron,
    .dataxis-mega-menu__workbook[href] {
        transition: none;
    }
}

/* Portal responsive R2B — mobile mega-menu anchoring.
 * The mobile Portal header is now two rows tall. Anchor the fixed mega menu
 * below the actual rendered header bottom so the navigation rail, including
 * the Explore Data trigger used to close the menu, remains visible. */
@media (max-width: 760px) {
    .dataxis-mega-menu,
    body.admin-bar .dataxis-mega-menu {
        top: var(--dataxis-mega-menu-mobile-top, 150px);
        height: var(--dataxis-mega-menu-mobile-height, calc(100dvh - 158px));
        max-height: var(--dataxis-mega-menu-mobile-height, calc(100dvh - 158px));
    }
}
