.titlebar {
    background: linear-gradient(90deg, #ffffff 10%, #f8fafc 90%);
    border-bottom: 1px solid #e1e8ed;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1050;
    padding-inline: 0.5rem;
}

.titlebar__side,
.titlebar__center,
.titlebar__brand,
.titlebar__heading {
    display: flex;
    align-items: center;
    min-width: 0;
}

.titlebar__side {
    flex: 0 0 auto;
}

.titlebar__side--start {
    min-width: 0;
}

.titlebar__side--has-toggle {
    min-width: 40px;
}

.titlebar__side--end {
    justify-content: flex-end;
}

.titlebar__center {
    flex: 1 1 auto;
    min-width: 0;
}

.titlebar__brand {
    width: 100%;
    gap: 0.5rem;
}

.titlebar__heading {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.titlebar[data-title-align="center"] .titlebar__brand {
    justify-content: center;
}

.titlebar[data-title-align="center"] .titlebar__heading {
    align-items: center;
    text-align: center;
}

.titlebar[data-title-align="end"] .titlebar__brand {
    justify-content: flex-end;
}

.titlebar[data-title-align="end"] .titlebar__heading {
    align-items: flex-end;
    text-align: end;
}

.titlebar[data-title-align="start"] .titlebar__brand {
    justify-content: flex-start;
}

.titlebar[data-title-align="start"] .titlebar__heading {
    align-items: flex-start;
    text-align: start;
}

.titlebar__title {
    color: #2c3e50;
    font-weight: 800;
    transition: all 0.3s;
    font-size: clamp(1.1rem, 1.4vw, 1.8rem);
    margin: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.titlebar__header-slot {
    min-width: 0;
}

.titlebar__header-slot:empty {
    display: none;
}

.titlebar[data-titlebar-show-logo="false"] .titlebar__logo {
    display: none;
}

.titlebar[data-titlebar-show-title="false"] .titlebar__title {
    display: none !important;
}

.titlebar[data-titlebar-show-home="false"] .ms-titlebar-home {
    display: none;
}

.titlebar[data-title-size="sm"] .titlebar__title {
    font-size: clamp(1rem, 1.2vw, 1.4rem);
}

.titlebar[data-title-size="md"] .titlebar__title {
    font-size: clamp(1.1rem, 1.4vw, 1.8rem);
}

.titlebar[data-title-size="lg"] .titlebar__title {
    font-size: clamp(1.2rem, 1.8vw, 2.1rem);
}

.titlebar[data-titlebar-height="dense"] {
    height: calc(var(--header-height) - 8px);
}

.titlebar[data-titlebar-height="roomy"] {
    height: calc(var(--header-height) + 8px);
}

.titlebar[data-titlebar-surface="muted"] {
    background: linear-gradient(90deg, #f8fafc 10%, #eef2f7 90%);
}

.titlebar[data-titlebar-surface="glass"] {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.72) 10%, rgba(248, 250, 252, 0.78) 90%);
    backdrop-filter: blur(12px);
}

.titlebar .btn-light {
    background-color: transparent !important;
    border: none !important;
    color: var(--primal) !important;
    font-weight: 600 !important;
    transition: all 0.2s ease;
    border-radius: 8px !important;
}

.titlebar .btn-light:hover {
    background-color: rgba(var(--primal-rgb), 0.08) !important;
    color: var(--primal) !important;
    transform: translateY(-1px);
}

.titlebar .login-title-btn {
    border: none !important;
}

.titlebar .login-title-btn:hover {
    border-color: rgba(var(--primal-rgb), 0.2) !important;
}

.titlebar .ms-titlebar-home,
.titlebar .ms-login-round {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--title);
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(var(--primal-rgb), 0.12);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    font-size: 1rem;
}

.titlebar[data-titlebar-home-shape="square"] .ms-titlebar-home,
.titlebar[data-titlebar-home-shape="square"] .ms-login-round {
    border-radius: 10px;
}

.titlebar[data-titlebar-home-shape="squircle"] .ms-titlebar-home,
.titlebar[data-titlebar-home-shape="squircle"] .ms-login-round {
    border-radius: 14px;
}

.titlebar .ms-titlebar-home:hover,
.titlebar .ms-login-round:hover,
.titlebar .ms-titlebar-home:focus,
.titlebar .ms-login-round:focus,
.titlebar .ms-titlebar-home:focus-visible,
.titlebar .ms-login-round:focus-visible {
    color: var(--primal_dark);
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(var(--primal-rgb), 0.22);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
    outline: none;
}

.titlebar .ms-titlebar-home i,
.titlebar .ms-login-round i {
    font-size: 1rem;
    line-height: 1;
}

.titlebar__logo {
    height: 42px;
    width: auto;
    padding: 4px;
    border-radius: 8px;
    margin-inline-end: 10px;
    transition: all 0.3s;
}

.titlebar[data-titlebar-logo-treatment="plate"] .titlebar__logo {
    background:
        linear-gradient(135deg, rgba(var(--primal-rgb, 13, 110, 253), 0.1), transparent 58%),
        color-mix(in srgb, var(--hbody, #ffffff) 84%, transparent);
    border: 1px solid rgba(var(--primal-rgb, 13, 110, 253), 0.18);
    box-shadow:
        0 0.45rem 1.15rem rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.titlebar[data-titlebar-logo-treatment="plate"][data-titlebar-logo-treatment-shape="soft"] .titlebar__logo {
    border-radius: 12px;
}

.titlebar[data-titlebar-logo-treatment="plate"][data-titlebar-logo-treatment-shape="pill"] .titlebar__logo {
    border-radius: 999px;
    padding-inline: 8px;
}

.titlebar[data-titlebar-logo-treatment="plate"][data-titlebar-logo-treatment-shape="square"] .titlebar__logo {
    border-radius: 4px;
}

.titlebar[data-titlebar-logo-treatment="halo"] .titlebar__logo {
    filter:
        drop-shadow(0 0 0.35rem rgba(var(--primal-rgb, 13, 110, 253), 0.42))
        drop-shadow(0 0.35rem 0.85rem rgba(15, 23, 42, 0.16));
}

.titlebar[data-titlebar-logo-treatment="contrast"] .titlebar__logo {
    filter:
        brightness(1.08)
        contrast(1.12)
        drop-shadow(0 1px 0 color-mix(in srgb, var(--hbody, #ffffff) 70%, transparent))
        drop-shadow(0 0.18rem 0.55rem rgba(15, 23, 42, 0.22));
}

.titlebar[data-sidebar-collapse-mode="locked_expanded"] .sidebar-toggle {
    display: none;
}

.titlebar .sidebar-toggle--desktop-disabled {
    display: none;
}

@media (max-width: 1099.98px) {
    .titlebar .sidebar-toggle--desktop-disabled {
        display: inline-flex !important;
    }

    .titlebar__side--mobile-toggle {
        min-width: 40px;
    }
}

@media (max-width: 991.98px) {
    .titlebar .sidebar-toggle {
        display: inline-flex !important;
    }

    .titlebar .titlebar__brand {
        justify-content: flex-start !important;
    }

    .titlebar .titlebar__heading {
        align-items: flex-start !important;
        text-align: start !important;
    }
}
