.shell-footer-tools {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    overflow: visible;
    color: var(--theme-text, #253832);
}

html body :is(.shop-header,.shop-footer) {
    --theme-text: var(--shop-text);
    --theme-border: var(--shop-line);
    --theme-raised: var(--shop-surface);
    --theme-surface: var(--shop-surface);
    --theme-soft: var(--shop-panel);
    --theme-link: var(--shop-accent);
    --theme-primary: var(--shop-accent);
    --theme-on-primary: var(--shop-bg);
}

html body .shop-footer > .shell-footer-tools {
    grid-column: 1 / -1;
    justify-self: end;
}

html body header.pitvu-header .account .shell-icon-control,
html body .shell-icon-control,
html body .shell-footer-tools .theme-toggle {
    box-sizing: border-box;
    display: inline-flex !important;
    position: relative;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0;
    padding: 0 !important;
    line-height: 1;
    list-style: none;
    text-decoration: none !important;
    background: transparent;
    color: inherit;
    border: 1px solid transparent;
    border-radius: 8px;
    box-shadow: none;
    cursor: pointer;
}

html body .shell-footer-tools .theme-toggle[hidden] { display: none !important; }
.pitvu-header .account > details.account-menu:has(> .shell-icon-control) {
    display: block;
    box-sizing: border-box;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    flex: 0 0 44px;
}
html body .pitvu-header .account > details.account-menu:not([open]):has(> .shell-icon-control) > .account-panel {
    display: none !important;
}
.shell-icon-control::-webkit-details-marker { display: none; }
html body :is(.shell-icon-control,.shell-footer-tools .theme-toggle):hover,
html body details[open] > .shell-icon-control {
    background: var(--theme-soft, #eae4d7);
    color: var(--theme-text, #252c2d);
}
html body :is(.shell-icon-control,.shell-footer-tools .theme-toggle,.shell-footer-link):focus-visible {
    outline: 2px solid var(--theme-link, #245f57) !important;
    outline-offset: 2px;
}

html body header.pitvu-header .account .shell-icon-control > svg.shell-icon,
html body .shell-icon-control > svg.shell-icon {
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    flex: 0 0 24px;
    fill: none !important;
    stroke: currentColor !important;
    color: inherit;
}
html body .shell-footer-tools .theme-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
}
html body .shell-footer-tools .theme-toggle .theme-sun,
html[data-pitvu-theme="dark"] body .shell-footer-tools .theme-toggle .theme-moon {
    display: none;
}
html body .shell-footer-tools .theme-toggle .theme-moon,
html[data-pitvu-theme="dark"] body .shell-footer-tools .theme-toggle .theme-sun {
    display: block;
}

html body .shell-icon-control .shell-visually-hidden {
    display: block !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    white-space: nowrap;
    border: 0 !important;
}

html body .shell-icon-control :is(.cart-badge,.shell-cart-badge)[hidden] {
    display: none !important;
}
html:root body .shell-icon-control :is(.cart-badge,.shell-cart-badge):not([hidden]) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0 0 auto auto;
    min-width: 17px;
    height: 17px;
    padding: 0 3px;
    border: 1px solid var(--theme-surface, #fbf9f3);
    border-radius: 999px;
    background: var(--theme-primary, #204f49);
    color: var(--theme-on-primary, #fffdf5);
    font: 700 10px/1 system-ui,sans-serif;
    font-variant-numeric: tabular-nums;
}

.shell-footer-locale { display: inline-block; position: relative; margin: 0; }
html body .shell-footer-locale:not([open]) > .shell-locale-panel { display: none !important; }
html body .shell-footer-locale[open] > .shell-locale-panel {
    box-sizing: border-box;
    display: grid !important;
    position: absolute;
    z-index: 205;
    inset: auto 0 calc(100% + 6px) auto;
    width: max-content;
    min-width: min(13.5rem, calc(100vw - 22px));
    max-width: min(18rem, calc(100vw - 22px));
    max-height: min(22rem, calc(100vh - 100px));
    max-height: min(22rem, calc(100dvh - 100px));
    overflow-y: auto;
    overscroll-behavior: contain;
    grid-auto-flow: row;
    gap: 1px !important;
    padding: 5px;
    margin: 0;
    text-align: start;
    border: 1px solid var(--theme-border, #d6d0c3);
    border-radius: 10px;
    color: var(--theme-text, #252c2d);
    background: var(--theme-raised, #fffdf8);
    box-shadow: 0 7px 24px #142a211f;
}
html body .shell-footer-locale .shell-locale-panel > :is(a,button) {
    display: flex;
    box-sizing: border-box;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: .5rem .8rem;
    text-align: start;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 5px;
    box-shadow: none;
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 550;
    line-height: 1.3;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none !important;
    white-space: normal;
    cursor: pointer;
}
html body .shell-footer-locale .shell-locale-panel > :is(a,button):is(:hover,:focus-visible,[aria-current="true"],[aria-current="page"]) {
    color: var(--theme-text, #252c2d);
    background: var(--theme-soft, #eae4d7);
}
html body .shell-footer-locale .shell-locale-panel > :focus-visible {
    outline: 2px solid var(--theme-link, #245f57);
    outline-offset: -2px;
}
html body .shell-footer-locale .shell-locale-panel > [aria-current]::after {
    content: "";
    display: block;
    margin-inline-start: auto;
    width: 5px;
    height: 9px;
    border: solid currentColor;
    border-width: 0 1.6px 1.6px 0;
    transform: translateY(-1px) rotate(45deg);
}

html body footer[data-footer-row] > nav > a.shell-footer-link,
html body footer a.shell-footer-link {
    display: inline-flex;
    box-sizing: border-box;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding: 10px 9px;
    font: 600 .75rem/1.35 Roboto, sans-serif;
    letter-spacing: .055em;
    transition: background-color .16s, border-color .16s, color .16s, box-shadow .16s;
    text-transform: uppercase;
    text-decoration: none !important;
    color: var(--theme-text, #252c2d);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    box-shadow: none;
}
html body footer a.shell-footer-link:any-link,
html body footer a.shell-footer-link:is(:hover,:focus,:active,:visited) {
    text-decoration: none !important;
}
html body footer[data-footer-row] > nav > .shell-footer-link:is(:hover,:focus-visible),
html body footer .shell-footer-link:is(:hover,:focus-visible) {
    color: var(--theme-text, #252c2d);
    background: var(--theme-soft, #eae4d7);
    border-color: var(--theme-border, #d6d0c3);
}
html body footer[data-footer-row] .footer-meta:has(.shell-footer-tools) { overflow: visible; }
@media (max-width: 680px) {
    html:root body footer.minimal-footer.pitvu-shell[data-footer-row] {
        grid-template-columns: minmax(0, 1fr) auto !important;
        grid-template-rows: auto auto !important;
        gap: 0 8px !important;
        padding-block: 4px max(4px, env(safe-area-inset-bottom, 0px)) !important;
    }
    html:root body footer[data-footer-row] > .footer-identity {
        grid-area: 2 / 1 !important;
        min-height: 1.1rem;
        font-size: .75rem;
        line-height: 1.3;
    }
    html:root body footer[data-footer-row] > nav {
        grid-area: 1 / 1 !important;
        justify-self: start;
        flex-wrap: wrap;
        gap: 0 2px !important;
    }
    html:root body footer[data-footer-row] > .footer-meta:has(.shell-footer-tools) {
        display: contents !important;
    }
    html:root body footer[data-footer-row] .footer-meta > .shell-footer-tools {
        grid-area: 1 / 2 !important;
        justify-self: end;
    }
    html:root body footer[data-footer-row] .footer-meta > small {
        grid-area: 2 / 2 !important;
        justify-self: end;
        font-size: .68rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    html body footer[data-footer-row] > nav > a.shell-footer-link {transition: none;}
}

/* Keep an empty editable control visible against both the panel and the page. */
:root {
    --pitvu-field-rest: #fffefa;
    --pitvu-field-text: #20332d;
    --pitvu-field-placeholder: #55665c;
    --pitvu-field-edge: #718176;
    --pitvu-field-accent: #156248;
    --pitvu-field-error: #a13238;
}
html[data-pitvu-theme="dark"] {
    --pitvu-field-rest: #202d2b;
    --pitvu-field-text: #f2f4ed;
    --pitvu-field-placeholder: #b9c8bd;
    --pitvu-field-edge: #879b8f;
    --pitvu-field-accent: #b2dfb9;
    --pitvu-field-error: #ffb4ae;
}

.pv-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, max(16rem, calc((100% - .8rem) / 2))), 1fr));
    gap: .8rem;
    margin-block: .6rem;
}
.pv-field-grid > :is(.pv-field-box, p) { margin: 0; }

@layer pitvu-field-surfaces {
    :where(input:not([type]), input[type=""], input:is([type=text], [type=search], [type=email], [type=password],
        [type=tel], [type=url], [type=number], [type=date], [type=datetime-local], [type=time], [type=month], [type=week]),
        textarea, select, [contenteditable=""], [contenteditable=true], [contenteditable=plaintext-only],
        #directory-search, #homepage-search) {
        box-sizing: border-box;
        border: 1px solid var(--pitvu-field-edge) !important;
        background-color: var(--pitvu-field-rest) !important;
        color: var(--pitvu-field-text) !important;
        caret-color: currentColor;
    }
    :where(input, textarea)::placeholder {
        color: var(--pitvu-field-placeholder) !important;
    }
    :where(input:not([type]), input[type=""], input:is([type=text], [type=search], [type=email], [type=password],
        [type=tel], [type=url], [type=number], [type=date], [type=datetime-local], [type=time], [type=month], [type=week]),
        textarea, select, [contenteditable=""], [contenteditable=true], [contenteditable=plaintext-only]):focus,
    :is(#directory-search, #homepage-search):focus-within {
        border-color: var(--pitvu-field-accent) !important;
        outline: 2px solid var(--pitvu-field-accent) !important;
        outline-offset: 2px !important;
    }
    :is(#directory-search, #homepage-search) input[type=search] {
        background-color: transparent !important;
        box-shadow: none !important;
        border: 0 !important;
        outline: 0 !important;
    }
    :where(input, textarea, select)[aria-invalid=true] {
        border-color: var(--pitvu-field-error) !important;
    }
    html body .pv-field-box:not([hidden]) {
        display: grid !important;
        align-content: start;
        min-width: 0;
        gap: 0 !important;
        padding: 0 !important;
        border: 1px solid var(--pitvu-field-edge) !important;
        border-radius: .55rem;
        background: var(--pitvu-field-rest) !important;
        color: var(--pitvu-field-text) !important;
        box-sizing: border-box;
    }
    html body .pv-field-box:focus-within {
        border-color: var(--pitvu-field-accent) !important;
        outline: 2px solid var(--pitvu-field-accent);
        outline-offset: 2px;
    }
    html body .pv-field-box > .pv-field-caption {
        display: block;
        color: var(--pitvu-field-placeholder) !important;
        padding: .55rem .78rem .16rem !important;
        margin: 0 !important;
        font-size: .8rem;
        font-weight: 650;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }
    html body .pv-field-box :is(input, textarea, select):not([type=hidden]),
    #main .account-entry .entry-form .pv-field-box :is(#entry-email, #entry-password),
    :root .auth-registration form.panel label.pv-field-box > input:is([name=name], [type=email], [type=password]) {
        width: 100%;
        min-width: 0;
        min-height: 2rem;
        box-sizing: border-box;
        margin: 0 !important;
        padding: .15rem .78rem .52rem;
        border: 0 !important;
        border-radius: 0 0 .5rem .5rem;
        outline: 0 !important;
        box-shadow: none !important;
        background-color: transparent !important;
        color: var(--pitvu-field-text) !important;
        font-size: max(1rem, 1em);
    }
    html body .pv-field-box select { padding-inline-end: 2rem; }
    html body .pv-field-box .entry-secret input { padding-inline-end: 3.2rem; }
    #main .account-entry .entry-form .pv-field-box :is(#entry-email, #entry-password):focus-visible { outline: 0 !important; }
    html body .pv-field-box textarea { min-height: 6rem; }
    html body .pv-field-box:has([aria-invalid=true]) { border-color: var(--pitvu-field-error) !important; }
    @media (forced-colors: active) {
        html body .pv-field-box:not([hidden]) { border-color: ButtonText !important; }
        html body .pv-field-box:focus-within { outline-color: Highlight; }
        :where(input, textarea, select, [contenteditable=true], [contenteditable=""], [contenteditable=plaintext-only]),
        :is(#directory-search, #homepage-search) {
            border-color: ButtonText !important;
        }
        :where(input, textarea, select, [contenteditable=true], [contenteditable=""], [contenteditable=plaintext-only]):focus,
        :is(#directory-search, #homepage-search):focus-within {
            outline-color: Highlight !important;
        }
    }
}

#directory-search.pitvu-live-anchor { overflow: visible; }
.directory-query-hint { display: none; }
@media (max-width: 680px) {
    .directory-toolbar #directory-search {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }
    #directory-search > :is(#q, .directory-query-hint) { grid-area: 1 / 1; }
    #directory-search > .directory-search-submit { grid-area: 1 / 2; }
    #directory-search .directory-query-hint {
        display: block;
        pointer-events: none;
        padding: 5px 8px 5px 12px;
        color: var(--theme-muted, #525f5c);
        font-size: .875rem;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }
    #directory-search #q::placeholder { opacity: 0 !important; }
    #directory-search #q:not(:placeholder-shown) ~ .directory-query-hint { visibility: hidden; }
    #directory-search #q { align-self: stretch; min-height: 44px; height: 100%; }
}
