/* Keep available navigation visually distinct from disabled controls. */
body:not(.is-dark) .webapp-navbar .webapp-navbar-inner .center .centered-links .centered-link:not(.is-active) span {
    color: #5f687b;
}

body:not(.is-dark) .webapp-navbar .webapp-navbar-inner .center .centered-links .centered-link:not(.is-active) svg {
    stroke: #667085;
}

body:not(.is-dark) .webapp-navbar .webapp-navbar-inner .center .centered-links .centered-link:not(.is-active):hover {
    background: #f3f5f8;
}

body:not(.is-dark) .webapp-navbar .webapp-navbar-inner .center .centered-links .centered-link:not(.is-active):hover span {
    color: #283252;
}

body:not(.is-dark) .webapp-navbar .webapp-navbar-inner .center .centered-links .centered-link:not(.is-active):hover svg {
    stroke: #39445c;
}

body:not(.is-dark) .webapp-subnavbar .webapp-subnavbar-inner .tab-content .tab-content-inner .center ul li:not(.is-active):not(.is-disabled) > a:not([aria-disabled="true"]) {
    color: #667085;
    opacity: 1;
}

body:not(.is-dark) .webapp-subnavbar .webapp-subnavbar-inner .tab-content .tab-content-inner .center ul li:not(.is-disabled) > a:not([aria-disabled="true"]):hover {
    color: #d92d4b;
}

body:not(.is-dark) .webapp-subnavbar .webapp-subnavbar-inner .tab-content .tab-content-inner .center ul li.is-active > a {
    color: #d92d4b;
    opacity: 1;
}

body:not(.is-dark) .webapp-subnavbar .webapp-subnavbar-inner .tabs ul li:not(.is-active) a {
    color: #5f687b;
    opacity: 1;
}

/*
 * Let each desktop mega menu follow its visible content instead of sharing a
 * fixed height. A viewport-based ceiling keeps the menu usable on short
 * screens, where only the content area becomes scrollable.
 */
.webapp-subnavbar.is-active {
    height: auto !important;
    max-height: calc(100vh - 103px);
}

.webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active > .container {
    margin-top: 0 !important;
    padding-top: 28px;
    padding-bottom: 28px;
}

/*
 * Keep desktop mega menus compact: their four-column content is 940px wide,
 * so a 980px shell leaves a useful 20px gutter on either side without
 * stretching the panel across the screen.
 */
@media screen and (min-width: 769px) {
    .webapp-subnavbar.is-active {
        width: calc(100% - 40px) !important;
        max-width: 980px !important;
    }

    .webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active > .container {
        box-sizing: border-box;
        width: 100% !important;
        max-width: 100% !important;
        padding-right: 8px;
        padding-left: 8px;
    }

    .webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active .tab-content {
        padding-right: 8px;
        padding-left: 8px;
    }

    .webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active .center.has-slimscroll {
        padding-right: 8px;
        padding-left: 8px;
    }

    .webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active .tab-content-inner > .center > .columns {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    .webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active .tab-content-inner > .center > .columns > .column {
        min-width: 0;
        padding-right: 14px;
        padding-left: 14px;
    }

    .webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active .tab-content-inner li > a {
        max-width: 100%;
        overflow-wrap: break-word;
    }
}

@media screen and (min-width: 769px) and (max-width: 1100px) {
    .webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active .tab-content-inner > .center > .columns > .column {
        padding-right: 6px;
        padding-left: 6px;
    }

    .webapp-subnavbar.is-active .product-list-inline-item .product-list-inline-links {
        max-width: 100%;
        flex-wrap: wrap;
        white-space: normal !important;
        row-gap: 2px;
        line-height: 1.35;
    }
}

.webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active .tab-content-inner {
    min-height: 0 !important;
}

.webapp-subnavbar.is-active .webapp-subnavbar-inner.is-active .center.has-slimscroll {
    max-height: calc(100vh - 161px) !important;
}

.webapp-subnavbar .old-system-menu-heading {
    margin-top: 24px !important;
}

/* Mobile rows must contain wrapped labels, including the inline sale filters. */
.mobile-subsidebar .inner .submenu li.has-children > ul > li {
    height: auto;
    min-height: 32px;
}

.mobile-subsidebar .inner .submenu li.has-children > ul > li > a {
    padding: 6px 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.mobile-subsidebar .inner .submenu li.product-list-inline-item .product-list-inline-links {
    display: block;
    padding: 6px 0 !important;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.mobile-subsidebar .inner .submenu li.product-list-inline-item .product-list-inline-links > a {
    display: inline;
    width: auto;
    padding: 0;
    line-height: inherit;
}

/* Referral modal */
#refer-panel.referral-modal {
    padding: 20px;
}

#refer-panel.referral-modal .modal-background {
    background: rgba(26, 35, 55, .58);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

#refer-panel.referral-modal .modal-content {
    width: min(720px, calc(100vw - 40px)) !important;
    max-width: 720px !important;
    max-height: calc(100vh - 40px);
    margin: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 24px !important;
    background: transparent !important;
    box-shadow: none !important;
}

#refer-panel.referral-modal .modal-card {
    width: 100%;
    max-height: calc(100vh - 40px);
    margin: 0;
    overflow: hidden;
    border: 1px solid #dfe5ef;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 26px 70px rgba(21, 31, 51, .24);
}

