/* Shared chrome has its own theme, including Home where page theme CSS is absent. */
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) {
    --kg-nav-bg: #fff;
    --kg-nav-ink: #172033;
    --kg-nav-muted: #647084;
    --kg-nav-line: #e5e8ef;
    --kg-nav-hover: #f4f5fa;
    --kg-nav-accent: #4f46e5;
}
.dark .kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) {
    --kg-nav-bg: #171d2b;
    --kg-nav-ink: #edf0f8;
    --kg-nav-muted: #a7b1c5;
    --kg-nav-line: #30394b;
    --kg-nav-hover: #222a3a;
    --kg-nav-accent: #a5b4fc;
    background-color: var(--kg-nav-bg);
    border-color: var(--kg-nav-line);
    color: var(--kg-nav-ink);
}
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu {
    background-color: var(--kg-nav-bg);
    color: var(--kg-nav-ink);
    border-color: var(--kg-nav-line);
    color-scheme: light;
}
.dark .kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu {
    color-scheme: dark;
}
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-nav-action {
    color: var(--kg-nav-ink);
    border-color: var(--kg-nav-line);
}
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-nav-action:is(:hover, :active, [aria-expanded="true"]),
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu :is(a, button):is(:hover, :active) {
    background-color: var(--kg-nav-hover);
}
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) :is(a, button):focus-visible {
    outline: 2px solid var(--kg-nav-accent);
    outline-offset: -2px;
}
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu :is(.border, .border-t, .border-b, .border-r) {
    border-color: var(--kg-nav-line);
}
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu :is(.text-neutral-600, .text-neutral-700, .text-neutral-800, .text-neutral-100, .text-gray-600) {
    color: var(--kg-nav-ink);
}
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu :is(.text-neutral-400, .text-neutral-500, .text-neutral-300, .text-gray-500, .text-gray-400) {
    color: var(--kg-nav-muted);
}
.kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu :is(.text-indigo-400, .text-indigo-500, .text-indigo-600) {
    color: var(--kg-nav-accent);
}
.dark .kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu .text-red-600 {
    color: #fca5a5;
}
.dark .kg-customer :is(.kg-desktop-header, .kg-mobile-topbar) .kg-account-menu .text-amber-700 {
    color: #fcd34d;
}
.dark .kg-customer .kg-mobile-topbar .kg-mobile-icon .text-slate-600 {
    color: var(--kg-nav-ink);
}

/* Customer desktop actions share compact spacing and badge presentation.
   Profile menus, mobile chrome and seller headers do not use this variant. */
@media (min-width: 768px) {
    .kg-customer .kg-desktop-header .kg-header-icon-button {
        position: relative; display: inline-flex; align-items: center; justify-content: center;
        box-sizing: border-box; width: 44px; height: 44px; min-width: 44px; min-height: 44px;
        flex-shrink: 0; padding: 0; border: 0; border-radius: 10px;
        color: var(--kg-nav-ink); background: transparent; font-size: 18px;
    }
    .kg-customer .kg-desktop-header .kg-header-icon-button:is(:hover,:active,[aria-expanded="true"]) { background: var(--kg-nav-hover); }
    .kg-customer .kg-desktop-header .kg-header-icon-button:focus-visible { outline: 2px solid var(--kg-nav-accent); outline-offset: -2px; }
    .kg-customer .kg-desktop-header .kg-header-icon-button>i { font-size: 18px; line-height: 1; }
    /* The Bell's narrower silhouette needs a small optical-size adjustment. */
    .kg-customer .kg-desktop-header .kg-header-icon-button>i.fa-bell { font-size: 19px; }
    .kg-customer .kg-desktop-header .kg-header-count-badge {
        position: absolute; top: 2px; right: 2px; z-index: 1; box-sizing: border-box;
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9999px;
        background: #ef4444; color: #fff; font-size: 10px; font-weight: 400; line-height: 1;
        font-variant-numeric: tabular-nums; white-space: nowrap;
    }
}

