/* Mobile storefront and dashboard hardening — v1.3.11 */
html,
body {
  max-width: 100%;
}

body.store {
  overflow-x: clip;
}

body.store main,
body.store section,
body.store .container,
body.store .catalog-grid,
body.store .product-layout,
body.store .details-grid,
body.store .cart-grid,
body.store .checkout-grid {
  min-width: 0;
}

@media (max-width: 820px) {
  .store .header-row {
    position: relative;
    height: auto;
    min-height: 72px;
    padding: 10px 0;
    flex-wrap: wrap;
    gap: 9px 12px;
  }

  .store .header .brand {
    min-width: 0;
    max-width: calc(100% - 58px);
    flex: 1 1 auto;
  }

  .store .header .brand span,
  .store .header .brand b {
    min-width: 0;
  }

  .store .header .brand b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .store .header .menu {
    width: 44px;
    height: 44px;
    margin-inline-start: auto;
    padding: 0;
    display: grid;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid #dce3ea;
    border-radius: 12px;
    background: #f7f9fb;
    color: #0a1728;
  }

  .store .header .search {
    order: 3;
    display: block;
    width: 100%;
    max-width: none;
    flex: 1 0 100%;
    margin: 0;
  }

  .store .header .search input {
    height: 46px;
    padding-inline-end: 52px;
    background: #f4f7f9;
  }

  .store .header .search button {
    top: 4px;
    width: 38px;
    height: 38px;
  }

  .store .header nav,
  .home-body .header nav {
    position: absolute;
    z-index: 70;
    top: 100%;
    right: 0;
    left: 0;
    inset-inline: 0;
    width: 100%;
    max-height: calc(100dvh - 126px);
    padding: 12px 14px 16px;
    overflow-y: auto;
    border: 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #d8e0e8;
    border-radius: 0 0 16px 16px;
    background: #fff;
    box-shadow: 0 20px 40px rgba(7, 17, 31, .16);
  }

  .store .header nav a,
  .home-body .header nav a {
    min-height: 46px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 9px;
    font-size: 14px;
  }

  .store .header nav a + a,
  .home-body .header nav a + a {
    border-top: 1px solid #edf1f5;
  }

  .store .page-hero {
    padding: 34px 0;
  }

  .store .page-hero h1 {
    margin: 7px 0 9px;
    font-size: clamp(30px, 9vw, 38px);
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .store .category-pills {
    max-width: 100%;
    margin-top: 17px;
    padding: 2px 0 7px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-width: thin;
  }

  .store .category-pills a {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  /* The scrolling use-case row must be allowed to shrink inside its flex parent. */
  .store .catalog-use-cases,
  .store .catalog-use-cases .container {
    max-width: 100%;
    overflow: hidden;
  }

  .store .catalog-use-cases .container > div {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 3px 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-width: thin;
  }

  .store .catalog-use-cases a {
    scroll-snap-align: start;
  }

  .store .catalog aside form {
    padding: 17px;
  }

  .store .product-layout,
  .store .details-grid {
    gap: 28px;
  }

  .store .main-image {
    width: 100%;
    height: auto;
    min-height: 280px;
    aspect-ratio: 4 / 3;
  }

  .store .thumbs {
    max-width: 100%;
    padding-bottom: 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .store .thumbs button {
    flex: 0 0 68px;
  }

  .store .product-info h1 {
    overflow-wrap: anywhere;
  }

  .store .variant-panel,
  .store .checkout-form,
  .store .summary {
    min-width: 0;
  }

  .store .variant-group > div {
    max-width: 100%;
  }

  .store .option {
    min-height: 42px;
    padding: 9px 12px;
  }

  .store .details dl,
  .store .details dd {
    min-width: 0;
  }

  .store .details dd {
    overflow-wrap: anywhere;
  }

  .store input,
  .store select,
  .store textarea,
  .store button,
  .store .button {
    max-width: 100%;
  }

  .store input,
  .store select,
  .store textarea {
    font-size: 16px;
  }

  .store .footer-grid,
  .store .footer-bottom {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .store .top {
    display: none;
  }

  .store .header .brand-icon {
    width: 58px;
    height: 42px;
    flex-basis: 58px;
  }

  .store .header .brand span {
    display: flex;
  }

  .store .header .brand small {
    display: none;
  }

  .store .header .brand b {
    font-size: 13px;
  }

  .store .header nav,
  .home-body .header nav {
    max-height: calc(100dvh - 120px);
  }

  .store .section {
    padding: 42px 0;
  }

  .store .catalog-use-cases {
    padding: 14px 0 9px;
  }

  .store .catalog-use-cases .container {
    gap: 8px;
  }

  .store .catalog aside form {
    gap: 11px;
  }

  .store .card-media {
    height: 230px;
  }

  .store .main-image {
    min-height: 245px;
  }

  .store .product-info h1 {
    font-size: 28px;
    line-height: 1.3;
  }

  .store .spec-strip {
    grid-template-columns: 1fr;
  }

  .store .spec-strip div {
    min-width: 0;
  }

  .store .spec-strip b {
    overflow-wrap: anywhere;
  }

  .store .buy-row {
    align-items: stretch;
    flex-wrap: wrap;
    gap: 13px;
  }

  .store .buy-row > div:first-child {
    min-width: min(100%, 190px);
    flex: 1 1 190px;
  }

  .store .qty {
    min-height: 44px;
  }

  .store .details dl div {
    grid-template-columns: minmax(90px, 34%) minmax(0, 1fr);
    gap: 12px;
  }

  .store .cart-item {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .store .cart-item > div,
  .store .cart-item h3,
  .store .cart-item p {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .store .payment-methods,
  .store .payment-scope-grid {
    grid-template-columns: 1fr;
  }

  .store .footer {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }

  .store .whatsapp-float {
    right: 14px !important;
    left: auto !important;
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    width: 56px;
    height: 56px;
    padding: 0 !important;
    display: grid;
    place-items: center;
  }

  .store .whatsapp-float img {
    width: 28px;
    height: 28px;
  }
}

/* Dashboard mobile layout: prevent native file fields and long labels widening the page. */
@media (max-width: 820px) {
  body.admin,
  body.admin .admin-shell,
  body.admin .admin-main,
  body.admin .admin-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body.admin {
    overflow-x: clip;
  }

  body.admin .admin-top {
    position: sticky;
    z-index: 45;
    top: 0;
    height: 64px;
    padding: 0 16px;
  }

  body.admin .admin-top > button {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #cfd8e2;
    border-radius: 10px;
    background: #fff;
    font-size: 22px;
  }

  body.admin .admin-content {
    padding: 18px 14px 36px;
  }

  body.admin .admin-title,
  body.admin .admin-title > div,
  body.admin .panel,
  body.admin form,
  body.admin label,
  body.admin input,
  body.admin select,
  body.admin textarea,
  body.admin .table {
    min-width: 0;
    max-width: 100%;
  }

  body.admin .admin-title h1 {
    max-width: 100%;
    font-size: 27px;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  body.admin .panel {
    padding: 16px;
  }

  body.admin input,
  body.admin select,
  body.admin textarea,
  body.admin button,
  body.admin .button {
    max-width: 100%;
  }

  body.admin input,
  body.admin select,
  body.admin textarea {
    width: 100%;
    font-size: 16px;
  }

  body.admin input[type="checkbox"],
  body.admin input[type="radio"] {
    width: auto;
  }

  body.admin input[type="file"] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.admin label,
  body.admin label small,
  body.admin .muted-text,
  body.admin .panel-head small {
    overflow-wrap: anywhere;
  }

  body.admin .panel-head {
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
  }

  body.admin .category-upload-list form,
  body.admin .brand-upload-list form {
    width: 100%;
    max-width: 100%;
  }

  body.admin .category-icon-file,
  body.admin .brand-file-field,
  body.admin .category-spec-profile {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  body.admin .admin-content {
    padding-inline: 10px;
  }

  body.admin .admin-title {
    width: 100%;
    gap: 12px;
    align-items: stretch;
  }

  body.admin .admin-title .button,
  body.admin .title-actions,
  body.admin .title-actions .button {
    width: 100%;
  }

  body.admin .panel {
    border-radius: 13px;
    padding: 14px;
  }

  body.admin .category-upload-list form,
  body.admin .brand-upload-list form,
  body.admin .variants-panel .variant-list form,
  body.admin .variants-panel .add-variant,
  body.admin .specification-row {
    grid-template-columns: 1fr;
  }

  body.admin .category-upload-list form > *,
  body.admin .brand-upload-list form > * {
    grid-column: 1 !important;
  }

  body.admin .category-icon-preview,
  body.admin .brand-logo-preview {
    justify-self: center;
  }

  body.admin .category-product-count,
  body.admin .category-spec-badge {
    white-space: normal;
  }

  body.admin .publish,
  body.admin .publish .button {
    width: 100%;
  }
}