#refer-panel.referral-modal .modal-card-head {
    display: flex;
    align-items: center;
    min-height: 104px;
    padding: 22px 26px;
    border: 0;
    border-bottom: 1px solid #e7ebf2;
    border-radius: 0;
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 89, 111, .11), transparent 32%),
        #fff;
}

#refer-panel .referral-modal-heading {
    display: flex;
    align-items: center;
    min-width: 0;
}

#refer-panel .referral-modal-heading-icon {
    display: inline-flex;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-right: 14px;
    border-radius: 16px;
    background: #fff0f3;
    color: #ff596f;
    font-size: 20px;
}

#refer-panel .referral-modal-heading h3 {
    margin: 0;
    color: #283252;
    font-size: 22px;
    font-weight: 750;
    line-height: 1.25;
}

#refer-panel .referral-modal-heading p {
    margin: 5px 0 0;
    color: #8a94aa;
    font-size: 14px;
    line-height: 1.45;
}

#refer-panel .referral-modal-close {
    display: inline-flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: 16px;
    padding: 0;
    border: 1px solid #dfe5ef;
    border-radius: 14px;
    background: #fff;
    color: #69758d;
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

#refer-panel .referral-modal-close:hover,
#refer-panel .referral-modal-close:focus {
    border-color: #ffacb8;
    background: #fff7f8;
    color: #ff596f;
}

#refer-panel.referral-modal .modal-card-body {
    max-height: calc(100vh - 144px);
    padding: 26px !important;
    overflow-y: auto;
    background: #f7f9fc !important;
}

#refer-panel .referral-modal-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 22px;
}

#refer-panel .referral-qr-card,
#refer-panel .referral-modal-details {
    border: 1px solid #e0e6f0;
    border-radius: 18px;
    background: #fff;
}

#refer-panel .referral-qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 292px;
    padding: 22px 18px;
    text-align: center;
}

#refer-panel .referral-qr-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 190px;
    height: 190px;
    padding: 11px;
    border: 1px solid #e3e8f1;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(40, 50, 82, .06);
}

#refer-panel .referral-qrcode {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 168px;
    height: 168px;
}

#refer-panel .referral-qrcode img {
    display: block !important;
    width: 168px !important;
    height: 168px !important;
    margin: 0 !important;
}

#refer-panel .referral-qrcode canvas {
    display: none !important;
}

#refer-panel .referral-qr-card > p {
    margin: 15px 0 0;
    color: #8a94aa;
    font-size: 13px;
    line-height: 1.45;
}

#refer-panel .referral-modal-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 22px;
}

#refer-panel .referral-field-label {
    display: block;
    margin: 0 0 8px;
    color: #667085;
    font-size: 13px;
    font-weight: 650;
}

#refer-panel .referral-code-box {
    display: flex;
    align-items: center;
    min-height: 76px;
    padding: 8px 8px 8px 18px;
    border: 1px solid #ffd1d8;
    border-radius: 15px;
    background: #fff7f8;
}

#refer-panel #refer_text {
    min-width: 0;
    overflow: hidden;
    color: #283252;
    font-family: "Roboto Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 24px;
    font-weight: 750;
    letter-spacing: .05em;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#refer-panel .referral-copy-button,
#refer-panel .referral-icon-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

#refer-panel .referral-copy-button {
    min-width: 92px;
    height: 52px;
    margin-left: auto;
    padding: 0 15px;
    border-radius: 12px;
    background: #ff596f;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

#refer-panel .referral-copy-button i {
    margin-right: 7px;
}

