/**
 * Layout shell standard
 * - Menyamakan wrapper utama
 * - Header navigasi sedikit lebih kecil dari content (sesuai request)
 */

:root {
    --mogg-bottom-nav-h: 54px;
    --mogg-sticky-top: 84px;

    /* Header controls — shared geometry */
    --mogg-header-control-h: 44px;
    --mogg-header-control-radius: 10px;
    --mogg-header-control-pad-x: 10px;
    --mogg-header-control-gap: 8px;
    --mogg-header-inset-pad: 4px;
    --mogg-switch-w: 72px;
    --mogg-switch-inner-h: calc(var(--mogg-header-control-h) - 2px - (var(--mogg-header-inset-pad) * 2));
    --mogg-switch-inner-w: calc(var(--mogg-switch-w) - 2px - (var(--mogg-header-inset-pad) * 2));
    --mogg-switch-thumb: var(--mogg-switch-inner-h);
    --mogg-switch-travel: calc(var(--mogg-switch-inner-w) - var(--mogg-switch-thumb));

    /* Header controls — dark (default) */
    --mogg-header-control-bg: rgba(0, 0, 0, 0.28);
    --mogg-header-control-border: rgba(255, 255, 255, 0.18);
    --mogg-header-control-hover-bg: rgba(255, 255, 255, 0.12);
    --mogg-switch-track-bg: rgba(255, 255, 255, 0.07);
    --mogg-switch-icon: rgba(255, 255, 255, 0.48);
    --mogg-switch-thumb-bg: rgba(255, 255, 255, 0.2);
    --mogg-switch-thumb-icon: #ffffff;
    --mogg-switch-thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
    --mogg-switch-thumb-radius: 6px;
}

body.page-home {
    --mogg-header-control-radius: 12px;
    --mogg-switch-thumb-radius: 7px;
}

[data-theme="light"] {
    --mogg-header-control-bg: #ffffff;
    --mogg-header-control-border: #dde4ee;
    --mogg-header-control-hover-bg: #f4f7fb;
    --mogg-switch-track-bg: #e2e8f0;
    --mogg-switch-icon: #64748b;
    --mogg-switch-thumb-bg: #ffffff;
    --mogg-switch-thumb-icon: #1e293b;
    --mogg-switch-thumb-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

/* Theme switch — shared height/radius with account button */
.mogg-theme-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    width: var(--mogg-switch-w);
    height: var(--mogg-header-control-h);
    min-width: var(--mogg-switch-w);
    min-height: var(--mogg-header-control-h);
    max-height: var(--mogg-header-control-h);
    padding: var(--mogg-header-inset-pad);
    margin: 0;
    border: 1px solid var(--mogg-header-control-border);
    border-radius: var(--mogg-header-control-radius);
    background: var(--mogg-header-control-bg);
    cursor: pointer;
    font: inherit;
    color: inherit;
    box-shadow: none;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.mogg-theme-switch:hover {
    background: var(--mogg-header-control-hover-bg);
    transform: translateY(-1px);
}

.mogg-theme-switch:focus-visible {
    outline: 2px solid var(--mogg-gold, #d4a674);
    outline-offset: 3px;
}

.mogg-theme-switch__track {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: var(--mogg-switch-thumb-radius);
    background: var(--mogg-switch-track-bg);
}

.mogg-theme-switch__icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--mogg-switch-thumb) * 0.72);
    height: calc(var(--mogg-switch-thumb) * 0.72);
    font-size: 0.8rem;
    line-height: 1;
    color: var(--mogg-switch-icon);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.mogg-theme-switch__icon--sun {
    left: 1px;
}

.mogg-theme-switch__icon--moon {
    right: 1px;
}

.mogg-theme-switch__thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--mogg-switch-thumb);
    height: 100%;
    border-radius: var(--mogg-switch-thumb-radius);
    background: var(--mogg-switch-thumb-bg);
    box-shadow: var(--mogg-switch-thumb-shadow);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mogg-theme-switch__thumb-icon {
    font-size: 0.8rem;
    line-height: 1;
    color: var(--mogg-switch-thumb-icon);
}

