:root {
  --bg: #f8faf7;
  --card: #ffffff;
  --ink: #182016;
  --muted: #64715f;
  --line: #e1e8dd;
  --brand: #14532d;
  --brand-2: #256d3d;
  --accent: #f59e0b;
  --danger: #b91c1c;
  --shadow: 0 16px 40px rgba(13, 35, 19, 0.1);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --bottom-nav-height: 74px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

button, input { font: inherit; }

button { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: .55; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  transform: translateY(-140%);
  background: var(--brand);
  color: #fff;
  padding: 10px 12px;
  border-radius: 999px;
}

.skip-link:focus { transform: translateY(0); }

.app-header {
  color: #fff;
  background:
    radial-gradient(circle at 10% 20%, rgba(245, 158, 11, .45), transparent 28%),
    linear-gradient(135deg, #103d23, #14532d 55%, #0f3b28);
  padding: calc(16px + env(safe-area-inset-top)) 16px 18px;
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  max-width: 1160px;
  margin: 0 auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}


.app-brand-logo {
  display: block;
  max-width: 132px;
  max-height: 54px;
  object-fit: contain;
  margin: 0 0 10px;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.18));
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .85;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(26px, 7vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.install-button {
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.14);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  white-space: nowrap;
}

.cart-access-button {
  position: relative;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,.94);
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.cart-access-button.has-items::after {
  content: attr(data-count);
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
}

.stock.out { color: var(--danger); }
.stock.low { color: #a16207; }
.add-button[disabled],
.dialog-actions button[disabled],
.cart-line-controls button[disabled] {
  opacity: .5;
  cursor: not-allowed;
}
.add-button[disabled] {
  background: #e5e7eb;
  color: #6b7280;
}

.search-card {
  max-width: 1160px;
  margin: 18px auto 0;
  background: rgba(255,255,255,.98);
  color: var(--ink);
  padding: 12px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.search-card label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 8px;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 13px 15px;
  outline: none;
}

.search-row input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(37, 109, 61, .14);
}

.search-row button,
.primary-button {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  padding: 13px 16px;
  font-weight: 800;
}

.app-main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px;
}

.status-panel {
  margin-top: -4px;
  background: #fff7ed;
  color: #7c2d12;
  border: 1px solid #fed7aa;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
}

.status-panel.ok {
  background: #ecfdf3;
  color: #14532d;
  border-color: #bbf7d0;
}

.status-panel.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.quick-actions,
.category-scroller {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 14px 0 4px;
}

.quick-actions::-webkit-scrollbar,
.category-scroller::-webkit-scrollbar { display: none; }

.quick-action,
.category-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 14px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(13, 35, 19, 0.06);
}

.quick-action.active,
.category-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.section-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 800;
}

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

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(13, 35, 19, 0.06);
}

.product-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #eef4ea;
  overflow: hidden;
}

.product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 8px;
  opacity: 0;
  transition: opacity .18s ease;
}

.product-image-wrap img.loaded { opacity: 1; }

.product-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  background: #fff;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  padding: 5px 8px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
}

.product-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px;
  flex: 1;
}

.product-name {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
}

.product-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.price {
  font-weight: 900;
  color: var(--brand);
  font-size: 17px;
}

.stock {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0 11px 11px;
}

.card-actions button {
  border-radius: 999px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 900;
}

.view-button {
  border: 1px solid var(--brand);
  background: #fff;
  color: var(--brand);
}

.add-button {
  border: 0;
  background: var(--brand);
  color: #fff;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 22px 0;
}

.product-dialog {
  border: 0;
  border-radius: 26px;
  width: min(94vw, 560px);
  max-height: 88vh;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
}

.product-dialog::backdrop { background: rgba(0, 0, 0, .45); }

.dialog-close {
  position: absolute;
  z-index: 3;
  right: 10px;
  top: 10px;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(255,255,255,.95);
  font-size: 24px;
  line-height: 1;
}

.dialog-image {
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: contain;
  background: #eef4ea;
}

.dialog-body { padding: 18px; }

.dialog-body h3 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.dialog-body p { color: var(--muted); }

.dialog-actions {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.9fr;
  gap: 10px;
  margin-top: 16px;
}

.dialog-actions a,
.dialog-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
  padding: 13px 14px;
  font-weight: 900;
}

.dialog-actions a {
  border: 1px solid var(--line);
  color: var(--brand);
  background: #fff;
}

.dialog-actions button {
  border: 0;
  color: #fff;
  background: var(--brand);
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom));
  z-index: 30;
  background: #182016;
  color: #fff;
  padding: 12px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  text-align: center;
  transform: translateY(140%);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 18px;
  font-size: 12px;
  font-weight: 850;
}

.nav-item span {
  display: block;
  font-size: 20px;
  line-height: 1;
  margin-bottom: 2px;
}

