@media (max-width: 1023px) {
  .header-inner { gap: var(--space-3); }
  .address-trigger { margin-left: auto; }
  .catalog-floating-cart { top: 76px; right: 12px; min-height: 48px; padding: 5px 8px; border-radius: 14px; }
  .catalog-floating-cart span { width: 30px; height: 30px; font-size: 1rem; }
  .catalog-floating-cart strong { font-size: .75rem; }
  .primary-nav a:not(.cart-link) { display: none; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-layout, .cart-layout { grid-template-columns: 1fr; }
  .auth-grid, .account-layout { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar, .summary { position: static; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar a { flex: 0 0 auto; white-space: nowrap; }
}

@media (max-width: 639px) {
  main { padding-block: var(--space-5) var(--space-8); }
  .header-inner { min-height: 60px; }
  .brand { font-size: .95rem; }
  .brand-mark { width: 28px; height: 28px; }
  .address-trigger { max-width: 155px; padding: 6px 8px; }
  .address-trigger strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .address-trigger .eta-badge { display: none; }
  .service-grid, .trust-grid, .water-banner, .footer-inner { grid-template-columns: 1fr; }
  .hero { border-radius: var(--radius-lg); }
  .page-heading { display: block; }
  .page-heading .button { margin-top: var(--space-4); }
  .product-grid { gap: var(--space-3); }
  .form-grid { grid-template-columns: 1fr; }
  .admin-header, .admin-order { align-items: stretch; flex-direction: column; }
  .admin-header__actions { align-items: stretch; flex-direction: column; }
  .admin-order-tools, .admin-order__actions, .admin-detail-topbar, .admin-detail-header, .admin-detail-header__actions { align-items: stretch; flex-direction: column; }
  .admin-order-tools .search-input, .admin-order-tools select, .admin-detail-header__actions, .admin-detail-header__actions .button, .admin-detail-header__actions select { width: 100%; }
  .admin-products-toolbar { align-items: stretch; flex-direction: column; }
  .admin-products-toolbar .button { width: 100%; }
  .admin-product-row { grid-template-columns: 52px minmax(0, 1fr); }
  .admin-product-row > strong, .admin-stock-field, .admin-product-row > .status, .admin-product-actions { grid-column: 2; }
  .admin-product-actions { justify-content: start; }
  .admin-category-row { grid-template-columns: minmax(0, 1fr) auto; }
  .admin-category-row > strong, .admin-category-row > .status, .admin-category-row > .admin-product-actions { grid-column: 2; }
  .admin-category-row > .admin-product-actions { justify-content: start; }
  .admin-product-form { padding: var(--space-4); }
  .admin-detail-grid { grid-template-columns: 1fr; }
  .admin-detail-header { align-items: stretch; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-form { grid-template-columns: 1fr; }
  .product-detail { grid-template-columns: 1fr; }
  .product-card { padding: 10px; }
  .product-card__image { font-size: 2.25rem; }
  .product-card h3 { font-size: .9rem; }
  .product-card__footer { display: block; }
  .product-card__footer .button { width: 100%; margin-top: var(--space-3); }
  .sticky-cart { bottom: 64px; flex-wrap: wrap; }
  .sticky-cart .button { width: 100%; }
  .cart-layout > .summary { position: sticky; bottom: 68px; z-index: 8; padding: var(--space-4); border: 1px solid var(--brand-700); box-shadow: 0 8px 24px rgba(61, 33, 142, .2); }
  .cart-layout > .summary .button { min-height: 50px; }
  .cart-layout > .summary .muted { display: none; }
  .cart-app-heading { margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); color: #fff; background: linear-gradient(135deg, var(--brand-800), var(--brand-700)); }
  .cart-app-heading .eyebrow, .cart-app-heading h1 { color: #fff; }
  .cart-app-heading .back-link { color: #fff; background: rgba(255,255,255,.14); }
  .cart-app-heading .cart-clear { color: var(--brand-700); background: #fff; }
  .cart-line { grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--space-2); }
  .cart-line__visual { width: 64px; height: 64px; }
  .cart-line__quantity button, .cart-line__quantity strong { width: 30px; }
  .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 15; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: 76px; padding: 7px 10px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: rgba(255, 255, 255, .98); box-shadow: 0 -8px 22px rgba(38, 23, 80, .08); backdrop-filter: blur(12px); }
  .mobile-nav a { position: relative; display: grid; min-height: 58px; place-items: center; padding: 5px 3px; color: #a1a1a5; font-size: 0; font-weight: 700; text-decoration: none; }
  .mobile-nav a[aria-current="page"] { color: var(--brand-700); }
  .mobile-nav a::before { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; font-size: 1.8rem; line-height: 1; }
  .mobile-nav a[aria-current="page"]::after { content: ""; position: absolute; right: 18%; bottom: 0; left: 18%; height: 4px; border-radius: 4px 4px 0 0; background: var(--brand-700); }
  .mobile-nav a[href="index.html"]::before { content: "⌂"; }
  .mobile-nav a[href="market.html"]::before { content: "⌕"; }
  .mobile-nav a[href="water.html"]::before { content: "☷"; }
  .mobile-nav a[href="cart.html"]::before { content: "▣"; }
  .mobile-nav a[href="account.html"]::before { content: "●"; }
  .mobile-nav a[href="water.html"]::before { color: #ffd83d; background: var(--brand-700); box-shadow: 0 4px 10px rgba(91, 54, 198, .3); transform: translateY(-12px); }
  .mobile-nav a[href="water.html"] { height: 70px; }
  .mobile-nav a[href="water.html"]::after { display: none; }
  .site-footer { padding-bottom: 96px; }
  .profile-topbar { display: block; margin: calc(var(--space-5) * -1) calc(var(--gutter) * -1) var(--space-4); padding: var(--space-5) var(--gutter); color: #fff; background: linear-gradient(135deg, var(--brand-800), var(--brand-700)); font-size: 1.2rem; font-weight: 800; text-align: center; }
  .profile-identity { border-radius: var(--radius-lg); }
  .profile-identity h1 { font-size: 1.35rem; }
  .profile-quick-links { gap: var(--space-2); }
  .profile-quick-links a { min-height: 100px; padding: var(--space-2); }
  .profile-quick-links strong { font-size: .68rem; }
  .order-history-card { grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); }
  .order-history-card > strong { grid-column: 2; grid-row: 1; }
  .order-history-card > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
  .app-topbar .header-inner { min-height: 68px; }
  .app-topbar .brand { display: none; }
  .app-topbar .address-trigger { width: 100%; justify-content: space-between; margin: 0; }
  .app-home-hero { grid-template-columns: 1fr 110px; min-height: 305px; padding: 22px; border-radius: 0 0 var(--radius-xl) var(--radius-xl); margin-inline: calc(var(--gutter) * -1); }
  .active-order__card { padding: var(--space-4); border-radius: var(--radius-lg); }
  .active-order__top { gap: var(--space-2); }
  .active-order__live { font-size: .62rem; }
  .active-order__steps { margin-block: var(--space-5) var(--space-4); }
  .active-order__step small { font-size: .6rem; }
  .active-order__bottom { display: grid; gap: var(--space-2); }
  .order-history { padding: var(--space-4); }
  .order-history__list li { grid-template-columns: 14px minmax(0, 1fr); }
  .order-history__list time { grid-column: 2; }
  .app-home-hero__visual { min-height: 115px; }
  .hero-bottle { right: 40px; width: 76px; height: 104px; font-size: 3rem; }
  .hero-bag { width: 82px; height: 82px; font-size: 2.8rem; }
  .promo-strip { min-height: 104px; padding: var(--space-4); }
  .promo-strip strong { font-size: 1rem; }
  .promo-strip > b { font-size: 2.5rem; }
  .quick-services { gap: var(--space-2); }
  .quick-service { grid-template-columns: 38px 1fr; padding: var(--space-3); font-size: .85rem; }
  .quick-service > span { width: 38px; height: 38px; font-size: 1.3rem; border-radius: 12px; }
  .category-grid { gap: var(--space-2); }
  .category-grid a { min-height: 96px; padding: var(--space-2); }
  .category-grid span { width: 42px; height: 42px; font-size: 1.4rem; border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
