:root {
    --portal-font-size-min: 12px;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --pwa-appbar-height: 58px;
}

html {
    color-scheme: light;
    background: #f8fafc;
}

html[data-theme="dark"] {
    color-scheme: dark;
    background: #020617;
}

html, body {
    min-height: 100%;
    font-family: Inter, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

html[data-theme="dark"] body,
html[data-theme="dark"] #portal-application-root {
    background: #020617;
    color: #f8fafc;
}

@media (min-width: 1024px) {
    html {
        font-size: 14.4px;
    }
}

.dashboard-shell {
    min-height: calc(100vh - var(--pwa-appbar-height) - var(--safe-area-top));
    min-height: calc(100dvh - var(--pwa-appbar-height) - var(--safe-area-top));
    box-sizing: border-box;
    padding-top: 24px !important;
    padding-right: calc(24px + var(--safe-area-right)) !important;
    padding-bottom: calc(24px + var(--safe-area-bottom)) !important;
    padding-left: calc(24px + var(--safe-area-left)) !important;
}

@media (min-width: 1024px) {
    .dashboard-shell {
        padding:
            22px
            calc(22px + var(--safe-area-right))
            calc(22px + var(--safe-area-bottom))
            calc(22px + var(--safe-area-left)) !important;
    }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    height: calc(70px + var(--safe-area-top));
    min-height: calc(70px + var(--safe-area-top));
    box-sizing: border-box;
    justify-content: center;
    padding:
        calc(6px + var(--safe-area-top))
        12px
        6px !important;
    border-bottom: 0;
}

.sidebar-brand a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.sidebar-brand img {
    display: block;
    width: 97px;
    max-height: 45px;
    height: auto;
}

/* MudBlazor roots used by the authentication layout live outside CSS isolation. */
.auth-layout {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    background:
        radial-gradient(circle at 15% 15%, rgba(30, 58, 138, .08), transparent 32%),
        linear-gradient(145deg, #f8fafc 0%, #f3f6fb 52%, #eef2f8 100%);
}

html[data-theme="dark"] .auth-layout {
    background:
        radial-gradient(circle at 15% 15%, rgba(96, 165, 250, .1), transparent 32%),
        linear-gradient(145deg, #020617 0%, #07101f 52%, #0f172a 100%);
}

.auth-layout__container {
    position: relative;
    z-index: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    box-sizing: border-box;
    padding-top: calc(40px + var(--safe-area-top));
    padding-right: var(--safe-area-right);
    padding-bottom: calc(40px + var(--safe-area-bottom));
    padding-left: var(--safe-area-left);
}

.main-appbar {
    height: calc(var(--pwa-appbar-height) + var(--safe-area-top));
    min-height: calc(var(--pwa-appbar-height) + var(--safe-area-top));
    box-sizing: border-box;
    padding:
        var(--safe-area-top)
        calc(22px + var(--safe-area-right))
        0
        calc(22px + var(--safe-area-left)) !important;
    border-bottom: 0;
    background: var(--mud-palette-background) !important;
    color: var(--mud-palette-text-primary) !important;
    box-shadow: none !important;
}

.mud-layout > .mud-main-content {
    padding-top:
        calc(var(--pwa-appbar-height) + var(--safe-area-top)) !important;
}

.main-appbar__menu {
    margin-right: 8px !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    color: var(--mud-palette-text-secondary) !important;
}

.main-appbar__menu:hover,
.main-appbar__action:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent) !important;
    color: var(--mud-palette-primary) !important;
}

.main-appbar__title {
    overflow: hidden;
    max-width: min(30vw, 360px);
    font-size: .98rem !important;
    font-weight: 650 !important;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.main-appbar__divider {
    height: 30px;
    margin: 0 2px !important;
}

.main-appbar__user {
    min-width: 0;
    padding: 5px 8px;
    border-radius: 12px;
}

.portal-sidebar {
    border-right: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 72%, transparent) !important;
    background: var(--mud-palette-surface) !important;
    box-shadow: 3px 0 10px -9px rgba(15, 23, 42, .24) !important;
}

