/**
 * Storefront chrome — H1–H6 header + F1–F4 footer + M1 panel tokens (locale: header only).
 * M1–M5: tokens through drawer categories. M6: footer + payment/social + floats + locale dialog token cohesion.
 * Product grid, locale modal form: layout inline where noted.
 */
:root {
    /* M1 — Panel-aligned semantics (docs/STOREFRONT_UI_MODERNIZATION.md §8.5) */
    --sf-page-bg: #fbfbfb;
    --sf-btn-primary: #0d6efd;
    --sf-btn-primary-hover: #0b5ed7;
    --sf-brand: var(--sf-btn-primary);
    --sf-brand-hover: var(--sf-btn-primary-hover);
    --sf-brand-rgb: 13, 110, 253;
    --sf-heading-text: #3b4056;
    --sf-body-text: #566a7f;

    /* Layout (H1) */
    --sf-page-max: 1100px;
    --sf-page-pad: 1.25rem;

    /* Legacy aliases — layout.blade.php inline + utilities */
    --fg: var(--sf-heading-text);
    --muted: #8592a3;
    --accent: var(--sf-brand);
    --border: #d9dee3;

    /* Surfaces & elevation (H2), tuned to panel */
    --sf-surface: #ffffff;
    --sf-surface-subtle: #f7f7f9;
    --sf-surface-muted: #f7f7f9;
    --sf-surface-thumb: #f1f5f9;
    --sf-accent-soft: rgba(var(--sf-brand-rgb), 0.12);
    --sf-error: #b91c1c;
    --sf-backdrop: rgba(15, 23, 42, 0.35);
    --sf-backdrop-strong: rgba(15, 23, 42, 0.45);

    --sf-radius-sm: 4px;
    --sf-radius-input: 6px;
    --sf-radius-panel: 8px;
    --sf-radius-dialog: 10px;
    --sf-radius-search: 10px;

    --sf-shadow-panel: 0 8px 24px rgba(15, 23, 42, 0.08);
    /* M2: sticky header + main content sheet */
    --sf-shadow-header: 0 1px 0 rgba(15, 23, 42, 0.06), 0 6px 22px rgba(15, 23, 42, 0.05);
    --sf-shadow-main: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 32px rgba(15, 23, 42, 0.05);
    --sf-shadow-drawer: 4px 0 24px rgba(0, 0, 0, 0.12);
    --sf-shadow-drawer-rtl: -4px 0 24px rgba(0, 0, 0, 0.12);
    --sf-shadow-dialog: 0 12px 40px rgba(0, 0, 0, 0.15);
    --sf-shadow-float: 0 2px 12px rgba(0, 0, 0, 0.12);

    --sf-header-bg: var(--sf-surface);
    /* Mobile category band; desktop ≥769px overrides cats row via --sf-header-legacy-gradient */
    --sf-header-cats-bg: var(--sf-surface-subtle);
    --sf-z-header: 50;
    --sf-z-dropdown: 60;
    --sf-z-search: 70;
    --sf-z-backdrop: 80;
    --sf-z-drawer: 90;
    --sf-z-float: 40;

    /* M4 — header utilities (min touch target ~44px) */
    --sf-toolbar-hit: 2.75rem;

    /* Footer (F3) */
    --sf-footer-payment-icon-max-h: 30px;
    --sf-footer-payment-icon-max-w: 88px;

    /* M6 — floats (WA brand) + dialog/footer polish */
    --sf-wa-green: #25d366;
    --sf-wa-green-dark: #1faa52;

    /* Desktop header — legacy dark gradient (applied only @media min-width:769px) */
    --sf-header-legacy-gradient: linear-gradient(135deg, #1e2a3a 0%, #131921 100%);
    --sf-header-chrome-fg: #e8eaed;
    --sf-header-chrome-muted: #94a3b8;
    --sf-header-chrome-border: rgba(255, 255, 255, 0.16);
    --sf-header-chrome-surface: rgba(255, 255, 255, 0.08);
    --sf-header-chrome-hover: rgba(255, 255, 255, 0.12);
    --sf-header-hover-border: rgba(255, 255, 255, 0.22);
    --sf-header-shadow-line: rgba(0, 0, 0, 0.35);
    --sf-header-shadow-drop: rgba(0, 0, 0, 0.22);
    --sf-header-chrome-link: #93c5fd;
    --sf-header-chrome-link-hover: #bfdbfe;
    --sf-header-company-name: var(--sf-header-chrome-fg);
    --sf-header-logo-hover: #fff;
    --sf-subheader-text: var(--sf-header-chrome-fg);
    --sf-subheader-text-hover: #fff;
    --sf-subheader-border: rgba(255, 255, 255, 0.12);
    --sf-header-bm-badge-bg: rgba(59, 130, 246, 0.35);
    --sf-header-bm-badge-text: #dbeafe;
    --sf-header-bm-badge-border: rgba(255, 255, 255, 0.12);
    --sf-header-noti-badge-bg: rgba(59, 130, 246, 0.35);
    --sf-header-noti-badge-text: #e0f2fe;
    --sf-header-avatar-bg: rgba(255, 255, 255, 0.14);
    --sf-header-avatar-text: #bfdbfe;
    --sf-header-badge-accent-text: #bfdbfe;
    --sf-header-search-bg: var(--sf-surface);
    --sf-header-search-border: var(--border);
    --sf-header-search-text: var(--fg);
    --sf-header-search-placeholder: var(--muted);
    --sf-header-search-focus-border: var(--sf-btn-primary);
    --sf-header-search-focus-ring: var(--sf-accent-soft);
    --sf-header-search-inset-shadow: rgba(15, 23, 42, 0.04);
    --sf-header-search-focus-inset-shadow: rgba(15, 23, 42, 0.04);
    --sf-header-search-submit-bg: var(--sf-btn-primary);
    --sf-header-search-submit-icon: #fff;
    --sf-header-search-submit-hover-bg: var(--sf-btn-primary-hover);
    --sf-header-search-submit-hover-icon: #fff;
    --sf-header-search-submit-divider: var(--border);

    /* Footer — legacy dark gradient (parity with legacy theme: #0b1727 → #131921) */
    --sf-footer-gradient: linear-gradient(135deg, #0b1727 0%, #131921 100%);
    --sf-footer-fg: #e8eaed;
    --sf-footer-brand: var(--sf-footer-fg);
    --sf-footer-muted: #94a3b8;
    --sf-footer-body: #cbd5e1;
    --sf-footer-border: rgba(255, 255, 255, 0.12);
    --sf-footer-link: #93c5fd;
    --sf-footer-link-hover: #bfdbfe;
    --sf-footer-payment-bg: transparent;
    --sf-footer-payment-icon-hover-ring: rgba(96, 165, 250, 0.35);
    --sf-footer-social-link: var(--sf-footer-muted);
    --sf-footer-social-link-hover: var(--sf-footer-fg);
    --sf-footer-social-strip-bg: rgba(0, 0, 0, 0.18);
    --sf-footer-chip: rgba(255, 255, 255, 0.08);
    --sf-footer-chip-hover: rgba(255, 255, 255, 0.12);
    --sf-footer-social-hover-border: rgba(255, 255, 255, 0.2);
}

.sf-page {
    width: 100%;
    max-width: var(--sf-page-max);
    margin-inline: auto;
    padding-inline: var(--sf-page-pad);
    box-sizing: border-box;
}

/* M2: main page wrapper spacing only (no page-wide white panel) */
main.sf-page {
    padding-block: 1.5rem 3rem;
    margin-bottom: 1.25rem;
}

/* CMS static pages (fx_pages / Phase 4) */
.sf-cms-page {
    max-width: 52rem;
    margin-inline: auto;
}

.sf-cms-page__header {
    margin-bottom: 1rem;
}

.sf-cms-page__title {
    margin: 0;
    font-size: clamp(1.45rem, 2.2vw, 1.9rem);
    font-weight: 800;
    color: var(--sf-heading-text);
    line-height: 1.2;
}

.sf-cms-page__subtitle {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.sf-cms-page__surface {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    padding: clamp(0.9rem, 2vw, 1.35rem);
}

.sf-cms-page__body {
    color: var(--sf-body-text);
    font-size: 0.98rem;
    line-height: 1.75;
}

.sf-cms-page__body :where(h1, h2, h3, h4) {
    color: var(--sf-heading-text);
    line-height: 1.3;
    scroll-margin-top: 5rem;
}

.sf-cms-page__body :where(h1, h2) {
    margin-top: 1.5rem;
    margin-bottom: 0.55rem;
}

.sf-cms-page__body :where(h3, h4) {
    margin-top: 1.2rem;
    margin-bottom: 0.45rem;
}

.sf-cms-page__body :where(p, ul, ol, table, blockquote) {
    margin-top: 0.7rem;
    margin-bottom: 0.7rem;
}

.sf-cms-page__body :where(ul, ol) {
    padding-inline-start: 1.25rem;
}

.sf-cms-page__body :where(li + li) {
    margin-top: 0.25rem;
}

.sf-cms-page__body :where(a) {
    word-break: break-word;
}

.sf-cms-page__body :where(hr) {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.sf-cms-page__body :where(table) {
    width: 100%;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}

.sf-cms-page__body :where(th, td) {
    border: 1px solid var(--border);
    padding: 0.45rem 0.55rem;
}

.sf-cms-page__body :where(img) {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.sf-cms-page__empty {
    color: var(--muted);
    margin: 0;
}

/* --- Footer shell (F1): full-bleed band; inner .sf-page aligns with main/header --- */
.sf-footer {
    border-top: 1px solid var(--sf-footer-border);
    margin-top: 2rem;
    background: var(--sf-footer-gradient);
    font-size: 0.9rem;
    color: var(--sf-footer-fg);
}

.sf-footer .sf-page {
    padding-block: 1.5rem 2rem;
}

.sf-footer__sep {
    margin: 0 0.35rem;
    opacity: 0.85;
    color: var(--sf-footer-muted);
}

.sf-payment {
    text-align: center;
    padding: 0.85rem 0 1.35rem;
    border-bottom: 1px solid var(--sf-footer-border);
    margin-bottom: 1.25rem;
}

.sf-payment__title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sf-footer-muted);
    margin: 0 0 0.65rem;
}

.sf-payment__icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.sf-payment__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(var(--sf-footer-payment-icon-max-h) + 14px);
    min-width: 2.5rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--sf-footer-border);
    border-radius: var(--sf-radius-sm);
    background: var(--sf-surface);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sf-payment__icon:hover {
    border-color: var(--sf-btn-primary);
    box-shadow: 0 0 0 1px var(--sf-footer-payment-icon-hover-ring);
}

.sf-payment__icon img {
    display: block;
    max-height: var(--sf-footer-payment-icon-max-h);
    max-width: var(--sf-footer-payment-icon-max-w);
    width: auto;
    height: auto;
    object-fit: contain;
}

/* F2: responsive grid 1 → 2 → 5 cols (brand + 4 nav); RTL-safe; dividers on large screens */
.sf-footer__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem 1.25rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
    .sf-footer__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .sf-footer__grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        column-gap: 0;
        row-gap: 1.25rem;
    }

    .sf-footer__col {
        padding-inline-start: 1rem;
        border-inline-start: 1px solid var(--sf-footer-border);
    }

    .sf-footer__col:first-child {
        padding-inline-start: 0;
        border-inline-start: none;
    }
}

