/* ==========================================================================
   AtomFive Platform - Shell V1 Design System (shell-v1.css)
   Encapsulates the classic SPA Hub layout, navigation & shell components.
   ========================================================================== */

@import url('./css-components/generic-menu-bar.css');
@import url('./css-components/generic-bubble.css');
@import url('./css-components/generic-top-bar.css');
@import url('./css-components/notifications.css');
@import url('./css-components/generic-right-panel.css');
@import url('./css-components/burger-actions.css');
@import url('./css-components/generic-vertical-menu.css');
@import url('./css-components/generic-sidebar-nav.css');
@import url('./css-components/generic-tab-nav.css');
@import url('./css-components/theme-settings.css');
@import url('./css-components/account-links.css');
@import url('./css-components/page-host-card.css');

/* ==========================================================================
   1. Shell Host & Master Layout
   ========================================================================== */
body {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: var(--layout-sidebar) 1fr;
    grid-template-rows: 56px 1fr;
    grid-template-areas: "sidebar topbar" "sidebar main";
    background-color: var(--color-bg-base);
    background-image: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--color-brand) 6%, transparent) 0%, transparent 600px);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--color-text);
    font: var(--fs-body)/1.35 var(--font-family);
    transition: background 0.5s ease, color 0.5s ease;
    height: 100vh;
    overflow: hidden;
}

body.nav-collapsed {
    --layout-sidebar: 90px;
}

.page-host-card {
    outline: none;
}

/* Hidden Utility Elements */
svg.filter {
    display: none;
}

/* ===== Spinner Animation Keyframes ===== */
@keyframes spin {

    0%,
    100% {
        box-shadow: .2em 0px 0 0px currentcolor;
    }

    12% {
        box-shadow: .2em .2em 0 0 currentcolor;
    }

    25% {
        box-shadow: 0 .2em 0 0px currentcolor;
    }

    37% {
        box-shadow: -.2em .2em 0 0 currentcolor;
    }

    50% {
        box-shadow: -.2em 0 0 0 currentcolor;
    }

    62% {
        box-shadow: -.2em -.2em 0 0 currentcolor;
    }

    75% {
        box-shadow: 0px -.2em 0 0 currentcolor;
    }

    87% {
        box-shadow: .2em -.2em 0 0 currentcolor;
    }
}


/* ===== Initial Page Pre-loader ===== */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--color-bg-base);
    z-index: 9999;
    display: grid;
    place-items: center;
    transition: opacity 0.5s ease, visibility 0.5s;
    opacity: 1;
    visibility: visible;
}

#preloader .spinner {
    width: 64px;
    height: 64px;
}

/* Hide main content until the preloader is removed */
body:not(.is-loaded)>*:not(#preloader) {
    visibility: hidden;
    opacity: 0;
}



/* Topbar */
.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 10px;
    /*background: var(--color-surface);*/
    padding: 0 24px 0 20px !important;
    /*border-bottom: 1px solid var(--border-faint);*/
    position: sticky;
    top: 0;
    z-index: 5;
    height: 68px !important;
    /* transition moved to inner elements */
}

.topbar .top-nav-items-wrapper,
.topbar .top-actions {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
    border: 1px solid transparent;
    box-shadow: 0 0 0 transparent;
}

.topbar.is-scrolled .top-nav-items-wrapper,
.topbar.is-scrolled .top-actions {
    padding-top: 4px;
    padding-bottom: 4px;
}

.topbar .burger {
    height: 36px;
    width: 36px;
    border-radius: var(--radius);
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.topbar .burger:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring)
}

.search {
    position: relative;
    flex: 1;
    max-width: 720px;
}

.search input {
    width: 100%;
    height: 36px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    color: var(--color-text);
    border-radius: var(--radius);
    padding: 0 36px 0 36px;
    font-family: var(--font-family);
    font-size: var(--fs-body);
}

/* Hide default browser clear button */
.search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.search input:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: var(--focus-ring);
}

/* Fix for browser autofill color */
.search input:-webkit-autofill,
.search input:-webkit-autofill:hover,
.search input:-webkit-autofill:focus,
.search input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--color-surface-alt) inset !important;
    -webkit-text-fill-color: var(--color-text) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.search .icon,
.search .kbd {
    position: absolute;
    inset-block: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
    color: var(--color-text-muted);
}

.search .icon {
    left: 10px;
    width: 18px
}

.search .kbd {
    right: 8px;
    opacity: .75;
    padding: 2px 6px;
    font-size: var(--fs-meta);
    transition: opacity 0.2s;
}

.search:focus-within .kbd {
    opacity: 0;
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 2;
}

.search-clear:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.search-clear.show {
    opacity: 1;
    visibility: visible;
}

/* Keyboard Navigation Highlight */
.item.focused {
    background: var(--overlay-hover);
    border-color: var(--border-soft);
    box-shadow: inset 3px 0 0 var(--color-brand);
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: auto 0;
    position: relative;
    z-index: 10;
    padding: 9px 14px !important;
}

#top-actions-placeholder {
    display: contents;
}

.topbar-quota-container {
    display: none;
}

.open-panel-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    transform: scale(1.25);
}

#topbar-custom-left {
    display: flex;
    align-items: center;
}

#topbar-custom-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

#top-custom-actions-left,
.top-custom-actions-left {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: 16px;
}

#top-custom-actions-center,
.top-custom-actions-center {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.topbar-mask-icon {
    width: 18px;
    height: 18px;
    background-color: currentColor;
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
}

.topbar-img-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}



/* Settings Panel moved to css-components/theme-settings.css */


/* ===== Profile Wrapper & Panel ===== */
.profile-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.avatar-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 10px;
    transition: transform var(--anim-fast) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-btn:hover {
    transform: scale(1.05);
}

.avatar-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Topbar Login Button (Unauthenticated State - Stealth Minimalist) */
.topbar-login-btn {
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 15px;
    font-family: var(--font-family, var(--font-family-default));
    font-size: var(--fs-body, 13.5px);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--color-text);
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: all var(--anim-fast, 0.18s) cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar-login-btn:hover {
    background: var(--color-surface);
    border-color: color-mix(in srgb, var(--color-brand) 55%, var(--border-soft));
    color: var(--color-text);
    box-shadow: 0 2px 12px color-mix(in srgb, var(--color-brand) 20%, transparent);
    transform: translateY(-1px);
}