.auth-layout:has(.login-card) {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
}

.auth-layout:has(.login-card) .auth-layout__container {
    height: 100%;
    min-height: 0;
}

.sidebar-brand__mobile {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.portal-sidebar .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    padding:
        0
        calc(12px + var(--safe-area-right))
        calc(14px + var(--safe-area-bottom))
        calc(12px + var(--safe-area-left));
}

.portal-sidebar__nav {
    flex: 1;
    min-height: 0;
    padding: 5px 0 18px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.portal-sidebar__section-label {
    margin: 17px 12px 7px;
    color: color-mix(in srgb, var(--mud-palette-text-secondary) 76%, transparent);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.portal-sidebar__section-label--spaced {
    margin-top: 25px;
}

.portal-sidebar .mud-nav-link {
    align-items: center;
    min-height: 42px;
    margin: 3px 0;
    padding: 8px 11px;
    border-radius: 10px;
    color: var(--mud-palette-text-secondary);
    font-size: 14px;
    font-weight: 550;
    transition: color .16s ease, background-color .16s ease;
}

.portal-sidebar .mud-nav-link:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, transparent);
    color: var(--mud-palette-text-primary);
}

.portal-sidebar .mud-nav-link.active {
    background: color-mix(in srgb, var(--mud-palette-primary) 9%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
    font-weight: 700;
}

.portal-sidebar .mud-nav-link .mud-nav-link-icon {
    display: block;
    align-self: center;
    min-width: 31px;
    color: currentColor;
}

.portal-sidebar .mud-nav-link .mud-icon-root {
    display: block;
    font-size: 1.16rem;
}

.portal-sidebar .mud-nav-link .mud-nav-link-text {
    align-self: center;
}

.portal-sidebar .mud-nav-group .mud-nav-link {
    margin-bottom: 2px;
}

.portal-sidebar .mud-nav-group .mud-collapse-container {
    position: relative;
    margin-left: 10px;
    padding-left: 6px;
    padding-right: 0;
}

.portal-sidebar .mud-nav-group .mud-collapse-container::before {
    position: absolute;
    inset: 2px auto 5px 0;
    width: 1px;
    background: color-mix(in srgb, var(--mud-palette-lines-default) 82%, transparent);
    content: "";
}

.portal-sidebar .mud-nav-group .mud-collapse-container .mud-nav-link {
    min-height: 38px;
    margin-right: 0 !important;
    margin-left: 0 !important;
    padding-right: 7px !important;
    padding-left: 8px !important;
    font-size: 14px;
}

.portal-sidebar .mud-nav-group .mud-collapse-container .mud-nav-link-icon {
    min-width: 26px !important;
    margin-left: 0 !important;
}

.portal-sidebar .mud-nav-group .mud-collapse-container .mud-nav-link-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-sidebar__footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 12px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 72%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--mud-palette-primary) 2.5%, var(--mud-palette-surface));
}

.portal-sidebar__footer-mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--mud-palette-primary) 9%, transparent);
    color: var(--mud-palette-primary);
}

.portal-sidebar__footer-mark .mud-icon-root {
    font-size: 1rem;
}

.portal-sidebar__footer div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.portal-sidebar__footer strong {
    font-size: .75rem;
    line-height: 1.25;
}

.portal-sidebar__footer div span {
    margin-top: 2px;
    color: var(--mud-palette-text-secondary);
    font-size: .75rem;
}

.main-appbar__avatar {
    cursor: pointer;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--mud-palette-primary) 7%, transparent);
}

.profile-trigger {
    display: inline-flex;
    padding: 4px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.profile-trigger:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

.profile-menu__popover {
    min-width: 286px !important;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 82%, transparent);
    border-radius: 16px !important;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .16) !important;
}

.profile-menu__card {
    padding: 8px;
    background: var(--mud-palette-surface);
}