.sf-footer__heading {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.6rem;
    color: var(--sf-footer-muted);
}

.sf-footer__heading--brand {
    font-size: 1rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
    color: var(--sf-footer-brand);
}

.sf-footer__text {
    margin: 0 0 0.4rem;
    color: var(--sf-footer-body);
    font-size: 0.875rem;
    line-height: 1.5;
}

.sf-footer__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sf-footer__list li {
    margin-bottom: 0.25rem;
}

.sf-footer__list a {
    display: inline-block;
    padding: 0.25rem 0;
    color: var(--sf-footer-link);
    text-decoration: none;
    border-radius: var(--sf-radius-sm);
    font-size: 0.875rem;
    line-height: 1.4;
}

.sf-footer__list a:hover {
    text-decoration: underline;
    color: var(--sf-footer-link-hover);
}

.sf-footer__list a:focus-visible {
    outline: 2px solid var(--sf-footer-link);
    outline-offset: 2px;
}

.sf-footer__social {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 0;
    border-top: 1px solid var(--sf-footer-border);
    background: var(--sf-footer-social-strip-bg);
}

.sf-footer__social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--sf-footer-border);
    border-radius: var(--sf-radius-input);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--sf-footer-social-link);
    background: var(--sf-footer-chip);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sf-footer__social-link:hover {
    color: var(--sf-footer-social-link-hover);
    background: var(--sf-footer-chip-hover);
    text-decoration: none;
    border-color: var(--sf-footer-social-hover-border);
}

