.app-header {
    /* Layout (sticky / sidebar gap) lives in shell-chrome-classic.css */
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow:
        0 4px 6px -2px rgba(16, 24, 40, 0.04),
        0 12px 16px -4px rgba(16, 24, 40, 0.08);
}

.app-header:hover {
    box-shadow:
        0 4px 6px -2px rgba(16, 24, 40, 0.06),
        0 12px 20px -4px rgba(16, 24, 40, 0.1);
}

html.theme-dark .app-header {
    box-shadow:
        0 4px 6px -2px rgba(0, 0, 0, 0.24),
        0 12px 16px -4px rgba(0, 0, 0, 0.28);
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    max-width: min(42vw, 18rem);
}

.app-header-brand-logo {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.45rem;
    flex-shrink: 0;
    object-fit: contain;
    display: none;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.18);
}

.app-header-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.app-header-brand-name {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header-brand-tagline {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* When header has room: logo above store name (stacked) */
@media (min-width: 1100px) {
    .app-header-brand {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.2rem;
        max-width: min(36vw, 16rem);
    }

    .app-header-brand-logo {
        display: block;
        width: 1.5rem;
        height: 1.5rem;
    }

    .app-header-brand-text {
        align-items: flex-end;
        text-align: end;
    }
}

/* Very wide: logo beside name */
@media (min-width: 1400px) {
    .app-header-brand {
        flex-direction: row;
        align-items: center;
        gap: 0.7rem;
        max-width: min(40vw, 20rem);
    }

    .app-header-brand-logo {
        width: 2rem;
        height: 2rem;
    }

    .app-header-brand-text {
        align-items: flex-start;
        text-align: start;
    }
}

.header-fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--header-chip-height, 3.5rem);
    min-width: var(--header-chip-height, 3.5rem);
    height: var(--header-chip-height, 3.5rem);
    padding: 0;
    border: 1px solid var(--header-chip-border, var(--border-subtle));
    border-radius: 0.625rem;
    background: var(--header-chip-bg, rgba(15, 23, 42, 0.05));
    color: var(--header-chip-fg, var(--text-primary));
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.header-fullscreen-btn:hover {
    background: var(--header-chip-hover, rgba(15, 23, 42, 0.08));
}

.header-fullscreen-btn.is-active {
    border-color: rgba(var(--primary-rgb), 0.45);
    color: var(--primary-color);
}

.header-fullscreen-btn i {
    font-size: 1.1rem;
}

.header-account-menu {
    position: relative;
    flex-shrink: 0;
}

.header-account-trigger {
    position: relative;
    display: block;
    width: auto;
    max-width: min(15rem, 52vw);
    min-height: var(--header-chip-height, 3.5rem);
    padding: 0.5rem;
    border: 1px solid var(--header-chip-border, var(--border-subtle));
    border-radius: 0.625rem;
    background: var(--header-chip-bg, rgba(15, 23, 42, 0.05));
    color: var(--header-chip-fg, var(--text-primary));
    box-shadow: none;
    cursor: pointer;
    text-align: inherit;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        outline 0.15s ease;
}

.header-account-trigger:hover {
    background: var(--header-chip-hover, rgba(15, 23, 42, 0.08));
    border-color: var(--header-chip-border, var(--border-subtle));
}

.header-account-trigger:focus-visible {
    outline: 2px solid rgba(var(--primary-rgb), 0.55);
    outline-offset: 2px;
}

.header-account-trigger[aria-expanded="true"] {
    background: var(--header-chip-hover, rgba(15, 23, 42, 0.08));
    border-color: rgba(var(--primary-rgb), 0.45);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}

.header-account-identity {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding-inline-end: 1.75rem;
    min-width: 0;
}

.header-account-identity .avatar-slot {
    border: 2px solid rgba(var(--primary-rgb), 0.28);
    box-shadow: none;
    flex-shrink: 0;
}

.header-account-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
    text-align: start;
}

.header-account-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--header-chip-fg, var(--text-primary));
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-account-subtitle {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--header-chip-muted, var(--text-muted));
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-account-chevron {
    position: absolute;
    top: 0.5rem;
    inset-inline-end: 0.5rem;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: var(--header-chip-muted, var(--text-muted));
    font-size: 0.875rem;
    pointer-events: none;
    transition: transform 0.2s ease, color 0.15s ease;
}