.profile-menu__identity {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 14px;
}

.profile-menu__avatar {
    flex: 0 0 auto;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
}

.profile-menu__identity-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-menu__identity-copy strong,
.profile-menu__identity-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-menu__identity-copy strong { font-size: .9rem; line-height: 1.35; }
.profile-menu__identity-copy span { color: var(--mud-palette-text-secondary); font-size: .74rem; }
.profile-menu__identity-copy small {
    align-self: flex-start;
    margin-top: 5px;
    padding: 2px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--mud-palette-primary) 9%, transparent);
    color: var(--mud-palette-primary);
    font-size: .65rem;
    font-weight: 700;
}

.profile-menu__section {
    padding: 6px 0;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.profile-menu__section .mud-list-item {
    min-height: 42px;
    margin: 2px 0;
    border-radius: 9px;
}

.profile-menu__section .mud-list-item:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 7%, transparent);
}

.profile-menu__section--logout { padding-bottom: 0; }

.profile-menu__logout-button {
    justify-content: flex-start;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--mud-palette-error);
    text-transform: none;
}

.profile-menu__logout-button:hover {
    background: color-mix(in srgb, var(--mud-palette-error) 7%, transparent) !important;
}

.profile-menu__logout-form { display: none; }

.portal-sidebar__mobile-context { display: none; }
.profile-page { max-width: 620px; }

.context-switcher {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: min(42vw, 390px);
    min-height: 40px;
    padding: 5px 10px 5px 7px;
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 16%, var(--mud-palette-lines-default));
    border-radius: 12px;
    background: color-mix(in srgb, var(--mud-palette-primary) 7%, var(--mud-palette-surface));
    color: var(--mud-palette-text-primary);
    font: inherit;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.context-switcher:hover {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 40%, var(--mud-palette-lines-default));
    background: color-mix(in srgb, var(--mud-palette-primary) 11%, var(--mud-palette-surface));
    box-shadow: 0 5px 18px rgba(15, 23, 42, .07);
}

.context-switcher--static { cursor: default; }
.context-switcher--static:hover { box-shadow: none; }
.context-switcher__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 29px;
    height: 29px;
    border-radius: 8px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}
.context-switcher__icon .mud-icon-root { font-size: 1rem; }
.context-switcher__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: .78rem;
    font-weight: 700;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.context-switcher__chevron { flex: 0 0 auto; color: var(--mud-palette-text-secondary); font-size: 1.15rem !important; }

.context-menu__popover {
    min-width: 250px !important;
    max-width: min(92vw, 380px) !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
    margin-top: 7px;
    padding: 7px !important;
    border: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 76%, transparent);
    border-radius: 14px !important;
    background: var(--mud-palette-surface) !important;
    box-shadow: 0 14px 38px rgba(15, 23, 42, .13) !important;
}

.context-menu__heading {
    display: flex;
    flex-direction: column;
    padding: 7px 9px 10px;
}

.context-menu__heading span {
    color: var(--mud-palette-text-primary);
    font-size: 12px;
    font-weight: 750;
}

.context-menu__heading small {
    margin-top: 2px;
    color: var(--mud-palette-text-secondary);
    font-size: 12px;
}

.context-menu__popover .mud-list {
    padding: 0;
}

.context-menu__popover .mud-list-item {
    min-height: 42px;
    margin: 3px 0;
    padding: 7px 9px;
    border-radius: 9px;
    color: var(--mud-palette-text-secondary);
    font-size: 14px;
    transition: color .16s ease, background-color .16s ease;
}

.context-menu__popover .mud-list-item-text,
.context-menu__popover .mud-list-item-text .mud-typography,
.context-menu__popover .mud-menu-item-text,
.context-menu__popover .mud-menu-item-text.mud-typography {
    overflow: hidden;
    font-size: 14px !important;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-menu__popover .mud-list-item:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
    color: var(--mud-palette-text-primary);
}