.nav-item.active {
  color: var(--brand);
  background: #eaf6ed;
}

.empty-state {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}

@media (min-width: 720px) {
  body { padding-bottom: 24px; }
  .app-header { padding-left: 28px; padding-right: 28px; }
  .app-main { padding: 24px 28px; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .bottom-nav { display: none; }
  .toast { bottom: 24px; left: auto; right: 24px; width: min(420px, 90vw); }
}

@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card-actions { grid-template-columns: 1fr 1fr; }
}


.status-panel.loading {
  background: #f7fee7;
  color: #365314;
  border-color: #d9f99d;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-block,
.skeleton-line {
  background: linear-gradient(90deg, #edf3ea, #f8faf7, #edf3ea);
  background-size: 200% 100%;
  animation: ddvtSkeleton 1.1s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  border-radius: 999px;
  width: 70%;
}

.skeleton-line.wide { width: 92%; }
.skeleton-line.short { width: 42%; }

@keyframes ddvtSkeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 719px) {
  .app-header {
    border-bottom-left-radius: 22px;
    border-bottom-right-radius: 22px;
  }

  .header-top {
    align-items: flex-start;
  }

  
.app-brand-logo {
  display: block;
  max-width: 132px;
  max-height: 54px;
  object-fit: contain;
  margin: 0 0 10px;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.18));
}

.eyebrow {
    font-size: 11px;
    margin-bottom: 5px;
  }

  h1 {
    font-size: clamp(28px, 9vw, 36px);
    line-height: 1.08;
    max-width: 88vw;
  }

  .install-button {
    padding: 9px 12px;
    font-size: 14px;
  }

  .search-card {
    border-radius: 24px;
    margin-top: 18px;
  }

  .search-row {
    gap: 8px;
  }

  .search-row input {
    padding: 12px 13px;
    font-size: 16px;
  }

  .search-row button {
    padding: 12px 14px;
  }

  .status-panel {
    font-size: 13px;
  }

  .quick-action,
  .category-chip {
    padding: 10px 13px;
  }

  .product-grid {
    gap: 10px;
  }

  .product-image-wrap {
    aspect-ratio: 1 / .92;
  }

  .product-body {
    padding: 10px;
  }

  .product-name {
    font-size: 13px;
  }

  .price {
    font-size: 15px;
  }

  .stock {
    display: none;
  }

  .card-actions {
    padding: 0 10px 10px;
  }
}

.product-dialog {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.product-description {
  margin: 14px 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fbfdf9;
}

.product-description strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.product-description p,
.dialog-loading,
.dialog-meta,
.sku-line {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.dialog-loading {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8faf7;
  border-radius: var(--radius-md);
}

.sku-line {
  margin-top: 12px;
}

/* Phase 4 cart and secure checkout handoff */
.cart-qty-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(20, 83, 45, .28);
}

.cart-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #1f1600;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(9, 19, 12, .46);
  opacity: 0;
  transition: opacity .24s ease;
}

.cart-overlay.open { opacity: 1; }

.cart-drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 100vw);
  background: var(--card);
  box-shadow: -20px 0 50px rgba(13, 35, 19, .22);
  transform: translateX(105%);
  transition: transform .26s ease;
  display: flex;
  flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}

.cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.cart-drawer-header h2 {
  margin: 0;
  font-size: 26px;
}

.cart-eyebrow {
  color: var(--muted);
  margin-bottom: 2px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.cart-validation {
  margin: 12px 0;
  padding: 11px 12px;
  border-radius: 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #7c2d12;
  font-size: 13px;
  line-height: 1.35;
}

.cart-validation.ok {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #14532d;
}

.cart-items {
  flex: 1;
  overflow: auto;
  padding: 4px 2px 14px;
  -webkit-overflow-scrolling: touch;
}

.cart-empty { margin: 8px 0; }

.cart-line {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cart-line img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 16px;
  background: #f6f8f5;
  border: 1px solid var(--line);
}

.cart-line-body h4 {
  margin: 0 0 3px;
  font-size: 14px;
  line-height: 1.25;
}

.cart-line-body p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.cart-line-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cart-line-controls button {
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
}

.cart-line-controls span {
  min-width: 22px;
  text-align: center;
  font-weight: 800;
}

.cart-line-controls .remove-line {
  padding: 0 10px;
  color: var(--danger);
  font-size: 12px;
}

.cart-line-total {
  font-weight: 900;
  white-space: nowrap;
}

.cart-summary {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  background: var(--card);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 18px;
  margin-bottom: 6px;
}

.cart-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.cart-actions-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 14px;
  font-weight: 800;
}

.secondary-button.danger {
  color: var(--danger);
}

.primary-button.full {
  width: 100%;
}