.header-account-trigger[aria-expanded="true"] .header-account-chevron {
    transform: rotate(180deg);
    color: var(--header-chip-fg, var(--text-primary));
}

.header-account-popover {
    position: absolute;
    top: calc(100% + 0.5rem);
    inset-inline-start: 0;
    width: 15rem;
    max-height: 60vh;
    display: none;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    box-shadow:
        0 4px 6px -2px rgba(16, 24, 40, 0.04),
        0 12px 16px -4px rgba(16, 24, 40, 0.1),
        0 20px 24px -4px rgba(16, 24, 40, 0.06);
    z-index: 1090;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top;
    transition:
        opacity 0.16s ease,
        transform 0.16s ease,
        visibility 0.16s ease;
}

.header-account-popover.is-open {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.header-account-popover[hidden] {
    display: none !important;
}

.header-account-popover-head {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.header-account-popover-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.header-account-popover-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.header-account-popover-sub {
    margin: 0.125rem 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.header-account-menu-list {
    list-style: none;
    margin: 0;
    padding: 0.375rem;
}

.header-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5625rem 0.625rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.header-menu-item:hover,
.header-menu-item:focus-visible {
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--text-primary);
    outline: none;
}

.header-menu-item-icon {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 1rem;
}

.header-menu-item-label {
    flex: 1;
    min-width: 0;
    text-align: start;
}

.header-menu-item-addon {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.header-menu-toggle {
    position: relative;
    width: 2rem;
    height: 1.125rem;
    border-radius: 999px;
    background: var(--border-subtle);
    flex-shrink: 0;
    transition: background 0.15s ease;
    pointer-events: none;
}

.header-menu-toggle::after {
    content: "";
    position: absolute;
    top: 0.125rem;
    inset-inline-start: 0.125rem;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
    transition: transform 0.15s ease;
}

.header-menu-item.is-active .header-menu-toggle {
    background: var(--primary-color);
}

.header-menu-item.is-active .header-menu-toggle::after {
    inset-inline-start: calc(100% - 0.125rem - 0.875rem);
}

.header-account-separator {
    height: 1px;
    margin: 0.25rem 0.625rem;
    background: var(--border-subtle);
}

.header-account-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.375rem 1rem 0.125rem;
}

.header-account-section-label {
    padding: 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--primary-color);
}

.header-account-section > .header-account-section-label {
    padding: 0.375rem 1rem 0.125rem;
}

.header-account-section-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.625rem;
    height: 1.625rem;
    border: 1px solid var(--border-subtle);
    border-radius: 0.375rem;
    background: rgba(var(--primary-rgb), 0.04);
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1;
    text-decoration: none;
    flex-shrink: 0;
    transition:
        background 0.12s ease,
        color 0.12s ease,
        border-color 0.12s ease;
}

.header-account-section-action:hover,
.header-account-section-action:focus-visible {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    border-color: rgba(var(--primary-rgb), 0.22);
    outline: none;
}

.header-account-empty-hint {
    margin: 0;
    padding: 0.25rem 1rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.header-menu-item.is-danger {
    color: #b42318;
}

.header-menu-item.is-danger .header-menu-item-icon {
    color: #d92d20;
}

.header-menu-item.is-danger:hover,
.header-menu-item.is-danger:focus-visible {
    background: rgba(217, 45, 32, 0.08);
    color: #b42318;
}

.header-menu-item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.header-menu-item:disabled:hover {
    background: transparent;
}

.header-account-popover-foot {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.header-account-popover-foot span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.biometric-toggle-btn.is-active .header-menu-toggle {
    background: var(--primary-color);
}

.biometric-toggle-btn.is-active .header-menu-toggle::after {
    inset-inline-start: calc(100% - 0.125rem - 0.875rem);
}

@media (max-width: 575.98px) {

    .app-header-brand-tagline {
        display: none;
    }

    .header-account-trigger {
        max-width: min(12rem, 46vw);
    }

    .header-account-subtitle {
        display: none;
    }

    .header-account-name {
        max-width: 10rem;
    }

    .header-account-popover {
        width: min(15rem, calc(100vw - 2rem));
    }

}