/* GonvApp 1.0.1 — mobile viewport, Safari form zoom and bounded layouts. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Keep pinch zoom available. A readable input size avoids Safari's focus zoom. */
@media (max-width: 680px), (pointer: coarse) {
  body input:not([type="checkbox"]):not([type="radio"]),
  body select,
  body textarea,
  body .filters select,
  body .page-head select,
  body .result-bar select {
    font-size: 16px;
  }
}

@media (max-width: 680px) {
  html, body, #app {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .workspace, .main, .topbar {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .main {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  }

  .main > *, .home-top > *, .hero > *, .mini-campaigns > *,
  .stats > *, .cart-layout > *, .account-grid > *, .admin-two > *,
  .form-grid > *, .stack > * {
    min-width: 0;
    max-width: 100%;
  }

  .home-top, .mini-campaigns, .cart-layout, .account-grid, .admin-two,
  .form-grid, .stack, .consumption-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
    min-height: 268px;
  }

  .hero-copy {
    max-width: none;
    padding: 24px 0 24px 20px;
  }

  .hero h2 {
    font-size: clamp(24px, 7.1vw, 31px);
    line-height: 1.08;
    letter-spacing: -.9px;
    overflow-wrap: break-word;
  }

  .hero-copy .eyebrow {
    font-size: 8px;
    letter-spacing: .8px;
    overflow-wrap: break-word;
  }

  .hero-copy .btn {
    max-width: 100%;
    white-space: normal;
    padding: 10px;
    gap: 6px;
    text-align: left;
  }

  .hero-product.first {
    width: clamp(70px, 20vw, 92px);
    height: auto;
    aspect-ratio: 85 / 117;
    left: 5px;
    right: auto;
    top: 62px;
  }

  .hero-product.second {
    width: clamp(76px, 22vw, 101px);
    height: auto;
    aspect-ratio: 95 / 128;
    left: auto;
    right: 7px;
    top: 130px;
  }

  .hero-sticker {
    width: 54px;
    height: 54px;
    top: 16px;
    right: 11px;
  }

  /* Category strips scroll within their own box, never the entire page. */
  .category-row, .mobile-admin-nav {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-right: 0;
    padding-right: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .page-head, .section-head, .select-toolbar, .order-footer {
    flex-wrap: wrap;
  }

  .page-head > div:first-child {
    min-width: 0;
    flex: 1 1 190px;
  }

  .page-head h1, .section-head h2, .card h3, .order-heading strong,
  .notice > div, .notification > div, .demo-strip {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .section-head h2 { flex: 1 1 200px; }
  .section-head .link { flex: 0 0 auto; }
  .order-footer > .row { flex-wrap: wrap; }
  .table-wrap, .filters, .result-bar { min-width: 0; max-width: 100%; }
  .filters .search { flex-basis: 100%; min-width: 0; }
  .result-bar { flex-wrap: wrap; gap: 8px; }

  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat strong { font-size: clamp(16px, 4.6vw, 21px); }
  .stat label, .stat small { overflow-wrap: anywhere; }

  .consumption-item {
    grid-template-columns: 17px 46px minmax(0, 1fr) 38px;
  }

  .consumption-item .product-code { overflow-wrap: anywhere; }
  .consumption-item .item-price { flex-wrap: wrap; }
  .consumption-item .item-price .price { flex-shrink: 0; }

  .topbar {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    gap: 10px;
  }

  .topbar .brand { min-width: 0; }
  .topbar .header-actions { flex-shrink: 0; }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    gap: 0;
    padding-left: max(5px, env(safe-area-inset-left, 0px));
    padding-right: max(5px, env(safe-area-inset-right, 0px));
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }

  .mobile-nav a {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 9px;
  }

  .cart-float {
    left: max(16px, env(safe-area-inset-left, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    min-width: 0;
  }

  .cart-float > span:first-of-type { min-width: 0; }
  .cart-float .float-price { flex-shrink: 0; }
}

@media (max-width: 360px) {
  .hero-copy { padding-left: 16px; }
  .product-card { padding: 10px; }
  .product-footer { flex-wrap: wrap; gap: 8px; }
  .product-footer .add-btn { margin-left: auto; }
  .stats { gap: 6px; }
  .stat { padding: 12px 8px; }
  .select-toolbar .btn { white-space: normal; }
}
