:root {
    --header-h: 94px;
}

.app-header.site-header-masthead {
    width: calc(100% - 44px);
    height: 72px;
    min-height: 72px;
    margin: 8px 22px 10px;
    padding: 4px 18px 4px 8px;
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border-radius: 18px;
    overflow: visible;
}

.site-header-masthead.chat-home-masthead::after {
    pointer-events: none;
}

.site-header-visual {
    height: 72px;
    overflow: visible;
    text-decoration: none;
    border-radius: 16px;
    z-index: 2;
}

.site-header-masthead .chatbot-robot--hero {
    --robot-scale: .58;
    margin-top: 34px;
}

.site-header-content {
    min-width: 0;
    height: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-items: center;
    gap: 20px;
}

.site-header-brand-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    white-space: nowrap;
}

.site-header-logo {
    flex: 0 0 auto;
    color: #fff;
    text-decoration: none;
    font-size: clamp(30px, 2.25vw, 38px);
}

.site-header-logo::after {
    margin-top: 4px;
}

.site-header-copy strong {
    margin: 0;
    font-size: 14px;
    line-height: 1.15;
    white-space: nowrap;
}

/* Il sottotitolo descrittivo non occupa più spazio nell'header compatto. */
.site-header-copy span {
    display: none !important;
}

.site-header-navigation-row {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.site-header-navigation-row .main-nav {
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 3px;
}

.site-header-navigation-row .nav-link {
    height: 32px;
    padding-inline: 10px;
    font-size: 11px;
}

.site-header-navigation-row .nav-link.is-active::after {
    bottom: -8px;
}

.site-header-navigation-row .header-status {
    flex: 0 0 auto;
}

.site-header-navigation-row .config-nav-panel {
    z-index: 500;
}

/* The old home masthead is deliberately not mounted in the Analyst page.
   The global header above now owns that visual identity. */
body:has(#chatApp) .chat-home-masthead:not(.site-header-masthead) {
    display: none !important;
}

@media (min-width: 1050px) {
    body:has(#chatApp) .app-main {
        height: calc(100dvh - var(--header-h));
        min-height: 0;
        overflow: hidden;
    }

    #chatApp.chat-page {
        width: min(1880px, calc(100% - 32px));
        height: calc(100dvh - var(--header-h));
        min-height: 0;
        margin: 0 auto;
        padding: 0 0 12px;
        display: block;
        overflow: hidden;
    }

    #chatApp .conversation-shell {
        width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #chatApp .chat-feed {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }

    #chatApp .composer-wrap {
        flex: 0 0 auto;
    }
}

.analyst-mode-note {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(24, 216, 255, .14);
    border-radius: 999px;
    background: rgba(7, 29, 52, .56);
    color: #9fb8cf;
    font-size: 11px;
    font-weight: 720;
}

#chatApp .empty-state.analyst-empty-state {
    width: min(1120px, 100%);
}

#chatApp .analyst-empty-state > p {
    max-width: 820px;
    color: #8fa8c1;
    line-height: 1.65;
}

@media (max-width: 1320px) {
    .site-header-content {
        gap: 12px;
    }

    .site-header-brand-row {
        gap: 12px;
    }

    .site-header-copy strong {
        font-size: 12px;
    }

    .site-header-navigation-row {
        gap: 7px;
    }

    .site-header-navigation-row .nav-link {
        padding-inline: 8px;
        font-size: 10px;
    }

    .header-ai-badge,
    .header-user {
        display: none;
    }
}

@media (max-width: 1180px) {
    :root {
        --header-h: 90px;
    }

    .app-header.site-header-masthead {
        width: calc(100% - 28px);
        height: 70px;
        min-height: 70px;
        margin: 7px 14px 10px;
        grid-template-columns: 98px minmax(0, 1fr);
        padding-inline: 7px 12px;
    }

    .site-header-visual {
        height: 70px;
    }

    .site-header-masthead .chatbot-robot--hero {
        --robot-scale: .50;
        margin-top: 31px;
    }

    .site-header-copy {
        display: none;
    }

    .site-header-brand-row {
        gap: 10px;
    }
}

@media (max-width: 900px) {
    :root {
        --header-h: 84px;
    }

    .app-header.site-header-masthead {
        width: calc(100% - 20px);
        height: 64px;
        min-height: 64px;
        margin: 7px 10px 9px;
        grid-template-columns: 70px minmax(0, 1fr);
        border-radius: 16px;
    }

    .site-header-visual {
        height: 64px;
    }

    .site-header-masthead .chatbot-robot--hero {
        --robot-scale: .39;
        margin-top: 26px;
    }

    .site-header-masthead .robot-orbit-bubble {
        display: none;
    }

    .site-header-content {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px;
    }

    .site-header-logo {
        font-size: 27px;
    }

    .site-header-navigation-row {
        min-width: 0;
    }

    .site-header-navigation-row .main-nav {
        min-width: 0;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .site-header-navigation-row .main-nav::-webkit-scrollbar {
        display: none;
    }

    .site-header-navigation-row .header-status {
        display: none;
    }
}

@media (max-width: 720px) {
    :root {
        --header-h: 78px;
    }

    .app-header.site-header-masthead {
        height: 58px;
        min-height: 58px;
        grid-template-columns: 50px minmax(0, 1fr);
        gap: 5px;
        padding: 4px 8px 4px 5px;
    }

    .site-header-visual {
        height: 58px;
    }

    .site-header-masthead .chatbot-robot--hero {
        --robot-scale: .32;
        margin-top: 22px;
    }

    .site-header-logo {
        font-size: 23px;
    }

    .site-header-logo::after {
        margin-top: 2px;
    }

    .site-header-navigation-row .nav-link {
        height: 30px;
        padding-inline: 7px;
        font-size: 9px;
    }
}