@media (max-width: 719px) {
  .cart-drawer {
    top: auto;
    left: 0;
    width: 100vw;
    height: min(86vh, 720px);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    transform: translateY(105%);
  }

  .cart-drawer.open { transform: translateY(0); }

  .cart-line {
    grid-template-columns: 64px 1fr;
  }

  .cart-line img {
    width: 64px;
    height: 64px;
  }

  .cart-line-total {
    grid-column: 2;
    justify-self: start;
    margin-top: -4px;
  }
}


@media (max-width: 520px) {
  .header-actions { flex-direction: column; align-items: flex-end; gap: 8px; }
  .cart-access-button { display: none; }
}

/* Phase 4.1 production hardening */
body.cart-is-open {
  overflow: hidden;
}

.cart-validation.neutral {
  background: #f8faf7;
  border-color: var(--line);
  color: var(--muted);
}

.cart-validation.loading {
  background: #f7fee7;
  border-color: #d9f99d;
  color: #365314;
}

.cart-validation.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.cart-empty-action {
  display: inline-flex;
  margin-top: 14px;
}

.cart-line-warning,
.product-stock-warning {
  margin: 6px 0 0;
  color: #92400e;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.product-stock-warning {
  display: inline-flex;
  align-self: flex-start;
  border-radius: 999px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 4px 8px;
}

.primary-button.is-busy {
  position: relative;
  pointer-events: none;
}

.primary-button.is-busy::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgba(255,255,255,.55);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ddvtSpin .65s linear infinite;
  vertical-align: -2px;
}

@keyframes ddvtSpin {
  to { transform: rotate(360deg); }
}

.app-debug {
  max-width: 1160px;
  margin: 0 auto 88px;
  padding: 10px 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (min-width: 1180px) {
  .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
  .cart-drawer { width: min(470px, 100vw); }
  .app-debug { margin-bottom: 24px; }
}

@media (max-width: 719px) {
  .stock {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
  }
  .product-price-row {
    align-items: center;
  }
  .product-stock-warning {
    font-size: 11px;
    padding: 3px 7px;
  }
  .cart-actions-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .cart-line-controls { gap: 6px; }
  .cart-line-controls button { min-width: 30px; height: 30px; }
  .cart-actions-row { grid-template-columns: 1fr; }
}

/* Phase 4 pickup/delivery pre-checkout experience */
.fulfillment-panel {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0 14px;
  background: #fff;
}

.fulfillment-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.fulfillment-heading h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.required-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  color: #14532d;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}


.customer-info-section {
  margin: 0 0 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfefc;
}

.subsection-heading {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.customer-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fulfillment-methods {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.9fr;
  gap: 10px;
  margin-bottom: 10px;
}

.fulfillment-method {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 10px;
  font-weight: 900;
}

.fulfillment-method.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 10px 22px rgba(20, 83, 45, .16);
}

.fulfillment-method.field-invalid {
  border-color: #dc2626;
  background: #fff7f7;
  color: #991b1b;
}

.fulfillment-fields,
.delivery-row {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.9fr;
  gap: 10px;
}

.delivery-summary {
  margin-top: 10px;
}

.fulfillment-panel label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.fulfillment-panel input,
.fulfillment-panel select,
.fulfillment-panel textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  font: inherit;
}

.fulfillment-panel textarea {
  resize: vertical;
  min-height: 62px;
}

.fulfillment-panel input:focus,
.fulfillment-panel select:focus,
.fulfillment-panel textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(37, 109, 61, .12);
}

.fulfillment-note-label {
  margin-top: 10px;
}

.field-help {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.fulfillment-status {
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 14px;
  background: #f8faf7;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.fulfillment-status.needs-choice {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #7c2d12;
}

.fulfillment-status.ok {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #14532d;
}

.fulfillment-panel input.field-invalid,
.fulfillment-panel select.field-invalid,
.fulfillment-panel textarea.field-invalid {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .10);
}

