/*
 * ShopAccount storefront unified layer v11
 * Đồng bộ giao diện user theo hệ thống marketplace sáng/tối.
 */
body.marketplace-surface {
    --store-bg: #ffffff;
    --store-bg-soft: #f6f8fb;
    --store-surface: #ffffff;
    --store-surface-raised: #ffffff;
    --store-ink: #171923;
    --store-muted: #667085;
    --store-line: #e2e7ef;
    --store-line-strong: #cfd7e3;
    --store-accent: #ff4058;
    --store-accent-hover: #ef2f49;
    --store-accent-soft: #fff0f3;
    --store-success: #11865b;
    --store-shadow: 0 14px 36px rgb(17 24 39 / 7%);
    background: var(--store-bg);
    color: var(--store-ink);
}

body.marketplace-surface .market-header {
    border-bottom: 1px solid var(--store-line);
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 8px 24px rgb(17 24 39 / 4%);
    backdrop-filter: blur(18px);
}

body.marketplace-surface .market-header-main {
    min-height: 72px;
}

body.marketplace-surface .market-primary-nav a {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    gap: 7px;
    color: #303440;
    font-size: 13px;
    font-weight: 720;
}

body.marketplace-surface .market-primary-nav a > .ui-icon {
    width: 16px;
    height: 16px;
    opacity: .72;
    stroke-width: 1.8;
}

body.marketplace-surface .market-primary-nav a:is(:hover, .active) > .ui-icon {
    opacity: 1;
}

body.marketplace-surface .market-primary-nav a::after {
    height: 2px;
    border-radius: 2px 2px 0 0;
}

body.marketplace-surface .market-theme-toggle {
    position: relative;
    display: inline-grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border: 1px solid var(--store-line);
    border-radius: 10px;
    background: var(--store-surface);
    color: var(--store-ink);
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease;
}

body.marketplace-surface .market-theme-toggle:hover {
    border-color: #ff9baa;
    background: var(--store-accent-soft);
    color: var(--store-accent);
    transform: translateY(-1px);
}

body.marketplace-surface .market-theme-toggle .ui-icon {
    position: absolute;
    width: 18px;
    height: 18px;
    transition: opacity .18s ease, transform .18s ease;
}

body.marketplace-surface .market-theme-icon-sun {
    opacity: 0;
    transform: scale(.68) rotate(-20deg);
}

body.marketplace-surface .market-theme-icon-moon {
    opacity: 1;
    transform: scale(1) rotate(0);
}

html[data-color-scheme="dark"] body.marketplace-surface .market-theme-icon-sun {
    opacity: 1;
    transform: scale(1) rotate(0);
}

html[data-color-scheme="dark"] body.marketplace-surface .market-theme-icon-moon {
    opacity: 0;
    transform: scale(.68) rotate(20deg);
}

body.marketplace-surface :is(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid rgb(255 64 88 / 28%);
    outline-offset: 2px;
}

body.marketplace-surface .market-main > :not(.auth-marketplace) {
    animation: storefront-enter .42s cubic-bezier(.22, .8, .28, 1) both;
}

