/* Shared constraints first. Phone layouts are defined once below. */
:root {
  --mobile-gutter: 16px;
  --mobile-nav-height: calc(64px + env(safe-area-inset-bottom, 0px));
}
html { min-width: 0; -webkit-text-size-adjust: 100%; }
body { min-width: 0; }
main, section, article, aside, form, fieldset { min-width: 0; }
.wrap { width: 100%; }
.hero-layout > *, .hero-aside > *, .categories > *, .product-grid > *,
.catalog-layout > *, .pdp-grid > *, .cart-layout > *, .checkout-layout > *,
.content-layout > *, .account-layout > *, .editorial-grid > *, .help-grid > *,
.form-row > *, .stats-grid > *, .dashboard-grid > *, .admin-two-col > *,
.integration-grid > *, .requirements-summary > *, .role-grid > *,
.branch-directory > *, .merch-grid > *, .footer-grid > * { min-width: 0; }
.flex > div, .row > div, .section-head > *, .admin-title > *, .detail-pair > *,
.summary-row > *, .option-card > *, .search-wrap { min-width: 0; }
h1, h2, h3, h4, p, dd, .detail-pair b, .summary-row, .product-card a,
.table-product b, .option-card, footer a { overflow-wrap: anywhere; }
.input, select, textarea { max-width: 100%; min-width: 0; }
input[type="checkbox"], input[type="radio"] { flex-shrink: 0; }
.col { min-width: min(200px, 100%); }
.table-scroll { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 100%; }
.suggestions { max-height: min(48vh, 440px); max-height: min(48dvh, 440px); overflow-y: auto; overscroll-behavior: contain; }
.suggestions a > span { min-width: 0; overflow-wrap: anywhere; }
.suggestions img { flex-shrink: 0; }
.btn { white-space: normal; text-align: center; }
.btn .icon { flex-shrink: 0; }
.quantity { min-width: 0; }
.quantity button { flex-shrink: 0; }
.quantity span { text-align: center; }
dialog { min-width: 0; max-height: calc(var(--app-viewport-height, 100dvh) - 32px); overscroll-behavior: contain; }
.modal-head h2 { min-width: 0; overflow-wrap: anywhere; }
.modal-head .icon-button { flex-shrink: 0; }
.modal-body { min-width: 0; }
html.modal-open, html.drawer-open { overflow: hidden; }
html.modal-open body, html.drawer-open body { overflow: hidden; }
html.keyboard-open dialog { top: calc(var(--app-viewport-top, 0px) + 8px); bottom: auto; margin-top: 0; margin-bottom: 0; }
.admin-backdrop, .admin-drawer-close { display: none; }