.context-menu__popover .mud-list-item-icon {
    min-width: 32px;
    color: currentColor;
}

.context-menu__popover .mud-list-item-icon .mud-icon-root {
    font-size: 1.05rem;
}

.context-menu__popover .mud-divider {
    margin: 6px 5px;
    border-color: color-mix(in srgb, var(--mud-palette-lines-default) 72%, transparent);
}

.context-menu__popover .context-menu__item--active {
    background: color-mix(in srgb, var(--mud-palette-primary) 9%, var(--mud-palette-surface));
    color: var(--mud-palette-primary);
    opacity: 1;
}

.main-appbar__user .mud-avatar-root {
    background: color-mix(in srgb, var(--mud-palette-primary) 13%, transparent) !important;
    color: var(--mud-palette-primary) !important;
    font-weight: 700;
}

.main-appbar__action {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    color: var(--mud-palette-text-secondary) !important;
    transition: color .18s ease, background-color .18s ease;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 38px !important;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 20px !important;
    background: var(--mud-palette-surface);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .1) !important;
}

.login-card .mud-input-outlined-border {
    border-radius: 10px !important;
}

.login-card .mud-button-root {
    min-height: 48px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: none;
    box-shadow: none;
}

.mobile-nav-overlay {
    display: none;
}

@media (max-width: 600px) {
    .auth-layout__container {
        padding:
            calc(24px + var(--safe-area-top))
            calc(16px + var(--safe-area-right))
            calc(24px + var(--safe-area-bottom))
            calc(16px + var(--safe-area-left));
    }

    .login-card {
        padding: 28px 22px !important;
        border-radius: 16px !important;
    }

    .main-appbar {
        padding:
            var(--safe-area-top)
            calc(10px + var(--safe-area-right))
            0
            calc(10px + var(--safe-area-left)) !important;
    }

    .main-appbar__title,
    .main-appbar__divider,
    .main-appbar__context {
        display: none !important;
    }

    .main-appbar__user {
        padding: 0;
    }

    .context-switcher {
        max-width: 48vw;
    }

    .sidebar-brand__desktop,
    .portal-sidebar__footer--desktop,
    .portal-sidebar.mud-drawer {
        display: none !important;
    }

    /* Suppress MudBlazor drawer default overlay backdrop scrim on mobile */
    .portal-drawer-overlay-disabled,
    .mud-drawer-overlay,
    .mud-overlay-drawer,
    .mud-drawer-overlay--responsive {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Freeze background page scrolling and interactions when mobile menu is open */
    html:has(.mobile-nav-overlay--open),
    body:has(.mobile-nav-overlay--open),
    body.mobile-nav-no-scroll {
        overflow: hidden !important;
        height: 100vh !important;
        height: 100dvh !important;
        touch-action: none !important;
        -webkit-overflow-scrolling: auto !important;
    }

    html:has(.mobile-nav-overlay--open) .mud-layout,
    html:has(.mobile-nav-overlay--open) .mud-main-content,
    html:has(.mobile-nav-overlay--open) .dashboard-shell,
    body.mobile-nav-no-scroll .mud-layout,
    body.mobile-nav-no-scroll .mud-main-content,
    body.mobile-nav-no-scroll .dashboard-shell {
        overflow: hidden !important;
        touch-action: none !important;
        pointer-events: none !important;
    }

    .mobile-nav-overlay {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: var(--mud-palette-surface) !important;
        z-index: 2000 !important;
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity .22s cubic-bezier(0.16, 1, 0.3, 1), transform .22s cubic-bezier(0.16, 1, 0.3, 1), visibility .22s;
        pointer-events: none;
        touch-action: none;
        overscroll-behavior: contain;
    }

    .mobile-nav-overlay--open {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .mobile-nav-overlay__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: calc(12px + var(--safe-area-top, 0px)) 18px 12px;
        border-bottom: 1px solid var(--mud-palette-lines-default);
        flex-shrink: 0;
        background: var(--mud-palette-surface);
        touch-action: none;
    }

    .mobile-nav-overlay__brand {
        display: flex;
        align-items: center;
        text-decoration: none;
    }

    .mobile-nav-overlay__brand img {
        height: 36px;
        width: auto;
        object-fit: contain;
    }

    .mobile-nav-overlay__close-button {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        border: none !important;
        background: transparent !important;
        color: var(--mud-palette-text-primary);
        cursor: pointer;
        padding: 0;
        transition: opacity .15s ease, transform .15s ease;
    }

    .mobile-nav-overlay__close-button:active {
        transform: scale(0.9);
        opacity: 0.7;
    }

    .mobile-nav-overlay__close-button .mud-icon-root {
        font-size: 1.75rem;
    }

    .mobile-nav-overlay__content {
        flex: 1 1 auto;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        overscroll-behavior-y: contain !important;
        touch-action: pan-y !important;
        padding: 16px 16px calc(28px + var(--safe-area-bottom, 16px));
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .mobile-nav-overlay .context-switcher {
        width: 100%;
        max-width: none;
        background: transparent !important;
        border: 1px solid var(--mud-palette-lines-default);
        min-height: 46px;
        padding: 6px 12px 6px 8px;
        border-radius: 12px;
    }

    .mobile-nav-overlay .context-switcher:hover,
    .mobile-nav-overlay .context-switcher:active {
        background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent) !important;
    }

    .mobile-nav-overlay .context-switcher--static {
        cursor: default;
    }

    .mobile-nav-overlay .context-switcher--static:hover,
    .mobile-nav-overlay .context-switcher--static:active {
        background: transparent !important;
        box-shadow: none;
    }

    .mobile-nav-section {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .mobile-nav-section__title {
        margin: 0;
        color: var(--mud-palette-text-secondary);
        font-size: .75rem;
        font-weight: 800;
        letter-spacing: .08em;
        text-transform: uppercase;
        padding-left: 2px;
    }

    .mobile-nav-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .mobile-nav-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 106px;
        padding: 14px 10px 12px;
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 16px;
        background: var(--mud-palette-surface);
        color: var(--mud-palette-text-primary);
        text-decoration: none;
        box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
        transition: transform .15s ease, border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
    }

    .mobile-nav-card:active {
        transform: scale(0.96);
        background: color-mix(in srgb, var(--mud-palette-primary) 7%, var(--mud-palette-surface));
    }

    .mobile-nav-card.active {
        border-color: var(--mud-palette-primary);
        background: color-mix(in srgb, var(--mud-palette-primary) 8%, var(--mud-palette-surface));
        box-shadow: 0 4px 14px color-mix(in srgb, var(--mud-palette-primary) 16%, transparent);
    }

    .mobile-nav-card__icon-box {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: color-mix(in srgb, var(--mud-palette-primary) 9%, transparent);
        color: var(--mud-palette-primary);
        margin-bottom: 8px;
        transition: transform .15s ease, background-color .15s ease;
    }

    .mobile-nav-card.active .mobile-nav-card__icon-box {
        background: var(--mud-palette-primary);
        color: var(--mud-palette-primary-text);
    }

    .mobile-nav-card__icon-box .mud-icon-root {
        font-size: 1.65rem;
    }

    .mobile-nav-card__label {
        font-size: .82rem;
        font-weight: 600;
        line-height: 1.25;
        text-align: center;
        color: var(--mud-palette-text-primary);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .mobile-nav-card.active .mobile-nav-card__label {
        font-weight: 700;
        color: var(--mud-palette-primary);
    }

    .mobile-nav-overlay__footer {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-top: 6px;
        padding: 12px 14px;
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 14px;
        background: color-mix(in srgb, var(--mud-palette-primary) 3%, var(--mud-palette-surface));
    }

    .mobile-nav-overlay__footer strong {
        display: block;
        font-size: .84rem;
        color: var(--mud-palette-text-primary);
    }

    .mobile-nav-overlay__footer span {
        font-size: .75rem;
        color: var(--mud-palette-text-secondary);
    }
}

@media (max-width: 600px) {
    .dashboard-shell {
        padding:
            20px
            calc(16px + var(--safe-area-right))
            calc(20px + var(--safe-area-bottom))
            calc(16px + var(--safe-area-left)) !important;
    }
}

@media (max-height: 600px) {
    .auth-layout__container {
        align-items: flex-start;
    }

    .auth-layout:has(.login-card) .auth-layout__container {
        align-items: center;
        padding-top: calc(8px + var(--safe-area-top));
        padding-bottom: calc(8px + var(--safe-area-bottom));
    }
}

.mud-dialog-content,
.mud-popover {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Mobile Bottom Sheet - Context Switcher
   ========================================================================== */

.mud-dialog-container:has(.context-bottom-sheet-dialog),
.mud-dialog-container.mud-dialog-custom {
    padding: 0 !important;
    align-items: flex-end !important;
    justify-content: center !important;
}

.mud-dialog.context-bottom-sheet-dialog {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 520px !important;
    margin: 0 auto !important;
    border-radius: 24px 24px 0 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 80%, transparent) !important;
    border-bottom: none !important;
    background: var(--mud-palette-surface) !important;
    box-shadow: 0 -12px 36px rgba(15, 23, 42, 0.22) !important;
    animation: bottomSheetSlideUp 0.26s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow: hidden !important;
    z-index: 1401 !important;
}

.mud-dialog.context-bottom-sheet-dialog .mud-dialog-content {
    padding: 0 !important;
}

@keyframes bottomSheetSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0.92;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.bottom-sheet {
    display: flex;
    flex-direction: column;
    max-height: 85dvh;
}

.bottom-sheet__handle-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
    padding-bottom: 4px;
}

.bottom-sheet__handle {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background-color: var(--mud-palette-lines-default);
    opacity: 0.85;
}

.bottom-sheet__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 8px 16px 12px 20px;
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 65%, transparent);
}