.mogg-theme-switch__thumb-icon--dark {
    display: none;
}

/* Light mode active — thumb kiri */
.mogg-theme-switch[aria-checked="true"] .mogg-theme-switch__thumb {
    transform: translateX(0);
}

.mogg-theme-switch[aria-checked="true"] .mogg-theme-switch__thumb-icon--light {
    display: inline-block;
}

.mogg-theme-switch[aria-checked="true"] .mogg-theme-switch__thumb-icon--dark {
    display: none;
}

.mogg-theme-switch[aria-checked="true"] .mogg-theme-switch__icon--sun {
    opacity: 0;
}

.mogg-theme-switch[aria-checked="true"] .mogg-theme-switch__icon--moon {
    opacity: 1;
}

/* Dark mode active — thumb kanan */
.mogg-theme-switch[aria-checked="false"] .mogg-theme-switch__thumb {
    transform: translateX(var(--mogg-switch-travel));
}

.mogg-theme-switch[aria-checked="false"] .mogg-theme-switch__thumb-icon--light {
    display: none;
}

.mogg-theme-switch[aria-checked="false"] .mogg-theme-switch__thumb-icon--dark {
    display: inline-block;
}

.mogg-theme-switch[aria-checked="false"] .mogg-theme-switch__icon--sun {
    opacity: 1;
}

.mogg-theme-switch[aria-checked="false"] .mogg-theme-switch__icon--moon {
    opacity: 0;
}

[data-theme="light"] .mogg-theme-switch {
    background: #d1d9e6 !important;
    border-color: #c5d0de !important;
}

[data-theme="light"] .mogg-theme-switch:hover {
    background: #c5cedd !important;
}

[data-theme="light"] .mogg-theme-switch[aria-checked="true"] .mogg-theme-switch__icon--sun {
    color: #d97706;
}