.topbar-login-btn:active {
    transform: translateY(0);
}

.topbar-login-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.topbar-login-btn svg {
    width: 14px;
    height: 14px;
    stroke: var(--color-brand);
    stroke-width: 2.2;
    transition: transform var(--anim-fast, 0.18s) ease, stroke var(--anim-fast, 0.18s) ease;
}

.topbar-login-btn:hover svg {
    transform: translateX(2.5px);
}

.profile-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 24px;
    width: 270px;
    backdrop-filter: blur(24px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(140%) !important;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius, 14px);
    padding: 16px;
    overflow: hidden;
    z-index: 10050 !important;
    box-shadow: var(--shadow-elevation, 0 16px 36px rgba(0, 0, 0, 0.4));
    flex-direction: column;
    gap: 8px;
}

.profile-panel.show {
    display: flex;
}

/* Elevação do contexto de empilhamento ao abrir o painel de perfil (nível padronizado com generic-right-panel) */
.profile-wrapper:has(.profile-panel.show),
.profile-wrapper.is-open,
.top-actions:has(.profile-panel.show),
.topbar:has(.profile-panel.show),
a5-slot[name="top"]:has(.profile-panel.show) {
    z-index: 10050 !important;
}

.profile-panel-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 4px;
}

.profile-panel-info .name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}

