.app-header {
    position: sticky;
    z-index: 1000;
    top: 0;
    display: block;
    min-height: 0;
    padding: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(18px);
}

.app-header-inner {
    display: flex;
    align-items: center;
    gap: 26px;
    width: min(1280px, calc(100% - 40px));
    min-height: 76px;
    margin: 0 auto;
}

.app-brand {
    flex: 0 0 auto;
}

.app-brand-copy {
    min-width: 0;
}

.app-navigation {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
}

.nav-primary {
    display: flex;
    align-items: center;
    gap: 3px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 11px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.nav-link:hover {
    background: #f3f5f1;
    color: var(--sage-dark);
}

.nav-link.is-active {
    background: var(--sage-soft);
    color: var(--sage-dark);
}

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

.nav-dropdown {
    position: relative;
}

.nav-dropdown > summary {
    list-style: none;
}

.nav-dropdown > summary::-webkit-details-marker {
    display: none;
}

.nav-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    user-select: none;
}

.nav-summary:hover,
.nav-dropdown[open] > .nav-summary,
.nav-dropdown.is-active > .nav-summary {
    border-color: var(--line);
    background: #f7f8f5;
}

.nav-create-summary {
    border-color: var(--sage);
    background: var(--sage);
    color: white;
}

.nav-create-summary:hover,
.nav-dropdown[open] > .nav-create-summary,
.nav-dropdown.is-active > .nav-create-summary {
    border-color: var(--sage-dark);
    background: var(--sage-dark);
    color: white;
}

.nav-plus {
    font-size: 21px;
    font-weight: 500;
    line-height: 1;
}

.nav-chevron {
    font-size: 11px;
    transition: transform 160ms ease;
}

.nav-dropdown[open] .nav-chevron {
    transform: rotate(180deg);
}

.nav-family-summary {
    max-width: 210px;
}

.nav-family-summary-copy {
    display: grid;
    min-width: 0;
}

.nav-family-summary-copy small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
}

.nav-family-summary-copy strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-account-summary {
    padding-left: 7px;
}

.nav-account-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--gold-soft);
    color: #705022;
    font-size: 11px;
    font-weight: 900;
}

.nav-account-name {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-menu {
    position: absolute;
    z-index: 1100;
    top: calc(100% + 10px);
    right: 0;
    display: grid;
    width: 270px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: white;
    box-shadow: 0 18px 50px rgba(33, 43, 37, 0.18);
}

.nav-menu-family {
    width: 310px;
}

.nav-menu-label {
    padding: 7px 10px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.nav-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 43px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.nav-menu-link:hover,
.nav-menu-link.is-active {
    background: var(--sage-soft);
    color: var(--sage-dark);
}

.nav-menu-link.is-current-family {
    background: #f7f4ec;
}

.nav-menu-divider {
    height: 1px;
    margin: 8px 3px;
    background: var(--line);
}

.nav-menu-section {
    display: grid;
}

.nav-menu-family-header,
.nav-menu-account-header {
    display: grid;
    gap: 3px;
    padding: 9px 10px 12px;
}

.nav-menu-family-header span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-menu-family-header strong,
.nav-menu-account-header strong {
    overflow-wrap: anywhere;
}

.nav-menu-family-header small,
.nav-menu-account-header span {
    color: var(--muted);
    font-size: 12px;
}

.nav-signout-form {
    margin: 0;
}

.nav-signout-button {
    width: 100%;
    min-height: 43px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: #9b3d3d;
    font: inherit;
    font-size: 14px;
    font-weight: 900;
    text-align: left;
    cursor: pointer;
}

.nav-signout-button:hover {
    background: #fff0f0;
}

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

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

@media (max-width: 1120px) {
    .app-header-inner {
        gap: 18px;
    }

    .nav-primary .nav-link {
        padding: 0 9px;
    }

    .nav-family-summary {
        max-width: 170px;
    }

    .nav-account-name {
        display: none;
    }
}

@media (max-width: 960px) {
    .app-header-inner {
        position: relative;
        justify-content: space-between;
        width: min(100% - 28px, 1280px);
        min-height: 70px;
    }

    .nav-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 84px;
        min-height: 44px;
        padding: 0 13px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: white;
        color: var(--ink);
        cursor: pointer;
    }

    .nav-mobile-toggle span {
        display: none;
    }

    .nav-mobile-toggle strong {
        font-size: 14px;
    }

    .navigation-js .app-navigation {
        display: none;
    }

    .navigation-js .app-navigation.is-open {
        display: flex;
    }

    .app-navigation {
        position: absolute;
        top: calc(100% + 1px);
        right: -14px;
        left: -14px;
        z-index: 1050;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        max-height: calc(100vh - 72px);
        padding: 18px;
        overflow-y: auto;
        border-bottom: 1px solid var(--line);
        background: white;
        box-shadow: 0 22px 40px rgba(33, 43, 37, 0.16);
    }

    .nav-mobile-family {
        display: grid;
        gap: 2px;
        padding: 14px 15px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: var(--sage-soft);
    }

    .nav-mobile-family span {
        color: var(--muted);
        font-size: 10px;
        font-weight: 900;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .nav-mobile-family small {
        color: var(--muted);
        font-size: 12px;
    }

    .nav-primary {
        align-items: stretch;
        flex-direction: column;
        gap: 4px;
    }

    .nav-link {
        width: 100%;
        min-height: 48px;
        padding: 0 14px;
    }

    .nav-actions {
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-summary {
        justify-content: space-between;
        width: 100%;
        min-height: 50px;
        padding: 0 14px;
    }

    .nav-family-summary {
        max-width: none;
    }

    .nav-family-summary-copy {
        flex: 1;
        text-align: left;
    }

    .nav-account-name {
        display: inline;
        flex: 1;
        max-width: none;
        text-align: left;
    }

    .nav-menu,
    .nav-menu-family {
        position: static;
        width: 100%;
        margin-top: 7px;
        padding: 8px;
        border-radius: 13px;
        box-shadow: none;
    }

    body.navigation-open {
        overflow: hidden;
    }
}

@media (max-width: 540px) {
    .app-brand small {
        display: none;
    }

    .app-brand-mark {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .app-main {
        width: min(100% - 28px, 1180px);
        padding-top: 36px;
    }
}