body.marketplace-surface :is(.shop-product-card, .market-product-card, .account-overview-card, .tool-grid > *, .contact-layout > *) {
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

body.marketplace-surface :is(.shop-product-card, .market-product-card):hover {
    border-color: #ffb2bd;
    box-shadow: 0 18px 40px rgb(17 24 39 / 10%);
    transform: translateY(-3px);
}

@keyframes storefront-enter {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dark theme: one coherent navy-black marketplace rather than mixed black/white panels. */
html[data-color-scheme="dark"] body.marketplace-surface {
    --store-bg: #080d14;
    --store-bg-soft: #0c131e;
    --store-surface: #121b28;
    --store-surface-raised: #172233;
    --store-ink: #f7f9fc;
    --store-muted: #aeb8c8;
    --store-line: #2a3749;
    --store-line-strong: #3b4a60;
    --store-accent: #ff5b70;
    --store-accent-hover: #ff7587;
    --store-accent-soft: #30151d;
    --store-success: #36d399;
    --store-shadow: 0 18px 46px rgb(0 0 0 / 28%);
    --gcmmo-ink: var(--store-ink);
    --gcmmo-muted: var(--store-muted);
    --gcmmo-subtle: var(--store-bg-soft);
    --gcmmo-surface: var(--store-surface);
    --gcmmo-line: var(--store-line);
    --gcmmo-line-strong: var(--store-line-strong);
    --gcmmo-brand-soft: var(--store-accent-soft);
    --gcmmo-brand-border: #793344;
    background: var(--store-bg);
    color: var(--store-ink);
    color-scheme: dark;
}

html[data-color-scheme="dark"] body.marketplace-surface .market-shell,
html[data-color-scheme="dark"] body.marketplace-surface .market-main {
    background: var(--store-bg);
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-header, .market-header-main) {
    border-color: var(--store-line);
    background: rgb(12 19 30 / 96%);
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.marketplace-surface .market-announcement-strip {
    border-color: #222d3d;
    background: #080c12;
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.marketplace-surface .market-primary-nav a {
    color: #c5cedb;
}

html[data-color-scheme="dark"] body.marketplace-surface .market-primary-nav a:is(:hover, .active) {
    color: var(--store-accent) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-search, .market-theme-toggle, .market-wallet-shortcut, .market-login, .market-action-link, .market-account) {
    border-color: var(--store-line);
    background: #0b1119;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.marketplace-surface .market-search :is(input, button) {
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.marketplace-surface .market-search input::placeholder {
    color: #8692a5;
}

html[data-color-scheme="dark"] body.marketplace-surface .market-register {
    border-color: var(--store-accent);
    background: var(--store-accent);
    color: #fff;
}

html[data-color-scheme="dark"] body.marketplace-surface .market-account-dropdown {
    border-color: var(--store-line);
    background: var(--store-surface-raised);
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.marketplace-surface .market-live-ticker {
    border-color: var(--store-line);
    background: rgb(8 13 20 / 96%);
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-home-methods, .market-home-assurance) b {
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-home-methods, .market-home-assurance) small {
    color: var(--store-muted) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface .market-home-methods > span > .ui-icon {
    border-color: var(--store-line);
    color: var(--store-accent);
}

/* Commerce pages */
html[data-color-scheme="dark"] body.marketplace-surface :is(.market-home-hero, .market-home-flow, .market-home-products, .market-catalog-page, .market-product-page, .market-store-page) {
    background: var(--store-bg) !important;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-home-copy h1, .market-home-products h2, .market-page-heading h1, .market-results-toolbar h2, .market-filter-panel h2, .market-store-page h1, .market-product-summary h1, .market-product-detail-card h2, .market-seller-card h2) {
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface .market-home-copy h1 em {
    color: var(--store-accent) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-home-copy > p:not(.market-home-eyebrow), .market-page-heading p, .market-product-lead, .market-product-benefits small, .market-product-spec-strip small, .market-store-page p, .market-product-card small, .shop-product-card small) {
    color: var(--store-muted) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-home-assurance, .market-assurance-band, .market-filter-panel, .market-weekly-offer, .shop-product-card, .market-product-card, .market-gallery-stage, .market-product-summary, .market-purchase-panel, .market-product-detail-card, .market-seller-card, .market-store-cover, .market-store-identity) {
    border-color: var(--store-line) !important;
    background: var(--store-surface) !important;
    color: var(--store-ink);
    box-shadow: var(--store-shadow);
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-product-summary li, .market-product-summary li b, .market-product-spec-strip b, .market-purchase-panel label, .market-purchase-panel header > span, .market-product-tab-panel, .market-product-tab-panel p, .market-product-tab-panel li, .market-breadcrumb > span:last-child) {
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-filter-panel a, .market-filter-panel span, .market-filter-panel b, .market-product-card footer, .shop-product-copy, .market-breadcrumb, .market-breadcrumb a) {
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-filter-search > span, .market-price-filter input, .market-currency-filter select, .market-sort-tabs a, .market-view-switch, .market-package-options label, .market-quantity-row, .market-coupon-field input, .market-order-note textarea, .quantity-control, .market-add-favorite) {
    border-color: var(--store-line) !important;
    background: #0b1119 !important;
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-package-options label.active, .market-sort-tabs a.active) {
    border-color: var(--store-accent) !important;
    background: var(--store-accent-soft) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-product-tabs, .market-product-spec-strip, .market-purchase-panel header, .market-quantity-row, .market-purchase-total) {
    border-color: var(--store-line) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-buy-now, .mock-primary, .button) {
    border-color: var(--store-accent);
    background: var(--store-accent);
    color: #fff;
}

html[data-color-scheme="dark"] body.marketplace-surface :is(.market-buy-now, .mock-primary, .button):hover {
    border-color: var(--store-accent-hover);
    background: var(--store-accent-hover);
}

/* Shared account, support and informational pages */
html[data-color-scheme="dark"] body.customer-surface :is(.dashboard-v2, .orders-workspace, .wallet-deposit-v4, .account-profile-page, .account-settings-page, .affiliate-page, .page-hero) {
    background: var(--store-bg) !important;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .page-hero {
    border-color: var(--store-line) !important;
}

html[data-color-scheme="dark"] body.customer-surface .page-hero :is(h1, h2) {
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.customer-surface .page-hero > p:not(.eyebrow) {
    color: var(--store-muted) !important;
}

html[data-color-scheme="dark"] body.customer-surface :is(.table-shell, .article-page, .contact-layout > *, .tool-grid > *, .account-settings-panel, .profile-media-card, .content-hub-v5) {
    border-color: var(--store-line) !important;
    background: var(--store-surface) !important;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface :is(.table-shell, .article-page, .contact-layout, .tool-grid, .content-hub-v5) :is(h1, h2, h3, h4, strong, b, dt) {
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface :is(.table-shell, .article-page, .contact-layout, .tool-grid, .content-hub-v5) :is(p, small, dd, li) {
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.customer-surface :is(.table-shell, .article-page, .contact-layout, .tool-grid, .account-settings-panel) :is(input, select, textarea) {
    border-color: var(--store-line);
    background: #0b1119;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface :is(.table-shell, .article-page, .contact-layout, .tool-grid, .account-settings-panel) :is(input, textarea)::placeholder {
    color: #8390a3;
}

/* Dashboard */
html[data-color-scheme="dark"] body.customer-surface .dashboard-v2 :is(.dashboard-command-band, .dashboard-wallet-summary, .dashboard-kpi-rail, .mock-panel, .quick-action-grid a, .amount-chips span, .affiliate-mini-stats span) {
    border-color: var(--store-line);
    background: var(--store-surface);
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .dashboard-v2 :is(h1, h2, h3, strong, b) {
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .dashboard-v2 :is(p, small, em) {
    color: var(--store-muted);
}

/* Orders */
html[data-color-scheme="dark"] body.customer-surface .orders-page-heading {
    border-color: var(--store-line);
    background: var(--store-bg);
}

html[data-color-scheme="dark"] body.customer-surface .orders-page-heading :is(h1, strong) {
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.customer-surface .orders-page-heading p:not(.orders-eyebrow) {
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace :is(.orders-list-pane, .order-detail-pane, .order-list-panel, .orders-filter-bar, .order-summary-card, .delivered-account, .order-timeline, .detail-note) {
    border-color: var(--store-line) !important;
    background: var(--store-surface) !important;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace :is(.customer-order-row, .customer-order-row.selected) {
    border-color: var(--store-line);
    background: #0d141f;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace .customer-order-row.selected {
    border-left-color: var(--store-accent);
    background: #21141a;
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace :is(.customer-order-row b, .order-detail-pane h2, .order-detail-pane h3, .order-detail-pane strong, .delivered-account b) {
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace :is(.customer-order-row small, .order-summary-card span, .order-detail-pane p, .delivered-account small) {
    color: var(--store-muted);
}

/* Wallet */
html[data-color-scheme="dark"] body.customer-surface .wallet-v4-header :is(h1, dd) {
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.customer-surface .wallet-v4-header :is(p, dt) {
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.customer-surface .wallet-deposit-v4 :is(.wallet-v4-balance, .payment-tabs, .wallet-payment-panel, .transaction-state, .process-card, .balance-history, .wallet-aside .mock-panel, .deposit-totals, .bank-transfer-box, .amount-selector button, .gateway-selector label) {
    border-color: var(--store-line) !important;
    background: var(--store-surface) !important;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .wallet-deposit-v4 :is(.payment-tabs button, .deposit-amount-input, .deposit-amount-input input) {
    border-color: var(--store-line);
    background: #0b1119;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .wallet-deposit-v4 :is(.payment-tabs button.active, .amount-selector button.active, .gateway-selector label:has(input:checked)) {
    border-color: var(--store-accent) !important;
    background: var(--store-accent-soft) !important;
}

html[data-color-scheme="dark"] body.customer-surface .wallet-deposit-v4 :is(h1, h2, h3, strong, b, dd) {
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .wallet-deposit-v4 :is(p, small, dt, span) {
    color: var(--store-muted);
}

/* Profile and settings */
html[data-color-scheme="dark"] body.customer-surface .account-profile-identity {
    border-color: var(--store-line);
    background: var(--store-surface);
}

html[data-color-scheme="dark"] body.customer-surface .account-profile-copy :is(h1, p) {
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.customer-surface .account-profile-stats,
html[data-color-scheme="dark"] body.customer-surface .account-profile-stats article,
html[data-color-scheme="dark"] body.customer-surface .account-overview-card,
html[data-color-scheme="dark"] body.customer-surface .profile-settings-section {
    border-color: var(--store-line) !important;
    background: var(--store-surface) !important;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface :is(.account-profile-stats, .account-overview-card, .profile-settings-section) :is(h2, h3, h4, strong, b, dd) {
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface :is(.account-profile-stats, .account-overview-card, .profile-settings-section) :is(p, small, dt) {
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.customer-surface .account-card-action {
    border-color: #285a58;
    background: #103c3a;
    color: #ff8292;
}

/* Support conversation */
html[data-color-scheme="dark"] body.customer-surface .ticket-thread {
    border-color: var(--store-line);
    background: var(--store-surface);
}

html[data-color-scheme="dark"] body.customer-surface .ticket-message {
    border: 1px solid var(--store-line);
    background: #0d141f;
}

html[data-color-scheme="dark"] body.customer-surface .ticket-message.admin-message {
    border-color: #3d5638;
    background: #15291d;
}

html[data-color-scheme="dark"] body.customer-surface .ticket-message :is(b, p, small) {
    color: var(--store-ink);
}

/* Keep the footer readable in both modes. */
html[data-color-scheme="dark"] body.marketplace-surface .market-footer {
    border-color: var(--store-line);
    background: #0a1018;
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.marketplace-surface .market-footer :is(b, strong) {
    color: var(--store-ink);
}

/* Final contrast repairs discovered during rendered QA. */
html[data-color-scheme="dark"] body.marketplace-surface .market-purchase-panel :is(legend, label, b),
html[data-color-scheme="dark"] body.marketplace-surface .market-package-options :is(b, small) {
    color: var(--store-ink) !important;
}

html[data-color-scheme="dark"] body.marketplace-surface .market-package-options small,
html[data-color-scheme="dark"] body.marketplace-surface .market-purchase-panel > form > p {
    color: var(--store-muted) !important;
}

html[data-color-scheme="dark"] body.customer-surface .content-hero-links-v5 a {
    color: #cbd5e3;
}

html[data-color-scheme="dark"] body.customer-surface .content-hero-links-v5 a:hover {
    color: var(--store-accent);
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace :is(.orders-page-summary, .detail-pane-heading, .credential-item, .transaction-state > div) {
    border-color: var(--store-line) !important;
    background: var(--store-surface-raised) !important;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace :is(.detail-pane-heading, .credential-item) :is(h2, h3, strong, b, span) {
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace :is(.detail-pane-heading, .credential-item) small {
    color: var(--store-muted);
}

html[data-color-scheme="dark"] body.customer-surface .orders-workspace :is(.orders-filter-bar input, .orders-filter-bar select, .order-note-form textarea) {
    border-color: var(--store-line);
    background: #0b1119;
    color: var(--store-ink);
}

html[data-color-scheme="dark"] body.customer-surface .wallet-deposit-v4 .transaction-state > div {
    border-color: var(--store-line);
    background: var(--store-surface-raised);
}

html[data-color-scheme="dark"] body.customer-surface .wallet-deposit-v4 .transaction-state > div :is(span, b) {
    color: var(--store-ink);
}


/* Product quantity stepper: one unified control with room for larger values. */
body.marketplace-surface .market-product-page .market-quantity-row .quantity-control {
    width: 176px;
    min-height: 46px;
    height: 46px;
    grid-template-columns: 44px minmax(86px, 1fr) 44px;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--store-line);
    border-radius: 10px;
    background: var(--store-surface) !important;
    box-shadow: none;
}

body.marketplace-surface .market-product-page .market-quantity-row .quantity-control :is(button, input) {
    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--store-ink) !important;
    line-height: 1;
}

body.marketplace-surface .market-product-page .market-quantity-row .quantity-control button {
    display: grid;
    place-items: center;
    font-size: 18px;
    font-weight: 650;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease;
}

body.marketplace-surface .market-product-page .market-quantity-row .quantity-control input[type="number"] {
    min-width: 86px;
    border-right: 1px solid var(--store-line) !important;
    border-left: 1px solid var(--store-line) !important;
    appearance: textfield;
    -moz-appearance: textfield;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    caret-color: var(--store-accent);
}

body.marketplace-surface .market-product-page .market-quantity-row .quantity-control input[type="number"]::-webkit-inner-spin-button,
body.marketplace-surface .market-product-page .market-quantity-row .quantity-control input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

body.marketplace-surface .market-product-page .market-quantity-row .quantity-control button:hover {
    background: var(--store-accent-soft) !important;
    color: var(--store-accent) !important;
}

body.marketplace-surface .market-product-page .market-quantity-row .quantity-control button:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--store-accent);
    outline-offset: -3px;
}

body.marketplace-surface .market-product-page .market-quantity-row .quantity-control input[type="number"]:focus {
    position: relative;
    z-index: 1;
    outline: 0;
    box-shadow: inset 0 0 0 2px var(--store-accent) !important;
}

@media (max-width: 1100px) {
    body.marketplace-surface .market-primary-nav a {
        gap: 5px;
        font-size: 12px;
    }

    body.marketplace-surface .market-primary-nav a > .ui-icon {
        width: 15px;
        height: 15px;
    }
}

@media (max-width: 760px) {
    body.marketplace-surface .market-theme-toggle {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    body.marketplace-surface .market-primary-nav a {
        width: 100%;
        min-height: 44px;
        justify-content: flex-start;
        padding-inline: 14px;
    }

    body.marketplace-surface .market-primary-nav a > .ui-icon {
        width: 18px;
        height: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.marketplace-surface .market-main > :not(.auth-marketplace) {
        animation: none;
    }

    body.marketplace-surface :is(.shop-product-card, .market-product-card, .market-theme-toggle, .market-theme-icon) {
        transition: none;
    }
}