.profile-panel-info .role {
    color: var(--color-text-muted);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

.profile-panel-logout {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.profile-panel-logout:hover {
    background-color: var(--color-surface-alt);
    color: var(--color-danger);
}

/* Theme Settings & Color Picker rules moved to css-components/theme-settings.css */

/* ===== Notification History Panel (Refined) ===== */
.notification-history-panel {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 520px;
    border: 1px solid var(--border-soft);
    border-top: 1px solid color-mix(in srgb, white, transparent 90%);
    border-radius: 16px;
    z-index: 1000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    flex-direction: column;
    overflow: hidden;
    transform-origin: top right;
    animation: panelSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.notification-history-panel.show {
    display: flex;
}

.notification-history-header {
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid var(--border-faint);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-history-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.notification-history-clear {
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-history-clear:hover {
    color: var(--color-danger);
    border-color: rgba(244, 67, 54, 0.3);
    background: rgba(244, 67, 54, 0.1);
    transform: translateY(-1px);
}

.notification-history-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    gap: 8px;
}

/* Custom Scrollbar */
.notification-history-list::-webkit-scrollbar {
    width: 6px;
}

.notification-history-list::-webkit-scrollbar-track {
    background: transparent;
}

.notification-history-list::-webkit-scrollbar-thumb {
    background-color: var(--border-soft);
    border-radius: 10px;
}

.notification-history-item {
    margin: 0 16px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--color-surface-alt), transparent 35%);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    display: flex;
    gap: 14px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    align-items: center;
}

.notification-history-item:hover {
    background-color: var(--color-surface-hover, var(--overlay-hover));
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.notification-history-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-history-icon svg {
    width: 16px;
    height: 16px;
}

.notification-history-item[data-type="success"] .notification-history-icon {
    color: var(--green, #10b981);
    background: color-mix(in srgb, var(--green, #10b981) 10%, transparent);
    border-color: color-mix(in srgb, var(--green, #10b981) 20%, transparent);
}

.notification-history-item[data-type="error"] .notification-history-icon {
    color: var(--color-danger, #ef4444);
    background: color-mix(in srgb, var(--color-danger, #ef4444) 10%, transparent);
    border-color: color-mix(in srgb, var(--color-danger, #ef4444) 20%, transparent);
}

.notification-history-item[data-type="warning"] .notification-history-icon {
    color: var(--yellow, #f59e0b);
    background: color-mix(in srgb, var(--yellow, #f59e0b) 10%, transparent);
    border-color: color-mix(in srgb, var(--yellow, #f59e0b) 20%, transparent);
}

.notification-history-item[data-type="insight"] .notification-history-icon {
    color: var(--purple, #8b5cf6);
    background: color-mix(in srgb, var(--purple, #8b5cf6) 10%, transparent);
    border-color: color-mix(in srgb, var(--purple, #8b5cf6) 20%, transparent);
}

.notification-history-item[data-type="advice"] .notification-history-icon {
    color: var(--blue, #3b82f6);
    background: color-mix(in srgb, var(--blue, #3b82f6) 10%, transparent);
    border-color: color-mix(in srgb, var(--blue, #3b82f6) 20%, transparent);
}

.notification-history-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notification-history-message {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.4;
    font-weight: 500;
}

.notification-history-time {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notification-history-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    background-color: var(--color-danger);
    color: white;
    border-radius: 10px;
    border: 2px solid var(--color-surface);
    display: none;
    font-size: 9px;
    font-weight: 700;
    line-height: 10px;
    text-align: center;
    box-shadow: 0 0 0 1px var(--color-surface);
    z-index: 10;
}

.notification-badge.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar Base Navigation moved to css-components/generic-sidebar-nav.css */

/* Main */
.main {
    grid-area: main;
    grid-row: 1 / -1;
    /* Faz o main começar do topo, passando por baixo da topbar */
    padding: 68px 0px 0px 0px !important;
    /* Compensa a altura da topbar (68px) */
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    /*overflow: auto;*/
    position: relative;
    outline: none;
    border: none;
    display: flex;
    flex-direction: column;
}

.page-host-card {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: var(--radius);
    padding: 0px;
    flex: 1 0 auto;
    min-height: 0;
    /* Note: We have intentionally left out display:flex and its related properties */
}

/* ===== Mandatory Universal Legal & Institutional Footer (Elastic Spring Peek & Retract) ===== */
.app-global-footer {
    width: 100%;
    margin-top: auto;
    box-sizing: border-box;
    border-top: 1px solid transparent;
    background: transparent;
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    font-size: var(--fs-caption, 11.5px);
    line-height: 1.6;
    color: var(--color-text-muted, #8e8ea0);
    z-index: 10;

    /* Estado inicial: recolhido além do limite da página */
    max-height: 0;
    opacity: 0;
    padding: 0 24px;
    overflow: hidden;
    transform: translateY(28px) scale(0.98);
    pointer-events: none;
    visibility: hidden;

    /* Curva elástica / física de mola (Spring) */
    transition:
        max-height 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
        padding 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
        border-color 0.4s ease,
        visibility 0.7s;
    will-change: transform, max-height, opacity, padding;
}

/* Estado esticado / revelado */
.app-global-footer.is-stretched {
    max-height: 160px;
    opacity: 1;
    padding: 16px 24px 76px 24px;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
    border-top-color: var(--border-faint, rgba(255, 255, 255, 0.06));
}

/* Retorno elástico de mola (Spring recoil back) */
.app-global-footer.is-spring-closing {
    transition:
        max-height 0.6s cubic-bezier(0.68, -0.45, 0.265, 1.25),
        padding 0.6s cubic-bezier(0.68, -0.45, 0.265, 1.25),
        transform 0.6s cubic-bezier(0.68, -0.45, 0.265, 1.25),
        opacity 0.35s ease,
        border-color 0.35s ease,
        visibility 0.6s;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    transform: translateY(28px) scale(0.98) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    border-top-color: transparent !important;
}

.app-global-footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.app-global-footer-info {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    opacity: 0.78;
    letter-spacing: 0.01em;
}

.app-global-footer-brand {
    font-weight: 500;
}

.app-global-footer-links {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.app-global-footer-link {
    color: var(--color-text-muted, #8e8ea0);
    text-decoration: none;
    transition: color 0.18s ease, opacity 0.18s ease;
    opacity: 0.78;
    font-weight: 400;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    line-height: inherit;
}

.app-global-footer-link:hover {
    color: var(--color-brand, #4e46e5);
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.app-global-footer-sep {
    color: var(--border-soft, rgba(255, 255, 255, 0.15));
    font-size: 8px;
    user-select: none;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .app-global-footer {
        text-align: center;
        max-height: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
        overflow: visible !important;
        border-top-color: var(--border-faint, rgba(255, 255, 255, 0.06));
        padding: 18px 16px max(24px, env(safe-area-inset-bottom, 24px)) 16px;
    }

    body:not(.no-template) .app-global-footer {
        padding-bottom: max(88px, calc(72px + env(safe-area-inset-bottom, 20px)));
    }

    body.no-template .app-global-footer {
        padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
    }

    .app-global-footer.is-stretched {
        max-height: none;
    }

    .app-global-footer-inner {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }

    .app-global-footer-info {
        justify-content: center;
        gap: 6px;
        font-size: 11px;
    }

    .app-global-footer-links {
        justify-content: center;
        gap: 4px 8px;
        line-height: 1.8;
    }

    .app-global-footer-link {
        display: inline-flex;
        align-items: center;
        min-height: 32px;
        padding: 2px 4px;
        font-size: 11.5px;
        -webkit-tap-highlight-color: transparent;
    }
}

body.fullscreen-mode .app-global-footer {
    display: none !important;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--brand-tint);
    border: 1px solid var(--color-brand-border);
    color: var(--color-text);
    font-weight: 600;
}

.kbd {
    opacity: .9;
    padding: 3px 8px;
    font-size: var(--fs-meta);
}

.mobile-logo {
    display: none;
}

/* ===== Fullscreen Mode Styles ===== */
/* Native browser fullscreen preserves the topbar, navigation and primary layout intact */


/* ===== Notification System ===== */
#notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    max-width: 90vw;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.notification-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 16px;
    border-top-color: color-mix(in srgb, white, transparent 92%);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-elevation), 0 10px 30px -10px color-mix(in srgb, var(--notif-color) 25%, transparent);
    color: var(--color-text);
    font-size: var(--fs-body);
    pointer-events: auto;
    position: relative;
    overflow: visible;
    opacity: 0;
    transform: translateY(-80px) scale(0.9);
    animation: slideInFromTop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
}

.notification-card::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background-color: color-mix(in srgb, var(--color-surface-block, var(--color-surface)), transparent 15%);
    border-left: 1px solid var(--border-soft);
    border-top: 1px solid var(--border-soft);
    box-sizing: border-box;
    z-index: -1;
}

.notification-card:hover {
    transform: scale(1.02) translateY(-2px);
    box-shadow: var(--shadow-elevation), 0 15px 35px -8px color-mix(in srgb, var(--notif-color) 35%, transparent);
    border-color: var(--border-strong);
}

.notification-card.closing {
    animation: slideOutToTop 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.notification-card.notification-bump {
    animation: notifBump 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes notifBump {

    0%,
    100% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.04) translateY(-3px);
    }

    60% {
        transform: scale(0.98);
    }
}

/* Different types of notifications based on data-type attribute */
.notification-card[data-type="error"] {
    --notif-color: var(--color-danger, #ef4444);
    border-left: 4px solid var(--notif-color);
}

.notification-card[data-type="warning"] {
    --notif-color: var(--yellow, #f59e0b);
    border-left: 4px solid var(--notif-color);
}

.notification-card[data-type="success"] {
    --notif-color: var(--green, #10b981);
    border-left: 4px solid var(--notif-color);
}

.notification-card[data-type="insight"] {
    --notif-color: var(--purple, #8b5cf6);
    border-left: 4px solid var(--notif-color);
}

.notification-card[data-type="advice"] {
    --notif-color: var(--blue, #3b82f6);
    border-left: 4px solid var(--notif-color);
}

.notification-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    color: var(--notif-color, var(--color-text));
}

.notification-icon svg {
    width: 100%;
    height: 100%;
}

.notification-content {
    flex-grow: 1;
    line-height: 1.4;
    word-wrap: break-word;
    font-weight: 500;
}

.notification-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin: -4px -4px 0 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text-muted);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.notification-close:hover {
    opacity: 1;
    transform: scale(1.1);
    color: var(--color-text);
}

/* Progress Indicator */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--notif-color), color-mix(in srgb, var(--notif-color) 40%, white));
    width: 100%;
    transform-origin: left;
    animation: shrinkWidth linear forwards;
}

@keyframes shrinkWidth {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* === Confirmation Dialog Style === */
.notification-confirm-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999;
    display: grid;
    place-items: center;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.notification-confirm-overlay.closing {
    animation: fadeOut 0.3s ease forwards;
}

.notification-card.confirm {
    transform: none;
    animation: confirmZoom 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    width: 440px;
    max-width: 90vw;
    padding: 24px;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border-left: 4px solid var(--notif-color, var(--color-brand)) !important;
}

@keyframes confirmZoom {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(15px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.notification-card.confirm .notification-icon {
    width: 32px;
    height: 32px;
    margin-top: 0;
    margin-bottom: 12px;
}

.notification-card.confirm .notification-content {
    text-align: center;
    line-height: 1.5;
}

.notification-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin-top: 20px;
}

.notification-actions button {
    flex: 1;
    height: 40px;
    font-weight: 600;
    font-size: var(--fs-body);
    border-radius: var(--radius, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-actions .btn-proceed {
    background-color: var(--color-brand);
    border: 1px solid transparent;
    color: white;
}

.notification-actions .btn-proceed:hover {
    background-color: color-mix(in srgb, var(--color-brand), white 10%);
    transform: translateY(-1px);
}

.notification-actions .btn-cancel {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--color-text-muted);
}

.notification-actions .btn-cancel:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.notification-actions .btn-alt {
    margin-right: auto;
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--color-text);
}

.notification-actions .btn-alt:hover {
    background: var(--color-surface-alt);
    border-color: var(--border-strong);
}

.notification-modal-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: var(--fs-title-sub, 18px);
    color: var(--color-text);
}

.notification-modal-desc {
    margin-bottom: 12px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.notification-form-container {
    text-align: left;
    margin-top: 15px;
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 5px;
    box-sizing: border-box;
}

.notif-form-group {
    margin-bottom: 15px;
}

.notif-form-label {
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 5px;
    display: block;
    color: var(--color-text);
}

.notif-form-input,
.notif-form-textarea {
    width: 100%;
    border: 1px solid var(--border-soft);
    padding: 8px;
    border-radius: var(--radius, 8px);
    background: var(--color-bg-base);
    color: var(--color-text);
    margin-bottom: 8px;
    font-family: inherit;
    font-size: 13px;
    box-sizing: border-box;
}

.notif-form-textarea {
    resize: vertical;
}

.notif-add-more-btn {
    font-size: 11px;
    padding: 4px 8px;
    border: 1px solid var(--border-soft);
    background: transparent;
    border-radius: var(--radius, 8px);
    color: var(--color-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.notif-add-more-btn:hover {
    background: var(--color-surface-hover, var(--overlay-hover));
    border-color: var(--border-strong);
}

.notification-card-title {
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.notification-history-item-title {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
    font-size: 13px;
    color: var(--color-text);
}

.notification-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-push-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: var(--radius, 8px);
    transition: all 0.2s;
}

.notification-push-btn:hover {
    color: var(--color-text);
    background: var(--color-surface-hover, var(--overlay-hover));
}

/* Notification Panel Tabs */
.notification-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    margin: 4px 16px 12px 16px;
    background: var(--color-surface-alt);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    flex-shrink: 0;
}

.notification-tab {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.notification-tab:hover {
    color: var(--color-text);
}

.notification-tab:active {
    transform: scale(0.95);
}

.notification-tab.active {
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 600;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
}

/* Hide history items that don't match filter */
.notification-history-item.hidden-by-tab {
    display: none !important;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* === END: New Styles === */

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-80px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideOutToTop {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-80px) scale(0.9);
    }
}

/* Responsive */
@media (max-width: 1000px) {
    body {
        grid-template-columns: 1fr;
        grid-template-areas: "topbar" "main"
    }

    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        inset: 0 auto 0 0;
        width: 280px;
        z-index: 10;
    }

    .sidebar.open {
        transform: none;
    }

    .backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .4);
        display: none;
        z-index: 9;
    }

    .backdrop.show {
        display: block
    }

    .mobile-logo {
        display: block;
    }
}

/* Burger Menu */
.burger-wrapper {
    position: relative;
}

.burger-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation);
    z-index: 10000;
    width: 220px;
    padding: 6px;
    flex-direction: column;
    gap: 4px;
}

.burger-menu.show {
    display: flex;
    z-index: 10000;
}

.burger-menu button {
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--fs-body);
    position: relative;
    /* ADDED for spinner */
}

.burger-menu button:hover {
    background-color: var(--overlay-hover);
}

.burger-menu button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.burger-menu .menu-divider {
    height: 1px;
    background: var(--border-faint);
    margin: 4px 0;
}

/* Button Loading State */
.is-loading {
    pointer-events: none;
    color: transparent !important;
}

.is-loading>* {
    /* Hide direct children like text or SVG */
    visibility: hidden;
}

.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    /* Center the spinner */
    border: 2px solid var(--color-text-muted);
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== Page transition loader ===== */

/* MOBILE-FIRST: Default to covering the entire screen */
.page-loader {
    position: fixed;
    inset: 0;

    /* Make the background transparent */
    background-color: transparent;

    /* Remove the blur effect */
    backdrop-filter: none;

    display: grid;
    place-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

/* DESKTOP OVERRIDE: Constrain the loader on larger screens */
@media (min-width: 1001px) {
    .page-loader {
        position: absolute;
        top: 56px;
        /* Align below the topbar */
        left: var(--layout-sidebar);
        /* Align next to the sidebar */
        right: 0;
        bottom: 0;
        /* Add transition for the sidebar collapse/expand animation */
        transition: opacity 0.3s ease, visibility 0.3s, left var(--anim-fast) ease;
    }
}

.page-loader.is-active {
    opacity: 1;
    visibility: visible;
}

#contentHost {
    transition: opacity 0.4s ease;
    min-height: 100%;
    /* Prevent collapsing during transition */
}

/* ===== UPDATED: Spinner Style ===== */
.spinner {
    transform: rotateZ(45deg);
    perspective: 1000px;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    color: var(--color-brand);
    position: relative;
}

.spinner:before,
.spinner:after {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: inherit;
    height: inherit;
    border-radius: 50%;
    transform: rotateX(70deg);
    animation: 1s spin linear infinite;
}

.spinner:after {
    color: var(--color-brand-soft);
    transform: rotateY(70deg);
    animation-delay: .4s;
}

/* ===== Search Help Modal ===== */
.search-help-modal {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90vw;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation);
    z-index: 10005;
    display: none;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}

.search-help-modal.show {
    display: flex;
}

.search-help-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-faint);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-help-title {
    font-weight: 700;
    font-size: var(--fs-title-sub);
}

.search-help-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 20px;
}

.search-help-body {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.search-help-section h4 {
    color: var(--color-brand-soft);
    margin-bottom: 10px;
    font-size: var(--fs-body);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-help-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: var(--fs-meta);
}

.search-help-cmd {
    font-family: var(--font-family-mono);
    background: var(--color-surface-alt);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-text);
}

.search-help-desc {
    color: var(--color-text-muted);
}

/* ===== Search Autocomplete ===== */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-elevation);
    z-index: 10006;
    margin-top: 4px;
    display: none;
    flex-direction: column;
    max-height: 300px;
    overflow-y: auto;
}

.search-autocomplete.show {
    display: flex;
}

.search-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-body);
    color: var(--color-text);
}

.search-autocomplete-item:hover,
.search-autocomplete-item.active {
    background: var(--overlay-hover);
}

.search-autocomplete-item .cmd {
    font-family: var(--font-family-mono);
    color: var(--color-brand-soft);
    font-weight: 500;
}

.search-autocomplete-item .desc {
    color: var(--color-text-muted);
    font-size: var(--fs-meta);
    margin-left: auto;
}

/* ===== Global Glass Effect (Generic Menu Bar) ===== */
.gmb-glass {
    background-color: color-mix(in srgb, var(--color-surface-block), transparent 60%);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-elevation);
}

/* --- No Data State Styling (Shared from Builder Core) --- */
.quanta-no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-text-muted);
    gap: 0.75rem;
    padding: 1rem;
    box-sizing: border-box;
    text-align: center;
    animation: quanta-fade-in 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.quanta-no-data svg {
    width: 48px;
    height: 48px;
    opacity: 0.15;
    /* Very subtle */
    stroke: currentColor;
    stroke-width: 1.5;
    transition: all 0.3s ease;
}

@keyframes quanta-fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Interaction: Bounce & Brand Color */
.quanta-no-data:hover svg {
    stroke: var(--color-brand);
    opacity: 0.8;
    animation: quanta-bounce 0.6s cubic-bezier(0.25, 1.5, 0.5, 1);
}

.quanta-no-data:hover span {
    color: var(--color-brand);
    opacity: 1;
}

@keyframes quanta-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }

    50% {
        transform: translateY(0);
    }

    70% {
        transform: translateY(-5px);
    }
}

.quanta-no-data span {
    font-size: var(--fs-meta, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    opacity: 0.5;
    transition: all 0.3s ease;
}

/* ===== Global Geometric Background Pattern ===== */
.bg-pattern-container {
    position: fixed;
    top: -10vh;
    left: -10vw;
    width: 120vw;
    height: 120vh;
    z-index: -1;
    overflow: hidden;
    background: transparent;
    pointer-events: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 60%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 60%);
}

.bg-pattern-item {
    border: 1px solid rgba(255, 255, 255, 0.02);
    width: 10em;
    height: 10em;
    transform: rotate(45deg);
    margin: 2em;
    float: left;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(0, 0, 0, 0.02) 100%);
}

/* Modern Floating Sidebar Redesign Overrides moved to css-components/generic-sidebar-nav.css */

/* =========================================
   COMPLEX MAC DOCK SIDEBAR REDESIGN
   ========================================= */

/* Independent Brand Header (always expanded, not part of sidebar) */
.brand.independent-brand {
    position: fixed !important;
    left: 30px !important;
    top: 6px !important;
    /* Centered in 68px topbar: (68 - 56) / 2 */
    height: 56px !important;
    padding-left: 0 !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
}

.brand.independent-brand .logo {
    width: 45px !important;
    height: 45px !important;
    flex: 0 0 auto !important;
    object-fit: contain !important;
}

.brand.independent-brand .meta {
    display: block !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform-origin: left center !important;
    opacity: 1 !important;
    transform: scale(1) translateX(0) !important;
    overflow: hidden !important;
    max-width: 300px !important;
    white-space: nowrap !important;
}

.brand.independent-brand.is-scrolled .meta {
    max-width: 0px !important;
    opacity: 0 !important;
    transform: scale(0.5) translateX(-20px) !important;
    margin-left: -12px !important;
    /* Counteracts the parent's gap: 12px */
    pointer-events: none !important;
}

.brand.independent-brand .brand-logo-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    flex: 0 0 auto !important;
    cursor: pointer !important;
    transition: opacity 0.2s ease !important;
}

.brand.independent-brand .brand-logo-link:hover,
.brand.independent-brand .title:hover {
    opacity: 0.82 !important;
}

.brand.independent-brand .title {
    display: block !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: opacity 0.2s ease !important;
    font-weight: 700 !important;
    text-transform: capitalize !important;
    font-size: var(--fs-title-nav) !important;
    color: var(--color-text) !important;
}

.brand.independent-brand .subtitle {
    display: block !important;
    text-decoration: none !important;
    cursor: pointer !important;
    transition: opacity 0.2s ease !important;
    color: var(--color-text-muted) !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em !important;
    opacity: 0.7 !important;
    margin-top: 2px !important;
}

.brand.independent-brand .subtitle:hover {
    opacity: 1 !important;
}

.brand.independent-brand .subtitle .highlight {
    color: var(--color-brand) !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
}

/* Mac Dock Sidebar Container & Subpages moved to css-components/generic-sidebar-nav.css */

/* ===== Layout Override for 'no-template' tag (No Sidebar) ===== */
body.no-template {
    --layout-sidebar: 0px !important;
    grid-template-columns: 1fr !important;
    grid-template-areas: "topbar" "main" !important;
}

body.no-template #sidebar,
body.no-template #sidebar.sidebar.mac-dock-container,
body.no-template #sidebar.sidebar.mac-dock-container.is-expanded,
body.no-template .sidebar,
body.no-template .burger,
body.no-template #burger {
    display: none !important;
}

/* ===== Layout Override for 'top-bar-disabled' tag (No Top Bar) ===== */
body.top-bar-disabled {
    grid-template-rows: 1fr !important;
    grid-template-areas: "sidebar main" !important;
}

body.no-template.top-bar-disabled {
    grid-template-rows: 1fr !important;
    grid-template-columns: 1fr !important;
    grid-template-areas: "main" !important;
}

body.top-bar-disabled .topbar,
body.top-bar-disabled a5-slot[name="top"],
body.top-bar-disabled #slot-top,
body.top-bar-disabled .top-actions-wrapper {
    display: none !important;
}

body.top-bar-disabled .main,
body.no-template.top-bar-disabled .main {
    padding-top: 0 !important;
}

/* ===== Layout Override for 'sidebar-mode-top' (Top Navigation Mode) ===== */
body.sidebar-mode-top {
    --layout-sidebar: 0px !important;
    grid-template-columns: 1fr !important;
    grid-template-areas: "topbar" "main" !important;
}

body.sidebar-mode-top #sidebar,
body.sidebar-mode-top #sidebar.sidebar.mac-dock-container,
body.sidebar-mode-top #sidebar.sidebar.mac-dock-container.is-expanded,
body.sidebar-mode-top .sidebar,
body.sidebar-mode-top .burger,
body.sidebar-mode-top #burger,
body.sidebar-mode-top #sidebar-toggle-btn,
body.sidebar-mode-top #mobile-sidebar-toggle,
body.sidebar-mode-top .mobile-sidebar-toggle {
    display: none !important;
}

/* ===== Top Navigation Bar Styling ===== */
.topbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space out logo, top-nav, and top-actions */
}

.top-nav {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    /* Center the top navigation menu */
    align-items: center;
    margin: 0;
    z-index: 10;
    border-radius: 20px;
    pointer-events: auto;
}

.top-nav-items-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    height: 100%;
}

/* Top Navigation Items */
.top-nav-items-wrapper .mac-dock-item {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    height: 40px !important;
    width: auto !important;
    /* Allow dynamic width based on text */
    padding: 0 14px !important;
    margin: 4px !important;
    border-radius: var(--radius) !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: var(--color-text-muted) !important;
    flex-direction: row !important;
}

.top-nav-items-wrapper .mac-dock-item-main {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    height: 100% !important;
    width: auto !important;
    /* Allow dynamic width based on text */
    padding: 0 !important;
    margin: 0 !important;
    transform: none !important;
    /* Disable zoom physics completely */
    background: transparent !important;
}

.top-nav-items-wrapper .mac-dock-item .ic {
    display: inline-block !important;
    width: 18px !important;
    height: 18px !important;
    background-color: currentColor !important;
    mask-size: contain !important;
    -webkit-mask-size: contain !important;
    mask-repeat: no-repeat !important;
    -webkit-mask-repeat: no-repeat !important;
    mask-position: center !important;
    -webkit-mask-position: center !important;
}

.top-nav-items-wrapper .mac-dock-item .mac-dock-label {
    font-size: 13px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    color: currentColor !important;
    display: none !important;
    pointer-events: auto !important;
}

.top-nav-items-wrapper .mac-dock-item:not(.top-icon-only) .mac-dock-label {
    display: block !important;
}

/* Hover & Active States */
.top-nav-items-wrapper .mac-dock-item:hover {
    background: var(--overlay-hover) !important;
    color: var(--color-text) !important;
}

.top-nav-items-wrapper .mac-dock-item:hover .mac-dock-item-main {
    background: transparent !important;
}

.top-nav-items-wrapper .mac-dock-item.active {
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-brand) 20%, transparent), color-mix(in srgb, var(--color-brand) 10%, transparent)) !important;
    color: var(--color-brand, var(--color-text)) !important;
    box-shadow: 0 4px 12px -2px color-mix(in srgb, var(--color-brand) 15%, transparent) !important;
}

.top-nav-items-wrapper .mac-dock-item.active .mac-dock-item-main::before {
    display: none !important;
    content: none !important;
}

/* Custom Display Options for Top Navigation Layouts (Icon only, Title only) */
.top-nav-items-wrapper .mac-dock-item.top-icon-only .mac-dock-label {
    display: none !important;
}

.top-nav-items-wrapper .mac-dock-item.top-title-only .ic {
    display: none !important;
}

/* Tooltip controls: Hide tooltips unless it's icon-only layout */
.top-nav-items-wrapper .mac-dock-item:not(.top-icon-only) .tooltip {
    display: none !important;
}

.top-nav-items-wrapper .mac-dock-item.top-icon-only:hover .tooltip {
    display: block !important;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

/* Separators */
.top-nav-separator {
    width: 1px;
    height: 18px;
    background: var(--border-soft);
    margin: 0 8px;
}

/* Chevrons */
.top-nav-items-wrapper .mac-dock-chevron {
    width: 12px !important;
    height: 12px !important;
    margin-left: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: currentColor !important;
    opacity: 0.7 !important;
}

.top-nav-items-wrapper .mac-dock-chevron svg {
    width: 100%;
    height: 100%;
}

/* Dropdown / Subpages for Top Navigation */
.top-nav-items-wrapper .mac-dock-subpages {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    padding: 6px;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
}

.top-nav-items-wrapper .mac-dock-item:hover .mac-dock-subpages {
    display: flex;
}

.top-nav-items-wrapper .mac-dock-flyout-header {
    display: none !important;
    /* Hide header in top dropdowns */
}

.top-nav-items-wrapper .mac-dock-subpage-item {
    padding: 8px 12px;
    border-radius: calc(var(--radius) - 2px);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.top-nav-items-wrapper .mac-dock-subpage-item:hover {
    background: var(--overlay-hover);
    color: var(--color-text);
}

.top-nav-items-wrapper .mac-dock-subpage-item.active {
    background: color-mix(in srgb, var(--color-brand) 12%, transparent);
    color: var(--color-brand);
}

/* Generic Right Panel (Lateral Drawer) styles moved to css-components/generic-right-panel.css */


/* Responsive adjustments for brand logo */
@media (min-width: 1001px) {

    /* Ensure the independent brand logo stays on top of the fullscreen brand wrapper on desktop */
    body.no-template:has(.brand-page-wrapper):not(.fullscreen-mode) .brand.independent-brand {
        display: flex !important;
        z-index: 10000 !important;
        top: 40px !important;
        left: 60px !important;
    }

    /* Ensure text is always readable on desktop */
    body.no-template:has(.brand-page-wrapper) .brand.independent-brand .title {
        color: #ffffff !important;
    }

    body.no-template:has(.brand-page-wrapper) .brand.independent-brand .subtitle {
        color: rgba(255, 255, 255, 0.6) !important;
    }

    body.no-template:has(.brand-page-wrapper) .brand.independent-brand .subtitle .highlight {
        color: #ffffff !important;
    }

    /* Hide redundant internal logo on desktop */
    body.no-template:has(.brand-page-wrapper) .brand-logo-group {
        display: none !important;
    }

    body.no-template:has(.brand-page-wrapper) .brand-nav {
        margin-left: auto !important;
    }
}

@media (max-width: 1000px) {
    .brand.independent-brand {
        display: none !important;
    }

    /* Display internal brand logo cleanly on mobile/tablet */
    body.no-template:has(.brand-page-wrapper) .brand-logo-group {
        display: flex !important;
    }

    body.no-template:has(.brand-page-wrapper) .brand-nav {
        margin-left: auto !important;
    }
}

/* Mobile Floating Sidebar Toggle moved to css-components/generic-sidebar-nav.css */
/* Generic Right Panel Left Fullscreen moved to css-components/generic-right-panel.css */

/* Hide Mac Dock sidebar on mobile moved to css-components/generic-sidebar-nav.css */

/* --- TV Spatial Navigation Styles --- */
body[data-device-type="tv"] :focus:not(.superflix-movie-card),
body[data-device-type="tv"] [data-tv-focused="true"]:not(.superflix-movie-card) {
    outline: 2px solid var(--color-brand) !important;
    outline-offset: 0 !important;
    box-shadow: 0 10px 25px color-mix(in srgb, var(--color-brand) 40%, rgba(0, 0, 0, 0.6)) !important;
    z-index: 99 !important;
}

body[data-device-type="tv"] {
    /* Provide smooth scrolling globally for TV */
    scroll-behavior: smooth;
    cursor: none !important;
    pointer-events: none !important;
}

body[data-device-type="tv"] * {
    cursor: none !important;
}

/* --- TV Generic Section Animations --- */
body[data-device-type="tv"] [data-tv-section] {
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: center center;
    will-change: opacity, transform;
}

body[data-device-type="tv"] [data-tv-section][data-tv-section-status="previous"],
body[data-device-type="tv"] [data-tv-section][data-tv-section-status="next"] {
    opacity: 0.5;
}

body[data-device-type="tv"] [data-tv-section][data-tv-section-status="active"] {
    opacity: 1;
    transform: scale(1);
    z-index: 10;
}

/* --- TV Fullscreen Override for Video --- */
body[data-device-type="tv"] .superflix-video-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #000 !important;
    max-width: none !important;
    max-height: none !important;
}

body[data-device-type="tv"] .superflix-player-wrapper {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    position: static !important;
}

body[data-device-type="tv"] .superflix-modal-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    border: none !important;
    transform: none !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
}

body[data-device-type="tv"] #superflix-ctrl-play,
body[data-device-type="tv"] #superflix-ctrl-prev,
body[data-device-type="tv"] #superflix-ctrl-next,
body[data-device-type="tv"] #superflix-ctrl-pip,
body[data-device-type="tv"] .superflix-volume-wrapper,
body[data-device-type="tv"] #superflix-ctrl-settings,
body[data-device-type="tv"] #superflix-ctrl-audio,
body[data-device-type="tv"] .superflix-controls-progress-wrapper {
    display: none !important;
}

body[data-device-type="tv"] .superflix-search-input-box {
    display: none !important;
}

/* Global spatial navigation scrollbar hidden styles */
body[data-device-type="tv"] * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

body[data-device-type="tv"] *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}


/* Styles extracted from template.html */
/* Custom Profile Panel Styles */
.profile-wrapper {
    position: relative;
}

.profile-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 12px 4px;
}

.profile-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: var(--color-surface-alt, #1e293b);
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.profile-header-avatar span {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text, #f8fafc);
}

.profile-header-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-header-meta .name {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: var(--color-text, #f8fafc) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.profile-header-meta .email {
    font-size: 11px !important;
    color: var(--color-text-muted, #94a3b8) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.profile-header-meta .device-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--color-text-muted, #64748b);
    margin-top: 2px;
}

.profile-header-meta .status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
    flex-shrink: 0;
}

.profile-panel .menu-divider {
    height: 1px;
    background: var(--border-soft, rgba(255, 255, 255, 0.08));
    margin: 8px -16px 10px -16px;
}

.profile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-menu-link {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    color: var(--color-text, #f8fafc) !important;
    text-decoration: none !important;
    border-radius: var(--radius, 8px) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}

.profile-menu-link:hover {
    background: var(--color-surface-alt, rgba(255, 255, 255, 0.06)) !important;
    color: var(--color-brand, #6366f1) !important;
    transform: translateX(2px);
}

.profile-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text-muted, #94a3b8);
    transition: all 0.2s ease;
}

.profile-menu-link:hover .profile-menu-icon {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-brand, #6366f1);
}

.profile-menu-logout:hover {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08) !important;
}

.profile-menu-logout:hover .profile-menu-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Back to Portal Button inside Sidebar moved to css-components/generic-sidebar-nav.css */


/* Normalize Top Actions Buttons & Elements */
.top-actions .btn,
.top-actions .burger,
.top-actions .expandable-search,
.top-actions .topbar-cart-capsule,
.top-actions .topbar-player-capsule {
    height: 36px !important;
    border-radius: var(--radius) !important;
    background: var(--color-surface-alt) !important;
    border: 1px solid var(--border-soft) !important;
    box-sizing: border-box !important;
    color: var(--color-text) !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.top-actions .btn,
.top-actions .burger,
.top-actions .expandable-search {
    flex: 0 0 auto !important;
    width: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Unified Hover State for All Top Actions Elements */
.top-actions .btn:hover,
.top-actions .burger:hover,
.top-actions .expandable-search:hover,
.top-actions .topbar-cart-capsule:hover,
.top-actions .topbar-player-capsule:hover {
    background: color-mix(in srgb, var(--color-surface-alt) 80%, var(--color-text) 10%) !important;
    border-color: color-mix(in srgb, var(--border-soft) 60%, var(--color-text) 20%) !important;
    color: var(--color-text) !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Unified Active/Pressed State */
.top-actions .btn:active,
.top-actions .burger:active,
.top-actions .topbar-cart-capsule:active {
    background: color-mix(in srgb, var(--color-surface-alt) 65%, var(--color-text) 18%) !important;
    transform: scale(0.98) !important;
}

/* Topbar Cart Active State (when dropdown modal is open) */
.top-actions .topbar-cart-capsule.is-active {
    background: color-mix(in srgb, var(--color-surface-alt) 85%, var(--color-brand) 15%) !important;
    border-color: var(--color-brand) !important;
    box-shadow: 0 0 10px color-mix(in srgb, var(--color-brand) 25%, transparent) !important;
}


/* Expandable Search in Top Actions */
.expandable-search {
    position: relative;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    justify-content: flex-start !important;
    /* Left-align the icon */
    overflow: hidden !important;
}

.expandable-search:hover,
.expandable-search:focus-within,
.expandable-search:has(input:not(:placeholder-shown)) {
    width: 280px !important;
    border-color: var(--color-brand) !important;
}

.expandable-search input {
    width: 100% !important;
    height: 100% !important;
    padding: 0 36px 0 36px !important;
    background: transparent !important;
    border: none !important;
    color: transparent !important;
    cursor: pointer !important;
    transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
    box-shadow: none !important;
}

.expandable-search input::placeholder {
    color: transparent !important;
}

.expandable-search:hover input,
.expandable-search:focus-within input,
.expandable-search input:not(:placeholder-shown) {
    color: var(--color-text) !important;
    cursor: text !important;
}

.expandable-search:hover input::placeholder,
.expandable-search:focus-within input::placeholder {
    color: var(--color-text-muted) !important;
}

.expandable-search .icon {
    position: absolute;
    left: 9px !important;
    pointer-events: none;
    z-index: 2;
}

.expandable-search .kbd {
    position: absolute;
    right: 8px !important;
    opacity: 0 !important;
    transition: opacity 0.3s;
    z-index: 2;
}

.expandable-search:hover .kbd {
    opacity: 0.75 !important;
}

.expandable-search:focus-within .kbd,
.expandable-search:has(input:not(:placeholder-shown)) .kbd {
    opacity: 0 !important;
}

/* ═══════════════════════════════════════
   FEATURED SERVICES GRID (Landpage Component)
   ═══════════════════════════════════════ */
.featured-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

.featured-service-card {
    background: var(--color-surface);
    border-radius: var(--radius, 16px);
    padding: 36px;
    box-shadow: var(--shadow-elevation, 0 4px 16px rgba(0, 0, 0, 0.12));
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.featured-service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-gradient, var(--color-brand));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.featured-service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover, 0 10px 40px rgba(0, 0, 0, 0.18));
    border-color: var(--border-strong);
}

.featured-service-card:hover::before {
    transform: scaleX(1);
}

.featured-service-icon {
    width: 64px;
    height: 64px;
    background: var(--color-surface-alt, rgba(27, 107, 46, 0.1));
    border-radius: 8px;
    /* like var(--radius-sm) */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--color-brand);
    margin-bottom: 20px;
    transition: all 0.3s;
}

.featured-service-card:hover .featured-service-icon {
    background: var(--accent-gradient, var(--color-brand));
    color: #fff;
}

.featured-service-card h3 {
    font-size: 1.3rem;
    color: var(--color-text);
    margin-bottom: 12px;
    font-weight: 700;
}

.featured-service-card p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.featured-service-features {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    border-top: 1px solid var(--border-soft);
    padding-top: 16px;
    margin-top: auto;
    /* Pushes list to bottom */
}

.featured-service-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

.featured-service-features li i {
    color: var(--color-accent);
    font-size: 1rem;
}

/* ==========================================================================
   Global Top Viewport Progress Bar
   ========================================================================== */
.global-top-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 3.5px;
    background: rgba(255, 255, 255, 0.04);
    z-index: 999999;
    pointer-events: none;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    display: none;
}

.global-top-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00f2fe 0%, #4facfe 35%, #00c6ff 70%, #a855f7 100%);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.8), 0 0 20px rgba(168, 85, 247, 0.6);
    border-radius: 0 3px 3px 0;
    transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.global-top-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9));
    box-shadow: 0 0 8px #ffffff;
    border-radius: 50%;
}

/* ==========================================================================
   Wizard Navigation Controls in Generic Menu Bar
   ========================================================================== */
.gmb-item[data-id="exp-gmb-prev"],
.gmb-item[data-id="exp-gmb-next"] {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    animation: none !important;
    padding: 0 12px !important;
    margin: 0 2px !important;
    height: 40px !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.gmb-item[data-id="exp-gmb-prev"]:hover,
.gmb-item[data-id="exp-gmb-next"]:hover {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.gmb-item[data-id="exp-gmb-prev"] .gmb-nav-btn-content,
.gmb-item[data-id="exp-gmb-next"] .gmb-nav-btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--color-text, #f8fafc);
    transition: color 0.2s ease, transform 0.2s ease;
    user-select: none;
}

.gmb-item[data-id="exp-gmb-prev"]:hover .gmb-nav-btn-content,
.gmb-item[data-id="exp-gmb-next"]:hover .gmb-nav-btn-content {
    color: var(--color-brand, #38bdf8);
}

.gmb-item[data-id="exp-gmb-prev"].gmb-disabled,
.gmb-item[data-id="exp-gmb-next"].gmb-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.gmb-item[data-id="exp-gmb-prev"].gmb-disabled .gmb-nav-btn-content,
.gmb-item[data-id="exp-gmb-next"].gmb-disabled .gmb-nav-btn-content {
    color: var(--color-text-muted, #94a3b8) !important;
}

/* ===== Universal Typewriter Input Styling ===== */
input[data-typewriter]::placeholder,
input[data-typewriter-phrases]::placeholder {
    transition: opacity 0.12s ease;
}

input[data-typewriter]:focus::placeholder,
input[data-typewriter-phrases]:focus::placeholder {
    opacity: 0.6;
}

/* Headless Utility Classes */
.route-load-error {
    color: var(--color-text-muted);
}

.quota-exceeded-text {
    color: var(--color-danger, #FF3F3F);
}