/* A shared, quieter mobile surface for the storefront's native dialogs. */
@media (max-width:600px) {
  :is(#city-dialog,#category-dialog,#filter-dialog,#product-dialog,#cart-dialog,#checkout-dialog,#info-dialog) {
    position:fixed;
    inset:auto 0 0;
    width:100%;
    max-width:100%;
    max-height:92dvh;
    margin:0 auto;
    padding:20px 20px calc(20px + env(safe-area-inset-bottom));
    border:0;
    border-radius:20px 20px 0 0;
    background:#fffefd;
    box-shadow:0 -12px 48px #40312c14;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior:contain;
  }
  :is(#city-dialog,#category-dialog,#filter-dialog,#product-dialog,#cart-dialog,#checkout-dialog,#info-dialog)::backdrop {
    background:#30282238;
    backdrop-filter:blur(3px);
  }
  :is(#city-dialog,#category-dialog,#filter-dialog,#cart-dialog,#checkout-dialog,#info-dialog) .modal-heading {
    align-items:center;
    gap:12px;
    flex-shrink:0;
    margin:0 0 14px;
    padding:0;
  }
  :is(#city-dialog,#category-dialog,#filter-dialog,#cart-dialog,#checkout-dialog,#info-dialog) .modal-heading h2 {
    font-size:23px;
    line-height:1.4;
    letter-spacing:-.45px;
  }
  :is(#city-dialog,#category-dialog) .modal-heading .eyebrow {
    margin-bottom:5px;
    font-size:8px;
    letter-spacing:1px;
    color:#7d7167;
  }
  :is(#city-dialog,#category-dialog,#filter-dialog,#cart-dialog,#checkout-dialog,#info-dialog) .modal-heading .close {
    width:44px;
    height:44px;
    min-height:44px;
    margin:-4px -8px -4px 0;
    background:transparent;
    font-size:26px;
    color:#92867f;
  }
  :is(#city-dialog,#category-dialog) .modal-search {
    min-height:46px;
    height:46px;
    margin-bottom:12px;
    padding:0 12px;
    border:1px solid #eae5df;
    border-radius:10px;
    background:#faf8f5;
  }
  :is(#city-dialog,#category-dialog) .modal-search input {
    height:44px;
    min-height:44px;
    font-size:16px;
  }

  /* Pickers keep their title and search in view while the lists scroll. */
  #city-dialog[open],#category-dialog[open] {
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }
  #city-dialog {
    max-height:88dvh;
  }
  #city-dialog>.city-locate-button {
    justify-content:flex-start;
    flex-shrink:0;
    gap:9px;
    min-height:44px;
    margin:0 0 12px;
    padding:10px 12px;
    border:0;
    border-radius:10px;
    background:#f8f2ef;
    color:#a54f65;
    font-size:13px;
    line-height:1.5;
  }
  #city-dialog .city-location-status {
    flex-shrink:0;
    font-size:12px;
    line-height:1.65;
    margin:0 0 12px;
  }
  #city-dialog .city-location-result {
    flex-shrink:0;
    flex-direction:row;
    align-items:center;
    gap:12px;
    padding:12px;
    margin:0 0 12px;
    background:#f9f2ef;
    border-radius:10px;
  }
  #city-dialog .city-location-result small {
    font-size:10px;
    line-height:1.5;
    margin-bottom:4px;
  }
  #city-dialog .city-location-result strong {
    font-size:14px;
    overflow-wrap:anywhere;
  }
  #city-dialog .city-location-result .primary {
    min-height:44px;
    padding:9px 12px;
    font-size:12px;
  }
  #city-list {
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:2px 8px;
    max-height:44dvh;
    min-height:0;
    padding-right:2px;
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-width:thin;
  }
  #city-list button {
    min-height:44px;
    padding:10px 9px;
    border-radius:8px;
    text-align:left;
    font-size:13px;
    line-height:1.5;
    overflow-wrap:anywhere;
  }
  #city-list button.selected {
    background:#f7e9eb;
    color:#a94c64;
  }
  #category-dialog[open] {
    height:min(82dvh,720px);
  }
  #category-show-all {
    flex-shrink:0;
    min-height:44px;
    padding:10px 12px;
    border:0;
    border-radius:9px;
    background:#f9f4f1;
    font-size:13px;
    color:#a25568;
  }
  #category-dialog .category-menu-count {
    flex-shrink:0;
    margin:12px 0 4px;
    font-size:11px;
    line-height:1.6;
    color:#7d7167;
  }
  #category-menu {
    flex:1;
    min-height:0;
    margin-top:0;
    padding-right:3px;
    overflow-y:auto;
    overscroll-behavior:contain;
    scrollbar-width:thin;
  }
  #category-dialog .category-department {
    border-bottom-color:#eee8e2;
  }
  #category-dialog .category-department summary {
    min-height:50px;
    padding:11px 2px;
    gap:9px;
    font-size:14px;
    font-weight:500;
    line-height:1.5;
  }
  #category-dialog .category-department summary small {
    font-size:11px;
  }
  #category-dialog .category-children {
    grid-template-columns:1fr;
    gap:2px;
    padding:0 0 10px;
  }
  #category-dialog .category-children button {
    min-height:44px;
    padding:10px 12px;
    border-radius:8px;
    font-size:13px;
    line-height:1.6;
    font-weight:400;
  }
  #category-dialog .category-children .department-all {
    margin:0 0 4px;
    background:#faf7f3;
    font-size:12px;
  }

  /* The filter form scrolls independently from its apply action. */
  #filter-dialog[open] {
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }
  #filter-dialog-content {
    min-height:0;
    padding:0 3px 4px;
    overflow-y:auto;
    overscroll-behavior:contain;
  }
  #filter-dialog .filter-title {
    margin:-6px 0 4px;
  }
  #filter-dialog .filter-title button {
    min-height:44px;
    font-size:12px;
    color:#9c7e76;
  }
  #filter-dialog .category-picker {
    min-height:44px;
    padding:10px 12px;
    border-radius:9px;
    background:#f9f2ef;
    font-size:13px;
  }
  #filter-dialog .filters .field-label {
    margin:16px 0 6px;
    font-size:12px;
    font-weight:500;
    color:#71675f;
  }
  #filter-dialog select,#filter-dialog .price-fields label {
    height:46px;
    min-height:46px;
    border:1px solid #e8e2db;
    border-radius:9px;
    background-color:#fffefd;
  }
  #filter-dialog select,#filter-dialog .price-fields input {
    font-size:16px;
  }
  #filter-dialog .price-fields {
    gap:8px;
  }
  #filter-dialog .color-options {
    gap:5px;
    margin-left:-3px;
  }
  #filter-dialog .color-option {
    width:44px;
    height:44px;
  }
  #filter-dialog .color-option:before {
    width:24px;
    height:24px;
  }
  #filter-dialog .checkbox-label {
    font-size:13px;
    line-height:1.6;
  }
  #filter-dialog .filter-apply {
    position:static;
    flex-shrink:0;
    min-height:46px;
    margin:14px 0 0;
    box-shadow:none;
    border-radius:10px;
    font-size:13px;
  }

  /* A product image and its details share one scroll surface. */
  #product-dialog {
    padding:0;
    overflow:hidden;
  }
  #product-dialog .product-modal-layout {
    display:block;
    max-height:92dvh;
    overflow-y:auto;
    overflow-x:hidden;
    overscroll-behavior:contain;
  }
  #product-dialog .product-modal-image {
    height:min(38dvh,320px);
    min-height:0;
    max-height:none;
    object-fit:contain;
    object-position:center;
    background:#faf8f4;
    border-bottom:1px solid #f2ede6;
  }
  #product-dialog>.close {
    top:10px;
    right:10px;
    width:44px;
    height:44px;
    min-height:44px;
    border:1px solid #eee7de;
    border-radius:50%;
    background:#fffffff0;
    box-shadow:none;
    color:#8b8077;
    font-size:25px;
  }
  #product-dialog .product-modal-details {
    padding:18px 20px calc(22px + env(safe-area-inset-bottom));
  }
  #product-dialog .product-modal-details .eyebrow {
    margin:0;
    padding:0;
    font-size:9px;
    line-height:1.6;
    letter-spacing:1px;
    color:#7d7167;
  }
  #product-dialog .product-modal-details h2 {
    margin:10px 0;
    font-size:24px;
    line-height:1.4;
    letter-spacing:-.4px;
  }
  #product-dialog .product-modal-details>p {
    margin:8px 0;
    font-size:14px;
    line-height:1.75;
    color:#7d7167;
  }
  #product-dialog .modal-variant-label {
    margin-top:16px;
    font-size:12px;
    color:#7d7167;
  }
  #product-dialog .modal-variant-label select {
    height:46px;
    min-height:46px;
    min-width:0;
    max-width:100%;
    margin-top:6px;
    border:1px solid #e8e2db;
    border-radius:9px;
    background-color:#fffefd;
    font-size:16px;
  }
  #product-dialog .product-modal-details .product-price {
    margin:18px 0 10px;
    font-size:24px;
    line-height:1.5;
  }
  #product-dialog .product-modal-details .product-price del {
    font-size:13px;
  }
  #product-dialog .product-modal-details .primary {
    position:static;
    min-height:46px;
    margin:14px 0 0;
    border-radius:10px;
    font-size:13px;
    gap:14px;
  }
  #product-dialog .product-specs {
    margin:20px 0 0;
    padding-top:10px;
    border-top-color:#eee8e1;
  }
  #product-dialog .product-specs div {
    gap:14px;
    padding:7px 0;
    font-size:12px;
    line-height:1.7;
  }

  /* The cart preserves a stable header without the full-screen drawer weight. */
  #cart-dialog[open] {
    display:flex;
    flex-direction:column;
    height:auto;
    max-height:88dvh;
    overflow:hidden;
  }
  #cart-content {
    min-height:0;
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior:contain;
  }
  #cart-dialog .modal-heading h2 {
    font-size:24px;
  }
  #cart-dialog .modal-heading h2 span {
    font-size:13px;
  }
  #cart-dialog .cart-item {
    position:relative;
    grid-template-columns:64px minmax(0,1fr);
    gap:12px;
    padding:14px 0;
    border-bottom-color:#eee8e1;
  }
  #cart-dialog .cart-item img {
    width:64px;
    height:84px;
    border-radius:9px;
    background:#faf7f2;
    object-fit:cover;
  }
  #cart-dialog .cart-item h3 {
    padding-right:40px;
    font-size:14px;
    font-weight:500;
    line-height:1.55;
  }
  #cart-dialog .cart-item p {
    margin:3px 0;
    font-size:11px;
    line-height:1.6;
    color:#7d7167;
  }
  #cart-dialog .cart-item-controls {
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    gap:8px;
    align-items:center;
    margin-top:8px;
  }
  #cart-dialog .quantity {
    gap:0;
    width:max-content;
    border:1px solid #eee8e1;
    border-radius:24px;
    background:#faf8f5;
  }
  #cart-dialog .quantity button {
    width:44px;
    height:44px;
    min-height:44px;
    padding:0;
    border:0;
    border-radius:50%;
    background:transparent;
    font-size:18px;
    color:#786c63;
  }
  #cart-dialog .quantity span {
    min-width:16px;
    font-size:13px;
    text-align:center;
  }
  #cart-dialog .cart-item-controls>strong {
    margin:0;
    text-align:right;
    font-size:13px;
    font-weight:600;
    line-height:1.5;
    overflow-wrap:anywhere;
  }
  #cart-dialog .remove-item {
    position:absolute;
    top:8px;
    right:0;
    width:44px;
    height:44px;
    padding:0;
    background:transparent;
    font-size:22px;
    color:#ad9a8d;
  }
  #cart-dialog .cart-total {
    padding:18px 0 8px;
    font-size:16px;
  }
  #cart-dialog .cart-total strong {
    font-size:20px;
    font-weight:600;
  }
  #cart-dialog .cart-summary .muted {
    margin:3px 0 8px;
    font-size:12px;
    line-height:1.6;
  }
  #cart-dialog .cart-summary .full {
    min-height:46px;
    margin:10px 0 0;
    border-radius:10px;
    font-size:13px;
    gap:12px;
  }
  #cart-dialog .modal-note {
    margin:12px 0 0;
    font-size:12px;
    line-height:1.7;
    color:#7d7167;
  }
  #cart-dialog .empty-state {
    padding:28px 6px;
  }
  #cart-dialog .empty-state h3 {
    font-size:22px;
    line-height:1.5;
  }
  #cart-dialog .empty-state p {
    font-size:14px;
    line-height:1.7;
  }

  /* Checkout stays readable on iOS and uses a single scrolling form body. */
  #checkout-dialog[open] {
    display:flex;
    flex-direction:column;
    height:min(91dvh,880px);
    overflow:hidden;
  }
  #checkout-dialog .modal-heading h2 {
    font-size:22px;
  }
  #checkout-dialog .checkout-body {
    min-height:0;
    padding:0 2px 2px;
    overflow:auto;
    overscroll-behavior:contain;
  }
  #checkout-dialog .checkout-review {
    align-items:center;
    gap:12px;
    padding:0 0 12px;
    margin:0 0 12px;
    border:0;
    border-bottom:1px solid #ece5dc;
    border-radius:0;
    background:transparent;
  }
  #checkout-dialog .checkout-review span {
    font-size:11px;
    color:#7d7167;
  }
  #checkout-dialog .checkout-review strong {
    font-size:20px;
    font-weight:600;
  }
  #checkout-dialog .checkout-review button {
    min-height:44px;
    font-size:12px;
    font-weight:400;
    color:#9c5667;
  }
  #checkout-dialog .checkout-body>.muted {
    margin:0 0 12px;
    font-size:12px;
    line-height:1.7;
    color:#7d7167;
  }
  #checkout-form fieldset {
    margin:20px 0 0;
  }
  #checkout-form legend {
    margin-bottom:4px;
    font-size:13px;
    font-weight:700;
    color:#6d6259;
  }
  #checkout-form .form-row {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:10px;
  }
  #checkout-form .field-label,#checkout-form fieldset .field-label {
    margin:10px 0 0;
    font-size:12px;
    font-weight:500;
    line-height:1.5;
    color:#7d7167;
  }
  #checkout-form .form-row>.field-label {
    margin:10px 0 0;
  }
  #checkout-form .field-label>input,#checkout-form .field-label>textarea,#checkout-form .field-label>select {
    height:46px;
    min-height:46px;
    min-width:0;
    max-width:100%;
    margin-top:6px;
    padding:10px 12px;
    border:1px solid #e7dfd5;
    border-radius:9px;
    background-color:#fffefd;
    color:#4c443d;
    font-size:16px;
    font-weight:400;
    line-height:1.4;
  }
  #checkout-form .field-label>select {
    padding-right:34px;
  }
  #checkout-form .field-label>input:focus,#checkout-form .field-label>textarea:focus,#checkout-form .field-label>select:focus {
    border-color:#d6a2ae;
    outline:2px solid #dcaab326;
    outline-offset:1px;
  }
  #checkout-form .field-label>textarea {
    height:82px;
    min-height:82px;
  }
  #checkout-form .checkbox-label {
    align-items:flex-start;
    gap:9px;
    min-height:44px;
    margin:16px 0 0;
    padding:7px 0;
    font-size:12px;
    line-height:1.7;
    font-weight:400;
    color:#7d7167;
  }
  #checkout-form .checkbox-label input {
    width:18px;
    height:18px;
    margin-top:2px;
    flex-shrink:0;
  }
  #checkout-dialog .checkout-legal {
    margin-top:14px;
    padding-top:12px;
    border-top-color:#ece5dc;
  }
  #checkout-dialog .checkout-legal p {
    font-size:11px;
    line-height:1.75;
    color:#7d7167;
  }
  #checkout-dialog .checkout-legal .checkbox-label {
    margin-top:5px;
    color:#7d7064;
  }
  #checkout-dialog .checkout-data-note {
    margin-top:10px!important;
  }
  #checkout-form>.full {
    min-height:48px;
    margin:16px 0 0;
    padding:12px 15px;
    border-radius:10px;
    font-size:13px;
    gap:12px;
  }
  #checkout-form>.full svg {
    width:17px;
    height:17px;
  }
  #checkout-dialog .checkout-error {
    padding:10px 12px;
    margin:0 0 12px;
    border-radius:9px;
    font-size:13px;
    line-height:1.65;
  }
  #checkout-dialog .checkout-payment-note {
    margin:0 0 10px;
    font-size:12px;
    line-height:1.7;
  }
  #info-dialog #info-content {
    font-size:14px;
    line-height:1.8;
  }
}
@media (min-width:360px) and (max-width:600px) {
  #checkout-form fieldset:nth-of-type(3) .form-row {
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    gap:12px;
  }
}
@media (max-width:350px) {
  #city-dialog .city-location-result {
    align-items:stretch;
    flex-direction:column;
  }
  #cart-dialog .cart-item {
    grid-template-columns:56px minmax(0,1fr);
    gap:10px;
  }
  #cart-dialog .cart-item img {
    width:56px;
    height:76px;
  }
  #cart-dialog .quantity button {
    width:44px;
  }
  #cart-dialog .cart-item-controls {
    gap:6px;
  }
}