[data-theme="light"] .mogg-theme-switch__icon--moon {
    color: var(--mogg-primary, #164a82);
}

/* Header — gradient accent hanya light mode; dark mengikuti vendor_css asli */
[data-theme="light"] .account-header-section {
    background: linear-gradient(135deg,
            #ffffff 0%,
            #f3f7fc 46%,
            #edf3fa 78%,
            #f5efe6 100%) !important;
    border-color: #d5e0ed !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08) !important;
}

[data-theme="light"] .user-info {
    background: #ffffff;
    border: 1px solid var(--mogg-border, #dde4ee);
    border-radius: var(--mogg-header-control-radius);
    padding: 0 var(--mogg-header-control-pad-x);
}

/* Header right cluster — aligned controls */
.account-header-right {
    align-items: center !important;
    gap: var(--mogg-header-control-gap) !important;
}

/* Account menu dropdown */
.mogg-account-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.mogg-account-menu .user-info {
    display: inline-flex;
    align-items: center;
    gap: var(--mogg-header-control-gap);
    min-width: 0;
    max-width: 220px;
    height: var(--mogg-header-control-h);
    min-height: var(--mogg-header-control-h);
    max-height: var(--mogg-header-control-h);
    margin: 0;
    padding: 0 var(--mogg-header-control-pad-x);
    border: 1px solid var(--mogg-header-control-border);
    border-radius: var(--mogg-header-control-radius);
    background: var(--mogg-header-control-bg);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    text-align: left;
    box-sizing: border-box;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.mogg-account-menu .user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.92;
}

.mogg-account-menu .user-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    line-height: 1;
    gap: 1px;
}

.mogg-account-menu .user-name {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.1;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mogg-account-menu .user-role {
    font-size: 0.58rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.04em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .mogg-account-menu .user-role {
    color: var(--mogg-text-muted);
}

.mogg-account-menu .user-info:hover,
.mogg-account-menu.show .user-info {
    background: var(--mogg-header-control-hover-bg);
    border-color: rgba(255, 255, 255, 0.24);
    transform: translateY(-1px);
}

body.page-home .mogg-account-menu .user-info,
body.page-home .mogg-theme-switch {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.09);
}

body.page-home .mogg-account-menu .user-info:hover,
body.page-home .mogg-account-menu.show .user-info,
body.page-home .mogg-theme-switch:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.16);
}

[data-theme="light"] .mogg-account-menu .user-info {
    background: #ffffff !important;
    border-color: var(--mogg-border, #dde4ee) !important;
    color: var(--mogg-text);
}

[data-theme="light"] .mogg-account-menu .user-info:hover,
[data-theme="light"] .mogg-account-menu.show .user-info {
    background: #f4f7fb !important;
    border-color: #c5d0de !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    color: var(--mogg-text);
}

[data-theme="light"] body.page-home .mogg-account-menu .user-info,
[data-theme="light"] body.page-home .mogg-theme-switch {
    background: #ffffff !important;
    border-color: var(--home-border, #dde4ee) !important;
}

.mogg-account-dropdown {
    min-width: 210px;
    margin-top: 8px !important;
    padding: 0.4rem 0;
    border-radius: 12px;
    background: rgba(12, 24, 48, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    color: #ffffff;
    overflow: hidden;
}

.mogg-account-dropdown .dropdown-item-text {
    display: block;
    padding: 0.2rem 1rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mogg-account-dropdown__name {
    font-size: 0.84rem;
    font-weight: 700;
    color: inherit;
}

.mogg-account-dropdown__role {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--mogg-text-muted, rgba(255, 255, 255, 0.55));
    padding-bottom: 0.15rem;
}

.mogg-account-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 1rem;
    font-size: 0.84rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
}

.mogg-account-dropdown .dropdown-item:hover,
.mogg-account-dropdown .dropdown-item:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.mogg-account-dropdown .dropdown-item i {
    width: 1rem;
    text-align: center;
    opacity: 0.85;
}

.mogg-account-dropdown__logout {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    color: var(--mogg-danger, #dc3545);
}

.mogg-account-dropdown__logout:hover,
.mogg-account-dropdown__logout:focus {
    color: #fff !important;
    background: var(--mogg-danger, #dc3545) !important;
}

[data-theme="light"] .mogg-account-dropdown {
    background: #ffffff;
    border-color: var(--mogg-border, #dde4ee);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    color: var(--mogg-text);
}

[data-theme="light"] .mogg-account-dropdown__name {
    color: var(--mogg-text);
}

[data-theme="light"] .mogg-account-dropdown__role {
    color: var(--mogg-text-muted);
}

[data-theme="light"] .mogg-account-dropdown .dropdown-item {
    color: var(--mogg-text);
}

[data-theme="light"] .mogg-account-dropdown .dropdown-item:hover,
[data-theme="light"] .mogg-account-dropdown .dropdown-item:focus {
    background: #f4f7fb;
    color: var(--mogg-primary);
}

[data-theme="light"] body.page-home .account-header-section {
    background: linear-gradient(135deg,
            #ffffff 0%,
            #f4f8fd 48%,
            #edf3fa 82%,
            #f6f0e8 100%) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.mogg-shell-root {
    width: 100%;
    max-width: var(--mogg-shell-max);
    margin: 0 auto;
    padding: 0 var(--mogg-shell-padding-x);
}

.mobile-app-container {
    width: 100% !important;
    max-width: var(--mogg-content-max);
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

/* Header navigasi — lebar sama dengan konten utama (seperti home).
   Center with left/right + auto margin so transform stays free (no load flash). */
.account-header-section {
    width: min(var(--mogg-content-max), calc(100% - 24px)) !important;
    max-width: var(--mogg-content-max) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    left: 0;
    right: 0;
    transform: none;
    animation: none;
}

body.page-admin .home-container {
    padding-top: 92px !important;
}

body.page-admin .top-breaker {
    margin: 8px 0 12px 0 !important;
}

/* Content cards / wrapper mengikuti grid yang rapi */
body.page-admin .mogg-page-header,
body.page-admin .mogg-filter-bar,
body.page-admin .mogg-info-banner,
body.page-admin .master-catalog-nav,
body.page-admin .panelCategory,
body.page-admin .table-wrapper,
body.page-admin .alert {
    width: calc(100% - 2rem);
    max-width: calc(100% - 2rem);
    margin-left: auto;
    margin-right: auto;
}

.mogg-mobile-title {
    display: none;
}

.home-bottom-nav {
    display: none;
}

@media (max-width: 1024px) {
    :root {
        --mogg-shell-padding-x: 10px;
    }
}

@media (max-width: 768px) {
    :root {
        --mogg-shell-padding-x: 8px;
    }

    .account-header-section {
        width: calc(100% - 12px) !important;
    }

    .mogg-account-menu .user-meta {
        display: none;
    }

    .mogg-account-menu .user-info {
        width: var(--mogg-header-control-h);
        min-width: var(--mogg-header-control-h);
        max-width: var(--mogg-header-control-h);
        padding: 0;
        justify-content: center;
    }
}

/* Mobile: keep top header + bottom nav (except pages that omit header in Blade, e.g. topspender) */
@media (max-width: 991px) {
    :root {
        --mogg-sticky-top: 84px;
    }

    .mogg-mobile-title {
        display: none;
    }

    .home-container,
    body.page-admin .home-container,
    body.page-home .home-container {
        padding-top: 84px !important;
        padding-bottom: calc(28px + var(--mogg-bottom-nav-h, 54px) + env(safe-area-inset-bottom, 0px));
    }

    /* Home mobile: header reveals on scroll (see home-dashboard.css + JS) */
    body.page-home {
        --mogg-sticky-top: 8px;
    }

    body.page-home .home-container {
        padding-top: 12px !important;
        /* Avoid double bottom pad — .home-dashboard owns clearance for the dock */
        padding-bottom: 0 !important;
    }

    body.page-home.is-home-header-visible {
        --mogg-sticky-top: 84px;
    }

    body.no-account-header {
        --mogg-sticky-top: 8px;
    }

    body.no-account-header .home-container,
    body.no-account-header.page-admin .home-container,
    body.no-account-header.page-home .home-container {
        padding-top: 12px !important;
    }

    body.no-account-header .home-bottom-nav {
        display: none !important;
    }

    .home-bottom-nav {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        z-index: 300;
        padding: 0 12px calc(6px + env(safe-area-inset-bottom, 0px));
        pointer-events: none;
        /* Promote to viewport layer — avoids iOS “mid-screen” fixed drift */
        transform: translate3d(0, 0, 0);
    }

    .home-bottom-nav-inner {
        pointer-events: auto;
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        gap: 0;
        max-width: var(--mogg-content-max, 1120px);
        margin: 0 auto;
        padding: 3px 5px;
        background: rgba(8, 17, 34, 0.94);
        border: 1px solid rgba(255, 255, 255, 0.09);
        border-radius: 14px;
        backdrop-filter: blur(20px) saturate(140%);
        -webkit-backdrop-filter: blur(20px) saturate(140%);
        box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.32);
    }

    .home-bottom-nav-inner--theme {
        justify-content: center;
        align-items: stretch;
        gap: 0;
        padding: 6px 8px;
        max-width: min(420px, calc(100% - 8px));
        width: 100%;
        border-radius: 16px;
    }

    .home-bottom-nav-theme,
    .mogg-theme-segment-wrap {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        gap: 0;
        width: 100%;
        min-width: 0;
    }

    .mogg-theme-segment {
        position: relative;
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        min-height: 46px;
        padding: 4px;
        margin: 0;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 12px;
        background: rgba(8, 20, 48, 0.55);
        cursor: pointer;
        overflow: hidden;
        font: inherit;
        color: inherit;
        box-shadow: none;
        transition: background 0.2s ease, border-color 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mogg-theme-segment:hover {
        border-color: rgba(255, 255, 255, 0.22);
        background: rgba(8, 20, 48, 0.68);
    }

    .mogg-theme-segment:focus-visible {
        outline: 2px solid var(--mogg-gold, #d4a674);
        outline-offset: 2px;
    }

    .mogg-theme-segment__indicator {
        position: absolute;
        top: 4px;
        left: 4px;
        width: calc(50% - 4px);
        height: calc(100% - 8px);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.16);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
        z-index: 1;
        pointer-events: none;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mogg-theme-segment[aria-checked="false"] .mogg-theme-segment__indicator {
        transform: translateX(100%);
    }

    .mogg-theme-segment[aria-checked="true"] .mogg-theme-segment__indicator {
        transform: translateX(0);
    }

    .mogg-theme-segment__option {
        position: relative;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        padding: 0.35rem 0.4rem;
        font-size: 0.78rem;
        font-weight: 600;
        line-height: 1.2;
        color: rgba(255, 255, 255, 0.48);
        white-space: nowrap;
        pointer-events: none;
        transition: color 0.2s ease;
    }

    .mogg-theme-segment__option i {
        font-size: 0.88rem;
        flex-shrink: 0;
    }

    .mogg-theme-segment[aria-checked="true"] .mogg-theme-segment__option--light {
        color: #fde68a;
    }

    .mogg-theme-segment[aria-checked="false"] .mogg-theme-segment__option--dark {
        color: #e8c99a;
    }

    /* First paint from data-theme before JS sets aria-checked */
    [data-theme="light"] .mogg-theme-segment .mogg-theme-segment__indicator {
        transform: translateX(0);
    }

    [data-theme="dark"] .mogg-theme-segment .mogg-theme-segment__indicator {
        transform: translateX(100%);
    }

    [data-theme="light"] .mogg-theme-segment {
        background: #eef2f7;
        border-color: #c5d0de;
    }

    [data-theme="light"] .mogg-theme-segment:hover {
        background: #e4eaf2;
        border-color: #b8c5d6;
    }

    [data-theme="light"] .mogg-theme-segment__indicator {
        background: #ffffff;
        border-color: #c5d0de;
        box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    }

    [data-theme="light"] .mogg-theme-segment__option {
        color: #94a3b8;
    }

    [data-theme="light"] .mogg-theme-segment[aria-checked="true"] .mogg-theme-segment__option--light,
    [data-theme="light"] .mogg-theme-segment .mogg-theme-segment__option--light {
        color: #b45309;
    }

    [data-theme="light"] .mogg-theme-segment[aria-checked="false"] .mogg-theme-segment__option--dark {
        color: #164a82;
    }

    [data-theme="light"] .mogg-theme-segment .mogg-theme-segment__option--dark {
        color: #94a3b8;
    }

    [data-theme="dark"] .mogg-theme-segment .mogg-theme-segment__option--dark {
        color: #e8c99a;
    }

    [data-theme="dark"] .mogg-theme-segment .mogg-theme-segment__option--light {
        color: rgba(255, 255, 255, 0.48);
    }

    /* Mitra home: theme lives in bottom dock — hide duplicate header switch on mobile */
    body:has(.home-bottom-nav--theme-only) .account-header-right > .mogg-theme-switch {
        display: none !important;
    }

    body:has(.home-bottom-nav--theme-only) {
        --mogg-bottom-nav-h: 72px;
    }

    .home-bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 3px 2px 2px;
        border-radius: 10px;
        text-decoration: none;
        color: rgba(255, 255, 255, 0.42);
        transition: color 0.22s ease, background 0.22s ease, transform 0.22s ease;
        min-width: 0;
        position: relative;
    }

    .home-bottom-nav-item:hover {
        color: rgba(255, 255, 255, 0.78);
    }

    .home-bottom-nav-item.is-active {
        color: #e8c99a;
        background: linear-gradient(180deg, rgba(212, 166, 116, 0.18) 0%, rgba(212, 166, 116, 0.06) 100%);
        box-shadow: inset 0 0 0 1px rgba(232, 201, 154, 0.22);
    }

    .home-bottom-nav-item.is-active .home-bottom-nav-icon {
        color: #0b152a;
        background: linear-gradient(135deg, #e8c99a 0%, #d4a674 100%);
        box-shadow: 0 4px 10px rgba(212, 166, 116, 0.35);
        transform: translateY(-1px);
    }

    .home-bottom-nav-item.is-active .home-bottom-nav-label {
        color: #e8c99a;
        font-weight: 700;
    }

    .home-bottom-nav-item--logout {
        color: rgba(255, 130, 130, 0.86);
    }

    .home-bottom-nav-item--back {
        color: rgba(255, 255, 255, 0.55);
    }

    .home-bottom-nav-item--back.is-hidden,
    .home-bottom-nav-item--back[hidden] {
        display: none !important;
    }

    .home-bottom-nav-icon {
        width: 22px;
        height: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        font-size: 0.82rem;
        transition: background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
    }

    .home-bottom-nav-label {
        font-size: 0.5rem;
        font-weight: 600;
        letter-spacing: 0.01em;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .mogg-back-to-top,
    .home-back-to-top,
    .back-to-top {
        bottom: calc(var(--mogg-bottom-nav-h, 54px) + 14px + env(safe-area-inset-bottom, 0px)) !important;
        z-index: 1020;
    }

    /* Pages without home bottom nav — default lower dock */
    body.no-bottom-nav .mogg-back-to-top,
    body.no-bottom-nav .home-back-to-top,
    body.no-bottom-nav .back-to-top {
        bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
    }

    body.no-bottom-nav .home-container,
    body.no-bottom-nav.page-admin .home-container,
    body.no-bottom-nav.page-home .home-container {
        padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    }

    body.no-bottom-nav .home-bottom-nav {
        display: none !important;
    }

    /* Preorder form: clear fixed .ppk-summary bar */
    body.page-preorder-form .mogg-back-to-top,
    body.page-preorder-form .home-back-to-top,
    body.page-preorder-form .back-to-top {
        bottom: calc(var(--mogg-preorder-summary-h, 6.5rem) + 12px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Form preorder paket: top header stays, no bottom nav (has its own summary bar) */
    body.page-preorder-form {
        --mogg-sticky-top: 84px;
        --mogg-preorder-summary-h: 6.5rem;
    }

    body.page-preorder-form .mogg-mobile-title,
    body.page-preorder-form .home-bottom-nav {
        display: none !important;
    }

    body.page-preorder-form .home-container {
        padding-top: 84px !important;
        padding-bottom: 12px !important;
    }
}

/* ── Floating back to top (global shell, glass) ── */
.mogg-back-to-top,
.home-back-to-top {
    position: fixed;
    right: 20px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 1020;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: rgba(15, 35, 71, 0.42);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.mogg-back-to-top.is-visible,
.home-back-to-top.is-visible {
    opacity: 0.88;
    visibility: visible;
    transform: translateY(0);
}

.mogg-back-to-top.is-visible:hover,
.home-back-to-top.is-visible:hover {
    opacity: 1;
    transform: translateY(-2px);
    background: rgba(15, 35, 71, 0.58);
    border-color: rgba(255, 255, 255, 0.4);
}

.mogg-back-to-top:focus-visible,
.home-back-to-top:focus-visible {
    outline: 2px solid var(--mogg-gold, #d4a674);
    outline-offset: 3px;
    opacity: 1;
}

/* Desktop/tablet too: keep clear of preorder summary bar */
body.page-preorder-form .mogg-back-to-top,
body.page-preorder-form .home-back-to-top,
body.page-preorder-form .back-to-top {
    bottom: calc(var(--mogg-preorder-summary-h, 6.5rem) + 12px + env(safe-area-inset-bottom, 0px));
}

[data-theme="light"] .mogg-back-to-top,
[data-theme="light"] .home-back-to-top {
    background: rgba(255, 255, 255, 0.55) !important;
    border: 1px solid rgba(15, 35, 71, 0.16) !important;
    color: var(--mogg-text, #1e293b) !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12) !important;
}

[data-theme="light"] .mogg-back-to-top.is-visible:hover,
[data-theme="light"] .home-back-to-top.is-visible:hover {
    background: rgba(255, 255, 255, 0.78) !important;
    border-color: rgba(15, 35, 71, 0.28) !important;
}

@media (max-width: 991px) {
    .mogg-back-to-top,
    .home-back-to-top {
        right: 14px;
        width: 40px;
        height: 40px;
    }

    body.page-preorder-form {
        --mogg-preorder-summary-h: 5.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mogg-back-to-top,
    .home-back-to-top {
        transition: none !important;
        transform: none !important;
    }
}