.sf-footer__social-link:focus-visible {
    outline: 2px solid var(--sf-footer-link);
    outline-offset: 2px;
}

.sf-footer__copy {
    text-align: center;
    font-size: 0.78rem;
    color: var(--sf-footer-muted);
    padding-top: 0.65rem;
    margin-top: 0.15rem;
    line-height: 1.45;
}

/* F4 + M6: locale dialog (tokens; parity with header / search dialog) */
.sf-dialog {
    max-width: min(420px, 92vw);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-dialog);
    box-shadow: var(--sf-shadow-dialog);
    background: var(--sf-surface);
    color: var(--fg);
}

.sf-dialog::backdrop {
    background: var(--sf-backdrop-strong);
}

.sf-dialog__form {
    padding: 1rem 1.15rem 1.15rem;
}

.sf-dialog__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: -1rem -1.15rem 1rem;
    padding: 0.75rem 1.15rem;
    border-bottom: 1px solid var(--border);
    background: var(--sf-surface-subtle);
}

.sf-dialog__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--fg);
}

.sf-dialog__x {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    border-radius: var(--sf-radius-input);
}

.sf-dialog__x:hover {
    background: var(--sf-surface-muted);
    color: var(--fg);
}

.sf-dialog__x:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-dialog__x .sf-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.sf-dialog__field {
    margin-bottom: 0.85rem;
}

.sf-dialog__field label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.sf-dialog__field select {
    width: 100%;
    padding: 0.5rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    font: inherit;
    background: var(--sf-surface);
    color: var(--fg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sf-dialog__field select:focus {
    outline: none;
}

.sf-dialog__field select:focus-visible {
    border-color: var(--sf-btn-primary);
    box-shadow: 0 0 0 3px var(--sf-accent-soft);
}

.sf-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.sf-float {
    position: fixed;
    z-index: var(--sf-z-float);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    box-shadow: var(--sf-shadow-float);
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--fg);
    background: var(--sf-surface);
    transition: background-color 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}

.sf-float:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.sf-float--wa {
    bottom: 1.25rem;
    inset-inline-end: 1.25rem;
    background: var(--sf-wa-green);
    color: #fff;
    border-color: var(--sf-wa-green-dark);
}

.sf-float--wa:hover {
    color: #fff;
    text-decoration: none;
    filter: brightness(1.05);
}

.sf-float--wa:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.sf-float--top {
    bottom: 5.25rem;
    inset-inline-end: 1.25rem;
}

.sf-float--top:hover {
    background: var(--sf-surface-muted);
    text-decoration: none;
}

.sf-header .sf-page .sf-header__bar {
    padding: 0.65rem 0;
}

.sf-header .sf-page .sf-header__cats {
    padding: 0;
}

/* --- Header & chrome (from layout Phase 3+) --- */
.sf-header {
    position: sticky;
    top: 0;
    z-index: var(--sf-z-header);
    background: var(--sf-header-bg);
    border-bottom: none;
    box-shadow: var(--sf-shadow-header);
}

/* Desktop only: hide header after scroll-down; show again only at top (see storefront-header.js) */
@media (min-width: 769px) {
    @media (prefers-reduced-motion: no-preference) {
        .sf-header {
            transition: transform 0.22s ease;
        }
    }

    .sf-header.sf-header--scroll-hidden {
        transform: translateY(-100%);
        pointer-events: none;
    }
}

/* Mobile: hide header on scroll-down; show immediately on scroll-up (JS toggles class). */
@media (max-width: 768px) {
    @media (prefers-reduced-motion: no-preference) {
        .sf-header {
            transition: transform 0.22s ease;
        }
    }

    .sf-header.sf-header--scroll-hidden {
        transform: translateY(-100%);
        pointer-events: none;
    }
}

.sf-header__bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.sf-header__logo {
    font-weight: 700;
    font-size: 1.1rem;
    margin-inline-end: auto;
    color: var(--fg);
}

.sf-header__search--desktop {
    display: flex;
    flex: 1;
    max-width: 420px;
    margin: 0 0.5rem;
    align-items: stretch;
}

.sf-header__search--desktop .sf-search-cluster {
    flex: 1;
    min-width: 0;
}

/* M3 — soft pill: field + icon submit (desktop header, search dialog, drawer) */
.sf-search-cluster {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-search);
    background: var(--sf-surface-muted);
    box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sf-search-cluster:focus-within {
    border-color: var(--sf-btn-primary);
    box-shadow:
        inset 0 1px 1px rgba(15, 23, 42, 0.04),
        0 0 0 3px var(--sf-accent-soft);
}

.sf-search-cluster .sf-search-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sf-search-cluster .sf-search-wrap__input {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font: inherit;
    color: var(--fg);
    min-height: 2.625rem;
    padding: 0.45rem 0.65rem;
    padding-inline-start: 0.75rem;
}

.sf-search-cluster .sf-search-wrap__input::placeholder {
    color: var(--muted);
}

.sf-search-cluster .sf-search-wrap__input:focus {
    outline: none;
}

.sf-search-cluster__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 2.75rem;
    min-height: 2.625rem;
    padding: 0 0.7rem;
    margin: 0;
    border: none;
    border-inline-start: 1px solid var(--border);
    background: var(--sf-btn-primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    flex-shrink: 0;
    align-self: stretch;
    /* Inline-end outer corners (top-right + bottom-right in LTR). Previously used
       border-end-* which rounds the bottom row only and breaks alignment with the pill. */
    border-start-end-radius: calc(var(--sf-radius-search) - 1px);
    border-end-end-radius: calc(var(--sf-radius-search) - 1px);
    transition: background-color 0.15s ease;
}

/* RTL: submit sits on physical left; outer pill corners are inline-end (not inline-start). */
[dir="rtl"] .sf-search-cluster__submit {
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-start-end-radius: calc(var(--sf-radius-search) - 1px);
    border-end-end-radius: calc(var(--sf-radius-search) - 1px);
}

.sf-search-cluster__submit:hover {
    background: var(--sf-btn-primary-hover);
}

.sf-search-cluster__submit:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    z-index: 1;
}