.bottom-sheet__titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bottom-sheet__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.bottom-sheet__subtitle {
    font-size: .8rem;
    color: var(--mud-palette-text-secondary);
}

.bottom-sheet__close {
    margin-top: -4px;
    margin-right: -6px;
    color: var(--mud-palette-text-secondary) !important;
}

.bottom-sheet__search {
    padding: 10px 16px 4px;
}

.bottom-sheet__search .mud-input-outlined-border {
    border-radius: 10px !important;
}

.bottom-sheet__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: calc(75dvh - 90px);
    overflow-y: auto;
    padding: 12px 14px calc(16px + var(--safe-area-bottom, 10px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.bottom-sheet__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--mud-palette-text-primary);
    text-align: left;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease;
}

.bottom-sheet__item:hover:not(:disabled),
.bottom-sheet__item:active:not(:disabled) {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 20%, transparent);
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent);
}

.bottom-sheet__item--active {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 30%, transparent) !important;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, var(--mud-palette-surface)) !important;
    cursor: default !important;
}

.bottom-sheet__item-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 10%, transparent);
    color: var(--mud-palette-text-secondary);
}

.bottom-sheet__item-icon--active {
    background: var(--mud-palette-primary) !important;
    color: var(--mud-palette-primary-text) !important;
}