#refer-panel .referral-copy-button:hover,
#refer-panel .referral-copy-button:focus {
    background: #ee4861;
    color: #fff;
    transform: translateY(-1px);
}

#refer-panel .referral-copy-button.is-copied,
#refer-panel .referral-icon-button.is-copied {
    background: #e9f8ef;
    color: #25834b;
}

#refer-panel .referral-link-section {
    margin-top: 18px;
}

#refer-panel .referral-link-box {
    display: flex;
    align-items: center;
    height: 50px;
    padding-left: 14px;
    border: 1px solid #e0e6f0;
    border-radius: 13px;
    background: #f8fafc;
}

#refer-panel #refer_link_text {
    min-width: 0;
    overflow: hidden;
    color: #59657c;
    font-size: 13px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#refer-panel .referral-icon-button {
    width: 40px;
    height: 40px;
    margin: 0 5px 0 auto;
    border-radius: 10px;
    background: #fff;
    color: #69758d;
    font-size: 15px;
}

#refer-panel .referral-icon-button:hover,
#refer-panel .referral-icon-button:focus {
    background: #fff0f3;
    color: #ff596f;
}

#refer-panel .referral-tip {
    display: flex;
    align-items: flex-start;
    margin: 17px 0;
    color: #7b869c;
    font-size: 13px;
    line-height: 1.5;
}

#refer-panel .referral-tip i {
    margin: 3px 8px 0 1px;
    color: #ff8b9b;
}

#refer-panel .referral-open-button {
    width: 100%;
    min-height: 48px;
    margin-top: auto;
    border-radius: 13px;
    font-weight: 700;
}

#refer-panel .referral-open-button i {
    margin-right: 8px;
}

body.is-dark #refer-panel.referral-modal .modal-card,
body.is-dark #refer-panel.referral-modal .modal-card-head,
body.is-dark #refer-panel .referral-qr-card,
body.is-dark #refer-panel .referral-modal-details {
    border-color: #394158;
    background: #242938;
}

body.is-dark #refer-panel.referral-modal .modal-card-head {
    background: #242938;
}

body.is-dark #refer-panel.referral-modal .modal-card-body {
    background: #1d2230 !important;
}

body.is-dark #refer-panel .referral-modal-heading h3,
body.is-dark #refer-panel #refer_text {
    color: #f2f4f8;
}

body.is-dark #refer-panel .referral-code-box,
body.is-dark #refer-panel .referral-link-box,
body.is-dark #refer-panel .referral-qr-frame {
    border-color: #414960;
    background: #2b3142;
}

/*
 * Shared Dark mode legibility fixes.
 * Keep these global so list pages and legacy views receive the same minimum
 * text contrast without requiring page-by-page colour overrides.
 */
body.is-dark .webapp-navbar .webapp-navbar-inner .center .centered-links .centered-link:not(.is-active) span,
body.is-dark .webapp-navbar .webapp-navbar-inner .center .centered-links .centered-link:not(.is-active) .centered-link-label {
    color: #e2e7ef !important;
}

body.is-dark .webapp-navbar .webapp-navbar-inner .center .centered-links .centered-link:not(.is-active) svg {
    color: #aeb8ca !important;
    stroke: #aeb8ca !important;
}

body.is-dark .webapp-subnavbar .column-heading,
body.is-dark .webapp-subnavbar .column-heading span,
body.is-dark .webapp-subnavbar .column-heading i {
    color: #eef2f8 !important;
}

body.is-dark .webapp-subnavbar .subnavbar-column ul li > a,
body.is-dark .webapp-subnavbar .subnavbar-column ul li > a span {
    color: #e1e6ef !important;
}

body.is-dark .webapp-subnavbar .subnavbar-column ul li > a:hover,
body.is-dark .webapp-subnavbar .subnavbar-column ul li > a:focus-visible,
body.is-dark .webapp-subnavbar .subnavbar-column ul li > a:hover span,
body.is-dark .webapp-subnavbar .subnavbar-column ul li > a:focus-visible span {
    color: #ff9b54 !important;
}

body.is-dark .currencySymbol,
body.is-dark .show_update_cost {
    color: #eef2f8 !important;
}

body.is-dark .tag.is-green.level_name,
body.is-dark .tag.is-success.level_name {
    color: #17351e !important;
    text-shadow: none !important;
}

body.is-dark .account-wrapper .account-box h4,
body.is-dark .account-wrapper .account-box .fieldset-heading h4 {
    color: #cbd3e1;
}

