/* QuickMart responsive layout. Presentation only, no data or action changes. */
@media (max-width: 639px) {
  main, section, article, form, fieldset { min-width: 0; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
  .qm-portal-bar { flex-wrap: wrap; gap: 6px 8px; padding: 10px 12px 8px; }
  .qm-portal-bar [data-testid=link-home] { flex: 1 1 auto; min-width: 0; gap: 6px; }
  .qm-portal-bar [data-testid=link-home] > svg { width: 30px; height: 30px; }
  .qm-portal-bar > div:last-child { flex: 0 0 auto; margin-inline-start: auto; }
  .qm-portal-bar [data-testid=text-portal-title] { order: 5; flex: 1 0 100%; white-space: normal; overflow: visible; text-align: center; font-size: 12px; line-height: 1.4; }
  .qm-portal-bar button { min-width: 40px; min-height: 40px; }
  .qm-merchant-main { padding-inline: 12px; padding-top: 16px; }
  .qm-merchant-tabs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 6px; border: 0; overflow: visible; margin-top: 20px; }
  .qm-merchant-tabs > button { min-width: 0; min-height: 50px; padding: 8px 4px; margin: 0; border: 1px solid #dfe1e7; border-bottom-width: 2px; border-radius: 12px; background: #fff; white-space: normal; line-height: 1.35; font-size: 13px; overflow-wrap: anywhere; }
  .qm-merchant-tabs > button.border-\[\#F2645A\] { border-color: #F2645A; background: #fff7f3; }
  .qm-order-filters { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; overflow: visible; }
  .qm-order-filters > button { min-width: 0; min-height: 44px; height: auto; padding: 8px 4px; font-size: 13px; white-space: normal; }
  .qm-product-row { display: grid; grid-template-columns: 56px minmax(0,1fr); gap: 12px; align-items: start; padding-block: 16px; }
  .qm-product-row > img { width: 56px; height: 56px; grid-column: 1; grid-row: 1; }
  .qm-product-identity { grid-column: 2; grid-row: 1; align-self: center; min-width: 0; width: 100%; }
  .qm-product-identity > p:first-child { line-height: 1.6; overflow-wrap: anywhere; word-break: normal; }
  .qm-product-identity > p:last-child { margin-top: 4px; line-height: 1.5; overflow-wrap: anywhere; }
  .qm-product-controls { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0,1fr) minmax(68px,auto); gap: 10px; width: 100%; min-width: 0; }
  .qm-price-stepper { display: flex; width: 100%; min-width: 0; border-radius: 12px; }
  .qm-price-stepper button { width: 44px; min-width: 44px; height: 44px; }
  .qm-price-stepper input { width: 100%; min-width: 0; flex: 1 1 0; height: 44px; }
  .qm-product-controls > button { min-height: 44px; height: auto; padding: 8px 14px; font-size: 14px; border-radius: 12px; }
  .qm-product-availability { grid-column: 1 / -1; justify-self: stretch; justify-content: space-between; flex-direction: row-reverse; min-height: 44px; gap: 12px; padding: 8px 12px; border-radius: 10px; background: #f5f6f8; font-size: 14px; }
  .qm-product-availability > button { flex-shrink: 0; }
  [data-testid^=merchant-money-] dl > div { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 8px; }
  [data-testid^=merchant-money-] dt { min-width: 0; overflow-wrap: anywhere; }
  [data-testid^=merchant-money-] dd { white-space: nowrap; }
  .qm-merchant-main [data-testid^=stat-] { overflow-wrap: anywhere; }
  [data-testid=merchant-settle-form], [data-testid=merchant-settle-form] > label { min-width: 0; }
  [data-testid=merchant-settle-form] button { min-height: 44px; }
  [data-testid=preview-settle-proof] { max-width: 100%; }
}
@media (max-width: 359px) {
  .qm-merchant-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .qm-merchant-main { padding-inline: 10px; }
  .qm-product-controls { grid-template-columns: minmax(0,1fr) 66px; gap: 8px; }
  .qm-product-controls > button { padding-inline: 10px; }
}

@media (max-width: 479px) {
 .qm-customer-bar { flex-wrap: wrap; gap: 6px 8px; padding: 10px 12px 8px; }
 .qm-customer-bar [data-testid=link-home] { flex: 1 1 auto; min-width: 0; }
 .qm-customer-actions { flex: 1 0 100%; min-width: 0; justify-content: space-between; margin: 0; }
 .qm-customer-actions [data-testid=button-cart] { min-height: 44px; padding-inline: 12px; }
 .qm-customer-header [data-testid=button-location] { max-width: 100%; }
}

@media (max-width: 639px) {
 .qm-admin-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; border: 0; overflow: visible; margin-block: 16px; }
 .qm-admin-tabs > button { min-width: 0; min-height: 48px; margin: 0; padding: 8px; white-space: normal; justify-content: center; line-height: 1.4; border: 1px solid #dfe1e7; border-radius: 12px; background: #fff; }
 .qm-admin-tabs > button.border-\[\#F2645A\] { border-color: #F2645A; background: #fff7f3; }
}
/* Camera helper belongs only to the merchant route. */
.qmcp-fab { display: block; margin: 12px auto; padding: 12px 18px; border-radius: 14px; background: #12141f; color: #fff; font-weight: 600; animation: none !important; }
.qmcp-modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: #12141fb3; overflow: auto; }
.qmcp-card { width: min(100%,460px); max-height: calc(100dvh - 32px); overflow: auto; background: #fff; border-radius: 20px; padding: 20px; color: #12141f; box-shadow: 0 20px 60px #0003; }
.qmcp-card h3 { margin-bottom: 16px; font-size: 20px; font-weight: 700; }
.qmcp-card video, .qmcp-card canvas, .qmcp-card img { display: block; max-width: 100%; max-height: 42dvh; height: auto; margin-inline: auto; border-radius: 12px; object-fit: contain; }
.qmcp-card canvas { touch-action: none; }
.qmcp-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.qmcp-btn { min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid #dfe1e7; font-weight: 600; }
.qmcp-primary { background: #12141f; color: #fff; }
.qmcp-input { display: block; min-width: 0; width: 100%; min-height: 44px; border: 1px solid #dfe1e7; border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 16px; }

/* qm-brand-dock-20261122: mobile header keeps the hamburger at start and the
   QuickMart brand exactly centered in row 1. The action controls (language,
   profile, night mode, cart) leave the header and become a floating glass
   dock centered at the bottom of the screen, with smooth state transitions
   and a soft entrance, per the owner's 2026-11-22 direction. All control
   functions, day/night colors and RTL/LTR placement are preserved; the dock
   hides while a field is focused so it never covers keyboard or submit.
   Desktop (md+) is unchanged: controls stay in the header there. */
@keyframes qm-dock-in {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 767px) {
  .qm-customer-header .qm-customer-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }
  .qm-customer-header .qm-customer-bar > *:first-child {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }
  .qm-customer-header .qm-customer-bar > [data-testid="link-home"] {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }
  .qm-customer-header .qm-customer-actions {
    position: fixed;
    inset-inline: 0;
    margin-inline: auto;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: max-content;
    max-width: calc(100vw - 32px);
    z-index: 45;
    gap: 4px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    backdrop-filter: blur(18px) saturate(1.5);
    border: 1px solid rgba(18, 20, 31, .1);
    box-shadow: 0 14px 34px -12px rgba(18, 20, 31, .35);
    color: #12141F;
    animation: qm-dock-in .45s cubic-bezier(.2, .9, .25, 1.15) .15s backwards;
    transition: transform .25s ease, opacity .25s ease, background-color .25s ease, border-color .25s ease;
  }
  html.qm-night .qm-customer-header .qm-customer-actions {
    background: rgba(21, 24, 32, .62);
    border-color: rgba(255, 255, 255, .14);
    box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .6);
    color: #F2EEE2;
  }
  .qm-customer-header .qm-customer-actions > * {
    transition: transform .18s ease, background-color .25s ease, color .25s ease, border-color .25s ease;
  }
  .qm-customer-header .qm-customer-actions > *:active { transform: scale(.88); }
  .qm-customer-header .qm-customer-actions [data-testid="button-lang"],
  .qm-customer-header .qm-customer-actions [data-testid="link-profile"],
  .qm-customer-header .qm-customer-actions [data-testid="link-login"],
  .qm-customer-header .qm-customer-actions [data-testid="link-orders"],
  .qm-customer-header .qm-customer-actions [data-testid="button-logout"] {
    color: inherit;
  }
  .qm-customer-header .qm-customer-actions.qm-dock-away {
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px);
  }
  .qm-customer-header .qm-customer-actions [data-testid="button-cart"] {
    background: #12141F;
    color: #fff;
  }
  html.qm-night .qm-customer-header .qm-customer-actions [data-testid="button-cart"] {
    background: #F2EEE2;
    color: #171A1D;
  }
  body:has(:where(input, textarea, select):focus) .qm-customer-header .qm-customer-actions {
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px);
  }
  body { padding-bottom: 96px; }
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .qm-customer-header .qm-customer-actions { animation: none; }
  .qm-customer-header .qm-customer-actions > * { transition: none; }
}
