/* A gallery with one picture must span the columns reserved for arrow buttons. */
body .kimmie-product-lightbox__stage > figure:only-child { grid-column: 1 / -1; width: 100%; min-width: 0; }
body .kimmie-product-lightbox__stage { min-height: 0; grid-template-rows: minmax(0, 1fr); }
body .kimmie-product-lightbox__stage figure { min-width: 0; min-height: 0; height: 100%; align-self: stretch; grid-template-rows: minmax(0, 1fr) auto; }
body .kimmie-product-lightbox__stage figure img { width: 100%; height: 100%; min-height: 0; max-height: 100%; object-fit: contain; }

/* Equal-height cards across each grid, based on the tallest content without clipping text. */
html body[class] :is(ul.products,.kimmie-public-profile__products,.kimmie-seller-products__grid) { grid-auto-rows: 1fr !important; align-items: stretch !important; }
html body[class] :is(ul.products li.product,.kimmie-public-product-card,.kimmie-seller-product) { display: flex !important; flex-direction: column !important; align-self: stretch !important; height: 100% !important; box-sizing: border-box !important; }
/* One card rhythm across catalog, favourites, home and seller collections. */
html body[class] :is(ul.products li.product,.kimmie-public-product-card,.kimmie-seller-product) { border: 1px solid #d4e1ee !important; border-radius: 18px !important; background: #fff !important; overflow: hidden !important; text-align: left !important; }
html body[class] :is(ul.products li.product .astra-shop-thumbnail-wrap,.kimmie-public-product-card__image,.kimmie-seller-product__image) { margin: 0 !important; border-radius: 0 !important; overflow: hidden !important; aspect-ratio: 10 / 9 !important; height: auto !important; flex: 0 0 auto !important; display: block !important; }
html body[class] :is(ul.products li.product .woocommerce-LoopProduct-link > img,.kimmie-public-product-card__image > img,.kimmie-seller-product__image > img) { display: block !important; width: 100% !important; height: auto !important; aspect-ratio: 10 / 9 !important; object-fit: cover !important; margin: 0 !important; border-radius: 0 !important; }
html body[class] :is(ul.products li.product .astra-shop-summary-wrap,.kimmie-public-product-card__copy,.kimmie-seller-product__body) { padding: 14px !important; flex: 1 0 auto !important; display: flex !important; flex-direction: column !important; gap: 6px !important; text-align: left !important; }
html body[class] :is(ul.products li.product .woocommerce-loop-product__title,.kimmie-public-product-card h3,.kimmie-seller-product h3) { margin: 0 !important; padding: 0 !important; min-height: 0 !important; font-size: 16px !important; line-height: 1.4 !important; font-weight: 600 !important; color: #12345a !important; overflow-wrap: anywhere !important; white-space: normal !important; text-overflow: clip !important; display: block !important; -webkit-line-clamp: unset !important; max-height: none !important; overflow: visible !important; }
html body[class] :is(ul.products li.product .kimmie-card-meta,.kimmie-public-product-card__copy > p,.kimmie-seller-product .kimmie-card-meta) { margin: 0 !important; min-height: 0 !important; color: #526579 !important; font-size: 14px !important; font-weight: 400 !important; line-height: 1.4 !important; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
html body[class] :is(ul.products li.product .price,.kimmie-public-product-card__price,.kimmie-seller-product__body > .kimmie-buyer-price,.kimmie-seller-product__body > span:last-child) { margin-top: auto !important; margin-bottom: 0 !important; }
html body[class] ul.products li.product :is(.by-store-name-link,.ast-woo-product-category) { display: none !important; }
@media(max-width:600px) {
 html body[class] :is(ul.products li.product .astra-shop-summary-wrap,.kimmie-public-product-card__copy,.kimmie-seller-product__body) { padding: 12px !important; gap: 5px !important; }
 html body[class] :is(ul.products li.product .woocommerce-loop-product__title,.kimmie-public-product-card h3,.kimmie-seller-product h3) { font-size: 15px !important; }
}
body .kimmie-no-results .kimmie-search-category-suggestions { margin: 12px 0 0 !important; padding: 0 !important; color: #748191 !important; font-size: 13px !important; line-height: 1.8 !important; font-weight: 400 !important; }
body .kimmie-no-results .kimmie-search-category-suggestions a { color: inherit !important; text-decoration: underline !important; text-underline-offset: 3px; font-weight: 400 !important; }
body .kimmie-no-results .kimmie-search-category-suggestions a:hover { color: #205a9e !important; }
body .kimmie-chat-product { display: flex !important; align-items: center; gap: 12px; padding: 10px; margin: 8px 0; border: 1px solid #cedded; border-radius: 14px; background: #f3f7fc; color: #12345a !important; text-decoration: none !important; max-width: 100%; white-space: normal; line-height: 1.4; }
body .kimmie-chat-product img { display: block; flex: 0 0 64px; width: 64px; height: 64px; object-fit: cover; border-radius: 9px; margin: 0 !important; }
body .kimmie-chat-product > span { min-width: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
body .kimmie-chat-product small { display: block; margin-top: 3px; color: #526579; font-weight: 400; font-size: 13px; }
body .kimmie-bid-card > .kimmie-chat-product { margin: 8px 0 12px; }
@media(max-width:480px) { body .kimmie-chat-product img { flex-basis: 52px; width: 52px; height: 52px; } }

@media(max-width:600px) {
 body .kimmie-product-lightbox__stage { position: relative; grid-template-columns: minmax(0,1fr); }
 body .kimmie-product-lightbox__stage > figure { grid-column: 1 / -1; grid-row: 1; }
 body .kimmie-product-lightbox__stage > button { position: absolute; z-index: 1; top: calc(50% - 22px); }
 body .kimmie-product-lightbox__stage > .is-previous { left: 12px; }
 body .kimmie-product-lightbox__stage > .is-next { right: 12px; }
 body .kimmie-product-lightbox__stage figcaption { white-space: normal; text-overflow: clip; overflow: visible; }
}

/* Elementor's home widget sets its own card border after the theme. */
html body.home .elementor.elementor-219 .elementor-widget .woocommerce ul.products li.product { border: 1px solid #d4e1ee !important; border-radius: 18px !important; overflow: hidden !important; background: #fff !important; }

body .kimmie-add-draft-article { margin: 0 0 10px; padding: 10px 14px; min-height: 44px; background: #205a9e; color: #fff; border: 0; border-radius: 10px; font-size: 14px; }

/* Five products per row on the desktop homepage; retain the mobile two-column grid. */
@media(min-width:1024px) {
 html body.home .elementor.elementor-219 .elementor-widget .woocommerce ul.products { display: grid !important; grid-template-columns: repeat(5,minmax(0,1fr)) !important; gap: 24px !important; }
 html body.home .elementor.elementor-219 .elementor-widget .woocommerce ul.products::before,
 html body.home .elementor.elementor-219 .elementor-widget .woocommerce ul.products::after { display: none !important; }
 html body.home .elementor.elementor-219 .elementor-widget .woocommerce ul.products li.product { width: auto !important; min-width: 0 !important; margin: 0 !important; }
}

/* The missing-page view shares the site's calm blue palette and rounded cards. */
html body.error404 #content { background: #f4f7fb !important; }
html body.error404 #content > .ast-container { width: 100%; max-width: 1200px; padding: 0 24px; }
html body.error404 #primary.kimmie-not-found { width: 100%; margin: 40px 0 56px !important; padding: 0 !important; }
body .kimmie-not-found__card { max-width: 1040px; margin: 0 auto; padding: 48px 32px; border: 1px solid #d4e1ee; border-radius: 24px; background: #fff; text-align: center; box-shadow: 0 8px 28px rgba(18,52,90,.04); }
body .kimmie-not-found__code { display: inline-block; margin: 0 0 18px; padding: 8px 18px; border-radius: 12px; background: #eaf2fc; color: #205a9e; font-size: 20px; font-weight: 600; letter-spacing: 2px; }
body .kimmie-not-found__card h1 { margin: 0 0 16px; color: #12345a; font-size: clamp(28px,3.5vw,42px); line-height: 1.2; font-weight: 600; }
body .kimmie-not-found__intro { max-width: 620px; margin: 0 auto 26px; color: #526579; font-size: 16px; line-height: 1.65; }
body .kimmie-not-found__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-bottom: 32px; }
body .kimmie-not-found__actions a { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 12px 22px; border: 1px solid #b7cde6; border-radius: 12px; color: #205a9e; background: #fff; font-weight: 600; text-decoration: none; line-height: 1.4; }
body .kimmie-not-found__actions a:first-child { background: #ed7000; border-color: #ed7000; color: #fff; }
body .kimmie-not-found__actions a:hover { background: #edf4fc; }
body .kimmie-not-found__actions a:first-child:hover { background: #c45d00; border-color: #c45d00; }
body .kimmie-not-found__search { max-width: 550px; margin: 0 auto; padding-top: 24px; border-top: 1px solid #e1e9f2; }
body .kimmie-not-found__search label { display: block; margin: 0 0 10px; font-size: 15px; color: #526579; font-weight: 400; }
body .kimmie-not-found__search > div { display: flex; gap: 8px; }
html body .kimmie-not-found__search input[type=search] { flex: 1; min-width: 0; width: 100%; height: 50px; padding: 12px 16px; border: 1px solid #b7cde6; border-radius: 12px; background: #fff; color: #12345a; font-size: 16px; }
html body .kimmie-not-found__search button { min-height: 50px; padding: 12px 20px; border: 0; border-radius: 12px; background: #205a9e; color: #fff; font-size: 15px; font-weight: 600; }
body .kimmie-not-found__help { margin: 24px 0 0; color: #748191; font-size: 14px; }
body .kimmie-not-found__help a { color: #205a9e; text-decoration: underline; text-underline-offset: 3px; }
@media(max-width:600px) {
 html body.error404 #content > .ast-container { padding: 0 16px; }
 html body.error404 #primary.kimmie-not-found { margin: 24px 0 32px !important; }
 body .kimmie-not-found__card { padding: 28px 20px; border-radius: 20px; }
 body .kimmie-not-found__actions { flex-direction: column; margin-bottom: 24px; }
 body .kimmie-not-found__search > div { flex-direction: column; }
}

/* Product context belongs above the messages, outside the editable composer. */
body .bm-wrap-main .kimmie-conversation-product {flex:0 0 auto;margin:0!important;border-width:0 0 1px;border-radius:0;padding:10px 14px;}
body .kimmie-conversation-product:focus-visible {outline:2px solid #205b9e;outline-offset:-3px;}
body .bm-thread-col > .kimmie-conversation-product strong {display:block;line-height:1.35;color:#12345a;}
body .bm-thread-col > .kimmie-conversation-product small {line-height:1.35;}
@media(max-width:767px) {
 /* A sibling of the scrolling message list keeps the product visible as the conversation moves. */
 body .bm-wrap-main .bm-thread-col > .kimmie-conversation-product {gap:9px;padding:6px 12px;}
 body .bm-thread-col > .kimmie-conversation-product img {flex:0 0 44px;width:44px;height:44px;border-radius:7px;}
 body .bm-thread-col > .kimmie-conversation-product strong {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;}
 body .bm-thread-col > .kimmie-conversation-product small {margin-top:1px;font-size:12px;}
}

@media (max-width:767px) {
  .kimmie-dashboard-messages .bm-wrap-main.kimmie-mobile-conversation {
    --bm-ios-keyboard-overlap: 0px;
    height: var(--kimmie-chat-height, 100dvh) !important;
    min-height: 0 !important;
    max-height: var(--kimmie-chat-height, 100dvh) !important;
  }
  .kimmie-dashboard-messages .kimmie-mobile-conversation > .bm-threads-wrapper {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
  }
  .kimmie-mobile-conversation .bm-msg-list { overscroll-behavior-y: contain; }
}