/* Account identity and purchase badges belong only to customer desktop chrome. */
@media (min-width: 768px) {
    .kg-customer .kg-desktop-header .kg-desktop-avatar {
        position: relative; display: inline-flex; align-items: center; justify-content: center;
        width: 28px; height: 28px; flex: 0 0 28px; aspect-ratio: 1; overflow: hidden;
        border-radius: 50%; background: var(--kg-nav-hover); color: var(--kg-nav-accent);
    }
    .kg-customer .kg-desktop-header .kg-desktop-avatar img {
        position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
    }
    .kg-customer .kg-desktop-header .kg-account-name {
        display: block; min-width: 0; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .kg-customer .kg-desktop-header .kg-account-name + svg { flex-shrink: 0; }
    .kg-customer .kg-desktop-header .kg-desktop-purchase-icon {
        position: relative; display: inline-flex; align-items: center; justify-content: center; height: 20px;
    }
    .kg-customer .kg-desktop-header .kg-desktop-purchase-badge {
        position: absolute; top: -5px; left: calc(100% - 3px); box-sizing: border-box;
        display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px;
        padding: 0 4px; border-radius: 9999px; background: #ef4444; color: #fff;
        font-size: 10px; line-height: 1; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
    }
}

@media (min-width: 768px) {
    .kg-customer .kg-desktop-header button:has(> .kg-desktop-avatar) {
        padding: 7px 9px; gap: 6px; flex-shrink: 0; width: auto;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .kg-customer .kg-desktop-header .kg-desktop-top-row { flex-wrap: wrap; gap: 8px; }
    .kg-customer .kg-desktop-header .kg-desktop-main-nav { order: 3; flex-basis: 100%; justify-content: center; }
}

/* Customer desktop refinements; seller and mobile chrome retain their styles. */
@media (min-width: 768px) {
    .kg-customer .kg-desktop-header .kg-desktop-avatar + svg { flex-shrink: 0; }
    .kg-customer .dc-window-name .dc-context { display: none; }
    .kg-customer .dc-stack-options > button { opacity: 0; pointer-events: none; transition: opacity .15s; }
    .kg-customer .dc-stack:hover .dc-stack-options > button,
    .kg-customer .dc-stack:focus-within .dc-stack-options > button { opacity: 1; pointer-events: auto; }
    .kg-customer .dc-stack-options > button:focus-visible { opacity: 1; pointer-events: auto; }
    .kg-customer .kg-support-launch { position: fixed; right: 20px; bottom: 20px; }
}

@media (min-width: 768px) {
    .kg-customer .kg-desktop-header .kg-header-icon-button,
    .kg-customer .kg-desktop-header [aria-label="Menu akun"] {
        background: transparent; border: 0; box-shadow: none;
        width: 44px; height: 44px; padding: 0; flex-shrink: 0;
        display: inline-flex; align-items: center; justify-content: center;
        transition: color .15s;
    }
    .kg-customer .kg-desktop-header :is(.kg-header-icon-button,[aria-label="Menu akun"]):is(:hover,:active,[aria-expanded="true"]) {
        background: transparent; color: var(--kg-nav-accent);
    }
    .kg-customer .kg-desktop-header :is(.kg-header-icon-button,[aria-label="Menu akun"]):focus-visible {
        outline: 2px solid var(--kg-nav-accent); outline-offset: -2px;
    }
    .kg-customer .kg-desktop-header .kg-account-menu .kg-dropdown-name {
        min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .kg-customer .kg-desktop-header .kg-account-menu :is(a > i, a > span:has(> svg), a > span:has(> i), a > span:has(> img), a > div > i, .kg-desktop-avatar) {
        width: 28px; min-width: 28px; flex: 0 0 28px; height: 28px;
        display: inline-flex; align-items: center; justify-content: center;
    }
}