.bottom-sheet__item-info {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    gap: 2px;
}

.bottom-sheet__item-name {
    overflow: hidden;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--mud-palette-text-primary);
    word-break: break-word;
}

.bottom-sheet__item--active .bottom-sheet__item-name {
    font-weight: 700;
    color: var(--mud-palette-primary);
}

.bottom-sheet__item-badge {
    font-size: .72rem;
    font-weight: 600;
    color: var(--mud-palette-primary);
}

.bottom-sheet__item-meta {
    font-size: .74rem;
    color: var(--mud-palette-text-secondary);
}

.bottom-sheet__active-check {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--mud-palette-primary) 16%, transparent);
    color: var(--mud-palette-primary);
}

.bottom-sheet__item-chevron {
    flex: 0 0 auto;
    color: var(--mud-palette-lines-default);
    font-size: 1.25rem !important;
}

.bottom-sheet__divider {
    height: 1px;
    margin: 6px 4px;
    background: color-mix(in srgb, var(--mud-palette-lines-default) 65%, transparent);
}

.bottom-sheet__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--mud-palette-text-secondary);
    font-size: .88rem;
}

.bottom-sheet__empty-icon {
    opacity: 0.6;
}

.mud-table-container,
.document-list {
    overscroll-behavior: auto;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
}