.field-error-message {
  display: block;
  margin-top: 5px;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

.fulfillment-status.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.fulfillment-status.error ul {
  margin: 6px 0 0 18px;
  padding: 0;
}

.fulfillment-status.error li {
  margin: 2px 0;
}

@media (max-width: 520px) {
  .customer-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .fulfillment-fields,
  .delivery-row {
    grid-template-columns: 1fr;
  }
}


/* Phase 4.3 cart scroll repair: allow the drawer itself and long forms to scroll on desktop, Android, and iOS. */
.cart-drawer {
  max-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.cart-drawer-header,
.cart-validation,
.fulfillment-panel,
.cart-summary {
  flex: 0 0 auto;
}

.cart-items {
  flex: 0 0 auto;
  max-height: min(34dvh, 320px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

@supports not (height: 100dvh) {
  .cart-drawer { max-height: 100vh; }
  .cart-items { max-height: min(34vh, 320px); }
}

@media (max-width: 719px) {
  .cart-drawer {
    height: min(92dvh, 760px);
    max-height: calc(100dvh - env(safe-area-inset-top));
  }

  .cart-items {
    max-height: min(30dvh, 260px);
  }
}

@media (max-height: 720px) {
  .cart-items {
    max-height: min(26dvh, 210px);
  }
}

/* Phase 5.0 order lookup */
.orders-dialog {
  width: min(720px, calc(100vw - 24px));
  max-height: min(820px, calc(100vh - 24px));
  border: 0;
  border-radius: 24px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
  background: var(--card);
  color: var(--ink);
  overflow: hidden;
}

.orders-dialog::backdrop {
  background: rgba(7, 20, 12, .58);
  backdrop-filter: blur(6px);
}

.orders-dialog-content {
  padding: 22px;
  max-height: min(820px, calc(100vh - 24px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.orders-dialog h2 {
  margin: 0 34px 8px 0;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.orders-help {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.45;
}

.order-lookup-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8faf7;
}

.order-lookup-form label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
}

.order-lookup-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  background: #fff;
  outline: none;
}

.order-lookup-form input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(37, 109, 61, .14);
}

.order-lookup-result {
  margin-top: 14px;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: #fff;
}

.order-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.order-card h3 {
  margin: 0;
  font-size: 22px;
}

.order-total {
  white-space: nowrap;
  background: #ecfdf3;
  color: var(--brand);
  padding: 8px 10px;
  border-radius: 999px;
}

.order-timeline {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 14px 0;
  padding: 0;
}

.order-timeline li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.timeline-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #cbd5c5;
  background: #fff;
  flex: 0 0 auto;
}

.order-timeline li.complete {
  color: var(--brand);
}

.order-timeline li.complete .timeline-dot {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: inset 0 0 0 4px #fff;
}

.order-timeline li.issue {
  color: var(--danger);
}

.order-timeline li.issue .timeline-dot {
  border-color: var(--danger);
  background: var(--danger);
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.order-info-grid div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #f8faf7;
}

.order-info-grid strong,
.order-info-grid span {
  display: block;
}

.order-info-grid strong {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.order-address,
.order-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.order-section p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 0;
}

@media (max-width: 640px) {
  .orders-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 22px;
  }
  .orders-dialog-content {
    padding: 18px;
  }
  .order-card-header,
  .order-section p {
    display: block;
  }
  .order-total {
    display: inline-block;
    margin-top: 10px;
  }
  .order-info-grid {
    grid-template-columns: 1fr;
  }
}


/* Phase 5.1 navigation polish: visible Orders + Account on desktop and mobile/app. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-nav-button {
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-weight: 900;
  white-space: nowrap;
}

.header-nav-button:hover,
.cart-access-button:hover,
.install-button:hover {
  transform: translateY(-1px);
}

.account-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(720px, calc(100vh - 24px));
  border: 0;
  border-radius: 24px;
  padding: 0;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
  background: var(--card);
  color: var(--ink);
  overflow: hidden;
}

.account-dialog::backdrop {
  background: rgba(15, 23, 42, .52);
  backdrop-filter: blur(4px);
}

.account-dialog-content {
  padding: 26px;
}

.account-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.account-link {
  text-align: center;
  text-decoration: none;
}

.account-next-note {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 719px) {
  .header-actions {
    gap: 8px;
  }
  .header-nav-button {
    display: none;
  }
  .bottom-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-left: 6px;
    padding-right: 6px;
  }
  .nav-item {
    font-size: 11px;
    border-radius: 16px;
    padding: 6px 2px;
  }
  .nav-item span {
    font-size: 18px;
  }
}

@media (min-width: 720px) {
  .header-nav-button,
  .cart-access-button,
  .install-button {
    min-height: 44px;
  }
}

/* Phase 5.2 mobile nav reliability repair: make bottom app bar fast, tappable, and above page/card layers. */
.bottom-nav {
  z-index: 110;
  pointer-events: auto;
  isolation: isolate;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  contain: layout paint;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: rgba(20, 83, 45, .12);
}

.nav-item,
.header-nav-button,
.cart-access-button,
.install-button {
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
}

.nav-item {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  overflow: visible;
}

.nav-item:active {
  transform: scale(.98);
}

.cart-count-badge {
  pointer-events: none;
}

.product-card,
.product-image-wrap,
.product-grid,
.app-main {
  position: relative;
  z-index: 1;
}

.toast {
  z-index: 105;
  pointer-events: none;
}

.cart-overlay,
.cart-drawer,
.product-dialog,
.orders-dialog,
.account-dialog,
.install-help-dialog {
  z-index: 200;
}

@media (max-width: 719px) {
  :root { --bottom-nav-height: 82px; }

  body {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 10px);
  }

  .bottom-nav {
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
  }

  .nav-item {
    min-width: 0;
    min-height: 64px;
    line-height: 1.05;
  }

  .nav-item span {
    pointer-events: none;
  }
}

/* Phase 5.3 Android bottom-nav reliability repair. */
.bottom-nav {
  z-index: 9999;
  contain: none;
  overscroll-behavior: contain;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.nav-item {
  -webkit-appearance: none;
  appearance: none;
  touch-action: none;
  -webkit-tap-highlight-color: rgba(20, 83, 45, .18);
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: -8px -4px;
  border-radius: 18px;
  pointer-events: none;
}

@media (max-width: 719px) {
  .bottom-nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
  }

  .nav-item {
    min-height: 66px;
    padding: 7px 1px;
    font-size: 10.5px;
    border-radius: 16px;
  }
}

body.dialog-open {
  overflow: hidden;
}

/* Fallback for Android WebView/Chrome builds where native dialog showModal is unreliable. */
.orders-dialog.is-open[open],
.account-dialog.is-open[open] {
  display: block;
  position: fixed;
  inset: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10050;
}

.orders-dialog.is-open[open]::backdrop,
.account-dialog.is-open[open]::backdrop {
  background: rgba(7, 20, 12, .58);
  backdrop-filter: blur(6px);
}

/* Phase 5.4 Android bottom-nav tap repair: normal taps open Orders/Account immediately. */
.bottom-nav {
  z-index: 2147483000;
  pointer-events: auto;
  transform: translate3d(0,0,0);
  -webkit-transform: translate3d(0,0,0);
}

.nav-item {
  touch-action: manipulation !important;
  -ms-touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
  cursor: pointer;
}

.nav-item span,
.nav-item em {
  pointer-events: none;
}

@media (max-width: 719px) {
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    min-height: 68px;
    padding: 8px 2px;
  }
}

