/* Gemensamt sidhuvud, huvudmeny och verktygsmeny för Kvikr Aett. */

html body header.k-header.aett-site-header[data-aett-menu] {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
}

html body header.k-header.aett-site-header[data-aett-menu] > .k-container {
    display: block !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding-block: .85rem .25rem !important;
    text-align: left !important;
}

html body header.k-header.aett-site-header[data-aett-menu] .k-header-main {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: .65rem !important;
    text-align: left !important;
}

html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-top-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 1rem !important;
    min-width: 0;
}

html body header.k-header.aett-site-header[data-aett-menu] .k-brand {
    display: flex !important;
    flex: 0 1 auto !important;
    align-items: center !important;
    min-width: 0;
    margin: 0 !important;
    text-align: left !important;
}

html body header.k-header.aett-site-header[data-aett-menu] .aett-site-logo {
    display: block;
    flex: 0 0 auto;
    width: 4rem;
    height: 4rem;
    object-fit: contain;
}

html body header.k-header.aett-site-header[data-aett-menu] .k-brand-title,
html body header.k-header.aett-site-header[data-aett-menu] .k-brand-title .name,
html body header.k-header.aett-site-header[data-aett-menu] .k-brand-title .tagline {
    text-align: left !important;
}

html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-toggle {
    display: none !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    gap: .35rem !important;
    width: auto !important;
    margin: 0 !important;
    margin-inline-start: auto !important;
    justify-content: flex-end !important;
    white-space: nowrap;
}

html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-controls {
    display: flex !important;
    flex: 0 1 auto !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: .35rem !important;
}

html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-navigation {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: .15rem !important;
}

html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-navigation > .k-btn,
html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-controls > .k-btn {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    justify-content: center !important;
    white-space: nowrap;
}

.aett-menu-auth-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .35rem;
    margin-inline-start: auto !important;
    white-space: nowrap;
}

.aett-menu-auth-link .k-icon,
.aett-menu-toggle .k-icon {
    flex: 0 0 auto;
}

/* Verktygsmenyn använder en vanlig Kvikr UI-knapp som öppnar en separat åtgärdsmeny. */
.aett-menu-tools {
    position: relative;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    margin: 0;
}

.aett-menu-tools-button {
    display: inline-flex;
    align-items: center;
    width: auto;
    min-width: 0;
    margin: 0;
    gap: .2rem;
    white-space: nowrap;
}

.aett-menu-tools-button .k-icon {
    flex: 0 0 auto;
}

.aett-menu-tools-popup {
    position: absolute;
    z-index: 1000;
    inset-block-start: calc(100% + .4rem);
    inset-inline-end: 0;
    display: grid;
    min-width: 15rem;
    padding: .4rem;
    border: 1px solid var(--border, rgb(0 0 0 / .14));
    border-radius: var(--radius, .75rem);
    background: var(--panel, #fff);
    box-shadow: 0 .75rem 2rem rgb(0 0 0 / .14);
}

.aett-menu-tools-popup[hidden] {
    display: none !important;
}

.aett-menu-tools-action {
    justify-content: flex-start;
    width: 100%;
    margin: 0;
    white-space: nowrap;
}

.aett-menu-tools-status {
    position: absolute;
    z-index: 1000;
    inset-block-start: calc(100% + .4rem);
    inset-inline-end: 0;
    width: max-content;
    max-width: min(22rem, 80vw);
    padding: .55rem .7rem;
    border: 1px solid var(--border, rgb(0 0 0 / .14));
    border-radius: var(--radius, .75rem);
    background: var(--panel, #fff);
    box-shadow: 0 .75rem 2rem rgb(0 0 0 / .14);
    font-size: .875rem;
    line-height: 1.35;
}

.aett-menu-tools-status.is-error {
    color: var(--danger, #b00020);
}

/* Kvikr UI ger huvudytan ett generöst toppavstånd. Aetts sidhuvud har redan
   ett eget kontrollerat nederavstånd. */
html body header.k-header.aett-site-header[data-aett-menu] + main.k-main {
    padding-top: .55rem !important;
}

/* Huvudmenyn behöver extra utrymme när alla administrationslänkar och
   solfjäderrapporten visas. Växla till hamburgerläge innan de börjar mötas. */
@media (max-width: 1500px) {
    html body header.k-header.aett-site-header[data-aett-menu] > .k-container {
        padding-block: .7rem .2rem !important;
    }

    html body header.k-header.aett-site-header[data-aett-menu] .k-header-main {
        gap: .45rem !important;
    }

    html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-toggle {
        display: inline-flex !important;
    }

    html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-controls {
        display: none !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        width: 100% !important;
        gap: .2rem !important;
        padding: .35rem !important;
        border: 1px solid var(--border, rgb(0 0 0 / .14));
        border-radius: var(--radius, .75rem);
        background: var(--panel, #fff);
        box-shadow: 0 .6rem 1.5rem rgb(0 0 0 / .1);
    }

    html body header.k-header.aett-site-header[data-aett-menu][data-menu-open="true"] .aett-menu-controls {
        display: flex !important;
    }

    html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-navigation {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        gap: .1rem !important;
    }

    html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-navigation > .k-btn,
    html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-controls > .k-btn,
    html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-tools,
    html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-tools-button,
    html body header.k-header.aett-site-header[data-aett-menu] .aett-menu-auth-link {
        width: 100% !important;
        justify-content: flex-start !important;
        margin-inline-start: 0 !important;
    }

    .aett-menu-tools-popup,
    .aett-menu-tools-status {
        inset-inline-start: 0;
        inset-inline-end: auto;
    }

    html body header.k-header.aett-site-header[data-aett-menu] + main.k-main {
        padding-top: .35rem !important;
    }
}

@media (max-width: 640px) {
    html body header.k-header.aett-site-header[data-aett-menu] .aett-site-logo {
        width: 3.5rem;
        height: 3.5rem;
    }
}

@media (max-width: 520px) {
    html body header.k-header.aett-site-header[data-aett-menu] > .k-container {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
    }

    html body header.k-header.aett-site-header[data-aett-menu] .k-brand-title .name {
        font-size: clamp(1.6rem, 8vw, 2.2rem) !important;
    }

    html body header.k-header.aett-site-header[data-aett-menu] .k-brand-title .tagline {
        font-size: .9rem !important;
    }

    .aett-menu-tools-status {
        position: static;
        margin-block-start: .35rem;
        box-shadow: none;
    }
}
