/* e.emach.pl v9.8.248 — canonical responsive application shell
   Desktop >=761px: persistent sidebar (expanded or icon rail).
   Mobile <=760px: unchanged breadcrumb + drawer behavior. */

:root {
    --shell-sidebar-expanded: 220px;
    --shell-sidebar-collapsed: 72px;
    --shell-transition: 180ms ease;
}

body.app-shell-v246:not(.bqs-kiosk-mode).sidebar-expanded {
    --layout-content-left: var(--shell-sidebar-expanded);
}

body.app-shell-v246:not(.bqs-kiosk-mode).sidebar-collapsed {
    --layout-content-left: var(--shell-sidebar-collapsed);
}

.sidebar-collapse,
.sidebar-developer-broker-icon {
    display: none;
}

@media (min-width: 761px) {
    body.app-shell-v246:not(.bqs-kiosk-mode) .app-sidebar {
        position: fixed !important;
        z-index: 70 !important;
        inset: 0 auto 0 0 !important;
        display: flex !important;
        width: var(--layout-content-left) !important;
        height: 100vh !important;
        padding: 0 !important;
        overflow: visible !important;
        transform: none !important;
        box-shadow: none !important;
        transition: width var(--shell-transition) !important;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-brand-row {
        box-sizing: border-box;
        display: grid;
        flex: 0 0 var(--layout-topbar-height);
        width: 100%;
        margin: 0 !important; /* v9.8.248: cancel legacy margin: 0 -14px */
        min-height: var(--layout-topbar-height);
        height: var(--layout-topbar-height);
        grid-template-columns: minmax(0, 1fr) 34px;
        align-items: center;
        column-gap: var(--space-2);
        padding: 0 var(--space-3) !important;
        border-bottom: 1px solid var(--sidebar-border);
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-brand {
        display: flex;
        width: 100%;
        min-width: 0;
        margin: 0 !important;
        align-items: center;
        gap: var(--space-2);
        overflow: hidden;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-collapse {
        display: grid;
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        place-items: center;
        padding: 0;
        border: 1px solid var(--app-control-border);
        border-radius: var(--radius-md);
        background: var(--app-surface);
        color: var(--app-text-secondary);
        font-size: 1.35rem;
        line-height: 1;
        cursor: pointer;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-collapse:hover,
    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-collapse:focus-visible {
        border-color: var(--surface-border-strong);
        background: var(--surface-hover);
        color: var(--app-text);
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-collapse:focus-visible {
        outline: 2px solid var(--brand-focus);
        outline-offset: 1px;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-close,
    body.app-shell-v246:not(.bqs-kiosk-mode) .mobile-menu-button {
        display: none !important;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-nav {
        box-sizing: border-box;
        display: flex;
        min-height: 0;
        flex: 0 1 auto;
        flex-direction: column;
        gap: var(--space-1);
        padding: var(--space-3) var(--space-2) !important;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-nav-item {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        min-height: 44px;
        flex: 0 0 auto;
        overflow: hidden;
        white-space: nowrap;
        transition: padding var(--shell-transition), gap var(--shell-transition), background .16s ease, color .16s ease;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-nav-icon {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        font-size: 1.78125rem;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-nav-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-footer {
        box-sizing: border-box;
        display: flex;
        width: 100%;
        min-width: 0;
        margin-top: auto;
        flex-direction: column;
        gap: var(--space-2);
        padding: var(--space-2);
        overflow: visible;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-developer-broker-button {
        box-sizing: border-box;
        display: flex;
        width: 100%;
        min-width: 0;
        min-height: 40px;
        align-items: center;
        gap: var(--space-2);
        justify-content: flex-start;
        overflow: hidden;
        white-space: nowrap;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-developer-broker-icon {
        display: grid;
        flex: 0 0 22px;
        width: 22px;
        height: 22px;
        place-items: center;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-developer-broker-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-account-wrap {
        width: 100%;
        min-width: 0;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-account-button {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-account-popover {
        left: calc(100% + 8px);
        right: auto;
        bottom: 0;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .app-topbar {
        left: var(--layout-content-left) !important;
        transition: left var(--shell-transition) !important;
    }

    /* v9.8.259: cancel legacy justify-self:center on #appContent. Modern
       Chromium applies justify-self to block layout and would shrink the main
       content to its intrinsic width (often one device card), while older
       browsers ignored it. The shell owns main-column geometry explicitly. */
    body.app-shell-v246:not(.bqs-kiosk-mode) #appContent.spa-card,
    body.app-shell-v246:not(.bqs-kiosk-mode) #appContent.app-main {
        box-sizing: border-box !important;
        width: calc(100% - var(--layout-content-left)) !important;
        max-width: none !important;
        margin-left: var(--layout-content-left) !important;
        margin-right: 0 !important;
        justify-self: stretch !important;
        align-self: start !important;
        transition: margin-left var(--shell-transition), width var(--shell-transition) !important;
    }

    /* Expanded desktop navigation. */
    body.app-shell-v246.sidebar-expanded:not(.bqs-kiosk-mode) .sidebar-brand-logo {
        display: block !important;
        flex: 0 1 78px;
        width: auto;
        max-width: 78px;
        height: 22px;
        object-fit: contain;
        object-position: left center;
    }

    body.app-shell-v246.sidebar-expanded:not(.bqs-kiosk-mode) .sidebar-product-name {
        display: block;
        min-width: 0;
        flex: 0 1 auto;
        padding-left: var(--space-2);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.app-shell-v246.sidebar-expanded:not(.bqs-kiosk-mode) .sidebar-nav-item {
        justify-content: flex-start;
        gap: var(--space-3);
        padding-inline: var(--space-3);
    }

    /* Collapsed desktop rail. Navigation stays permanently visible. */
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-brand-row {
        grid-template-columns: minmax(0, 1fr) 28px;
        column-gap: var(--space-1);
        padding-inline: var(--space-2) !important;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-brand {
        width: 100%;
        min-width: 0;
        justify-content: center;
        gap: 0;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-brand-logo {
        display: block !important;
        width: 32px;
        max-width: 32px;
        height: 26px;
        object-fit: contain;
        object-position: center;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-product-name {
        display: none !important;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapse {
        width: 28px;
        height: 34px;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-nav {
        padding-inline: 8px !important;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-nav-item {
        justify-content: center;
        gap: 0;
        padding-inline: 0 !important;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-nav-label,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-developer-broker-label,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .account-profile-copy,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .account-chevron {
        display: none !important;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-developer-broker-button,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-account-button {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px;
        min-height: 44px;
        margin-inline: auto;
        justify-content: center !important;
        padding: 0 !important;
    }

}

@media (max-width: 760px) {
    body.app-shell-v246:not(.bqs-kiosk-mode),
    body.app-shell-v246.sidebar-expanded:not(.bqs-kiosk-mode),
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) {
        --layout-content-left: 0px !important;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-collapse {
        display: none !important;
    }

    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-brand-logo {
        display: block;
    }
}

/* Desktop account/footer details must win over historical sidebar rules. */
@media (min-width: 761px) {
    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-account-popover {
        top: auto !important;
        right: auto !important;
        bottom: 0 !important;
        left: calc(100% + 8px) !important;
        width: min(320px, calc(100vw - var(--layout-content-left) - 24px)) !important;
        min-width: 260px !important;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-account-button {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
    }

}

@media (min-width: 761px) {
    body.app-shell-v246.sidebar-expanded:not(.bqs-kiosk-mode) .account-profile-copy {
        display: flex !important;
    }

    body.app-shell-v246.sidebar-expanded:not(.bqs-kiosk-mode) .account-chevron {
        display: inline-flex !important;
    }

    body.app-shell-v246.sidebar-expanded:not(.bqs-kiosk-mode) .sidebar-account-button {
        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 52px !important;
        padding: 6px !important;
    }
}


/* v9.8.248 — branding geometry: keep the original EMACH asset in the desktop shell. */
@media (min-width: 761px) and (prefers-color-scheme: light) {
    body.app-shell-v246:not(.bqs-kiosk-mode) .sidebar-brand-logo {
        filter: none !important;
    }
}

/* v9.8.259 — list/detail return must never paint an intermediate scroll
   position. The list stays in layout (so its full height is measurable) but is
   not visible until app.js restores the saved scroll position. */
#appContent .dashboard-page.is-restoring-list-position {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* v9.8.296 — collapsed desktop rail: the EMACH mark owns the expand slot.
   The expand affordance appears in-place on hover/focus, so the rail header
   contains only one visible control instead of logo + a second button. */
.sidebar-collapsed-expand {
    display: none;
}

@media (min-width: 761px) {
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-brand-row {
        display: grid;
        grid-template-columns: 1fr;
        place-items: center;
        padding-inline: 8px !important;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-brand,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapse {
        display: none !important;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand {
        position: relative;
        display: grid;
        place-items: center;
        box-sizing: border-box;
        width: 44px;
        height: 44px;
        margin: 0 auto;
        padding: 0;
        border: 0;
        border-radius: var(--radius-md);
        background: transparent;
        color: var(--app-text-secondary);
        cursor: pointer;
        isolation: isolate;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand-logo,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand-icon {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        transition: opacity 120ms ease, transform 120ms ease;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand-logo {
        opacity: 1;
        transform: scale(1);
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand-logo img {
        display: block;
        width: 32px;
        max-width: 32px;
        height: 26px;
        object-fit: contain;
        object-position: center;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand-icon {
        opacity: 0;
        transform: scale(.86);
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand-icon > .app-static-icon {
        display: block;
        width: 22px;
        height: 22px;
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand:hover,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand:focus-visible {
        background: var(--surface-hover);
        color: var(--app-text);
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand:hover .sidebar-collapsed-expand-logo,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand:focus-visible .sidebar-collapsed-expand-logo {
        opacity: 0;
        transform: scale(.9);
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand:hover .sidebar-collapsed-expand-icon,
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand:focus-visible .sidebar-collapsed-expand-icon {
        opacity: 1;
        transform: scale(1);
    }

    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand:focus-visible {
        outline: 2px solid var(--brand-focus);
        outline-offset: 1px;
    }
}

@media (min-width: 761px) and (prefers-color-scheme: dark) {
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand-logo img {
        filter: brightness(0) invert(1);
    }
}

@media (min-width: 761px) and (prefers-color-scheme: light) {
    body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .sidebar-collapsed-expand-logo img {
        filter: none;
    }
}

/* v9.8.332 — legacy bootstrap-shell helpers. The application now ships the
   real sidebar/topbar DOM in app.html and initTopbar() hydrates it in place. */
.app-bootstrap-shell-sidebar,
.app-bootstrap-shell-topbar {
    pointer-events: none;
    user-select: none;
}

.app-bootstrap-shell-line,
.app-bootstrap-topbar-line {
    display: block;
    border-radius: 999px;
    background: var(--app-border-soft);
    opacity: .72;
}

.app-bootstrap-shell-line {
    width: 78px;
    height: 8px;
}

.app-bootstrap-shell-line.is-short { width: 48px; }
.app-bootstrap-shell-line.is-wide { width: 96px; }
.app-bootstrap-shell-line.is-account { width: 82px; height: 8px; }
.app-bootstrap-shell-line.is-account-meta { width: 54px; height: 6px; opacity: .52; }

.app-bootstrap-shell-account {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
}

.app-bootstrap-shell-account .account-profile-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.app-bootstrap-topbar-line {
    width: min(180px, 28vw);
    height: 12px;
}

.app-bootstrap-shell-menu {
    pointer-events: none;
}

@media (max-width: 760px) {
    .app-bootstrap-topbar-line {
        width: 96px;
        height: 10px;
    }
}

.app-bootstrap-brand-word {
    display: block;
    flex: 0 1 78px;
    min-width: 0;
    color: var(--app-text-strong);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .035em;
    white-space: nowrap;
}

body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .app-bootstrap-brand-word {
    width: 32px;
    max-width: 32px;
    overflow: hidden;
    font-size: 0;
}

body.app-shell-v246.sidebar-collapsed:not(.bqs-kiosk-mode) .app-bootstrap-brand-word::before {
    content: 'E';
    display: grid;
    width: 32px;
    height: 26px;
    place-items: center;
    color: var(--app-text-strong);
    font-size: 1rem;
    font-weight: 800;
}