/* Phase 5.5 cart checkout visibility repair.
   The Android nav fix made the bottom bar sit above the cart drawer. While cart is open,
   hide the nav and raise the cart drawer so the checkout CTA is always reachable. */
.cart-overlay {
  z-index: 2147483100;
}

.cart-drawer {
  z-index: 2147483200;
}

body.cart-is-open .bottom-nav {
  transform: translate3d(0, 120%, 0) !important;
  -webkit-transform: translate3d(0, 120%, 0) !important;
  opacity: 0;
  pointer-events: none;
}

body.cart-is-open .toast {
  z-index: 2147483300;
}

@media (max-width: 719px) {
  body.cart-is-open {
    padding-bottom: 0;
  }

  .cart-drawer {
    height: calc(100dvh - env(safe-area-inset-top));
    max-height: calc(100dvh - env(safe-area-inset-top));
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }

  @supports not (height: 100dvh) {
    .cart-drawer {
      height: 100vh;
      max-height: 100vh;
    }
  }

  .cart-summary {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  #checkoutNextButton {
    min-height: 54px;
    margin-bottom: 2px;
  }
}


/* Phase 6.7 in-app chatbot: single Ask Me shell, no duplicate header. */
.app-chat-launcher {
  position: fixed;
  right: 18px;
  bottom: calc(var(--bottom-nav-height) + 18px + env(safe-area-inset-bottom));
  z-index: 2147482500;
  border: 0;
  border-radius: 999px;
  background: #166534;
  color: #fff;
  font-weight: 900;
  padding: 13px 16px;
  box-shadow: 0 18px 42px rgba(20,83,45,.28);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.app-chat-launcher span { font-weight: 900; }
body.cart-is-open .app-chat-launcher,
body.dialog-open .app-chat-launcher { display: none; }
.app-chat-dialog {
  width: min(460px, calc(100vw - 18px));
  height: min(760px, calc(100dvh - 18px));
  border: 0;
  padding: 0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 28px 90px rgba(0,0,0,.32);
  background: #fff;
  color: var(--ink);
}
.app-chat-dialog::backdrop { background: rgba(7,20,12,.58); backdrop-filter: blur(5px); }
.app-chat-shell { display: flex; flex-direction: column; height: 100%; background: #f4fbf5; }
.app-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: linear-gradient(135deg,#14532d,#166534); color: #fff; }
.app-chat-header h2 { margin: 0; font-size: 22px; }
.app-chat-header .eyebrow { color: rgba(255,255,255,.78); margin: 0 0 2px; }
.app-chat-header .icon-button { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.28); }
#appChatFrame { flex: 1; width: 100%; border: 0; background: #f4fbf5; }
.app-chat-note { margin: 0; padding: 9px 12px calc(9px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; line-height: 1.35; background: #fff; border-top: 1px solid var(--line); }
@media (max-width: 719px) {
  .app-chat-launcher { right: 14px; bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom)); padding: 12px 13px; }
  .app-chat-dialog { width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; border-radius: 0; }
}


/* Phase 6.6 layout containment repair.
   Prevent horizontal drift/sideways blank areas after adding chatbot, bottom nav, and app checkout links. */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  position: relative;
}
.app-header,
.header-top,
.search-card,
.app-main,
.status-panel,
.quick-actions,
.category-scroller,
.product-grid,
.load-more-wrap,
.app-debug {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.app-header {
  overflow-x: hidden;
}
.quick-actions,
.category-scroller {
  width: 100%;
  max-width: 100%;
}
.product-grid {
  width: 100%;
  overflow: visible;
}
.product-card,
.product-card * {
  min-width: 0;
}
.app-chat-launcher {
  max-width: calc(100vw - 28px);
}
.app-chat-dialog[open],
.app-chat-dialog.is-open[open] {
  position: fixed;
  margin: 0;
  inset: auto 12px calc(12px + env(safe-area-inset-bottom)) auto;
  max-width: calc(100vw - 24px);
}
@media (max-width: 719px) {
  .app-main {
    padding-left: 14px;
    padding-right: 14px;
  }
  .app-chat-dialog[open],
  .app-chat-dialog.is-open[open] {
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }
}


/* Phase 6.7 chatbot consistency: keep only one chatbot header from the real assistant. */
.app-chat-dialog-clean {
  padding: 0;
}
.app-chat-dialog-clean .app-chat-shell {
  position: relative;
  height: 100%;
  background: #f4fbf5;
}
.app-chat-dialog-clean #appChatFrame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
}
.app-chat-close-floating {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  font-weight: 500;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.app-chat-header, .app-chat-note { display: none !important; }
.app-chat-launcher {
  background: #166534;
  color: #fff;
}
@media (max-width: 719px) {
  .app-chat-close-floating { top: 8px; right: 8px; }
}


/* v0.6.9 customer-facing cleanup */
.app-chat-close-floating { display:none !important; visibility:hidden !important; pointer-events:none !important; }
.status-panel { font-weight: 800; }
.cart-validation, .fulfillment-status { line-height: 1.35; }
.cart-note { color: #5b6a60; }

/* v0.7.1 delivery estimate in cart */
.delivery-quote{margin-top:12px;padding:12px 14px;border-radius:16px;border:1px solid #d7e6da;background:#f8fff9;color:#14211a;font-weight:800;line-height:1.35;}
.delivery-quote.ok{border-color:#bdeccf;background:#ecfdf5;color:#14532d;}
.delivery-quote.loading{border-color:#d8e7dc;background:#fff;color:#55665a;}
.delivery-quote.needs-address{border-color:#e5eadf;background:#fff;color:#55665a;}
.delivery-quote.error{border-color:#fed7aa;background:#fff7ed;color:#9a3412;}
.cart-delivery-total,.cart-grand-total{border-top:1px dashed #dfe9e2;padding-top:10px;margin-top:10px;}
.cart-grand-total span,.cart-grand-total strong{font-size:1.08em;font-weight:900;color:#14532d;}


/* v0.8.1 in-app account */
.account-dialog-v081 .account-dialog-content {
  max-height: min(86dvh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.account-status {
  margin: 10px 0 14px;
  padding: 11px 12px;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 14px;
}
.account-status.ok {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: var(--brand);
}
.account-status.loading {
  border-color: #d9f99d;
  background: #f7fee7;
  color: #365314;
}
.account-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0 12px;
}
.account-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 11px 12px;
  font-weight: 900;
  color: var(--ink);
}
.account-tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.account-form-panel { display: none; }
.account-form-panel.active { display: grid; gap: 12px; }
.account-form label,
.account-two-col label {
  display: grid;
  gap: 6px;
  font-weight: 800;
  color: var(--muted);
}
.account-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.account-form input:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(37, 109, 61, .14);
}
.account-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.account-customer-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid #bbf7d0;
  border-radius: 18px;
  background: #ecfdf3;
  color: var(--brand);
  margin-bottom: 12px;
}
.account-customer-card strong { font-size: 18px; color: var(--ink); }
.account-customer-card span { font-size: 14px; color: var(--muted); }
.account-mini-heading {
  margin: 16px 0 8px;
  font-size: 18px;
}
.account-orders-list {
  display: grid;
  gap: 10px;
}
.account-order-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.account-order-card div { display: grid; gap: 3px; }
.account-order-card div:last-child { text-align: right; }
.account-order-card span { color: var(--muted); font-size: 13px; }
.empty-state.compact { padding: 16px; border-radius: 16px; }
@media (max-width: 480px) {
  .account-two-col { grid-template-columns: 1fr; }
  .account-order-card { flex-direction: column; }
  .account-order-card div:last-child { text-align: left; }
}

/* Phase 0.8.3 admin-controlled branding/layout. */
:root {
  --app-content-width: 1160px;
  --app-logo-width: 132px;
  --app-hero-title-width: 760px;
  --brand-rgb: 20, 83, 45;
  --brand-2-rgb: 22, 101, 52;
  --app-header-overlay-alpha: .65;
  --app-header-overlay-alpha-soft: .57;
}
.header-top,
.search-card,
.app-main {
  max-width: min(var(--app-content-width), calc(100vw - 24px));
}
.app-brand-logo {
  max-width: var(--app-logo-width);
}
.app-header h1 {
  max-width: var(--app-hero-title-width);
}
body[data-hero-align="center"] .header-top {
  position: relative;
  display: block;
  text-align: center;
}
body[data-hero-align="center"] .header-top > div:first-child {
  margin-left: auto;
  margin-right: auto;
  max-width: min(var(--app-hero-title-width), 100%);
  text-align: center;
}
body[data-hero-align="center"] .app-header h1 {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
body[data-hero-align="center"] .app-brand-logo {
  margin-left: auto;
  margin-right: auto;
}
body[data-hero-align="center"] .header-actions {
  position: absolute;
  top: 0;
  right: 0;
}
body[data-hero-align="right"] .header-top {
  text-align: right;
}
body[data-hero-align="right"] .header-top > div:first-child,
body[data-hero-align="right"] .app-header h1 {
  margin-left: auto;
}
body[data-hero-align="right"] .app-brand-logo {
  margin-left: auto;
}
body[data-logo-position="hidden"] .app-brand-logo {
  display: none !important;
}
body[data-logo-position="left"] .header-top > div:first-child,
body[data-logo-position="right"] .header-top > div:first-child {
  display: grid;
  gap: 6px 14px;
  align-items: center;
}
body[data-logo-position="left"] .header-top > div:first-child {
  grid-template-columns: auto minmax(0, 1fr);
}
body[data-logo-position="right"] .header-top > div:first-child {
  grid-template-columns: minmax(0, 1fr) auto;
}
body[data-logo-position="left"] .app-brand-logo {
  grid-row: 1 / span 2;
  grid-column: 1;
  margin: 0;
}
body[data-logo-position="left"] .eyebrow,
body[data-logo-position="left"] .app-header h1 {
  grid-column: 2;
}
body[data-logo-position="right"] .app-brand-logo {
  grid-row: 1 / span 2;
  grid-column: 2;
  margin: 0;
}
body[data-logo-position="right"] .eyebrow,
body[data-logo-position="right"] .app-header h1 {
  grid-column: 1;
}
body[data-header-density="compact"] .app-header {
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-bottom: 12px;
}
body[data-header-density="compact"] .search-card {
  margin-top: 12px;
}
body[data-header-density="spacious"] .app-header {
  padding-top: calc(28px + env(safe-area-inset-top));
  padding-bottom: 30px;
}
body[data-header-density="spacious"] .search-card {
  margin-top: 26px;
}
@media (max-width: 719px) {
  .header-top,
  .search-card,
  .app-main {
    max-width: calc(100vw - 20px);
  }
  body[data-logo-position="left"] .header-top > div:first-child,
  body[data-logo-position="right"] .header-top > div:first-child {
    grid-template-columns: 1fr;
  }
  body[data-logo-position="left"] .app-brand-logo,
  body[data-logo-position="right"] .app-brand-logo,
  body[data-logo-position="left"] .eyebrow,
  body[data-logo-position="right"] .eyebrow,
  body[data-logo-position="left"] .app-header h1,
  body[data-logo-position="right"] .app-header h1 {
    grid-column: 1;
    grid-row: auto;
  }
}


/* Phase 0.8.4 production app branding controls. */
:root { --hero-bg-image: none; }
body[data-hero-background="1"] .app-header {
  background-image:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 88%, transparent), color-mix(in srgb, var(--brand-2) 86%, transparent)),
    radial-gradient(circle at 10% 20%, rgba(245, 158, 11, .28), transparent 30%),
    var(--hero-bg-image);
  background-size: cover;
  background-position: center;
}
body[data-header-mode="sticky"] .app-header,
body[data-header-mode="sticky-transparent"] .app-header {
  position: sticky;
  top: 0;
  z-index: 60;
}
body[data-header-mode="transparent"] .app-header,
body[data-header-mode="sticky-transparent"] .app-header {
  background-color: transparent;
  background-image:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 70%, transparent), color-mix(in srgb, var(--brand-2) 62%, transparent)),
    var(--hero-bg-image);
  backdrop-filter: blur(10px);
}
body[data-header-mode="transparent"]:not([data-hero-background="1"]) .app-header,
body[data-header-mode="sticky-transparent"]:not([data-hero-background="1"]) .app-header {
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--brand) 76%, transparent), color-mix(in srgb, var(--brand-2) 68%, transparent));
}
.app-chat-launcher {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
}
.app-chat-dialog,
.app-chat-shell,
#appChatFrame {
  background: var(--bg);
}


/* Phase 0.8.5 refinements: real transparent header control and centered hero repair. */
body[data-header-mode="transparent"] .app-header,
body[data-header-mode="sticky-transparent"] .app-header {
  background-image:
    linear-gradient(135deg, rgba(var(--brand-rgb), var(--app-header-overlay-alpha)), rgba(var(--brand-2-rgb), var(--app-header-overlay-alpha-soft))),
    var(--hero-bg-image) !important;
  background-color: transparent !important;
}
body[data-header-mode="transparent"][data-hero-background="1"] .app-header,
body[data-header-mode="sticky-transparent"][data-hero-background="1"] .app-header {
  background-size: cover;
  background-position: center;
}
@media (max-width: 719px) {
  body[data-hero-align="center"] .header-top > div:first-child {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
  }
  body[data-hero-align="center"] .header-actions {
    top: 0;
    right: 0;
  }
  body[data-hero-align="center"] .app-header h1 {
    max-width: min(var(--app-hero-title-width), 92vw);
  }
}


/* v0.8.6 sticky header/account/checkout and USPS shipping option polish */
body[data-header-mode="sticky"] .app-header,
body[data-header-mode="transparent"] .app-header,
body[data-header-mode="sticky-transparent"] .app-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 2147482400 !important;
  will-change: transform;
}
body[data-header-mode="sticky"] .app-header {
  box-shadow: 0 16px 36px rgba(13,35,19,.14);
}
body[data-header-mode="transparent"] .app-header,
body[data-header-mode="sticky-transparent"] .app-header {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.fulfillment-methods { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 420px){ .fulfillment-methods { grid-template-columns: 1fr; } }
body[data-header-mode="sticky"] .app-main,
body[data-header-mode="transparent"] .app-main,
body[data-header-mode="sticky-transparent"] .app-main {
  scroll-margin-top: 110px;
}


/* v0.8.7 shipping label and sticky header hardening */
body[data-header-mode="sticky"] .app-header,
body[data-header-mode="sticky-transparent"] .app-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 2147482400 !important;
}
.summary-row.cart-delivery-total strong { text-align: right; max-width: 190px; }