.sf-search-cluster__submit .sf-icon {
    width: 1.125rem;
    height: 1.125rem;
}

.sf-search-wrap {
    position: relative;
}

.sf-search-wrap__input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    font: inherit;
}

.sf-search-wrap__results {
    position: absolute;
    inset-inline-start: 0;
    inset-inline-end: 0;
    top: 100%;
    margin: 0.25rem 0 0;
    padding: 0.25rem 0;
    list-style: none;
    background: var(--sf-surface);
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-panel);
    box-shadow: var(--sf-shadow-panel);
    max-height: min(320px, 50vh);
    overflow-x: hidden;
    overflow-y: auto;
    z-index: var(--sf-z-search);
    scrollbar-gutter: stable;
}

.sf-search-wrap__option {
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.sf-search-wrap__option:last-child {
    border-bottom: none;
}

.sf-search-wrap__hit {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.45rem 0.65rem;
    text-decoration: none;
    color: inherit;
}

.sf-search-wrap__hit:hover {
    background: var(--sf-surface-muted);
}

.sf-search-wrap__hit:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: var(--sf-accent-soft);
}

.sf-search-wrap__option--active .sf-search-wrap__hit {
    background: var(--sf-accent-soft);
}

.sf-search-wrap__thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--sf-radius-sm);
    flex-shrink: 0;
    background: var(--sf-surface-thumb);
}

.sf-search-wrap__meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}

.sf-search-wrap__title {
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sf-search-wrap__price {
    font-size: 0.8rem;
    color: var(--muted);
}

.sf-search-wrap__status {
    padding: 0.65rem 0.85rem;
    font-size: 0.875rem;
    color: var(--muted);
    list-style: none;
    margin: 0;
}

.sf-search-wrap__status--loading {
    font-style: italic;
}

.sf-search-wrap__status--error {
    color: var(--sf-error);
}

.sf-search-wrap__status--empty {
    color: var(--muted);
    text-align: center;
    font-style: normal;
}

.sf-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

/* M4 — text links (login / signup): ghost pill, same hit height as toolbar */
.sf-header__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--sf-toolbar-hit);
    padding: 0 0.7rem;
    box-sizing: border-box;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    background: var(--sf-surface);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sf-header__link:hover {
    background: var(--sf-accent-soft);
    color: var(--sf-brand-hover);
    text-decoration: none;
}

.sf-header__link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Store / cart: icon + label, bordered ghost (matches icon buttons) */
.sf-header__link--with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: var(--sf-toolbar-hit);
    padding: 0 0.65rem;
    box-sizing: border-box;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--fg);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    background: var(--sf-surface);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sf-header__link--with-icon:hover {
    background: var(--sf-accent-soft);
    text-decoration: none;
    color: var(--fg);
}

.sf-header__link--with-icon:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-header__link--with-icon .sf-icon {
    width: 1.1rem;
    height: 1.1rem;
    opacity: 0.95;
    flex-shrink: 0;
}

/* Start Selling + locale: outlined secondary CTA / chip */
.sf-header__pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--sf-toolbar-hit);
    padding: 0 0.7rem;
    box-sizing: border-box;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    background: var(--sf-surface);
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sf-header__pill:hover {
    background: var(--sf-accent-soft);
    color: var(--sf-brand-hover);
    text-decoration: none;
}

.sf-header__pill:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-badge {
    font-size: 0.75rem;
    color: var(--muted);
}

.sf-badge--accent {
    color: var(--accent);
    font-weight: 600;
}

