/* AL-RAHUZ STORE - progressive storefront stylesheet.
   Keep first-paint/layout-critical rules in critical.css; place non-critical
   enhancements here so the shell can stay lighter over time without visual
   churn during production rollout. */

.shop-toast--queue {
  border-left: 3px solid var(--color-brand, #1e40af);
}

/* ============================================================
   Storefront live chat — customer widget (enterprise redesign)
   ============================================================ */
.sf-chat-widget {
  --sfc-accent: #0f766e;
  --sfc-accent-2: #0e7490;
  --sfc-ink: #0f172a;
  --sfc-muted: #64748b;
  --sfc-line: #e6eaf0;
  --sfc-bg: #f6f8fb;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  font-family: inherit;
}
/* The `hidden` attribute (toggled from chat.js) must always win over any
   explicit `display` set on widget elements. Without this, [hidden] is
   silently ignored on elements styled display:flex/block. */
.sf-chat-widget [hidden] { display: none !important; }

/* ---- Launcher (FAB) ---- */
.sf-chat-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sfc-accent), var(--sfc-accent-2));
  color: #fff;
  box-shadow: 0 16px 38px rgba(15, 118, 110, .34);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 12px 20px 12px 14px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sf-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 22px 48px rgba(15, 118, 110, .42); }
.sf-chat-launcher:active { transform: translateY(0); }
.sf-chat-launcher:focus-visible { outline: 3px solid rgba(15, 118, 110, .4); outline-offset: 2px; }
.sf-chat-launcher__glyph { width: 26px; height: 26px; flex: 0 0 auto; }
.sf-chat-launcher__glyph--close { display: none; }
.sf-chat-launcher[aria-expanded="true"] .sf-chat-launcher__glyph--open { display: none; }
.sf-chat-launcher[aria-expanded="true"] .sf-chat-launcher__glyph--close { display: block; }
.sf-chat-launcher__label { font-size: 14px; letter-spacing: .01em; }
.sf-chat-launcher__dot {
  position: absolute;
  top: 6px; right: 10px;
  width: 12px; height: 12px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 3px #fff;
  animation: sfc-pulse 1.8s ease-out infinite;
}
@keyframes sfc-pulse { 0% { box-shadow: 0 0 0 3px #fff, 0 0 0 0 rgba(239,68,68,.5); } 70% { box-shadow: 0 0 0 3px #fff, 0 0 0 8px rgba(239,68,68,0); } 100% { box-shadow: 0 0 0 3px #fff, 0 0 0 0 rgba(239,68,68,0); } }

/* ---- Window ---- */
.sf-chat-window {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(400px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--sfc-line);
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .26);
  transform-origin: bottom right;
  animation: sfc-pop .22s cubic-bezier(.2, .8, .25, 1);
}
@keyframes sfc-pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---- Header ---- */
.sf-chat-window__header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--sfc-accent), var(--sfc-accent-2));
  color: #fff;
  padding: 14px 14px 14px 16px;
}
.sf-chat-window__brand-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
}
.sf-chat-window__brand-avatar svg { width: 22px; height: 22px; }
.sf-chat-window__heading { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.sf-chat-window__heading strong { display: block; font-size: 15.5px; font-weight: 700; }
.sf-chat-window__status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; opacity: .92; }
.sf-chat-window__online { width: 8px; height: 8px; border-radius: 999px; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .28); }
.sf-chat-window__close {
  border: 0; border-radius: 10px;
  width: 34px; height: 34px; flex: 0 0 auto;
  background: rgba(255, 255, 255, .14);
  color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.sf-chat-window__close:hover { background: rgba(255, 255, 255, .28); }
.sf-chat-window__close svg { width: 18px; height: 18px; }

/* ---- Guest (signed-out) ---- */
.sf-chat-window__guest { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 28px 26px; color: var(--sfc-muted); }
.sf-chat-window__guest-icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 999px; background: rgba(15, 118, 110, .1); color: var(--sfc-accent); margin-bottom: 6px; }
.sf-chat-window__guest-icon svg { width: 28px; height: 28px; }
.sf-chat-window__guest h4 { margin: 0; font-size: 17px; color: var(--sfc-ink); }
.sf-chat-window__guest p { margin: 0; font-size: 13.5px; line-height: 1.5; max-width: 280px; }
.sf-chat-window__guest-cta { margin-top: 14px; display: inline-flex; border-radius: 12px; background: linear-gradient(135deg, var(--sfc-accent), var(--sfc-accent-2)); color: #fff; font-weight: 700; padding: 11px 22px; text-decoration: none; box-shadow: 0 10px 24px rgba(15, 118, 110, .28); }
.sf-chat-window__guest-cta:hover { filter: brightness(1.05); }

/* ---- Body ---- */
.sf-chat-window__body { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; background: var(--sfc-bg); }

/* Start bar: search + contact picker */
.sf-chat-startbar { display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 10px; border-bottom: 1px solid var(--sfc-line); background: #fff; }
.sf-chat-search { position: relative; display: flex; align-items: center; }
.sf-chat-search svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--sfc-muted); pointer-events: none; }
.sf-chat-search input { width: 100%; border: 1px solid var(--sfc-line); border-radius: 10px; background: var(--sfc-bg); color: var(--sfc-ink); padding: 9px 12px 9px 34px; font: inherit; font-size: 13.5px; }
.sf-chat-search input:focus { outline: none; border-color: var(--sfc-accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); background: #fff; }
.sf-chat-contact { width: 100%; border: 1px solid var(--sfc-line); border-radius: 10px; background: var(--sfc-bg); color: var(--sfc-ink); padding: 9px 12px; font: inherit; font-size: 13.5px; cursor: pointer; }
.sf-chat-contact:focus { outline: none; border-color: var(--sfc-accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }

/* Thread list (vertical, recent conversations) */
.sf-chat-thread-list { flex: 0 0 auto; max-height: 34%; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--sfc-line); background: #fff; }
.sf-chat-thread-list:empty { display: none; }
.sf-chat-thread {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: 0; border-radius: 12px;
  background: transparent; color: var(--sfc-ink);
  cursor: pointer; padding: 8px 10px; text-align: left;
  transition: background .12s ease;
}
.sf-chat-thread:hover { background: var(--sfc-bg); }
.sf-chat-thread.is-active { background: rgba(15, 118, 110, .09); }
.sf-chat-thread__avatar { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 999px; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; font-weight: 700; font-size: 14px; }
.sf-chat-thread__main { flex: 1 1 auto; min-width: 0; }
.sf-chat-thread strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-chat-thread span { display: block; margin-top: 1px; color: var(--sfc-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-chat-thread__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.sf-chat-thread__time { color: var(--sfc-muted); font-size: 11px; }
.sf-chat-thread em { min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--sfc-accent); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; }
.sf-chat-thread.is-overdue strong { color: #b91c1c; }

/* Messages */
.sf-chat-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--sfc-bg); scroll-behavior: smooth; }
.sf-chat-messages::-webkit-scrollbar { width: 7px; }
.sf-chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }

.sf-chat-empty { margin: auto; max-width: 250px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--sfc-muted); font-size: 13px; text-align: center; padding: 20px; }
.sf-chat-empty__icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 999px; background: rgba(15, 118, 110, .08); color: var(--sfc-accent); }
.sf-chat-empty__icon svg { width: 26px; height: 26px; }
.sf-chat-empty--compact { margin: 4px auto; padding: 8px 12px; flex-direction: row; font-size: 12px; }
.sf-chat-error { max-width: none; margin: 8px 0 0; flex-direction: row; border-radius: 10px; border: 1px solid #fecaca; background: #fef2f2; color: #991b1b; padding: 9px 12px; }

/* Message bubble */
.sf-chat-message { position: relative; display: flex; gap: 8px; max-width: 100%; margin: 0; padding: 3px 0; animation: sfc-msg .18s ease; }
@keyframes sfc-msg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sf-chat-message__avatar { width: 28px; height: 28px; flex: 0 0 auto; align-self: flex-end; border-radius: 999px; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sf-chat-message__bubble { max-width: 78%; border-radius: 14px 14px 14px 4px; background: #fff; border: 1px solid var(--sfc-line); color: var(--sfc-ink); padding: 8px 11px; box-shadow: 0 1px 1px rgba(15, 23, 42, .04); }
.sf-chat-message__name { display: block; color: var(--sfc-accent); font-size: 11px; font-weight: 700; margin-bottom: 2px; }
.sf-chat-message p { margin: 0; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.sf-chat-message__meta { display: flex; align-items: center; gap: 5px; justify-content: flex-end; margin-top: 3px; color: var(--sfc-muted); font-size: 10.5px; }
.sf-chat-message__att { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 7px 10px; border-radius: 10px; background: var(--sfc-bg); border: 1px solid var(--sfc-line); color: var(--sfc-accent); font-size: 12px; font-weight: 600; text-decoration: none; }
.sf-chat-message__att:hover { background: #eef2f7; }
.sf-chat-message.is-mine { flex-direction: row-reverse; }
.sf-chat-message.is-mine .sf-chat-message__avatar { display: none; }
.sf-chat-message.is-mine .sf-chat-message__bubble { border-radius: 14px 14px 4px 14px; background: linear-gradient(135deg, #0f766e, #0e7490); border-color: transparent; color: #fff; }
.sf-chat-message.is-mine .sf-chat-message__name { display: none; }
.sf-chat-message.is-mine .sf-chat-message__meta { color: rgba(255, 255, 255, .82); }
.sf-chat-message.is-mine .sf-chat-message__att { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .28); color: #fff; }

/* Typing indicator */
.sf-chat-typing { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0 4px 36px; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: #fff; border: 1px solid var(--sfc-line); width: fit-content; }
.sf-chat-typing i { width: 6px; height: 6px; border-radius: 999px; background: var(--sfc-muted); animation: sfc-typing 1.2s infinite ease-in-out; }
.sf-chat-typing i:nth-child(2) { animation-delay: .15s; }
.sf-chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes sfc-typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Compose */
.sf-chat-compose { display: flex; align-items: flex-end; gap: 8px; border-top: 1px solid var(--sfc-line); background: #fff; padding: 10px 12px; }
.sf-chat-attach { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; color: var(--sfc-muted); cursor: pointer; transition: background .12s ease, color .12s ease; }
.sf-chat-attach:hover { background: var(--sfc-bg); color: var(--sfc-accent); }
.sf-chat-attach svg { width: 20px; height: 20px; }
.sf-chat-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sf-chat-compose__field { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sf-chat-compose textarea { width: 100%; max-height: 110px; resize: none; border: 1px solid var(--sfc-line); border-radius: 12px; background: var(--sfc-bg); color: var(--sfc-ink); padding: 9px 13px; font: inherit; font-size: 13.5px; line-height: 1.4; }
.sf-chat-compose textarea:focus { outline: none; border-color: var(--sfc-accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); background: #fff; }
.sf-chat-attach-name { margin: 4px 2px 0; font-size: 11.5px; color: var(--sfc-accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-chat-send { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--sfc-accent), var(--sfc-accent-2)); color: #fff; cursor: pointer; box-shadow: 0 8px 18px rgba(15, 118, 110, .3); transition: transform .12s ease, filter .12s ease; }
.sf-chat-send:hover { filter: brightness(1.06); transform: translateY(-1px); }
.sf-chat-send svg { width: 19px; height: 19px; }
.sf-chat-compose button:disabled, .sf-chat-compose textarea:disabled, .sf-chat-send:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; transform: none; }

/* Mobile: full-screen sheet */
@media (max-width: 640px) {
  .sf-chat-widget { right: 14px; bottom: 14px; }
  .sf-chat-launcher__label { display: none; }
  .sf-chat-launcher { padding: 14px; }
  .sf-chat-window { position: fixed; inset: 8px; width: auto; height: auto; max-height: none; border-radius: 16px; }
}


.product-card--out {
  opacity: .82;
}

.product-card__stock {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255,255,255,.94);
  color: var(--fg, #111827);
  border: 1px solid var(--line, #e5e7eb);
  box-shadow: var(--shadow-sm, 0 4px 14px rgba(15,23,42,.08));
}

.product-card__stock.is-low {
  color: #92400e;
  border-color: rgba(245,158,11,.35);
}

.product-card__stock.is-out {
  color: #991b1b;
  border-color: rgba(239,68,68,.35);
}

.product-card__add:disabled,
.product-card__add[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 1;
  background: var(--bg-muted, #6b7280);
  box-shadow: none;
}

[data-theme="dark"] .product-card__stock {
  background: rgba(15,23,42,.92);
}

body {
  padding-top: calc(var(--header-h, 68px) + env(safe-area-inset-top));
}

.shop-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header, 50);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}

main {
  scroll-margin-top: calc(var(--header-h, 68px) + 16px);
}

@media print {
  body {
    padding-top: 0 !important;
  }

  .shop-toasts {
    display: none !important;
  }
}

.auth-ajax-message {
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  margin: 14px 0 16px;
  padding: 12px 14px;
  font-weight: 700;
  line-height: 1.35;
  background: var(--bg-soft, #f8fafc);
  color: var(--fg, #0f172a);
}
.auth-ajax-message.is-success {
  border-color: rgba(22,163,74,.35);
  background: rgba(22,163,74,.08);
  color: #166534;
}
.auth-ajax-message.is-error {
  border-color: rgba(220,38,38,.35);
  background: rgba(220,38,38,.08);
  color: #991b1b;
}
.auth-ajax-message.is-info {
  border-color: rgba(29,78,216,.28);
  background: rgba(29,78,216,.08);
  color: var(--p, #1d4ed8);
}
.auth-form.is-complete {
  opacity: .72;
}
.auth-verify-panel {
  margin-top: 18px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 18px;
  padding: 18px;
  background: color-mix(in srgb, var(--p, #1d4ed8) 5%, var(--bg-card, #fff));
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15,23,42,.08));
}
.auth-verify-panel__head h2 {
  font-size: 18px;
  margin-bottom: 6px;
}
.auth-verify-panel__head p {
  margin: 0 0 10px;
  color: var(--mu, #64748b);
}
.auth-verify-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.form-field__error {
  display: block;
  margin-top: 6px;
  color: var(--err, #dc2626);
  font-size: 12.5px;
  font-weight: 700;
}

.checkout-stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}
.checkout-stepper__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--bg-card, #fff);
  color: var(--mu, #64748b);
  font-size: 13px;
  font-weight: 800;
}
.checkout-stepper__item b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--bg-soft, #f8fafc);
  color: inherit;
  flex: 0 0 26px;
}
.checkout-stepper__item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.checkout-stepper__item.is-current {
  border-color: var(--p, #1d4ed8);
  background: color-mix(in srgb, var(--p, #1d4ed8) 8%, var(--bg-card, #fff));
  color: var(--p, #1d4ed8);
}
.checkout-stepper__item.is-current b,
.checkout-stepper__item.is-done b {
  background: var(--p, #1d4ed8);
  color: #fff;
}
.checkout-stepper__item.is-done {
  border-color: rgba(22,163,74,.35);
  color: #166534;
}
.checkout-form__success {
  border: 1px solid rgba(22,163,74,.32);
  border-radius: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: rgba(22,163,74,.08);
  color: #166534;
  font-weight: 700;
}
.review-card--payment {
  border-color: rgba(29,78,216,.22);
  background: color-mix(in srgb, var(--p, #1d4ed8) 5%, var(--bg-card, #fff));
}

.shop-scrolltop {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: calc(var(--z-toast, 9999) - 1);
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid color-mix(in srgb, var(--p, #1d4ed8) 28%, transparent);
  border-radius: 999px;
  background: var(--p, #1d4ed8);
  color: #fff;
  box-shadow: var(--shadow-lg, 0 18px 40px rgba(15,23,42,.18));
  cursor: pointer;
}
.shop-scrolltop:hover {
  background: var(--p-dk, #1e3a8a);
}

@media (max-width: 860px) {
  :root { --mobile-header-h: 60px; }
  body {
    padding-top: calc(var(--mobile-header-h) + env(safe-area-inset-top));
  }
  .shop-header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header, 50);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
  .shop-soft-launch {
    margin-top: 0;
  }
  main {
    scroll-margin-top: calc(var(--mobile-header-h) + 14px);
  }
  .checkout-stepper {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .checkout-stepper__item {
    flex: 0 0 auto;
    min-width: 124px;
  }
  .shop-scrolltop {
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 540px) {
  .auth-verify-panel {
    padding: 16px;
    border-radius: 14px;
  }
  .auth-verify-panel__actions .btn {
    flex: 1 1 100%;
  }
  .checkout-stepper__item {
    min-width: 108px;
    padding: 9px 10px;
  }
  .checkout-stepper__item span {
    font-size: 12px;
  }
}

/* Storefront mobile QA sweep: additive overrides for every public surface. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

.shop-header,
.shop-header *,
.cart-drawer,
.cart-drawer *,
.checkout,
.checkout *,
.catalog-layout,
.catalog-layout *,
.cart-page,
.cart-page *,
.account-page,
.account-page *,
.receipt-page,
.receipt-page *,
.delivery-page,
.delivery-page *,
.pdp,
.pdp * {
  box-sizing: border-box;
}

.shop-search input,
.shop-hero__search input,
.catalog-toolbar select,
.filter-rail input,
.filter-rail select,
.checkout input,
.checkout select,
.checkout textarea,
.cart-page input,
.cart-page select,
.auth-card input,
.auth-card select,
.account-page input,
.account-page select,
.account-page textarea,
.delivery-page input,
.delivery-page select,
.delivery-page textarea {
  min-width: 0;
  max-width: 100%;
}

.orders-table,
.receipt-table,
.account-table,
.delivery-table {
  max-width: 100%;
}

@media (max-width: 960px) {
  .catalog-layout,
  .checkout__grid,
  .cart-page__grid,
  .pdp,
  .account-page__grid,
  .delivery-track,
  .tracker__grid,
  .receipt-page__grid {
    grid-template-columns: 1fr !important;
  }

  .catalog-rail,
  .filter-rail,
  .cart-page__summary,
  .order-summary,
  .pdp__summary,
  .account-page__nav {
    position: static !important;
    top: auto !important;
    width: 100%;
  }

  .catalog-toolbar,
  .checkout__head,
  .cart-page__head,
  .receipt-card__head,
  .account-page__header,
  .delivery-page__header {
    align-items: flex-start;
    gap: 12px;
  }

  .catalog-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .catalog-toolbar select,
  .catalog-toolbar .btn,
  .filter-rail .btn,
  .checkout-form .btn,
  .account-page .btn,
  .delivery-page .btn {
    min-height: 44px;
  }

  .review-card__edit {
    position: static;
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 12px;
    background: var(--bg-soft, #f8fafc);
    text-decoration: none;
  }

  .checkout-form,
  .review-card,
  .order-summary,
  .cart-page__summary,
  .receipt-card,
  .tracker__card,
  .tracker__timeline,
  .auth-card {
    border-radius: 16px;
  }
}

@media (max-width: 860px) {
  :root { --mobile-header-h: 60px; }

  .shop-header__inner {
    height: var(--mobile-header-h) !important;
    min-height: var(--mobile-header-h);
    flex-wrap: nowrap !important;
    overflow: visible;
  }

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

  .shop-brand__text strong {
    max-width: clamp(116px, 38vw, 220px);
  }

  .shop-mega {
    display: none;
  }

  .shop-nav {
    flex: 0 0 auto;
    gap: 2px;
  }

  .shop-nav__link,
  .shop-theme-toggle,
  .cmdk-trigger {
    flex: 0 0 40px;
  }

  .shop-soft-launch {
    position: relative;
    z-index: 1;
  }

  .cmdk {
    padding-top: calc(var(--mobile-header-h) + 16px);
  }

  .cmdk__panel {
    width: min(100%, 640px);
    max-height: calc(100dvh - var(--mobile-header-h) - 28px);
    overflow: hidden;
  }

  .search-suggest {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-height: min(420px, calc(100dvh - var(--mobile-header-h) - 36px));
    overflow-y: auto;
  }
}

@media (max-width: 700px) {
  .checkout,
  .cart-page,
  .account-page,
  .receipt-page,
  .delivery-page,
  .auth-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .shop-hero__grid {
    gap: 18px;
  }

  .shop-hero__copy {
    min-width: 0;
  }

  .shop-hero__title {
    overflow-wrap: anywhere;
  }

  .shop-hero__cta {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .shop-hero__cta .btn,
  .shop-hero__cta-btn,
  .shop-cta-band__actions .btn,
  .checkout-form__submit,
  .payment-cta,
  .auth-form__submit,
  .cart-drawer__checkout,
  .cart-drawer__continue {
    width: 100%;
    min-width: 0;
    justify-content: center;
    text-align: center;
    white-space: normal;
  }

  .cart-drawer__panel {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: min(90dvh, calc(100dvh - 10px)) !important;
    border-radius: 22px 22px 0 0 !important;
  }

  .cart-drawer__body {
    max-height: none;
    overflow-y: auto;
  }

  .cart-lines--full .cart-line,
  .cart-line {
    grid-template-columns: 68px minmax(0, 1fr) !important;
    align-items: start;
  }

  .cart-line__body,
  .cart-line__name,
  .cart-line__meta,
  .cart-line__unit {
    min-width: 0;
  }

  .cart-line__name {
    overflow-wrap: anywhere;
  }

  .cart-line__actions,
  .cart-saved__actions,
  .cart-coupon__row,
  .auth-verify-panel__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .cart-line__btn,
  .cart-coupon__apply,
  .cart-coupon__clear,
  .auth-verify-panel__actions .btn {
    width: 100%;
  }

  .cart-totals__row,
  .order-summary__row,
  .receipt-card__head dl {
    gap: 10px;
  }

  .orders-table,
  .receipt-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .checkout-stepper {
    margin-left: -2px;
    margin-right: -2px;
    scroll-snap-type: x proximity;
  }

  .checkout-stepper__item {
    scroll-snap-align: start;
  }
}

@media (max-width: 480px) {
  :root { --mobile-header-h: 58px; }

  body {
    padding-top: calc(var(--mobile-header-h) + env(safe-area-inset-top));
  }

  .shop-header__inner {
    height: var(--mobile-header-h) !important;
    min-height: var(--mobile-header-h);
    gap: 6px;
  }

  .shop-brand__mark {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
  }

  .shop-brand {
    flex: 0 1 auto;
    gap: 7px;
  }

  .shop-brand__text strong {
    max-width: 86px;
    font-size: 13px;
  }

  .shop-nav {
    margin-left: auto;
    max-width: calc(100vw - 130px);
    overflow: visible;
  }

  .shop-nav__link,
  .shop-theme-toggle,
  .cmdk-trigger {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    flex-basis: 34px !important;
  }

  .shop-cart-pill {
    transform: scale(.92);
    transform-origin: top right;
  }

  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .product-card__body {
    padding: 11px;
  }

  .product-card__name {
    min-height: auto;
    overflow-wrap: anywhere;
  }

  .product-card__add {
    min-height: 40px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .checkout-form,
  .review-card,
  .order-summary,
  .cart-page__summary,
  .receipt-card,
  .auth-card,
  .tracker__card,
  .tracker__timeline {
    padding: 16px;
    border-radius: 14px;
  }

  .receipt-card__head dl,
  .receipt-actions,
  .account-recent__link {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pdp-sticky {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .pdp-sticky__inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 360px) {
  .shop-brand__text {
    display: none !important;
  }

  .shop-nav {
    max-width: calc(100vw - 72px);
  }

  .shop-nav__link,
  .shop-theme-toggle,
  .cmdk-trigger {
    width: 33px !important;
    height: 33px !important;
    min-width: 33px !important;
    min-height: 33px !important;
    flex-basis: 33px !important;
  }
}

/* Phase 4D: token-gated rider mobile delivery flow. */
.rider-page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.rider-hero {
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(30, 64, 175, 0.08));
  padding: 24px;
  color: var(--shop-fg, #0f172a);
}

.rider-hero__eyebrow {
  margin: 0 0 6px;
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rider-hero h1 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.5rem);
  line-height: 1.08;
}

.rider-hero p {
  margin: 10px 0 0;
  color: var(--shop-muted, #64748b);
  font-weight: 700;
}

.rider-status {
  min-height: 0;
  margin: 16px 0;
  border-radius: 14px;
  font-weight: 800;
}

.rider-status:not(:empty) {
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
}

.rider-status[data-state="success"] {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.rider-status[data-state="error"] {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.rider-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.rider-progress li {
  display: grid;
  gap: 7px;
  align-content: start;
  min-height: 82px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  padding: 12px;
  color: #64748b;
}

.rider-progress span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 900;
}

.rider-progress strong {
  font-size: 0.82rem;
  line-height: 1.2;
}

.rider-progress li.is-done,
.rider-progress li.is-current {
  border-color: rgba(15, 118, 110, 0.36);
  color: #0f172a;
}

.rider-progress li.is-done span,
.rider-progress li.is-current span {
  background: #0f766e;
  color: #fff;
}

.rider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.rider-grid--metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0;
}

.rider-card {
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.rider-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.rider-card h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.02rem;
}

.rider-grid--metrics .rider-card h2 {
  margin-top: 8px;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  line-height: 1;
}

.rider-card p {
  margin: 0;
  color: #334155;
  line-height: 1.55;
}

.rider-card a {
  overflow-wrap: anywhere;
}

.rider-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #f1f5f9;
  padding: 4px 10px;
  color: #334155;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.rider-pill--success {
  background: #dcfce7;
  color: #166534;
}

.rider-pill--warning {
  background: #fef3c7;
  color: #92400e;
}

.rider-pill--danger {
  background: #fee2e2;
  color: #991b1b;
}

.rider-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 22px 0 12px;
}

.rider-section-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.12rem;
}

.rider-assignment-list {
  display: grid;
  gap: 16px;
}

.rider-assignment-list .rider-card {
  border-color: rgba(15, 118, 110, 0.22);
}

.rider-card__actions,
.rider-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.rider-actions form {
  flex: 1 1 160px;
}

.rider-actions .btn,
.rider-proof-form .btn,
.rider-location-btn {
  width: 100%;
  justify-content: center;
}

.rider-note {
  margin-top: 12px;
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.rider-note strong {
  display: block;
  margin-bottom: 4px;
  color: #0f766e;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.rider-location-state {
  margin-top: 8px !important;
  color: #64748b !important;
  font-size: 0.86rem;
}

.rider-proof-form {
  display: grid;
  gap: 12px;
}

.rider-proof-hint {
  margin: 0 !important;
  border-radius: 12px;
  background: #ecfdf5;
  color: #166534;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
  padding: 10px 12px;
}

.rider-card--meta dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.rider-card--meta div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #eef2f7;
  padding-bottom: 8px;
}

.rider-card--meta dt {
  color: #64748b;
  font-weight: 800;
}

.rider-card--meta dd {
  margin: 0;
  color: #0f172a;
  font-weight: 900;
  text-align: right;
}

.location-capture {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  padding: 10px;
}

.location-capture [data-location-status] {
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 700;
}

.location-capture [data-location-status][data-state="success"] {
  color: #15803d;
}

.location-capture [data-location-status][data-state="error"] {
  color: #b91c1c;
}

.delivery-detail-extra {
  margin-top: 14px;
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.delivery-detail-extra p {
  margin: 0 0 10px;
}

.delivery-exception-card {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 14px;
  background: #fef2f2;
  color: #7f1d1d;
}

.delivery-exception-card strong {
  font-size: 0.98rem;
}

.delivery-exception-card span,
.delivery-exception-card small {
  color: #991b1b;
  font-weight: 700;
}

.delivery-exception-card p {
  margin: 0;
  color: #7f1d1d;
}

.delivery-detail-extra__actions,
.tracker__map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tracker__state {
  display: grid;
  gap: 5px;
  margin: -16px 0 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  box-shadow: var(--shadow-xs);
}

.tracker__state-label {
  color: var(--mu);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.tracker__state strong {
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.45;
}

.tracker__state--active {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.tracker__state--success {
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.tracker__state--warning {
  border-color: #fed7aa;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
}

.tracker__handoff {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.tracker__handoff span {
  color: #1d4ed8;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.tracker__handoff strong {
  color: #0f172a;
  font-size: 0.95rem;
}

.tracker__handoff small {
  display: block;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 700;
}

.tracker__handoff--proof {
  border-color: rgba(22, 163, 74, 0.24);
  background: rgba(240, 253, 244, 0.82);
}

.tracker__handoff--proof span {
  color: #15803d;
}

.tracker__handoff--live {
  border-color: rgba(14, 165, 233, 0.26);
  background: rgba(240, 249, 255, 0.86);
}

.tracker__handoff--live span {
  color: #0369a1;
}

.tracker__handoff--live .btn {
  margin-top: 4px;
}

.tracker__handoff--exception {
  border-color: rgba(220, 38, 38, 0.24);
  background: rgba(254, 242, 242, 0.9);
}

.tracker__handoff--exception span {
  color: #b91c1c;
}

@media (max-width: 980px) {
  .rider-grid--metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .rider-page {
    width: min(100% - 22px, 560px);
    padding-top: 14px;
  }

  .rider-hero,
  .rider-card {
    border-radius: 16px;
    padding: 16px;
  }

  .rider-progress {
    grid-template-columns: repeat(5, minmax(58px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .rider-progress li {
    min-width: 72px;
    min-height: 78px;
    padding: 10px;
  }

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

  .rider-grid--metrics {
    grid-template-columns: 1fr;
  }

  .rider-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .rider-card__actions,
  .rider-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .rider-card--meta div {
    align-items: start;
  }
}
.sf-chat-search,
.sf-chat-file {
    width: 100%;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 10px;
    padding: 9px 10px;
    font: inherit;
    background: #fff;
}

.sf-chat-file {
    font-size: 12px;
}

.sf-chat-message a {
    display: inline-flex;
    margin-top: 6px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    padding: 5px 9px;
    color: #0f766e;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.sf-chat-message small {
    display: block;
    margin-top: 4px;
    opacity: 0.75;
}

.sf-chat-thread.is-overdue,
.sf-chat-error {
    border-color: rgba(220, 38, 38, 0.35) !important;
    background: #fef2f2 !important;
    color: #991b1b !important;
}