/* Phase 0.8.8 loading promotion screen */
.app-loading-screen{
  position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;
  padding:24px;background:linear-gradient(145deg,var(--brand),var(--brand-2));color:#fff;box-sizing:border-box;
  transition:opacity .24s ease, visibility .24s ease;
}
.app-loading-screen.is-hiding{opacity:0;visibility:hidden;pointer-events:none;}
.app-loading-card{width:min(520px,100%);border-radius:32px;padding:24px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.25);box-shadow:0 28px 80px rgba(0,0,0,.28);backdrop-filter:blur(18px);text-align:center;}
.app-loading-image-wrap{width:100%;height:min(260px,40vh);border-radius:24px;overflow:hidden;background:rgba(255,255,255,.18);margin-bottom:18px;}
.app-loading-image-wrap img{width:100%;height:100%;object-fit:cover;display:block;}
.app-loading-badge{margin:0 0 10px;text-transform:uppercase;letter-spacing:.18em;font-size:12px;font-weight:800;opacity:.88;}
.app-loading-card h2{margin:0;font-size:clamp(28px,7vw,48px);line-height:1.02;font-weight:950;color:#fff;}
.app-loading-card p:not(.app-loading-badge){margin:14px auto 0;max-width:36rem;font-size:16px;line-height:1.45;opacity:.92;}
.app-loading-card button{margin-top:22px;border:0;border-radius:999px;background:#fff;color:var(--brand);font-weight:950;padding:13px 22px;min-height:48px;box-shadow:0 14px 36px rgba(0,0,0,.18);}
@media (max-width:640px){.app-loading-screen{padding:16px}.app-loading-card{padding:18px;border-radius:26px}.app-loading-image-wrap{height:220px}.app-loading-card button{width:100%;}}


/* v1.0.4 install help and production app icon support */
.install-help-dialog {
  border: 0;
  padding: 0;
  width: min(520px, calc(100vw - 28px));
  border-radius: 26px;
  overflow: hidden;
  background: transparent;
  color: var(--ink);
}
.install-help-dialog::backdrop { background: rgba(7,20,12,.58); backdrop-filter: blur(6px); }
.install-help-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 24px;
  box-shadow: 0 28px 70px rgba(var(--brand-rgb), .22);
}
.install-help-card h2 { margin: 4px 44px 14px 0; font-size: clamp(24px, 5vw, 34px); line-height: 1.05; }
.install-help-steps { color: var(--muted); font-weight: 650; line-height: 1.5; }
.install-help-steps ol { margin: 12px 0 0 20px; padding: 0; }
.install-help-steps li { margin: 8px 0; }
.install-help-note { color: var(--muted); font-size: 14px; margin: 14px 0 18px; }
.install-help-dialog.is-open[open] { display: block; }


/* v1.0.4 product modal polish */
.dialog-actions-single{grid-template-columns:1fr!important;}
.dialog-actions-single button{width:100%;}