.sf-noti-badge {
    min-width: 1.15rem;
    padding: 0.1em 0.35em;
    text-align: center;
    border-radius: 999px;
    background: var(--sf-accent-soft);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.sf-dropdown {
    position: relative;
}

.sf-dropdown__summary {
    cursor: pointer;
    list-style: none;
    font-size: 0.875rem;
    padding: 0.25rem 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.sf-dropdown__summary::-webkit-details-marker {
    display: none;
}

.sf-dropdown__panel {
    position: absolute;
    inset-inline-end: 0;
    top: 100%;
    margin-top: 0.35rem;
    min-width: 220px;
    background: var(--sf-surface);
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-panel);
    padding: 0.5rem;
    box-shadow: var(--sf-shadow-panel);
    z-index: var(--sf-z-dropdown);
}

.sf-dropdown--noti .sf-dropdown__panel {
    min-width: min(320px, 92vw);
    padding: 0;
    max-height: min(360px, 55vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sf-dropdown__summary--noti {
    flex-wrap: nowrap;
}

.sf-dropdown__summary--account {
    list-style: none;
    min-height: var(--sf-toolbar-hit);
    padding: 0 0.65rem;
    gap: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    background: var(--sf-surface);
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--fg);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sf-dropdown__summary--account::-webkit-details-marker {
    display: none;
}

.sf-dropdown__summary--account:hover {
    background: var(--sf-accent-soft);
}

.sf-dropdown__summary--account:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-header__locale-chip {
    flex-shrink: 0;
    white-space: nowrap;
}

.sf-header__locale-chip-inner {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    font-size: 0.8rem;
}

.sf-header__bm-btn {
    position: relative;
    text-decoration: none;
    color: var(--fg);
}

.sf-header__bm-btn .sf-icon {
    width: 1.35rem;
    height: 1.35rem;
}

.sf-header__bm-badge {
    position: absolute;
    top: 0.2rem;
    inset-inline-end: 0.2rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
    border-radius: 999px;
    background: var(--sf-accent-soft);
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.sf-header__noti-trigger {
    position: relative;
    min-width: var(--sf-toolbar-hit);
    min-height: var(--sf-toolbar-hit);
    justify-content: center;
    padding-inline: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    background: var(--sf-surface);
    color: var(--fg);
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sf-header__noti-trigger:hover {
    background: var(--sf-accent-soft);
}

.sf-header__noti-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-header__noti-trigger .sf-icon {
    width: 1.35rem;
    height: 1.35rem;
}

.sf-header__noti-trigger .sf-noti-badge {
    position: absolute;
    top: 0.12rem;
    inset-inline-end: 0.12rem;
}

.sf-dropdown__summary--account .sf-icon--chevron {
    margin-inline-start: 0.1rem;
    opacity: 0.8;
}

.sf-account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--sf-accent-soft);
    color: var(--accent);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.sf-dropdown__panel--account .sf-dropdown__nav {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sf-noti-badge:empty {
    display: none;
}

.sf-noti-panel__status {
    padding: 0.55rem 0.85rem;
    font-size: 0.8rem;
    color: var(--muted);
    font-style: italic;
    border-bottom: 1px solid var(--border);
    background: var(--sf-surface-subtle);
    flex-shrink: 0;
}

.sf-noti-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.sf-noti-panel__item {
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.sf-noti-panel__item:last-child {
    border-bottom: none;
}

.sf-noti-panel__item--unread {
    background: var(--sf-accent-soft);
    border-inline-start: 3px solid var(--accent);
}

.sf-noti-panel__link {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: inherit;
    font-size: 0.85rem;
}

.sf-noti-panel__link:hover {
    background: var(--sf-surface-muted);
}

.sf-noti-panel__link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: var(--sf-surface-muted);
}

.sf-noti-panel__item--unread .sf-noti-panel__msg {
    font-weight: 600;
}

.sf-noti-panel__msg {
    line-height: 1.35;
    word-break: break-word;
}

.sf-noti-panel__when {
    font-size: 0.75rem;
    color: var(--muted);
}

.sf-noti-panel__empty {
    padding: 1rem 0.85rem;
    font-size: 0.85rem;
    color: var(--muted);
    list-style: none;
    margin: 0;
    text-align: center;
    line-height: 1.45;
}

.sf-noti-panel__empty--error {
    color: var(--sf-error);
    font-weight: 500;
}

.sf-noti-panel__foot {
    border-top: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 0.85rem;
    background: var(--sf-surface-subtle);
    flex-shrink: 0;
}

.sf-noti-panel__foot a {
    font-weight: 500;
}

.sf-dropdown__panel a {
    display: block;
    padding: 0.35rem 0.5rem;
    color: var(--accent);
    text-decoration: none;
}

.sf-dropdown__panel a:hover {
    text-decoration: underline;
}

.sf-dropdown__meta {
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
}

.sf-dropdown__form {
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border);
    margin-top: 0.35rem;
    padding-top: 0.35rem;
}

.sf-dropdown__logout {
    width: 100%;
    text-align: start;
    border: none;
    background: transparent;
    color: var(--sf-error);
    cursor: pointer;
    font: inherit;
    font-size: 0.875rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--sf-radius-sm);
}

.sf-dropdown__logout:hover {
    text-decoration: underline;
    color: var(--sf-error);
}

/* M5 — category row (subordinate band; flyouts match account/noti panels).
   No horizontal scroll: overflow-x:auto clipped .sf-cat__flyout; .sf-cat wraps instead. */
.sf-header__cats {
    border-top: 1px solid var(--border);
    background: var(--sf-header-cats-bg);
    padding-block: 0.4rem 0.5rem;
    overflow: visible;
}

.sf-cat {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.35rem;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: min-content;
}

.sf-cat__item {
    position: relative;
    flex: 0 0 auto;
}

.sf-cat__parent {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--sf-body-text);
    text-decoration: none;
    border-radius: var(--sf-radius-input);
    border: 1px solid transparent;
    box-sizing: border-box;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sf-cat__parent:hover {
    background: var(--sf-accent-soft);
    color: var(--fg);
    text-decoration: none;
}

.sf-cat__parent:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-cat__item:hover .sf-cat__parent,
.sf-cat__item:focus-within .sf-cat__parent {
    background: var(--sf-accent-soft);
    color: var(--fg);
}

.sf-cat__flyout {
    display: none;
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + 0.35rem);
    min-width: 220px;
    max-width: min(320px, 85vw);
    max-height: min(60vh, 380px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--sf-surface);
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-panel);
    padding: 0.35rem 0;
    margin: 0;
    list-style: none;
    box-shadow: var(--sf-shadow-panel);
    z-index: var(--sf-z-dropdown);
}

/* Bridge the gap between parent link and flyout (top: calc(100% + 0.35rem)).
   That gap is not inside the li's in-flow box, so :hover was lost before the panel opened.
   ::after stays on the item (always), not on the flyout (display:none until hover). */
.sf-cat__item:has(.sf-cat__flyout)::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    width: 100%;
    top: 100%;
    height: 0.55rem;
}

.sf-cat__flyout li {
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.sf-cat__flyout li:last-child {
    border-bottom: none;
}

.sf-cat__flyout a {
    display: block;
    padding: 0.45rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--fg);
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.sf-cat__flyout a:hover {
    background: var(--sf-surface-muted);
    color: var(--accent);
    text-decoration: none;
}

.sf-cat__flyout a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: var(--sf-surface-muted);
}

.sf-cat__item:hover .sf-cat__flyout,
.sf-cat__item:focus-within .sf-cat__flyout {
    display: block;
}

.sf-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: var(--sf-backdrop);
    z-index: var(--sf-z-backdrop);
}

/* Ensure native [hidden] wins over .sf-drawer { display: flex } in all engines */
.sf-drawer-backdrop[hidden],
.sf-drawer[hidden] {
    display: none !important;
}

.sf-drawer {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(92vw, 320px);
    max-height: 100dvh;
    background: var(--sf-surface);
    z-index: var(--sf-z-drawer);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--sf-shadow-drawer);
    border-inline-end: 1px solid var(--border);
}

[dir="rtl"] .sf-drawer {
    inset-inline-start: auto;
    inset-inline-end: 0;
    box-shadow: var(--sf-shadow-drawer-rtl);
}

.sf-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--sf-surface-subtle);
}

.sf-drawer__title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--fg);
}

.sf-drawer__head .sf-dialog__x {
    min-width: 2.75rem;
    min-height: 2.75rem;
}

