

@media (max-width: 820px) {
  .product-grid-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .results-summary {
    align-self: stretch;
    text-align: left;
  }
}

@media (max-width: 1120px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .product-grid-header {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .header {
    padding: 0;
    gap: 0;
    background: #ffeb3b;
  }

  .top-bar {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.55rem 0.45rem;
  }

  .brand-mark {
    min-width: 0;
    flex: 0 0 auto;
    width: auto;
  }

  .brand-eyebrow {
    font-size: 0.43rem;
    letter-spacing: 0.09em;
    color: rgba(66, 66, 66, 0.8);
  }

  .brand-logo {
    font-size: 0.92rem;
    line-height: 1;
    color: #0f172a;
  }

  .search-bar {
    min-width: 0;
    max-width: none;
    flex: 1 1 auto;
    order: 3;
    margin-top: 0.25rem;
  }

  .search-input {
    display: none;
  }

  .search-icon {
    left: 0.8rem;
    color: #9ca3af;
    font-size: 0.92rem;
  }

  .search-open-mobile {
    display: flex;
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: flex-start;
    padding: 0.7rem 0.9rem 0.7rem 2.15rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    color: #94a3b8;
    font-size: 0.9rem;
    text-align: left;
  }

  .search-bar {
    cursor: pointer;
    position: relative;
    z-index: 2;
  }

  .header-actions {
    width: auto;
    gap: 0.2rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    overflow: visible;
    padding-bottom: 0;
  }

  .header-link {
    width: 38px;
    min-width: 38px;
    max-width: 38px;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    padding: 0;
    flex: 0 0 auto;
    white-space: nowrap;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.68);
    border-color: rgba(0, 0, 0, 0.08);
    color: #334155;
    overflow: hidden;
  }

  .header-link-icon {
    font-size: 0.88rem;
    line-height: 1;
  }

  .theme-toggle,
  .cart-btn {
    width: 38px;
    min-width: 38px;
    max-width: 38px;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    border-radius: 10px;
    flex: 0 0 auto;
    background: #f7e76a;
    border-color: rgba(0, 0, 0, 0.08);
    color: #111827;
  }

  .theme-toggle,
  .header-link,
  .cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
  }

  .theme-toggle svg,
  .cart-btn svg {
    width: 17px;
    height: 17px;
  }

  .cart-icon {
    font-size: 1rem;
  }

  .theme-toggle-icon {
    width: 18px;
    height: 18px;
    font-size: 0.95rem;
    line-height: 1;
  }

  .cart-badge {
    top: -7px;
    right: -7px;
    width: 18px;
    height: 18px;
    font-size: 0.68rem;
  }

  .categories {
    display: none;
  }

  .catalog-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.2rem;
    padding: 0;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }

  .catalog-action-btn {
    flex: 1 1 0;
    min-height: 40px;
    padding: 0 0.3rem;
    font-size: 0.7rem;
    background: #fff;
    border: 0;
    border-radius: 9999px;
    box-shadow: none;
    color: #2563eb;
    border: 1px solid rgba(0, 0, 0, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .catalog-action-btn:last-child {
    border-right: 1px solid rgba(0, 0, 0, 0.08);
  }

  .catalog-action-btn-wide {
    flex: 1 1 0;
  }

  .container {
    padding: 0 0.65rem 1.5rem;
  }

  .product-grid-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .results-summary {
    white-space: normal;
    align-self: stretch;
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .product-grid-flat {
    grid-template-columns: 1fr;
  }

  .category-section {
    gap: 0.7rem;
    margin-bottom: 1rem;
  }

  .category-section-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: clamp(150px, 42vw, 190px);
    overflow-x: auto;
    padding-bottom: 0.25rem;
    gap: 0.75rem;
    scrollbar-width: none;
  }

  .category-section-rail::-webkit-scrollbar {
    display: none;
  }

  .product-card-rail {
    min-width: 0;
  }

  .category-section-title {
    font-size: 1rem;
  }

  .product-card {
    border-radius: 14px;
  }

  .product-card-rail .product-media {
    border-radius: 14px 14px 10px 10px;
  }

  .product-card-rail .product-image {
    height: 118px;
  }

  .product-card-rail .product-info {
    padding: 0.62rem;
  }

  .product-card-rail .product-meta {
    gap: 0.1rem;
    margin-bottom: 0.15rem;
  }

  .product-card-rail .product-category {
    font-size: 0.58rem;
  }

  .product-card-rail .product-sku {
    font-size: 0.58rem;
  }

  .product-card-rail .product-title {
    font-size: 0.8rem;
    line-height: 1.1;
    min-height: 1.55em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .product-card-rail .product-commerce {
    gap: 0.2rem;
    align-items: flex-start;
  }

  .product-card-rail .product-price {
    font-size: 0.94rem;
  }

  .product-card-rail .product-stock {
    font-size: 0.64rem;
  }

  .product-card-rail .product-card-payment {
    display: none;
  }

  .product-card-rail .product-actions {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    margin-top: 0.4rem;
  }

  .product-card-rail .product-actions .btn-primary {
    min-height: 34px;
    padding: 0.42rem 0.55rem;
    font-size: 0.68rem;
  }

  .product-card-rail .product-actions .view-btn {
    display: none;
  }

  .search-panel-sheet {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .search-panel-field {
    position: relative;
  }

  .search-panel-field .search-input {
    display: block;
    width: 100%;
    border-radius: 12px;
    border-color: rgba(0, 0, 0, 0.08);
    background: #fff;
    box-shadow: none;
    padding: 0.8rem 1rem 0.8rem 2.25rem;
    font-size: 1rem;
    line-height: 1.2;
    color: #0f172a;
    caret-color: var(--primary);
  }

  .product-image {
    height: 160px;
  }

  .product-info {
    padding: 0.7rem;
  }

  .product-title {
    font-size: 0.98rem;
  }

  .product-actions {
    gap: 0.35rem;
  }

  .product-actions .btn-primary {
    padding: 0.45rem 0.55rem;
    font-size: 0.7rem;
  }

  .modal-content {
    width: calc(100vw - 1rem);
    max-width: none;
    max-height: 92vh;
    border-radius: 16px;
  }

  #modal-content-inner,
  .modal-footer,
  .modal-purchase-dock {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .modal-gallery-main img {
    height: 210px;
  }

  .modal-commerce {
    grid-template-columns: 1fr;
  }

  .cart-drawer {
    max-width: none;
  }

  .cart-items {
    padding: 0.85rem;
  }

  .cart-footer {
    padding: 0.85rem 0.85rem 1rem;
  }

  .share-actions {
    grid-template-columns: 1fr;
  }

  .filter-panel-sheet {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .header {
    background: #ffeb3b;
  }

  .top-bar {
    gap: 0.35rem;
  }

  .brand-eyebrow {
    font-size: 0.4rem;
    letter-spacing: 0.08em;
  }

  .brand-logo {
    font-size: 0.84rem;
  }

  .search-bar {
    margin-top: 0.2rem;
  }

  .search-open-mobile {
    min-height: 40px;
    font-size: 0.86rem;
  }

  .search-icon {
    left: 0.75rem;
    font-size: 0.88rem;
  }

  .header-actions {
    gap: 0.26rem;
    padding-bottom: 0;
  }

  .header-link {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
  }

  .header-link:not(:first-of-type):not(:nth-of-type(2)) {
    display: inline-flex;
  }

  .theme-toggle,
  .cart-btn {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .theme-toggle svg,
  .cart-btn svg,
  .cart-icon {
    transform: scale(0.92);
  }

  .categories {
    gap: 0.45rem;
    padding-top: 0.35rem;
  }

  .catalog-action-btn {
    min-height: 38px;
    border-radius: 12px;
    font-size: 0.74rem;
  }

  .category-btn {
    padding: 0.52rem 0.74rem;
    font-size: 0.76rem;
  }
}

@media (max-width: 360px) {
  .brand-mark {
    gap: 0.08rem;
  }

  .brand-mark {
    min-width: 0;
  }

  .brand-eyebrow {
    font-size: 0.42rem;
    letter-spacing: 0.08em;
  }

  .brand-logo {
    font-size: 0.8rem;
    letter-spacing: 0.03em;
  }

  .header-actions {
    gap: 0.22rem;
  }

  .header-link {
    padding: 0 0.45rem;
    font-size: 0.68rem;
  }

  .category-btn {
    padding: 0.5rem 0.7rem;
    font-size: 0.76rem;
  }
}

@media (max-width: 480px) {
  .header-link-text {
    display: none;
  }

  .header-link {
    width: 38px;
    min-width: 38px;
    justify-content: center;
    padding: 0;
    border-radius: 12px;
  }

  .header-link-dashboard,
  .header-link-logout {
    width: 38px;
    min-width: 38px;
  }

  .header-actions {
    gap: 0.25rem;
  }
}

@media (max-width: 960px) {
  .top-bar {
    align-items: stretch;
  }

  .brand-mark {
    min-width: 0;
  }

  .search-bar {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .header-actions {
    margin-left: auto;
  }

  .categories {
    justify-content: flex-start;
    padding-bottom: 0.15rem;
  }
}

@media (max-width: 960px) {
  .register-container {
    grid-template-columns: 1fr;
  }
  .register-sidebar-col {
    border-left: none;
    border-top: 1px solid rgba(203, 213, 225, 0.5);
    padding: 2rem;
  }
  .register-form-col {
    padding: 2rem;
  }
  :root[data-theme='dark'] .register-sidebar-col {
    border-top-color: rgba(51, 65, 85, 0.5);
  }
}

@media (max-width: 560px) {
  .auth-shell,
  .register-shell {
    padding: 0.75rem;
  }

  .auth-card,
  .register-container {
    border-radius: 18px;
  }

  .auth-theme-toggle {
    top: 0.75rem;
    right: 0.75rem;
  }

  .register-form-col,
  .register-sidebar-col {
    padding: 1.25rem;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }
}