body.is-dark .store-member-page-shell #users-datatable thead th {
    border-color: #41495b !important;
    background: #2a2f3d !important;
    color: #cbd3e1 !important;
}

body.is-dark .store-member-page-shell #users-datatable tbody td {
    border-color: #393f50 !important;
    background: #323236 !important;
    color: #dce2ec !important;
}

body.is-dark .store-member-page-shell #users-datatable tbody tr:hover td {
    background: #3a3b43 !important;
}

body.is-dark .store-member-page-shell #users-datatable th:first-child,
body.is-dark .store-member-page-shell #users-datatable td:first-child,
body.is-dark .store-member-page-shell #users-datatable th:nth-child(2),
body.is-dark .store-member-page-shell #users-datatable td:nth-child(2) {
    border-right-color: #454c5e !important;
    box-shadow: 1px 0 0 #454c5e !important;
}

body.is-dark .store-member-page-shell #users-datatable td:nth-child(2) b,
body.is-dark .store-member-page-shell #users-datatable td:nth-child(2) code {
    color: #eef2f8 !important;
}

body.is-dark .store-member-page-shell #users-datatable tbody td > div,
body.is-dark .store-member-page-shell #users-datatable tbody td > div div,
body.is-dark .store-member-page-shell #users-datatable tbody td > div span:not(.tag),
body.is-dark .store-member-page-shell #users-datatable .store-member-point-val,
body.is-dark .store-member-page-shell #users-datatable .store-member-voucher-val {
    color: #dce2ec !important;
}

body.is-dark .store-member-page-shell #users-datatable .store-member-joined-date,
body.is-dark .store-member-page-shell #users-datatable .store-member-remark-content,
body.is-dark .store-member-page-shell #users-datatable td > span:not(.tag) {
    color: #b8c1d1 !important;
}

body.is-dark .store-member-page-shell #users-datatable .store-member-joined-date {
    background: #292f3e !important;
}

body.is-dark .store-member-page-shell #users-datatable thead input,
body.is-dark .store-member-page-shell #users-datatable thead select,
body.is-dark .store-member-page-shell select[name$="_length"] {
    border-color: #454e62 !important;
    background: #252b39 !important;
    color: #eef2f8 !important;
}

body.is-dark .tag_sp .label {
    color: #17353a !important;
    text-shadow: none !important;
}

body.is-dark .webapp-subnavbar .dashboard-sale-type-menu-label.is-current,
body.is-dark .dashboard-sale-type-menu-label.is-current {
    color: #ff7890 !important;
}

@media (max-width: 640px) {
    #refer-panel.referral-modal {
        padding: 12px;
    }

    #refer-panel.referral-modal .modal-content {
        width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 24px);
    }

    #refer-panel.referral-modal .modal-card {
        max-height: calc(100vh - 24px);
        border-radius: 20px;
    }

    #refer-panel.referral-modal .modal-card-head {
        min-height: 88px;
        padding: 17px 18px;
    }

    #refer-panel .referral-modal-heading-icon {
        flex-basis: 44px;
        width: 44px;
        height: 44px;
        margin-right: 11px;
        border-radius: 13px;
    }

    #refer-panel .referral-modal-heading h3 {
        font-size: 19px;
    }

    #refer-panel .referral-modal-heading p {
        font-size: 12px;
    }

    #refer-panel .referral-modal-close {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
        margin-left: 10px;
        border-radius: 12px;
    }

    #refer-panel.referral-modal .modal-card-body {
        max-height: calc(100vh - 112px);
        padding: 16px !important;
    }

    #refer-panel .referral-modal-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    #refer-panel .referral-qr-card {
        min-height: 0;
        padding: 16px;
    }

    #refer-panel .referral-qr-frame {
        width: 166px;
        height: 166px;
    }

    #refer-panel .referral-qrcode,
    #refer-panel .referral-qrcode img {
        width: 144px !important;
        height: 144px !important;
    }

    #refer-panel .referral-modal-details {
        padding: 16px;
    }

    #refer-panel #refer_text {
        font-size: 20px;
    }

    #refer-panel .referral-copy-button {
        min-width: 82px;
        padding: 0 12px;
    }
}

/* Explicit merchant-only menu entries retain their gate independently of staff roles. */
.similar-product-review-menu[hidden] { display: none !important; }
.merchant-restricted-mark { display: inline-block; margin-left: 5px; color: #df9425; font-size: .7em; vertical-align: .1em; line-height: 1; }

.merchant-restricted-mark[hidden] { display: none !important; }