/* Tablets: contained grids and a real overlay navigation for management. */
@media (min-width: 768px) and (max-width: 1023px) {
  .header-main { gap: 14px; }
  .header-actions { gap: 16px; }
  .logo, .logo img { width: 155px; }
  .navline { gap: 20px; overflow-x: auto; overscroll-behavior-x: contain; }
  .navline a { flex-shrink: 0; }
  .hero-layout { grid-template-columns: 1fr; }
  .hero-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head { flex-wrap: wrap; }
  .brand-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .catalog-layout { grid-template-columns: 1fr; }
  .catalog-toolbar .filter-trigger { display: inline-flex; }
  .catalog-layout > .filters { display: none; }
  .content-layout { grid-template-columns: minmax(0, 1fr) 270px; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-grid > .product-card:nth-child(4):last-child { display: flex; }

}

@media (max-width: 1023px) {
  .admin-shell { margin-left: 0; min-width: 0; }
  .admin-sidebar {
    width: min(300px, calc(100vw - 48px));
    height: 100vh;
    height: 100dvh;
    bottom: auto;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateX(-105%);
    transition: transform .18s ease;
    visibility: hidden;
    box-shadow: 10px 0 40px #10271e30;
    z-index: 60;
  }
  .admin-sidebar.open { transform: translateX(0); visibility: visible; }
  .admin-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #10251c80;
    backdrop-filter: blur(2px);
    z-index: 59;
    border-radius: 0;
  }
  .admin-drawer-close { display: inline-grid; position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 10px; width: 44px; height: 44px; background: #ffffff10; border: 0; color: white; }
  .admin-brand { padding: 22px 54px 22px 18px; }
  .admin-brand .mark { width: 30px; height: 30px; border-radius: 9px; font-size: 24px; }
  .admin-brand strong { font-size: 14px; }
  .admin-brand small { font-size: 9px; letter-spacing: 1px; }
  .admin-menu-trigger { display: inline-grid; width: 44px; height: 44px; flex-shrink: 0; }
  .admin-role-mobile { display: inline-grid; }
  .admin-profile { display: none; }
  .admin-header {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    min-height: 68px;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
    gap: 12px;
  }
  .admin-breadcrumb { margin-right: auto; flex: 1; min-width: 0; flex-wrap: wrap; gap: 4px 7px; }
  .admin-header-right { gap: 8px; flex-shrink: 0; }
  .admin-header-right > a { display: none; }
  .admin-header-right > .icon-button { width: 44px; height: 44px; }
  .admin-main { padding: 26px 24px 40px; }
  .sidebar-nav { padding: 10px 14px; overscroll-behavior: contain; }
  .sidebar-nav a { font-size: 14px; min-height: 46px; gap: 13px; }
  .sidebar-footer { margin-bottom: 12px; }
}

/* Phones: one consistent set of layout rules, including narrow 320px screens. */
@media (max-width: 767px) {
  body:not(.admin-body) { padding-bottom: var(--mobile-nav-height); }
  .wrap {
    padding-left: max(var(--mobile-gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--mobile-gutter), env(safe-area-inset-right, 0px));
  }
  h1 { font-size: clamp(27px, 7.2vw, 33px); letter-spacing: -.8px; line-height: 1.22; }
  h2 { font-size: clamp(23px, 5.8vw, 28px); letter-spacing: -.55px; line-height: 1.3; }
  h3 { font-size: 18px; }
  .section { padding-top: 32px; padding-bottom: 0; }
  .section-head { align-items: flex-start; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 18px; }
  .section-head h1, .section-head h2 { flex: 1 1 190px; }
  .section-head a, .section-head > .text-button { min-height: 36px; font-size: 13px; white-space: normal; }
  .section-head a .icon { width: 18px; height: 18px; }
  .page-title { padding-top: 6px; }
  .page-title > p { font-size: 15px; }
  .crumbs { font-size: 12px; line-height: 1.6; margin: 18px 0; gap: 5px; }
  .crumbs span { min-width: 0; overflow-wrap: anywhere; }
  .btn { min-height: 46px; font-size: 14px; padding: 12px 16px; }
  .btn.sm { min-height: 44px; }
  .icon-button { width: 44px; height: 44px; }
  .text-button { min-height: 44px; font-size: 14px; }
  .input, select, textarea, .search input, .admin-body .input, .admin-body select, .admin-body textarea {
    font-size: 16px;
    line-height: 1.4;
    min-height: 48px;
  }
  .label { font-size: 14px; }
  .field { margin-bottom: 18px; }
  .check { align-items: center; min-height: 40px; font-size: 14px; }
  .check input { width: 20px; height: 20px; margin: 0; }
  .form-row, .merch-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .row { gap: 12px; }
  .panel { padding: 20px; border-radius: 14px; }
  .notice { padding: 16px; font-size: 14px; gap: 10px; }
  .notice > div { min-width: 0; }
  .notice .icon { width: 20px; height: 20px; }
  .empty { padding: 36px 20px; }
  .empty h2 { font-size: 24px; }
  .empty p { font-size: 14px; }

  /* Compact header. The bottom navigation carries account and favourites. */
  .topline > .wrap { min-height: 36px; gap: 14px; }
  .city-btn { font-size: 13px; min-height: 36px; }
  .top-message { display: none; }
  .topline nav { font-size: 13px; }
  .topline nav a:not(:last-child) { display: none; }
  .header-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    align-items: center;
    gap: 10px;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 12px;
  }
  .logo { width: min(158px, 100%); margin: 0; grid-column: 1; grid-row: 1; }
  .logo img { width: 100%; height: 46px; object-fit: contain; object-position: left center; }
  .catalogue-button { grid-column: 2; grid-row: 1; order: 0; padding: 10px; width: 44px; height: 44px; min-height: 44px; border-radius: 10px; }
  .catalogue-button span { display: none; }
  .header-actions { grid-column: 3; grid-row: 1; display: block; }
  .header-actions .header-action:not(:last-child) { display: none; }
  .header-actions .header-action:last-child { width: 44px; height: 44px; display: grid; place-items: center; }
  .header-actions small { display: none; }
  .header-action > .icon { width: 24px; height: 24px; }
  .header-action .count { top: 0; right: 0; }
  .search-wrap { order: 0; grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .search { height: 49px; border-radius: 11px; }
  .search input { font-size: 16px; min-width: 0; padding-left: 13px; }
  .search button { width: 48px; }
  .navline { display: none; }
  .suggestions { top: 55px; padding: 7px; max-height: min(45dvh, 360px); }
  .suggestions a { min-height: 56px; padding: 8px; font-size: 14px; gap: 10px; }
  .suggestions small { font-size: 12px; }
  .mega {
    top: 100%;
    left: max(var(--mobile-gutter), env(safe-area-inset-left, 0px));
    right: max(var(--mobile-gutter), env(safe-area-inset-right, 0px));
    width: auto;
    transform: none;
    margin-top: 6px;
    grid-template-columns: minmax(0, 1fr);
    padding: 10px;
    gap: 5px;
    max-height: min(65dvh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .mega a { min-width: 0; min-height: 50px; font-size: 14px; padding: 12px; gap: 12px; }
  .mega a .icon:last-child { margin-left: auto; }
  .demo-strip > .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 11px; line-height: 1.5; padding-top: 8px; padding-bottom: 8px; }
  .demo-strip .demo-long { display: none; }
  .demo-strip a { font-size: 11px; }

  /* Homepage blocks retain their content without overflowing two-column cards. */
  .hero-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 18px; }
  .hero {
    min-height: 0;
    padding: 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px;
    align-items: center;
    gap: 12px 16px;
    border-radius: 18px;
  }
  .hero-copy { display: contents; }
  .hero .eyebrow { grid-column: 1 / -1; margin: 0; font-size: 10px; letter-spacing: 1.1px; }
  .hero h1 { grid-column: 1 / -1; font-size: clamp(28px, 7.5vw, 35px); line-height: 1.18; letter-spacing: -.9px; max-width: none; margin: 0 0 3px; }
  .hero p { grid-column: 1; margin: 0; max-width: none; font-size: 14px; line-height: 1.6; }
  .hero .btn { grid-column: 1; width: 100%; justify-self: start; font-size: 14px; padding: 11px 12px; gap: 8px; margin: 0; }
  .hero .btn .icon { width: 18px; height: 18px; }
  .hero-visual { position: relative; grid-column: 2; grid-row: 3 / 5; align-self: center; width: 100%; height: 140px; right: auto; top: auto; bottom: auto; margin: 0; }
  .hero-visual:before { width: 125px; height: 125px; }
  .hero-visual img { width: 100%; height: 100%; object-fit: contain; }
  .hero-note { position: static; grid-column: 1 / -1; font-size: 10px; text-align: right; margin-top: 3px; }
  .hero-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hero-aside .service-card { min-height: 0; padding: 18px 16px; border-radius: 14px; }
  .service-card .badge { max-width: 100%; white-space: normal; font-size: 10px; letter-spacing: .2px; }
  .service-card h3 { font-size: 18px; line-height: 1.3; margin: 13px 0 9px; }
  .service-card p { font-size: 13px; max-width: none; line-height: 1.6; }
  .service-card .text-button { font-size: 13px; gap: 7px; position: relative; }
  .service-card .text-button .icon { width: 17px; height: 17px; }
  .service-card > .icon { width: 48px; height: 48px; right: 12px; bottom: 18px; }
  .benefits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; padding: 24px 0; }
  .benefits > div { min-width: 0; align-items: flex-start; gap: 9px; }
  .benefits b { font-size: 12px; }
  .benefits small { font-size: 11px; }
  .benefits .icon { width: 22px; height: 22px; }
  .categories { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .category-tile { min-height: 100px; padding: 16px; font-size: 14px; gap: 12px; }
  .category-tile .icon { width: 28px; height: 28px; }
  .category-tile:last-child { grid-column: 1 / -1; min-height: 70px; flex-direction: row; align-items: center; justify-content: flex-start; }
  .product-grid, .catalog-layout .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-grid > .product-card:nth-child(4):last-child { display: flex; }
  .product-card { padding: 14px 12px; border-radius: 14px; }
  .product-card .fav { top: 5px; right: 5px; width: 44px; height: 44px; }
  .product-image { height: clamp(126px, 35vw, 195px); margin-bottom: 14px; }
  .product-card .type { font-size: 10px; line-height: 1.4; letter-spacing: .5px; min-height: 14px; }
  .product-card h3 { font-size: 14px; line-height: 1.5; min-height: 42px; }
  .product-card .sub { font-size: 12px; line-height: 1.5; min-height: 36px; margin-bottom: 12px; }
  .product-card .availability { font-size: 11px; line-height: 1.5; min-height: 32px; align-items: flex-start; }
  .availability:before { margin-top: 5px; flex-shrink: 0; }
  .product-card .price { font-size: 22px; margin-bottom: 12px; }
  .product-card .price.unknown { font-size: 13px; line-height: 1.5; min-height: 29px; }
  .product-card .btn { font-size: 13px; padding: 10px 8px; min-height: 46px; gap: 6px; }
  .product-card .btn .icon { width: 17px; height: 17px; }
  .product-card .quantity { min-height: 46px; font-size: 13px; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .product-card .quantity button { width: 44px; height: 46px; padding: 4px; }
  .product-card .quantity .icon { width: 16px; height: 16px; }
  .product-card .quantity span { font-size: 14px; line-height: 1.3; }
  .product-card .quantity-caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .brand-row { display: flex; width: 100%; gap: 12px; overflow-x: auto; margin: 0; padding: 0 0 8px; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
  .brand-tile { flex: 0 0 145px; min-width: 0; min-height: 95px; font-size: 22px; scroll-snap-align: start; }
  .brand-tile small { font-size: 11px; }

  .editorial-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .editorial-grid > .article-card:last-child { grid-column: auto; }
  .article-card { min-height: 180px; padding: 24px; }
  .article-card .icon { margin-bottom: 18px; }
  .article-card h3 { font-size: 20px; }
  .article-card p { font-size: 14px; }
  .newsletter { flex-direction: column; align-items: stretch; gap: 18px; margin-top: 32px; padding: 26px 0; }
  .newsletter p { font-size: 14px; }
  .newsletter .btn { width: 100%; }
  .smart-search-intro { padding: 20px 16px; gap: 12px; margin-top: 24px; }
  .smart-search-intro > div:last-child { min-width: 0; }
  .smart-search-icon { width: 36px; height: 36px; border-radius: 10px; }
  .smart-search-intro h3 { font-size: 19px; line-height: 1.4; }
  .smart-search-intro p { font-size: 14px; }
  .search-examples { gap: 8px; }
  .search-examples a { font-size: 12px; min-width: 0; min-height: 36px; display: flex; align-items: center; gap: 6px; padding: 8px 11px; }
  .search-examples .icon { margin-left: auto; }

  /* Catalog and detailed shopping flows. */
  .catalog-layout { grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 24px; }
  .catalog-layout > .filters { display: none; }
  .catalog-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; margin-bottom: 18px; }
  .catalog-toolbar > .small { grid-column: 1 / -1; font-size: 14px; }
  .catalog-toolbar .filter-trigger { display: inline-flex; min-height: 46px; font-size: 14px; padding: 10px; }
  .catalog-toolbar select { width: 100%; max-width: none; font-size: 16px; padding: 11px 9px; }
  .chips { gap: 8px; }
  .chip { min-height: 36px; font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
  .filter-group .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .filter-group input[type="number"] { font-size: 16px; min-height: 48px; padding: 11px; }
  .filter-group nav a { min-height: 40px; display: flex; align-items: center; font-size: 14px; }
  .filter-group .check { font-size: 14px; margin: 8px 0; }
  .pdp-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; margin: 22px 0; }
  .pdp-photo { grid-column: auto; grid-row: auto; height: clamp(260px, 77vw, 390px); }
  .pdp-copy { grid-column: auto; grid-row: auto; }
  .pdp-copy h1 { font-size: 28px; margin: 14px 0; }
  .pdp-copy > p { font-size: 15px; }
  .buybox { grid-column: auto; grid-row: auto; position: static; padding: 22px; }
  .buybox .delivery-row { font-size: 14px; }
  .buybox .notice { font-size: 13px; }
  .spec-list > div { flex-wrap: wrap; gap: 5px 16px; }
  .spec-list dd { min-width: 0; flex: 1; }
  .tabs { gap: 24px; margin: 24px 0; overscroll-behavior-x: contain; }
  .tabs button { min-height: 48px; font-size: 14px; flex-shrink: 0; }
  .tab-panel { font-size: 15px; }
  .cart-layout, .checkout-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 24px; }
  .summary-card { position: static; padding: 22px; }
  .checkout-layout .summary-card { grid-row: auto; }
  .summary-row { font-size: 14px; flex-wrap: wrap; }
  .summary-total { font-size: 22px; }
  .cart-item { position: relative; display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px 16px; padding: 22px 0; }
  .cart-item > a { grid-column: 1; grid-row: 1 / 4; }
  .cart-item img { width: 62px; height: 88px; }
  .cart-item > div:not(.quantity):not(.price) { grid-column: 2; grid-row: 1; padding-right: 36px; }
  .cart-item h3 { font-size: 15px; line-height: 1.5; }
  .cart-item p { font-size: 12px; }
  .cart-item .text-button { font-size: 13px; }
  .cart-item > .price { grid-column: 2; grid-row: 2; text-align: left; font-size: 21px; }
  .cart-item > .quantity { grid-column: 2; grid-row: 3; width: 150px; max-width: 100%; min-height: 46px; }
  .cart-item > .quantity button { width: 46px; height: 46px; }
  .cart-item > .icon-button { position: absolute; right: -4px; top: 17px; width: 44px; height: 44px; }
  #promo-form .flex { flex-wrap: wrap; }
  #promo-form .input { flex: 1 1 100%; }
  #promo-form .btn { width: 100%; }
  .stepper { gap: 8px; justify-content: space-between; margin: 22px 0; }
  .stepper > div { flex: 1; min-width: 0; flex-direction: column; gap: 7px; font-size: 12px; text-align: center; }
  .stepper b { width: 30px; height: 30px; }
  .option-card { padding: 16px; margin-bottom: 12px; }
  .option-card h3 { font-size: 16px; }
  .option-card p { font-size: 13px; }
  #checkout-form h2 { font-size: 24px; }
  #checkout-form .panel > .flex { flex-wrap: wrap; align-items: flex-start; gap: 6px 12px; }
  #checkout-form .panel > .flex > b { overflow-wrap: anywhere; }
  .content-layout, .account-layout, .help-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .account-nav { display: flex; width: 100%; overflow-x: auto; gap: 6px; margin: 0; padding-bottom: 6px; overscroll-behavior-x: contain; }
  .account-nav a { font-size: 13px; padding: 11px 12px; min-height: 44px; flex-shrink: 0; }
  .account-nav .icon { width: 18px; height: 18px; }
  .order-card { padding: 20px; }
  .order-card .between { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .order-card .order-images { flex-wrap: wrap; }
  .branch-directory { grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 22px; }
  .branch-card { padding: 22px; }
  .branch-card-details { padding: 22px 20px 0; }
  .branch-card-details h3 { font-size: 23px; }
  .branch-card-details .flex { flex-wrap: wrap; }
  .branch-card-details .small { font-size: 12px; }
  .branch-map { height: 270px; }
  .branch-directory .branch-map-caption { font-size: 13px; padding: 0 20px; min-height: 0; }
  .branch-card-actions { padding: 4px 20px 22px; gap: 10px 16px; }
  .branch-card-actions .btn { width: 100%; font-size: 14px; }
  .branch-card-actions .text-button { font-size: 14px; }
  .branch-card .flex { flex-wrap: wrap; }
  .branch-illustration { min-height: 220px; padding: 28px; }
  .prose p, .prose li { font-size: 15px; }
  .prose h2 { font-size: 24px; }
  .help-grid { gap: 16px; }

  /* App dialog: compact content on phones. */
  .store-download { width: 100%; min-width: 0; min-height: 59px; justify-content: center; padding: 11px 16px; }
  .store-download b { font-size: 20px; }
  .store-download small { font-size: 11px; }
  dialog {
    width: calc(100% - 24px);
    max-width: 560px;
    max-height: calc(var(--app-viewport-height, 100dvh) - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    padding: 0;
    margin: auto;
    border-radius: 18px;
    overflow: auto;
  }
  .modal-head { padding: 16px 20px; gap: 12px; }
  .modal-head h2 { font-size: 21px; line-height: 1.3; }
  .modal-body { padding: 22px 20px; }
  .modal-actions { flex-wrap: wrap; gap: 12px; margin-top: 22px; }
  .modal-actions > .btn { flex: 1 1 100%; min-width: 0; }
  .app-install-modal { max-width: 480px; overflow: auto; }
  .app-install-modal .modal-head { padding: 14px 20px 8px; }
  .app-install-modal .modal-head h2 { font-size: 17px; }
  .app-install-modal .modal-body { padding: 0; }
  .app-popup { display: block; min-height: 0; }
  .app-popup-art { display: none; }
  .app-popup-copy { padding: 16px 24px 24px; align-items: stretch; }
  .app-popup-copy .eyebrow { font-size: 10px; letter-spacing: 1px; margin-bottom: 12px; }
  .app-popup-copy h3 { font-size: 27px; line-height: 1.2; margin-bottom: 14px; }
  .app-popup-copy > p { font-size: 14px; line-height: 1.65; margin-bottom: 18px; }
  .app-perks { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-bottom: 20px; font-size: 12px; }
  .app-perks .icon { width: 17px; height: 17px; }
  .app-popup-copy .store-buttons { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; width: 100%; }
  .app-popup-copy .store-download { min-width: 0; min-height: 57px; padding: 11px 16px; gap: 12px; }
  .app-popup-copy .store-download b { font-size: 20px; }
  .app-popup-copy .store-download small { font-size: 11px; }
  .app-popup-copy .store-download .icon { width: 25px; height: 25px; }
  .app-popup-copy > .text-button { justify-content: center; font-size: 14px; margin-top: 12px; }

  /* Footer and fixed bottom navigation account for the iOS home indicator. */
  footer { margin-top: 28px; padding: 30px 0 0; }
  footer .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 28px 18px !important; }
  footer .footer-grid > div:first-child { grid-column: 1 / -1; display: block; }
  footer .footer-grid > div:last-child { grid-column: 1 / -1; }
  .footer-logo { width: 165px; margin-bottom: 16px; }
  footer .phone { font-size: 24px; margin-top: 14px; }
  footer h3 { font-size: 15px; }
  footer p, footer a { font-size: 13px; }
  footer a { min-height: 32px; }
  .footer-bottom { flex-wrap: wrap; gap: 10px 18px; padding-top: 20px; padding-bottom: 24px; font-size: 12px; }
  .footer-bottom a { font-size: 12px; margin: 0; }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 25;
    border-top: 1px solid var(--line);
    background: #fffffff5;
    backdrop-filter: blur(12px);
    padding: 7px max(5px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(5px, env(safe-area-inset-left, 0px));
  }
  .mobile-nav a { min-width: 0; min-height: 48px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 2px; font-size: 11px; line-height: 1.25; color: #586c5d; text-align: center; }
  .mobile-nav .icon { width: 22px; height: 22px; }
  .mobile-nav a.active { color: var(--green); font-weight: 800; }
  .mobile-nav a.active:before { content: ''; position: absolute; top: -7px; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--green); }
  #toast { bottom: calc(var(--mobile-nav-height) + 14px); max-width: calc(100% - 32px); font-size: 14px; padding: 13px 18px; }
  .keyboard-open .mobile-nav { display: none; }
  .keyboard-open #toast { bottom: 16px; }

  /* Management: usable controls and bounded tables, not a compressed desktop. */
  .admin-body { padding-bottom: 0; }
  .admin-header { gap: 9px; padding: 10px 12px; min-height: 66px; }
  .admin-header-right { gap: 4px; }
  .admin-breadcrumb { font-size: 11px; line-height: 1.4; }
  .admin-breadcrumb b { font-size: 13px; overflow-wrap: anywhere; }
  .admin-main { padding: 22px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
  .admin-title { flex-wrap: wrap; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
  .admin-title > div:first-child { flex: 1 1 100%; }
  .admin-title h1 { font-size: 28px; line-height: 1.25; }
  .admin-title p { font-size: 13px; line-height: 1.6; }
  .admin-title > .row { justify-content: flex-start; width: 100%; gap: 10px; }
  .admin-title .btn, .admin-title .row .btn { font-size: 13px; min-height: 44px; padding: 11px 14px; white-space: normal; }
  .admin-demo { font-size: 12px; line-height: 1.65; padding: 14px; align-items: flex-start; }
  .admin-demo span { align-items: flex-start; }
  .admin-demo a { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
  .stat-card { padding: 17px 14px; }
  .stat-card .stat-top { font-size: 12px; align-items: flex-start; gap: 8px; }
  .stat-top > span { min-width: 0; overflow-wrap: anywhere; }
  .stat-number { font-size: clamp(24px, 6.5vw, 33px); letter-spacing: -.7px; margin: 12px 0 8px; overflow-wrap: anywhere; }
  .stat-caption { font-size: 11px; line-height: 1.6; }
  .dashboard-grid, .admin-two-col { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .admin-card-head { padding: 18px; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .admin-card-head h2 { font-size: 17px; }
  .admin-card-head .text-button { font-size: 12px; min-height: 30px; }
  .admin-card-content { padding: 18px; }
  .admin-body .notice { padding: 15px; font-size: 13px; }
  .admin-body .small { font-size: 13px; }
  .admin-body .btn, .admin-body .btn.sm { min-height: 44px; font-size: 13px; padding: 10px 14px; }
  .admin-body .form-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .admin-body .label { font-size: 14px; }
  .admin-body .field small { font-size: 12px; }
  .admin-body .panel { padding: 18px; }
  .admin-toolbar { display: flex; flex-wrap: wrap; padding: 16px; gap: 12px; }
  .admin-search { max-width: none; min-width: 0; flex: 1 1 100%; }
  .admin-search .icon { top: 15px; }
  .admin-toolbar select { max-width: 100%; width: 100%; flex: 1 1 100%; min-height: 46px; font-size: 16px; padding: 11px 32px 11px 12px; }
  .admin-toolbar .btn { flex: 1 1 auto; min-height: 44px; font-size: 14px; }
  .admin-body table { font-size: 13px; }
  .admin-body th { font-size: 12px; }
  .admin-body td, .admin-body th { padding: 14px; }
  .admin-body .table-scroll table { min-width: 580px; }
  .table-product { min-width: 190px; }
  .table-product b { max-width: 225px; }
  .admin-table-actions .icon-button { width: 44px; height: 44px; }
  .admin-tabs { gap: 22px; margin-bottom: 18px; padding-bottom: 1px; overscroll-behavior-x: contain; }
  .admin-tabs a { font-size: 13px; min-height: 44px; flex-shrink: 0; }
  .admin-footerline { padding: 14px 16px; font-size: 12px; flex-wrap: wrap; gap: 8px; }
  .bar-row { grid-template-columns: minmax(80px, 1fr) minmax(0, 1.2fr) 24px; gap: 10px; font-size: 12px; }
  .task-item { gap: 10px; align-items: flex-start; }
  .task-item > div { min-width: 0; }
  .task-item .task-icon { flex-shrink: 0; }
  .task-item h3 { font-size: 14px; }
  .task-item p { font-size: 12px; }
  .task-item .badge { flex-shrink: 0; }
  .detail-pair { font-size: 13px; flex-wrap: wrap; gap: 6px 14px; }
  .detail-pair b { flex: 1; min-width: 120px; }
  .admin-body .timeline > div { font-size: 13px; }
  .admin-body .timeline small { font-size: 12px; }
  .integration-grid, .role-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .integration-card { padding: 22px; }
  .integration-card h3 { font-size: 20px; }
  .integration-card p { font-size: 14px; }
  .role-card h3 { font-size: 18px; }
  .role-card p { font-size: 14px; }
  .requirements-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .requirements-summary > .stat-card:last-child { grid-column: 1 / -1; }
  .requirement-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 18px; }
  .requirement-row > div:last-child { grid-column: auto; }
  .requirement-row h3 { font-size: 15px; }
  .requirement-row p { font-size: 13px; line-height: 1.7; }
  .requirement-row a { font-size: 13px; display: inline-flex; min-height: 36px; align-items: center; }
  .requirement-row .code { font-size: 12px; }
  .requirements-filter { flex-wrap: wrap; }
  .admin-cms-preview { padding: 20px; gap: 15px; }
  .admin-cms-preview > div { min-width: 0; flex: 1; }
  .admin-cms-preview img { width: 70px; flex-shrink: 0; }
  .admin-cms-preview h3 { font-size: 24px; }
  .admin-cms-preview p { font-size: 13px; }
  .admin-body dialog { width: calc(100% - 24px); max-width: 560px; }
  .admin-body .modal-head { padding: 16px 20px; }
  .admin-body .modal-head h2 { font-size: 21px; }
  .admin-body .modal-body { padding: 22px 20px; }
  .admin-body .empty { padding: 32px 20px; }
  .admin-body .empty h2 { font-size: 23px; }
  .admin-body .empty p { font-size: 14px; }
  .admin-body #toast { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 359px) {
  :root { --mobile-gutter: 14px; }
  .hero { padding: 20px; grid-template-columns: minmax(0, 1fr) 82px; gap: 12px; }
  .hero h1 { font-size: 28px; }
  .hero-visual { height: 120px; }
  .hero-visual:before { width: 105px; height: 105px; }
  .hero p { font-size: 13px; }
  .hero-aside { grid-template-columns: minmax(0, 1fr); }
  .hero-aside .service-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .hero-aside .service-card .badge { grid-column: 1; justify-self: start; }
  .hero-aside .service-card h3 { grid-column: 1; margin: 6px 0; }
  .hero-aside .service-card p { grid-column: 1; margin: 0; }
  .hero-aside .service-card .text-button { grid-column: 2; grid-row: 2 / 4; align-self: center; }
  .hero-aside .service-card > .icon { display: none; }
  .product-grid, .catalog-layout .product-grid { gap: 10px; }
  .product-card { padding: 13px 10px; }
  .product-card .btn { font-size: 12px; padding: 10px 6px; }
  .product-card .price { font-size: 21px; }
  .app-popup-copy { padding: 16px 20px 20px; }
  .app-popup-copy h3 { font-size: 25px; }
  .admin-header { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .admin-header-right { gap: 0; }
  .admin-cms-preview img { display: none; }
}

@media (max-height: 520px) and (max-width: 1023px) {
  dialog, .app-install-modal { max-height: calc(var(--app-viewport-height, 100dvh) - 16px); overflow: auto; }
  .app-popup-art { display: none; }
  .app-popup { display: block; min-height: 0; }
  .app-popup-copy { padding: 18px 24px; }
  .modal-head { padding-top: 10px; padding-bottom: 10px; }
  .sidebar-footer { display: none; }
  .admin-brand { padding-top: 12px; padding-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-sidebar { transition: none; }
}