.sf-drawer__body {
    padding: 0.85rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sf-drawer__section {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sf-drawer__section + .sf-drawer__divider {
    margin-top: 0.65rem;
}

.sf-drawer__divider + .sf-drawer__section {
    margin-top: 0.65rem;
}

.sf-drawer__divider {
    flex-shrink: 0;
    height: 1px;
    margin: 0;
    border: none;
    background: var(--border);
}

.sf-drawer__section-title {
    font-weight: 600;
    margin: 0 0 0.45rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.sf-drawer__search {
    display: block;
}

.sf-drawer__search .sf-search-cluster {
    width: 100%;
}

.sf-drawer__search .sf-search-cluster .sf-search-wrap__input {
    min-height: 2.75rem;
    font-size: 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.sf-drawer__search .sf-search-cluster__submit {
    min-height: 2.75rem;
}

.sf-drawer__sell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    text-align: center;
    padding: 0.5rem 0.75rem;
    background: var(--sf-btn-primary);
    color: #fff !important;
    border-radius: var(--sf-radius-input);
    text-decoration: none;
    font-weight: 600;
}

.sf-drawer__sell:hover {
    background: var(--sf-btn-primary-hover);
    color: #fff !important;
    text-decoration: none;
}

.sf-drawer__row {
    display: flex;
    align-items: center;
    min-height: var(--sf-toolbar-hit);
    padding: 0.35rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--fg);
    background: none;
    border-top: none;
    border-inline: none;
    width: 100%;
    text-align: start;
    font: inherit;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.12s ease;
}

.sf-drawer__row:hover {
    background: var(--sf-surface-muted);
}

.sf-drawer__row:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-drawer__meta {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 0.35rem 0 0.15rem;
}

.sf-drawer-cats {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
}

.sf-drawer-cats__item {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.sf-drawer-cats__item:last-child {
    border-bottom: none;
}

.sf-drawer-cats__single {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.4rem 0.15rem;
    color: var(--fg);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
    border-radius: var(--sf-radius-input);
}

.sf-drawer-cats__single:hover {
    background: var(--sf-surface-muted);
    color: var(--accent);
    text-decoration: none;
}

.sf-drawer-cats__single:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Drawer categories: expandable rows (menu) + chevron */
.sf-drawer-cat {
    margin: 0;
    border: none;
    padding: 0;
}

.sf-drawer-cat__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.4rem 0.15rem;
    list-style: none;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
    color: var(--fg);
    transition: background-color 0.12s ease;
    border-radius: var(--sf-radius-input);
}

.sf-drawer-cat__summary::-webkit-details-marker {
    display: none;
}

.sf-drawer-cat__summary::marker {
    content: none;
}

.sf-drawer-cat__summary:hover {
    background: var(--sf-surface-muted);
}

.sf-drawer-cat__summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-drawer-cat__name {
    flex: 1;
    min-width: 0;
    text-align: start;
}

.sf-drawer-cat__chev {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--muted);
    transition: transform 0.2s ease;
}

.sf-drawer-cat__chev .sf-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.sf-drawer-cat[open] > .sf-drawer-cat__summary .sf-drawer-cat__chev {
    transform: rotate(180deg);
    color: var(--accent);
}

.sf-drawer-cat__panel {
    padding: 0 0 0.5rem;
}

.sf-drawer-cat__list {
    list-style: none;
    margin: 0;
    padding: 0.15rem 0 0;
    padding-inline-start: 0.65rem;
    border-inline-start: 2px solid var(--sf-accent-soft);
}

.sf-drawer-cat__list > li {
    margin: 0.1rem 0;
}

.sf-drawer-cat__link {
    display: flex;
    align-items: center;
    min-height: 2.35rem;
    padding: 0.3rem 0.45rem;
    margin: 0 -0.2rem;
    border-radius: var(--sf-radius-sm);
    color: var(--sf-body-text);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.sf-drawer-cat__link:hover {
    background: var(--sf-surface-muted);
    color: var(--accent);
    text-decoration: none;
}

.sf-drawer-cat__link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-drawer-cat__link--all {
    color: var(--accent);
    font-weight: 600;
}

.sf-drawer__logout {
    width: 100%;
    align-self: stretch;
}

.sf-drawer__logout button {
    width: 100%;
    margin-top: 0.5rem;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    background: var(--sf-surface);
    cursor: pointer;
    font: inherit;
    display: flex;
    align-items: center;
    justify-content: start;
    text-align: start;
    color: var(--sf-error);
}

.sf-drawer__logout button:hover {
    text-decoration: underline;
    color: var(--sf-error);
}

.sf-drawer__locale-chip-btn {
    justify-content: start;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sf-drawer__locale-chip-text {
    font-size: 0.95rem;
}

.sf-drawer__row--icon-hit .sf-drawer__bm-badge {
    margin-inline-start: auto;
    min-width: 1.35rem;
    padding: 0.15rem 0.45rem;
    text-align: center;
    border-radius: 999px;
    background: var(--sf-accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sf-search-dialog {
    max-width: min(480px, 94vw);
    max-height: min(90dvh, 100%);
    margin: auto;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-dialog);
    padding: 0;
    background: var(--sf-surface);
    box-shadow: var(--sf-shadow-dialog);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sf-search-dialog::backdrop {
    background: var(--sf-backdrop-strong);
}

.sf-search-dialog__form {
    padding: 0 1rem 1rem;
    overflow: visible;
}

.sf-search-dialog__form .sf-search-cluster {
    width: 100%;
    align-items: flex-start;
}

/*
 * Modal search: absolute dropdown is clipped by <dialog> overflow. Keep suggestions in normal
 * flow under the field so the dialog grows and scrolls as one panel (mobile + desktop).
 */
.sf-search-dialog .sf-search-wrap__results {
    position: static;
    margin-top: 0.5rem;
    margin-inline: 0;
    width: 100%;
    max-height: min(50vh, 320px);
    box-sizing: border-box;
}

.sf-search-dialog__form .sf-search-cluster .sf-search-wrap__input {
    min-height: 2.75rem;
    font-size: 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.sf-search-dialog__form .sf-search-cluster__submit {
    min-height: 2.75rem;
}

.sf-search-dialog__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--sf-surface-subtle);
}

.sf-search-dialog__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--fg);
}

@media (max-width: 768px) {
    .sf-only-desktop {
        display: none !important;
    }

    /*
     * Mobile pass: mirror legacy dark header gradient with the same token family
     * used on desktop. Keep scope limited to header chrome for predictable behavior.
     */
    .sf-header {
        background: var(--sf-header-legacy-gradient);
        box-shadow:
            0 1px 0 var(--sf-header-shadow-line),
            0 6px 18px var(--sf-header-shadow-drop);
    }

    .sf-header__logo {
        color: var(--sf-header-company-name);
    }

    .sf-header .sf-header__logo:hover {
        color: var(--sf-header-logo-hover);
        text-decoration: none;
    }

    .sf-header__link--with-icon {
        color: var(--sf-header-chrome-fg);
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
    }

    .sf-header__link--with-icon:hover {
        background: var(--sf-header-chrome-hover);
        color: var(--sf-header-chrome-fg);
        border-color: var(--sf-header-hover-border);
    }

    .sf-header__noti-trigger {
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
        color: var(--sf-header-chrome-fg);
    }

    .sf-header__noti-trigger:hover {
        background: var(--sf-header-chrome-hover);
    }

    .sf-header .sf-noti-badge {
        background: var(--sf-header-noti-badge-bg);
        color: var(--sf-header-noti-badge-text);
    }

    /*
     * Mobile header: bell trigger stays shrink-wrapped. Panel position uses position:fixed +
     * getBoundingClientRect() in storefront-header.js (absolute under <details> is unreliable
     * in the wrapped toolbar). Inline top/left/width override the desktop dropdown rules.
     */
    .sf-header__actions > .sf-dropdown.sf-dropdown--noti.sf-only-mobile {
        flex: 0 0 auto;
        width: fit-content;
        max-width: 100%;
    }

    .sf-header__actions > .sf-dropdown.sf-dropdown--noti.sf-only-mobile .sf-dropdown__panel {
        box-sizing: border-box;
    }

    /*
     * JS sets position:fixed + physical `left`. Base .sf-dropdown__panel uses inset-inline-end:0;
     * in RTL that pins to the physical left and fights `left`, clipping the panel off-screen.
     */
    .sf-header__actions > .sf-dropdown.sf-dropdown--noti.sf-only-mobile .sf-dropdown__panel.sf-noti-panel--mobile-fixed {
        inset-inline-start: auto !important;
        inset-inline-end: auto !important;
        min-width: 0 !important;
        max-width: calc(100vw - 1rem) !important;
        box-sizing: border-box !important;
    }
}

@media (min-width: 769px) {
    .sf-only-mobile {
        display: none !important;
    }

    /* Mobile drawer must not appear beside the desktop header (e.g. after resize) */
    .sf-drawer-backdrop,
    .sf-drawer {
        display: none !important;
        pointer-events: none !important;
    }

    /*
     * Desktop: legacy CardPlusPlay header / subheader gradient (#1e2a3a → #131921).
     */
    .sf-header {
        background: var(--sf-header-legacy-gradient);
        box-shadow:
            0 1px 0 var(--sf-header-shadow-line),
            0 8px 24px var(--sf-header-shadow-drop);
    }

    .sf-header__cats {
        background: var(--sf-header-legacy-gradient);
        border-top: 1px solid var(--sf-subheader-border);
    }

    .sf-header__logo {
        color: var(--sf-header-company-name);
    }

    .sf-header .sf-header__logo:hover {
        color: var(--sf-header-logo-hover);
        text-decoration: none;
    }

    /* White search field on dark bar (desktop) */
    .sf-header .sf-search-cluster {
        background: var(--sf-header-search-bg);
        border-color: var(--sf-header-search-border);
        box-shadow: inset 0 1px 1px var(--sf-header-search-inset-shadow);
    }

    .sf-header .sf-search-cluster:focus-within {
        border-color: var(--sf-header-search-focus-border);
        box-shadow:
            inset 0 1px 1px var(--sf-header-search-focus-inset-shadow),
            0 0 0 3px var(--sf-header-search-focus-ring);
    }

    .sf-header .sf-search-cluster .sf-search-wrap__input {
        color: var(--sf-header-search-text);
    }

    .sf-header .sf-search-cluster .sf-search-wrap__input::placeholder {
        color: var(--sf-header-search-placeholder);
    }

    .sf-header .sf-search-cluster__submit {
        border-inline-start-color: var(--sf-header-search-submit-divider);
        background: var(--sf-header-search-submit-bg);
        color: var(--sf-header-search-submit-icon);
    }

    .sf-header .sf-search-cluster__submit:hover {
        background: var(--sf-header-search-submit-hover-bg);
        color: var(--sf-header-search-submit-hover-icon);
    }

    .sf-header__link {
        color: var(--sf-header-chrome-link);
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
    }

    .sf-header__link:hover {
        background: var(--sf-header-chrome-hover);
        color: var(--sf-header-chrome-link-hover);
        border-color: var(--sf-header-hover-border);
    }

    .sf-header__link--with-icon {
        color: var(--sf-header-chrome-fg);
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
    }

    .sf-header__link--with-icon:hover {
        background: var(--sf-header-chrome-hover);
        color: var(--sf-header-chrome-fg);
        border-color: var(--sf-header-hover-border);
    }

    .sf-header__pill {
        color: var(--sf-header-chrome-link);
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
    }

    .sf-header__pill:hover {
        background: var(--sf-header-chrome-hover);
        color: var(--sf-header-chrome-link-hover);
        border-color: var(--sf-header-hover-border);
    }

    .sf-header__bm-badge {
        background: var(--sf-header-bm-badge-bg);
        color: var(--sf-header-bm-badge-text);
        border: 1px solid var(--sf-header-bm-badge-border);
    }

    .sf-header .sf-dropdown__summary--account {
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
        color: var(--sf-header-chrome-fg);
    }

    .sf-header .sf-dropdown__summary--account:hover {
        background: var(--sf-header-chrome-hover);
    }

    .sf-header .sf-account-avatar {
        background: var(--sf-header-avatar-bg);
        color: var(--sf-header-avatar-text);
    }

    .sf-header__noti-trigger {
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
        color: var(--sf-header-chrome-fg);
    }

    .sf-header__noti-trigger:hover {
        background: var(--sf-header-chrome-hover);
    }

    .sf-header .sf-badge {
        color: var(--sf-header-chrome-muted);
    }

    .sf-header .sf-badge--accent {
        color: var(--sf-header-badge-accent-text);
    }

    .sf-header .sf-noti-badge {
        background: var(--sf-header-noti-badge-bg);
        color: var(--sf-header-noti-badge-text);
    }

    .sf-header .sf-cat__parent {
        color: var(--sf-subheader-text);
    }

    .sf-header .sf-cat__parent:hover {
        background: var(--sf-header-chrome-hover);
        color: var(--sf-subheader-text-hover);
    }

    .sf-header .sf-cat__item:hover .sf-cat__parent,
    .sf-header .sf-cat__item:focus-within .sf-cat__parent {
        background: var(--sf-header-chrome-hover);
        color: var(--sf-subheader-text-hover);
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* H3: inline SVG icons */
.sf-icon {
    display: block;
    flex-shrink: 0;
}

.sf-header__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--sf-toolbar-hit);
    min-height: var(--sf-toolbar-hit);
    width: var(--sf-toolbar-hit);
    height: var(--sf-toolbar-hit);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--sf-radius-input);
    background: var(--sf-surface);
    cursor: pointer;
    color: var(--fg);
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sf-header__icon-btn:hover {
    background: var(--sf-accent-soft);
}

.sf-header__icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sf-header__icon-btn .sf-icon {
    width: 1.35rem;
    height: 1.35rem;
}

/*
 * Dark header: `.sf-header__icon-btn` base rules above use a light surface and load *after*
 * the responsive header blocks, so they override bookmark / menu / mobile search triggers.
 * Re-apply dark chrome with higher specificity (`.sf-header .sf-header__icon-btn`).
 */
@media (max-width: 768px) {
    .sf-header .sf-header__icon-btn {
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
        color: var(--sf-header-chrome-fg);
    }

    .sf-header .sf-header__icon-btn:hover {
        background: var(--sf-header-chrome-hover);
    }

    /*
     * Mobile parity: apply header search theming to mobile search surfaces
     * (sheet + drawer) so header_search_* controls reflect on mobile too.
     */
    .sf-search-dialog .sf-search-cluster,
    .sf-drawer__search .sf-search-cluster {
        background: var(--sf-header-search-bg);
        border-color: var(--sf-header-search-border);
        box-shadow: inset 0 1px 1px var(--sf-header-search-inset-shadow);
    }

    .sf-search-dialog .sf-search-cluster:focus-within,
    .sf-drawer__search .sf-search-cluster:focus-within {
        border-color: var(--sf-header-search-focus-border);
        box-shadow:
            inset 0 1px 1px var(--sf-header-search-focus-inset-shadow),
            0 0 0 3px var(--sf-header-search-focus-ring);
    }

    .sf-search-dialog .sf-search-cluster .sf-search-wrap__input,
    .sf-drawer__search .sf-search-cluster .sf-search-wrap__input {
        color: var(--sf-header-search-text);
    }

    .sf-search-dialog .sf-search-cluster .sf-search-wrap__input::placeholder,
    .sf-drawer__search .sf-search-cluster .sf-search-wrap__input::placeholder {
        color: var(--sf-header-search-placeholder);
    }

    .sf-search-dialog .sf-search-cluster__submit,
    .sf-drawer__search .sf-search-cluster__submit {
        border-inline-start-color: var(--sf-header-search-submit-divider);
        background: var(--sf-header-search-submit-bg);
        color: var(--sf-header-search-submit-icon);
    }

    .sf-search-dialog .sf-search-cluster__submit:hover,
    .sf-drawer__search .sf-search-cluster__submit:hover {
        background: var(--sf-header-search-submit-hover-bg);
        color: var(--sf-header-search-submit-hover-icon);
    }
}

@media (min-width: 769px) {
    .sf-header .sf-header__icon-btn {
        border-color: var(--sf-header-chrome-border);
        background: var(--sf-header-chrome-surface);
        color: var(--sf-header-chrome-fg);
    }

    .sf-header .sf-header__icon-btn:hover {
        background: var(--sf-header-chrome-hover);
    }
}

.sf-drawer__row--with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sf-drawer__row-icon {
    display: flex;
    flex-shrink: 0;
    color: var(--muted);
}

.sf-drawer__row-icon .sf-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.sf-btn {
    display: inline-block;
    padding: 0.45rem 0.85rem;
    border-radius: var(--sf-radius-input);
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--sf-surface);
}

.sf-btn--primary {
    background: var(--sf-btn-primary);
    color: #fff;
    border-color: var(--sf-btn-primary);
}

.sf-btn--primary:hover {
    background: var(--sf-btn-primary-hover);
    border-color: var(--sf-btn-primary-hover);
}

.sf-btn--with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.sf-btn--with-icon .sf-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.sf-btn--ghost {
    background: var(--sf-surface);
    color: var(--fg);
}

/* Phase 5 — analytics consent bar (fixed; respects RTL via logical properties) */
.sf-privacy-consent {
    position: fixed;
    z-index: 95;
    inset-inline: 0;
    bottom: 0;
    padding: 0.75rem var(--sf-page-pad);
    background: var(--sf-surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
}

.sf-privacy-consent__inner {
    max-width: var(--sf-page-max);
    margin-inline: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.sf-privacy-consent__title {
    margin: 0;
    width: 100%;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sf-heading-text);
}

.sf-privacy-consent__text {
    margin: 0;
    flex: 1 1 220px;
    font-size: 0.875rem;
    color: var(--sf-body-text);
    line-height: 1.45;
}

.sf-privacy-consent__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}

@media (max-width: 520px) {
    .sf-privacy-consent__actions {
        width: 100%;
    }

    .sf-privacy-consent__actions .sf-btn {
        flex: 1 1 auto;
    }
}

/* Phase 6 — shared empty states (cart, checkout, shop/seller grids) */
.sf-empty-state {
    text-align: center;
}

.sf-empty-state__title {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sf-heading-text);
}

.sf-empty-state__body {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    color: var(--sf-body-text);
    line-height: 1.45;
}

.sf-empty-state__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.sf-empty-state--grid-span {
    grid-column: 1 / -1;
    width: 100%;
    padding: 1.5rem 0.5rem;
}

.sf-empty-state--seller {
    margin-top: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: var(--sf-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.sf-checkout-empty-wrap {
    max-width: 32rem;
    margin: 1rem auto 2rem;
    padding: 1.75rem 1.25rem;
    background: var(--sf-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--sf-shadow-panel);
}