@media (pointer: coarse) {
    .mud-button-root,
    .mud-icon-button,
    .mud-nav-link,
    .mud-list-item,
    .context-switcher,
    .login-card .mud-link,
    .access-card a,
    .document-item__actions a,
    .document-item__actions button,
    #components-reconnect-modal button {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .mud-button-root:not(:disabled):active,
    .mud-icon-button:not(:disabled):active,
    .mud-nav-link:active,
    .mud-list-item:active,
    .context-switcher:active,
    .login-card .mud-link:active,
    .access-card a:active,
    .quick-action:active,
    .document-item__actions a:active,
    #components-reconnect-modal button:not(:disabled):active {
        filter: brightness(.94);
        transform: scale(.97);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Shared authenticated-page visual language */
.ui-page {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

.password-page {
    max-width: 520px;
}

.ui-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 2px;
}

.ui-page-header .mud-typography-h4 {
    font-size: clamp(1.5rem, 2vw, 1.85rem);
    font-weight: 650;
    letter-spacing: -.035em;
}

.ui-page-header .mud-typography-body1 {
    margin-top: 4px;
    font-size: .84rem;
}

.ui-page .mud-paper.ui-surface,
.ui-page > .mud-paper,
.ui-page > div > .mud-paper {
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 16px;
    background: var(--mud-palette-surface);
    box-shadow: 0 8px 28px rgba(15, 23, 42, .045) !important;
}

.ui-filter-card {
    padding: 15px !important;
}

.ui-table-card .mud-table-head {
    background: color-mix(in srgb, var(--mud-palette-primary) 3%, var(--mud-palette-surface));
}

.ui-table-card .mud-table-cell {
    padding: 11px 14px;
    border-color: var(--mud-palette-lines-default);
    font-size: .78rem;
}

.ui-table-card .mud-table-head .mud-table-cell {
    padding-top: 12px;
    padding-bottom: 12px;
    color: var(--mud-palette-text-secondary);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .025em;
}

.ui-metric-card {
    height: 100%;
    min-height: 98px;
    padding: 15px !important;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 16px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .04) !important;
}

.ui-metric-card .mud-typography-h4,
.ui-metric-card .mud-typography-h6 {
    margin-top: 4px;
    color: var(--mud-palette-primary);
    font-weight: 700;
}

.ui-metric-card .mud-icon-root {
    box-sizing: content-box;
    padding: 10px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
}

.ui-form-card {
    padding: 20px !important;
}

.ui-form-card > .mud-typography-h6,
.ui-form-card > .mud-stack > div > .mud-typography-h6 {
    font-weight: 650;
}

.ui-page .mud-button-root {
    border-radius: 9px;
    min-height: 36px;
    text-transform: none;
}

.ui-page .mud-input-control {
    font-size: .82rem;
}

.ui-page .mud-input-label {
    z-index: 1;
    padding: 0 4px;
    background: var(--mud-palette-surface);
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.ui-page .mud-input-outlined-border {
    border-radius: 10px !important;
}

.ui-page .mud-expansion-panels {
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .04);
}

@media (max-width: 600px) {
    .ui-page-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .ui-page-header .mud-button-root {
        width: 100%;
    }

    .ui-form-card {
        padding: 18px !important;
    }
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
