/* Global layout contract.
   Keep this file loaded last so page-specific CSS cannot break the app width rules. */
:root {
    --arca-layout-compact-min: 320px;
    --arca-layout-compact-max: 720px;
    --arca-layout-desktop-min: 1280.01px;
    --arca-layout-desktop-max: 100vw;
    --x-max-page-width: var(--arca-layout-desktop-max);
    --x-side-expanded-width: 360px;
    --x-side-collapsed-width: 96px;
}

html[data-theme="light"],
html[data-theme="dark"] {
    --arca-layout-desktop-max: 100vw;
    --x-max-page-width: var(--arca-layout-desktop-max);
}

body.arca-app:not(.is-embedded) {
    min-width: var(--arca-layout-compact-min);
}

body.arca-app:not(.is-embedded) .app-navbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 3200 !important;
}

body.arca-app:not(.is-embedded) .app-navbar-inner,
body.arca-app:not(.is-embedded) .app-content-inner {
    box-sizing: border-box;
    margin-inline: auto;
}

@media (max-width: 1280px) {
    body.arca-app:not(.is-embedded) .app-navbar-toggler {
        display: grid !important;
        order: 3;
        margin-left: 0.35rem;
    }

    body.arca-app:not(.is-embedded) .app-navbar-menu {
        display: flex !important;
        order: 2;
        width: auto;
        margin-left: auto;
    }

    body.arca-app:not(.is-embedded) .app-navbar-actions {
        gap: 0.35rem;
    }

    body.arca-app:not(.is-embedded) .app-navbar-action--theme .app-theme-btn,
    body.arca-app:not(.is-embedded) .app-navbar-action--user .app-user-chip,
    body.arca-app:not(.is-embedded) .app-navbar-action--user .app-signin-btn {
        width: 48px !important;
        height: 48px !important;
        min-height: 48px !important;
        justify-content: center !important;
        padding: 0 !important;
        border-radius: 14px !important;
    }

    body.arca-app:not(.is-embedded) .app-navbar-action--theme .app-theme-btn span,
    body.arca-app:not(.is-embedded) .app-navbar-action--user .app-signin-btn > span,
    body.arca-app:not(.is-embedded) .app-navbar-action--user .app-user-name,
    body.arca-app:not(.is-embedded) .app-navbar-action--user .app-user-chip-caret {
        display: none !important;
    }

    body.arca-app:not(.is-embedded) .app-navbar-action--user .app-user-avatar,
    body.arca-app:not(.is-embedded) .app-navbar-action--user .app-user-fallback {
        width: 34px !important;
        height: 34px !important;
        flex: 0 0 34px !important;
    }

    body.arca-app:not(.is-embedded).xplore-mobile-menu-open {
        overflow: hidden !important;
    }

    body.arca-app:not(.is-embedded) .xplore-mobile-menu-backdrop {
        position: fixed !important;
        inset: var(--x-nav-height, 90px) 0 0 !important;
        z-index: 3090 !important;
        display: block !important;
        visibility: hidden !important;
        opacity: 0 !important;
        background: rgba(5, 18, 38, 0.42) !important;
        transition: opacity 0.18s ease, visibility 0.18s ease !important;
    }

    body.arca-app:not(.is-embedded).xplore-mobile-menu-open .xplore-mobile-menu-backdrop {
        visibility: visible !important;
        opacity: 1 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-nav {
        position: fixed !important;
        top: var(--x-nav-height, 90px) !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        z-index: 3100 !important;
        display: flex !important;
        width: min(84vw, 320px) !important;
        max-width: calc(100vw - 1rem) !important;
        transform: translateX(105%) !important;
        visibility: hidden !important;
        opacity: 0 !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 1rem !important;
        padding: 1.35rem 1rem 1rem 0 !important;
        border: 0 !important;
        border-left: 1px solid color-mix(in srgb, var(--x-line) 84%, transparent) !important;
        border-radius: 22px 0 0 22px !important;
        background: linear-gradient(180deg, #e7effc 0%, #dce8f8 100%) !important;
        box-shadow: -18px 0 34px rgba(10, 31, 67, 0.22) !important;
        overflow-y: auto !important;
        transition: transform 0.22s ease, opacity 0.18s ease, visibility 0.18s ease !important;
    }

    body.arca-app:not(.is-embedded) .xplore-global-side-nav.xplore-side-nav {
        display: flex !important;
    }

    body.arca-app:not(.is-embedded).xplore-mobile-menu-open .xplore-side-nav {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-menu {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 0.72rem !important;
        padding-top: 0.25rem !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item {
        grid-template-columns: 30px minmax(0, 1fr) !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-mark {
        display: grid !important;
        width: 30px !important;
        min-width: 30px !important;
        height: 76px !important;
        min-height: 76px !important;
        font-size: 2rem !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-card,
    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card {
        width: 100% !important;
        height: 76px !important;
        min-height: 76px !important;
        margin: 0 !important;
        padding: 0.72rem 0.95rem !important;
        border-radius: 12px !important;
        clip-path: none !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item:hover {
        transform: none !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item:hover .xplore-side-card,
    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card {
        border-radius: 12px !important;
        clip-path: none !important;
    }

    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-nav {
        background: linear-gradient(180deg, #00152e 0%, #001e42 100%) !important;
        box-shadow: -22px 0 52px rgba(0, 0, 0, 0.58) !important;
    }
}

@media (min-width: 1280.01px) {
    body.arca-app:not(.is-embedded) .app-navbar-inner,
    body.arca-app:not(.is-embedded) .app-content-inner {
        width: 100% !important;
        max-width: none !important;
    }

    body.arca-app:not(.is-embedded) :is(
        .records-shell,
        .records-main.main-panel,
        .docs-search-layout,
        .docs-search-row,
        .docs-search-row > .docs-search-col,
        #_docsLayer .docs-shell,
        .doc-layer .doc-canvas,
        .doc-layer .xpdf-shell,
        .tasks-shell,
        .nlp-page,
        .nlp-results-shell
    ) {
        width: 100% !important;
        max-width: none !important;
    }
}

@media (max-width: 1280px) {
    body.arca-app:not(.is-embedded) .app-navbar-inner,
    body.arca-app:not(.is-embedded) .app-content-inner {
        width: min(100%, var(--arca-layout-compact-max)) !important;
        max-width: var(--arca-layout-compact-max) !important;
        min-width: 0 !important;
    }

    body.page-home-index.arca-app:not(.is-embedded) .xplore-landing-shell,
    body.page-home-index.arca-app:not(.is-embedded) .xplore-landing-frame {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-inline: auto !important;
    }

    body.page-home-index.arca-app:not(.is-embedded) .xplore-landing-shell:has(.xplore-hero.is-module-open),
    body.page-home-index.arca-app:not(.is-embedded) .xplore-landing-frame:has(.xplore-hero.is-module-open),
    body.page-home-index.arca-app:not(.is-embedded) .xplore-hero.is-module-open {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-inline: auto !important;
    }

    body.page-home-index.arca-app:not(.is-embedded) .xplore-hero.is-module-open .xplore-panel-frame {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

/* Light menu color contract. Loaded last so desktop and mobile drawers match. */
html[data-theme="light"] body.arca-app:not(.is-embedded) .xplore-side-nav,
html[data-theme="light"] body.page-home-index.arca-app .xplore-side-nav,
html[data-theme="light"] body.arca-app:not(.is-embedded).xplore-mobile-menu-open .xplore-side-nav,
html[data-theme="light"] body.arca-app:not(.is-embedded) .xplore-global-side-nav.xplore-side-nav {
    background: #f5f5ff !important;
}

html[data-theme="light"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card,
html[data-theme="light"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active:hover .xplore-side-card,
html[data-theme="light"] body.page-home-index.arca-app .xplore-side-item.is-active .xplore-side-card,
html[data-theme="light"] body.page-home-index.arca-app .xplore-side-item.is-active:hover .xplore-side-card,
html[data-theme="light"] body.arca-app:not(.is-embedded) .xplore-global-side-nav .xplore-side-item.is-active .xplore-side-card {
    background: #fcfcf7 !important;
}

@media (min-width: 1280.01px) {
    body.arca-app:not(.is-embedded) .xplore-side-collapse-toggle {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        align-self: flex-end !important;
        width: 34px !important;
        height: 34px !important;
        min-height: 34px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 10px !important;
        background: transparent !important;
        color: var(--x-text-2) !important;
        box-shadow: none !important;
        cursor: pointer !important;
        transition:
            margin 220ms cubic-bezier(0.22, 1, 0.36, 1),
            background-color 160ms ease,
            color 160ms ease,
            box-shadow 180ms ease !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-collapse-toggle:hover,
    body.arca-app:not(.is-embedded) .xplore-side-collapse-toggle:focus-visible {
        background: rgba(0, 103, 247, 0.1) !important;
        color: #0067f7 !important;
        outline: none !important;
        box-shadow: inset 0 0 0 1px rgba(0, 103, 247, 0.12) !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-collapse-toggle > i {
        display: inline-grid !important;
        place-items: center !important;
        width: 20px !important;
        height: 20px !important;
        font-size: 1.05rem !important;
        line-height: 1 !important;
        transition: color 160ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1) !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-collapse-label {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        max-width: 1px !important;
        margin: -1px !important;
        padding: 0 !important;
        border: 0 !important;
        overflow: hidden !important;
        clip: rect(0 0 0 0) !important;
        white-space: nowrap !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-nav {
        gap: 0.35rem !important;
        padding: 0.95rem 0.95rem 1.05rem 1rem !important;
        border-right: 1px solid rgba(139, 157, 189, 0.28) !important;
        background:
            linear-gradient(180deg,
                color-mix(in srgb, var(--x-surface) 88%, #ffffff 12%),
                color-mix(in srgb, var(--x-surface-2) 90%, #edf4ff 10%)) !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help {
        appearance: none !important;
        display: grid !important;
        grid-template-columns: 42px minmax(0, 1fr) 18px !important;
        align-items: center !important;
        gap: 0.72rem !important;
        width: calc(100% - 0.4rem) !important;
        min-height: 72px !important;
        margin: auto 0.2rem 1.05rem !important;
        padding: 0.82rem 0.86rem !important;
        border: 1px solid color-mix(in srgb, var(--x-line) 72%, transparent) !important;
        border-radius: 14px !important;
        background: color-mix(in srgb, var(--x-surface) 84%, transparent) !important;
        color: var(--x-text-2) !important;
        font: inherit !important;
        text-align: left !important;
        text-decoration: none !important;
        cursor: pointer !important;
        box-shadow:
            0 14px 30px rgba(16, 50, 92, 0.07),
            inset 0 0 0 1px rgba(255, 255, 255, 0.28) !important;
        transition:
            border-color 160ms ease,
            background-color 160ms ease,
            color 160ms ease,
            box-shadow 180ms ease,
            transform 180ms ease !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help:hover,
    body.arca-app:not(.is-embedded) .xplore-side-help:focus-visible {
        border-color: rgba(0, 103, 247, 0.36) !important;
        background: color-mix(in srgb, var(--x-surface) 92%, #0067f7 8%) !important;
        color: #0067f7 !important;
        outline: none !important;
        transform: translateY(-1px) !important;
        box-shadow:
            0 16px 32px rgba(0, 103, 247, 0.12),
            inset 0 0 0 1px rgba(0, 103, 247, 0.1) !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help-icon {
        display: grid !important;
        place-items: center !important;
        width: 42px !important;
        height: 42px !important;
        border-radius: 999px !important;
        background: rgba(0, 103, 247, 0.09) !important;
        color: #0067f7 !important;
        font-size: 1.35rem !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help-copy {
        display: grid !important;
        min-width: 0 !important;
        gap: 0.12rem !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help-copy strong,
    body.arca-app:not(.is-embedded) .xplore-side-help-copy small {
        display: block !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help-copy strong {
        color: var(--x-text) !important;
        font-size: 0.9rem !important;
        font-weight: 800 !important;
        line-height: 1.1 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help-copy small {
        color: #0067f7 !important;
        font-size: 0.78rem !important;
        line-height: 1.08 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help-arrow {
        display: grid !important;
        place-items: center !important;
        color: color-mix(in srgb, var(--x-text-3) 82%, transparent) !important;
        font-size: 0.95rem !important;
    }

    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-nav {
        border-right-color: rgba(105, 137, 188, 0.26) !important;
        background:
            linear-gradient(180deg,
                color-mix(in srgb, #071b35 78%, transparent),
                color-mix(in srgb, #082344 80%, transparent)) !important;
    }

    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-help {
        border-color: rgba(91, 154, 238, 0.24) !important;
        background: rgba(8, 28, 54, 0.72) !important;
        box-shadow: 0 16px 32px rgba(0, 8, 24, 0.28) !important;
    }

    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-help:hover,
    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-help:focus-visible {
        border-color: rgba(0, 103, 247, 0.62) !important;
        background: rgba(12, 42, 78, 0.92) !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-menu {
        position: relative !important;
        gap: 0.2rem !important;
        padding-top: 0.1rem !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-nav > .xplore-side-collapse-toggle {
        position: absolute !important;
        top: 0.95rem !important;
        right: 1.28rem !important;
        z-index: 3 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-section {
        display: block !important;
        margin: 1.15rem 0 0.42rem !important;
        padding: 0 0.35rem 0 1.55rem !important;
        color: color-mix(in srgb, var(--x-text-3) 78%, transparent) !important;
        font-size: 0.72rem !important;
        font-weight: 850 !important;
        letter-spacing: 0.055em !important;
        line-height: 1 !important;
        text-transform: uppercase !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-section:first-child {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        min-height: 34px !important;
        margin-top: 0 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-section:not(:first-child) {
        border-top: 1px solid color-mix(in srgb, var(--x-line) 72%, transparent) !important;
        padding-top: 1.05rem !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-card::before,
    body.arca-app:not(.is-embedded) .xplore-side-mark::before {
        display: none !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item {
        grid-template-columns: 34px minmax(0, 1fr) !important;
        column-gap: 0.72rem !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-mark {
        height: 78px !important;
        min-height: 78px !important;
        color: color-mix(in srgb, var(--x-text-3) 76%, transparent) !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-mark-outline,
    body.arca-app:not(.is-embedded) .xplore-side-mark-fill {
        height: 54px !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-card,
    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card {
        height: auto !important;
        min-height: 78px !important;
        padding: 0.62rem 0.92rem !important;
        border: 1px solid transparent !important;
        border-radius: 16px !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: hidden !important;
        transition:
            border-color 160ms ease,
            background-color 160ms ease,
            box-shadow 180ms ease,
            transform 180ms ease !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-copy {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-copy strong {
        display: -webkit-box !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        white-space: normal !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        line-height: 1.1 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item[href*="fotografia"] .xplore-side-copy strong,
    body.arca-app:not(.is-embedded) .xplore-side-item[data-panel-url*="fotografia"] .xplore-side-copy strong {
        display: block !important;
        max-width: 100% !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        -webkit-line-clamp: initial !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-copy small {
        display: block !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-card::after {
        content: "" !important;
        position: absolute !important;
        inset: 0 auto 0 0 !important;
        width: 4px !important;
        border-radius: 16px 0 0 16px !important;
        background: #0067f7 !important;
        opacity: 0 !important;
        transition: opacity 160ms ease !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item:not(.is-disabled):hover .xplore-side-card {
        border-color: color-mix(in srgb, #0067f7 34%, var(--x-line) 66%) !important;
        background: color-mix(in srgb, var(--x-surface) 82%, transparent) !important;
        box-shadow: 0 10px 22px rgba(16, 50, 92, 0.08) !important;
        transform: translateX(2px) !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card,
    body.arca-app:not(.is-embedded) .xplore-side-item.is-active:hover .xplore-side-card,
    body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card,
    body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active:hover .xplore-side-card {
        border-color: rgba(126, 154, 199, 0.24) !important;
        background: linear-gradient(150deg, rgba(255, 255, 255, 0.78), rgba(225, 235, 251, 0.66)) !important;
        box-shadow:
            0 14px 28px rgba(16, 50, 92, 0.08),
            inset 0 0 0 1px rgba(126, 154, 199, 0.22) !important;
    }

    html[data-theme="light"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card,
    html[data-theme="light"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active:hover .xplore-side-card,
    html[data-theme="light"] body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card,
    html[data-theme="light"] body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active:hover .xplore-side-card,
    html[data-theme="light"] body.arca-app:not(.is-embedded) .xplore-global-side-nav .xplore-side-item.is-active .xplore-side-card {
        border-color: rgba(126, 154, 199, 0.24) !important;
        background: linear-gradient(150deg, rgba(255, 255, 255, 0.78), rgba(225, 235, 251, 0.66)) !important;
        box-shadow:
            0 14px 28px rgba(16, 50, 92, 0.08),
            inset 0 0 0 1px rgba(126, 154, 199, 0.24) !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-mark,
    body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-mark {
        color: #0e6dff !important;
        text-shadow: none !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-icon,
    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-copy strong,
    body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-icon,
    body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-copy strong {
        color: #1f62f0 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-copy small,
    body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-copy small {
        color: #365d98 !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card::after,
    body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card::after {
        opacity: 1 !important;
    }

    body.arca-app:not(.is-embedded):not(.xplore-side-collapsed):not(.arcangel-rag-open) .xplore-side-item.is-active .xplore-side-card,
    body.page-home-index.arca-app:not(.is-embedded):not(.xplore-side-collapsed):not(.arcangel-rag-open) .xplore-side-item.is-active .xplore-side-card {
        width: calc(100% + 0.97rem) !important;
        max-width: calc(100% + 0.97rem) !important;
        margin-right: -0.97rem !important;
        border-right-width: 0 !important;
        border-radius: 16px 0 0 16px !important;
    }

    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-item:not(.is-disabled):hover .xplore-side-card {
        border-color: rgba(0, 103, 247, 0.54) !important;
        background: rgba(9, 35, 67, 0.86) !important;
        box-shadow: 0 12px 26px rgba(0, 8, 24, 0.24) !important;
    }

    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card,
    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active:hover .xplore-side-card,
    html[data-theme="dark"] body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-card,
    html[data-theme="dark"] body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active:hover .xplore-side-card {
        border-color: rgba(82, 151, 255, 0.42) !important;
        background: linear-gradient(150deg, rgba(14, 58, 110, 0.74), rgba(9, 35, 67, 0.64)) !important;
        box-shadow:
            0 10px 22px rgba(0, 8, 24, 0.18),
            inset 0 0 0 1px rgba(99, 167, 255, 0.12) !important;
    }

    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-icon,
    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-copy strong,
    html[data-theme="dark"] body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-icon,
    html[data-theme="dark"] body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-copy strong {
        color: #58a6ff !important;
    }

    html[data-theme="dark"] body.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-copy small,
    html[data-theme="dark"] body.page-home-index.arca-app:not(.is-embedded) .xplore-side-item.is-active .xplore-side-copy small {
        color: #9dc9ff !important;
    }

    body.page-home-index.arca-app:not(.is-embedded) .xplore-landing-frame {
        grid-template-columns: var(--x-side-expanded-width) minmax(0, 1fr) !important;
        transition: grid-template-columns 360ms cubic-bezier(0.22, 1, 0.36, 1) !important;
    }

    body.page-home-index.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-landing-frame,
    body.page-home-index.arca-app:not(.is-embedded).arcangel-rag-open .xplore-landing-frame {
        grid-template-columns: var(--x-side-collapsed-width) minmax(0, 1fr) !important;
    }

    body.arca-app.has-xplore-side-nav:not(.is-embedded) .xplore-global-side-nav.xplore-side-nav {
        position: fixed !important;
        top: var(--x-nav-height, 90px) !important;
        bottom: 0 !important;
        left: 0 !important;
        z-index: 40 !important;
        display: flex !important;
        width: var(--x-side-expanded-width) !important;
        max-width: var(--x-side-expanded-width) !important;
        overflow: visible !important;
        transition:
            width 360ms cubic-bezier(0.22, 1, 0.36, 1),
            max-width 360ms cubic-bezier(0.22, 1, 0.36, 1),
            padding 360ms cubic-bezier(0.22, 1, 0.36, 1) !important;
    }

    body.arca-app.has-xplore-side-nav:not(.is-embedded) .app-content-inner {
        padding-left: calc(var(--x-side-expanded-width) + 1rem) !important;
        transition: padding-left 360ms cubic-bezier(0.22, 1, 0.36, 1) !important;
    }

    body.arca-app.has-xplore-side-nav:not(.is-embedded).xplore-side-collapsed .app-content-inner,
    body.arca-app.has-xplore-side-nav:not(.is-embedded).arcangel-rag-open .app-content-inner {
        padding-left: calc(var(--x-side-collapsed-width) + 0.7rem) !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-nav,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-nav {
        width: var(--x-side-collapsed-width) !important;
        max-width: var(--x-side-collapsed-width) !important;
        padding: 3.15rem 0.45rem 0.75rem !important;
        overflow: visible !important;
        transition:
            width 360ms cubic-bezier(0.22, 1, 0.36, 1),
            max-width 360ms cubic-bezier(0.22, 1, 0.36, 1),
            padding 360ms cubic-bezier(0.22, 1, 0.36, 1) !important;
    }

    body.arca-app.has-xplore-side-nav:not(.is-embedded).xplore-side-collapsed .xplore-global-side-nav.xplore-side-nav,
    body.arca-app.has-xplore-side-nav:not(.is-embedded).arcangel-rag-open .xplore-global-side-nav.xplore-side-nav {
        width: var(--x-side-collapsed-width) !important;
        max-width: var(--x-side-collapsed-width) !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-collapse-toggle,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-collapse-toggle {
        display: none !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-hover-expanded .xplore-side-collapse-toggle {
        display: inline-flex !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-collapse-toggle:hover,
    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-collapse-toggle:focus-visible,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-collapse-toggle:hover,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-collapse-toggle:focus-visible {
        background: rgba(0, 103, 247, 0.12) !important;
        box-shadow:
            0 8px 18px rgba(0, 103, 247, 0.12),
            inset 0 0 0 1px rgba(0, 103, 247, 0.22) !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-help,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-help {
        grid-template-columns: 1fr !important;
        width: 54px !important;
        min-width: 54px !important;
        min-height: 54px !important;
        margin: auto auto 0.95rem !important;
        padding: 0 !important;
        border-radius: 14px !important;
        box-shadow: none !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-help-icon,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-help-icon {
        width: 100% !important;
        height: 54px !important;
        background: transparent !important;
        font-size: 1.4rem !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-help-copy,
    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-help-arrow,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-help-copy,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-help-arrow {
        display: none !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-menu,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-menu {
        gap: 0.2rem !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-section,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-section {
        display: block !important;
        height: 0 !important;
        min-height: 0 !important;
        margin: 1.15rem 0 0.42rem !important;
        padding: 0 !important;
        overflow: hidden !important;
        border: 0 !important;
        color: transparent !important;
        font-size: 0 !important;
        line-height: 0 !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-section:first-child,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-section:first-child {
        display: block !important;
        margin-top: 0 !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-section:not(:first-child),
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-section:not(:first-child) {
        border-top: 1px solid color-mix(in srgb, var(--x-line) 72%, transparent) !important;
        padding-top: 1.05rem !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-item,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-item {
        grid-template-columns: 26px minmax(0, 1fr) !important;
        gap: 0.18rem !important;
        min-width: 0 !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-mark,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-mark {
        width: 26px !important;
        min-width: 26px !important;
        height: 78px !important;
        min-height: 78px !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-mark-outline,
    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-mark-fill,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-mark-outline,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-mark-fill {
        width: 24px !important;
        height: 54px !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-card,
    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-item.is-active .xplore-side-card,
    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-item:hover .xplore-side-card,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-card,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-item.is-active .xplore-side-card,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-item:hover .xplore-side-card {
        width: 54px !important;
        min-width: 54px !important;
        height: 78px !important;
        min-height: 78px !important;
        justify-content: center !important;
        gap: 0 !important;
        padding: 0 !important;
        border-radius: 14px !important;
        clip-path: none !important;
        overflow: visible !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-card::after,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-card::after {
        display: none !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-icon,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-icon {
        width: 42px !important;
        min-width: 42px !important;
        flex: 0 0 42px !important;
        font-size: 1.35rem !important;
    }

    body.arca-app:not(.is-embedded).xplore-side-collapsed .xplore-side-copy,
    body.arca-app:not(.is-embedded).arcangel-rag-open .xplore-side-copy {
        display: none !important;
    }
}

@media (max-width: 1280px) {
    body.arca-app:not(.is-embedded) .xplore-side-collapse-toggle {
        display: none !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-section {
        display: none !important;
    }

    body.arca-app:not(.is-embedded) .xplore-side-help {
        display: none !important;
    }
}

/* RAG action contract: every RAG entry point is blue with a white icon. */
body.arca-app :is(
    #recordBtnRAG,
    .rag-btn,
    .ctx-btn[data-action="rag"],
    .xpdf-action-btn[data-act="record-rag"],
    .xpdf-mobile-action-item[data-act="record-rag"],
    [data-act="document-rag"]
) {
    border-color: rgba(0, 103, 247, 0.72) !important;
    background: linear-gradient(135deg, #147cff 0%, #0053d6 100%) !important;
    color: #ffffff !important;
    box-shadow:
        0 14px 28px rgba(0, 103, 247, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.24) !important;
}

body.arca-app :is(
    #recordBtnRAG,
    .rag-btn,
    .ctx-btn[data-action="rag"],
    .xpdf-action-btn[data-act="record-rag"],
    .xpdf-mobile-action-item[data-act="record-rag"],
    [data-act="document-rag"]
):hover {
    border-color: rgba(0, 103, 247, 0.92) !important;
    background: linear-gradient(135deg, #2b8bff 0%, #0067f7 100%) !important;
    color: #ffffff !important;
    box-shadow:
        0 16px 32px rgba(0, 103, 247, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
}

body.arca-app :is(
    #recordBtnRAG,
    .rag-btn,
    .ctx-btn[data-action="rag"],
    .xpdf-action-btn[data-act="record-rag"],
    .xpdf-mobile-action-item[data-act="record-rag"],
    [data-act="document-rag"]
) i {
    color: #ffffff !important;
}

body.arca-app .xplore-rag-icon {
    display: inline-block;
    width: 1.15em;
    height: 1.15em;
    object-fit: contain;
    flex: 0 0 auto;
    vertical-align: -0.15em;
}

body.arca-app :is(
    #recordBtnRAG,
    .rag-btn,
    .ctx-btn[data-action="rag"],
    .xpdf-action-btn[data-act="record-rag"],
    .xpdf-mobile-action-item[data-act="record-rag"],
    [data-act="document-rag"]
) .xplore-rag-icon {
    width: 28px;
    height: 28px;
    font-size: 1.18rem;
}

@media (min-width: 1280.01px) {
    body.arca-app.has-xplore-side-nav:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .app-content-inner {
        padding-left: calc(var(--x-side-collapsed-width) + 0.7rem) !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-nav,
    body.arca-app.has-xplore-side-nav:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-global-side-nav.xplore-side-nav {
        width: var(--x-side-collapsed-width) !important;
        max-width: var(--x-side-collapsed-width) !important;
        padding: 3.15rem 0.45rem 0.75rem !important;
        overflow: visible !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-collapse-toggle {
        display: none !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-help {
        grid-template-columns: 1fr !important;
        width: 54px !important;
        min-width: 54px !important;
        min-height: 54px !important;
        margin: auto auto 0.95rem !important;
        padding: 0 !important;
        border-radius: 14px !important;
        box-shadow: none !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-help-icon {
        width: 100% !important;
        height: 54px !important;
        background: transparent !important;
        font-size: 1.4rem !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-help-copy,
    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-help-arrow,
    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-copy {
        display: none !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-menu {
        gap: 0.2rem !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-section {
        display: block !important;
        height: 0 !important;
        min-height: 0 !important;
        margin: 1.15rem 0 0.42rem !important;
        padding: 0 !important;
        overflow: hidden !important;
        border: 0 !important;
        color: transparent !important;
        font-size: 0 !important;
        line-height: 0 !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-section:first-child {
        margin-top: 0 !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-section:not(:first-child) {
        border-top: 1px solid color-mix(in srgb, var(--x-line) 72%, transparent) !important;
        padding-top: 1.05rem !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-item {
        grid-template-columns: 26px minmax(0, 1fr) !important;
        gap: 0.18rem !important;
        min-width: 0 !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-mark {
        width: 26px !important;
        min-width: 26px !important;
        height: 78px !important;
        min-height: 78px !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-mark-outline,
    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-mark-fill {
        width: 24px !important;
        height: 54px !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-card,
    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-item.is-active .xplore-side-card,
    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-item:hover .xplore-side-card {
        width: 54px !important;
        min-width: 54px !important;
        height: 78px !important;
        min-height: 78px !important;
        justify-content: center !important;
        gap: 0 !important;
        padding: 0 !important;
        border-radius: 14px !important;
        clip-path: none !important;
        overflow: visible !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-card::after {
        display: none !important;
    }

    body.arca-app:not(.is-embedded):has(#docLayer.doc-layer.pdf-mode:not([hidden])) .xplore-side-icon {
        width: 42px !important;
        min-width: 42px !important;
        flex: 0 0 42px !important;
        font-size: 1.35rem !important;
    }
}

/* In the document grid menu, RAG should keep the same neutral action surface as the other actions in light mode. */
html[data-theme="light"] body.page-home-records #_docsLayer #_docsGrid .ctx-btn[data-action="rag"],
body.page-home-records:not([data-theme="dark"]) #_docsLayer #_docsGrid .ctx-btn[data-action="rag"] {
    border-color: rgba(175, 200, 232, 0.88) !important;
    background:
        linear-gradient(180deg, rgba(250, 253, 255, 0.98), rgba(235, 244, 255, 0.94)) !important;
    color: #1e63d8 !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.88),
        0 10px 18px rgba(14, 45, 91, 0.08) !important;
}

html[data-theme="light"] body.page-home-records #_docsLayer #_docsGrid .ctx-btn[data-action="rag"]:hover,
html[data-theme="light"] body.page-home-records #_docsLayer #_docsGrid .ctx-btn[data-action="rag"]:focus-visible,
body.page-home-records:not([data-theme="dark"]) #_docsLayer #_docsGrid .ctx-btn[data-action="rag"]:hover,
body.page-home-records:not([data-theme="dark"]) #_docsLayer #_docsGrid .ctx-btn[data-action="rag"]:focus-visible {
    border-color: rgba(31, 98, 240, 0.48) !important;
    background: linear-gradient(135deg, #f8fbff, #e5f0ff) !important;
    color: #0b58d8 !important;
    box-shadow: 0 14px 24px rgba(31, 98, 240, 0.14) !important;
}

html[data-theme="light"] body.page-home-records #_docsLayer #_docsGrid .ctx-btn[data-action="rag"] i,
body.page-home-records:not([data-theme="dark"]) #_docsLayer #_docsGrid .ctx-btn[data-action="rag"] i {
    color: currentColor !important;
}
