:root {
  --os-primary: #0b1b4a;
  --os-primary-soft: #eef1f8;
  --os-accent: #0b1b4a;
  --os-accent-soft: #eef1f8;
  --os-price: #0b1b4a;
  --os-surface: #f7f7f8;
  --os-card: #ffffff;
  --os-text: #18181b;
  --os-muted: #71717a;
  --os-line: #e4e4e7;
  --os-danger: #dc2626;
  --os-radius: 10px;
  --os-sidebar-w: 480px;
  --os-font-heading: "Inter", system-ui, sans-serif;
  --os-font-body: "Inter", system-ui, sans-serif;
}

.os-pdp-wrap,
.os-overlay,
.os-sheet,
.os-toast {
  font-family: var(--os-font-body);
  color: var(--os-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Demo store chrome ── */
.os-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px; background: var(--os-primary); color: #fff; font-size: 13px;
}
.os-topbar strong { font-family: var(--os-font-heading); }
.os-topbar-actions { display: flex; gap: 8px; }
.os-chip {
  border: 0; background: rgba(255,255,255,.12); color: #fff;
  padding: 7px 12px; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 600;
  text-decoration: none; display: inline-block;
}
.os-store-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-bottom: 1px solid var(--os-line);
}
.os-logo { display: flex; align-items: center; gap: 10px; font-family: var(--os-font-heading); font-weight: 800; font-size: 20px; }
.os-logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--os-primary); display: grid; place-items: center; }
.os-store-nav { display: flex; gap: 22px; color: var(--os-muted); font-size: 14px; }
.os-pdp {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px;
  max-width: 1180px; margin: 0 auto; padding: 36px 28px;
}
.os-gallery {
  background: var(--os-surface); border-radius: 24px; min-height: 380px;
  display: grid; place-items: center; padding: 32px;
}
.os-info h1 { margin: 0 0 8px; font-family: var(--os-font-heading); font-size: 30px; letter-spacing: -.03em; }
.os-price-lg { color: var(--os-price); font-size: 28px; font-weight: 700; margin: 0 0 16px; }
.os-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.os-tag { background: var(--os-surface); border: 1px solid var(--os-line); border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.os-copy { color: var(--os-muted); line-height: 1.55; margin: 0 0 24px; }
.os-btn { border: 0; cursor: pointer; font-weight: 600; border-radius: 8px; padding: 12px 20px; font-size: 14px; line-height: 1.2; transition: background .15s, border-color .15s; }
.os-btn-primary { background: var(--os-primary); color: #fff; }
.os-btn-primary:hover { filter: brightness(1.08); }
.os-btn-secondary { background: #fff; color: var(--os-text); border: 1px solid var(--os-line); }
.os-btn-secondary:hover { background: var(--os-surface); border-color: #d4d4d8; }
.os-btn-ghost { background: #fff; color: var(--os-text); border: 1px solid var(--os-line); }
.os-qty { display: inline-flex; align-items: center; border: 1px solid var(--os-line); border-radius: 8px; overflow: hidden; background: #fff; }
.os-qty button { width: 36px; height: 40px; border: 0; background: #fff; cursor: pointer; font-size: 16px; color: var(--os-text); }
.os-qty input { width: 40px; height: 40px; border: 0; text-align: center; font-weight: 600; font-size: 14px; background: #fff; }

/* Product page block (WooCommerce) */
.os-pdp-wrap { margin: 20px 0 0; max-width: 420px; }
.os-pdp-total-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 16px; margin-bottom: 14px; border-radius: var(--os-radius);
  background: var(--os-surface); border: 1px solid var(--os-line);
}
.os-pdp-total-label { font-size: 13px; font-weight: 500; color: var(--os-muted); }
.os-pdp-total-price { font-size: 22px; font-weight: 600; color: var(--os-price); letter-spacing: -0.02em; }
.os-pdp-total-price .woocommerce-Price-amount { font-weight: inherit; color: inherit; }
.os-pdp-hint { margin: 12px 0 0; font-size: 12px; line-height: 1.45; color: var(--os-muted); }
.os-cta-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.os-woo-cta { margin: 0; }

/* Lenskart sidebar */
.os-overlay {
  position: fixed; inset: 0; z-index: 999999;
  display: none; pointer-events: none;
}
.os-overlay.is-open { display: block; pointer-events: auto; }
.os-overlay::before {
  content: ""; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0; transition: opacity .25s ease;
}
.os-overlay.is-open::before { opacity: 1; }

.os-sheet {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(var(--os-sidebar-w), 100%);
  max-width: 100vw;
  background: #fff;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  z-index: 1000000;
  overflow: hidden;
}
.os-overlay.is-open .os-sheet { transform: translateX(0); }

.os-sheet-head {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: 16px 12px 12px; border-bottom: 1px solid var(--os-line); flex-shrink: 0;
}
.os-sheet-head h2 {
  margin: 0; text-align: center; font-family: var(--os-font-heading);
  font-size: 15px; font-weight: 600; color: var(--os-text); letter-spacing: -0.02em;
}
.os-icon-btn {
  width: 40px; height: 40px; border: 0; background: transparent;
  cursor: pointer; color: var(--os-primary); border-radius: 50%;
  display: grid; place-items: center; padding: 0;
}
.os-icon-btn:hover { background: var(--os-surface); }
.os-icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Stepper */
.os-lk-stepper {
  display: flex; padding: 14px 20px 0; gap: 0; position: relative; flex-shrink: 0;
}
.os-lk-stepper::after {
  content: ""; position: absolute; left: 20px; right: 20px; top: 28px;
  height: 2px; background: var(--os-line); z-index: 0;
}
.os-lk-step {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative; z-index: 1; padding-bottom: 12px;
}
.os-lk-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: #fff; border: 2px solid var(--os-line); color: var(--os-muted);
}
.os-lk-num svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.os-lk-step.is-on .os-lk-num { border-color: var(--os-primary); color: var(--os-primary); background: #fff; }
.os-lk-step.is-done .os-lk-num { background: var(--os-primary); border-color: var(--os-primary); color: #fff; }
.os-lk-name { font-size: 11px; font-weight: 500; color: var(--os-muted); text-align: center; line-height: 1.2; }
.os-lk-step.is-on .os-lk-name { color: var(--os-text); font-weight: 600; }
.os-lk-step.is-on::after {
  content: ""; position: absolute; bottom: 0; left: 20%; right: 20%;
  height: 2px; background: var(--os-primary); border-radius: 2px;
}

.os-sheet-body { flex: 1; overflow-y: auto; padding: 18px 20px 24px; -webkit-overflow-scrolling: touch; }
.os-panel { display: none; }
.os-panel.is-on { display: block; }

.os-panel-top {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.os-panel-label { margin: 0; font-weight: 600; font-size: 14px; color: var(--os-text); letter-spacing: -0.01em; }
.os-learn { color: var(--os-muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.os-learn:hover { color: var(--os-text); }

/* List rows (power type, rx hub) */
.os-list { display: flex; flex-direction: column; gap: 10px; }
.os-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border: 1px solid var(--os-line); border-radius: var(--os-radius);
  background: #fff; cursor: pointer; text-align: left; color: inherit;
  transition: border-color .12s, background .12s;
}
.os-row:hover { border-color: #d4d4d8; background: #fafafa; }
.os-row-icon {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 8px;
  background: var(--os-surface); display: grid; place-items: center;
}
.os-row-icon svg { width: 22px; height: 22px; stroke: var(--os-text); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.os-row-text { flex: 1; min-width: 0; }
.os-row-text strong {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-family: var(--os-font-heading); font-size: 14px; font-weight: 600; color: var(--os-text);
}
.os-row-text small { display: block; margin-top: 4px; font-size: 12px; color: var(--os-muted); line-height: 1.4; }
.os-row-go { flex-shrink: 0; color: #c5cad3; display: grid; place-items: center; }
.os-row-go svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.os-pill {
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 4px;
  text-transform: none; letter-spacing: 0;
}
.os-pill.purple { background: #f4f4f5; color: #52525b; }
.os-pill.blue { background: #f4f4f5; color: #52525b; }

/* Filters */
.os-filters {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 4px;
}
.os-filter {
  flex-shrink: 0; border: 1px solid var(--os-line); background: #fff;
  border-radius: 999px; padding: 8px 14px; font-size: 12px; font-weight: 600;
  cursor: pointer; color: var(--os-text);
  display: inline-flex; align-items: center; gap: 6px;
}
.os-filter svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.os-filter.is-on { background: var(--os-primary); color: #fff; border-color: var(--os-primary); }
.os-filter.is-on svg { stroke: #fff; }

/* Lens package cards */
.os-lens-list { display: flex; flex-direction: column; gap: 12px; }
.os-lens-card {
  display: grid; grid-template-columns: 100px 1fr 24px; gap: 12px; align-items: start;
  width: 100%; padding: 12px; border: 1px solid var(--os-line); border-radius: var(--os-radius);
  background: #fff; cursor: pointer; text-align: left; color: inherit;
}
.os-lens-card:hover { border-color: var(--os-accent); }
.os-lens-thumb {
  position: relative; background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  border-radius: 10px; height: 90px; display: grid; place-items: center;
}
.os-lens-glass {
  width: 56px; height: 28px; border-radius: 40px;
  border: 2px solid rgba(11,27,74,.3);
  background: linear-gradient(180deg, rgba(255,255,255,.8), rgba(255,255,255,.2));
}
.os-lens-tag {
  position: absolute; top: 6px; left: 6px; background: #2563eb; color: #fff;
  font-size: 9px; font-weight: 700; padding: 3px 6px; border-radius: 4px;
}
.os-lens-info strong { display: block; font-size: 14px; color: var(--os-primary); margin-bottom: 6px; }
.os-lens-info ul { margin: 0; padding: 0; list-style: none; }
.os-lens-info li { font-size: 12px; color: var(--os-muted); padding: 2px 0 2px 14px; position: relative; }
.os-lens-info li::before { content: "•"; position: absolute; left: 0; color: var(--os-accent); }
.os-lens-price { margin-top: 8px; }
.os-lens-price b { color: var(--os-price); font-size: 16px; }
.os-lens-price span { display: block; font-size: 11px; color: var(--os-muted); }
.os-lens-go { align-self: center; color: var(--os-primary); display: grid; place-items: center; }
.os-lens-go svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Rx hub */
.os-rx-block { margin-bottom: 20px; }
.os-rx-head h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--os-primary); }

/* Manual entry */
.os-form-title { margin: 0 0 14px; font-size: 17px; font-weight: 700; color: var(--os-primary); }
.os-rx-box {
  background: var(--os-surface); border-radius: var(--os-radius); padding: 16px;
}
.os-check-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
/* Rx grid + sidebar picker */
.os-rx-grid {
  display: grid; gap: 10px 8px; margin-top: 14px; align-items: center;
}
.os-rx-grid.is-same { grid-template-columns: 72px 1fr; }
.os-rx-grid.is-split { grid-template-columns: 72px 1fr 1fr; }
.os-rx-col-h { font-size: 12px; font-weight: 700; color: var(--os-muted); text-align: center; }
.os-rx-row-label { font-size: 13px; font-weight: 700; color: var(--os-primary); }
.os-pick-btn {
  width: 100%; border: 1px solid var(--os-line); border-radius: 12px;
  padding: 12px 14px; background: #fff; font-size: 14px; font-weight: 600;
  color: var(--os-text); cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between;
}
.os-pick-btn:hover { border-color: #cbd5e1; }
.os-pick-chev { color: var(--os-muted); display: grid; place-items: center; }
.os-pick-chev svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.os-customer-block { margin-top: 20px; }
.os-customer-block h4 { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--os-primary); }
.os-field-row { display: block; margin-bottom: 12px; }
.os-field-row span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--os-primary); }
.os-field-row input {
  width: 100%; border: 1px solid var(--os-line); border-radius: 8px;
  padding: 12px 14px; font-size: 14px; background: #fff;
  box-shadow: none; outline: none; appearance: none;
}
.os-field-row input:focus {
  border-color: var(--os-primary);
  box-shadow: 0 0 0 3px rgba(11, 27, 74, 0.1);
}
.os-help-link { text-align: center; color: var(--os-accent); font-size: 13px; font-weight: 600; margin-top: 16px; }
.os-help-link a { color: inherit; text-decoration: none; }

/* Sidebar power picker */
.os-rx-drawer {
  position: absolute; inset: 0; background: #fff; z-index: 20;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .28s ease;
  border-radius: inherit;
}
.os-rx-drawer.is-open { transform: translateX(0); }
.os-drawer-head {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center;
  padding: 14px 12px 10px; border-bottom: 1px solid var(--os-line); flex-shrink: 0;
}
.os-drawer-head h3 {
  margin: 0; text-align: center; font-family: var(--os-font-heading);
  font-size: 15px; font-weight: 700; color: var(--os-primary);
}
.os-picker-body { flex: 1; overflow-y: auto; padding: 12px 16px 24px; }
.os-picker-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.os-picker-col h4 {
  margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--os-primary);
  position: sticky; top: 0; background: #fff; padding: 4px 0;
}
.os-picker-list { display: flex; flex-direction: column; gap: 2px; }
.os-picker-opt {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.os-picker-opt:hover { background: var(--os-surface); }
.os-picker-opt input { accent-color: var(--os-primary); width: 16px; height: 16px; }
.os-picker-opt span { color: var(--os-text); }

.os-upload-card {
  display: block; border: 1.5px dashed #cbd5e1; border-radius: var(--os-radius);
  padding: 36px 20px; text-align: center; background: var(--os-surface); cursor: pointer;
}
.os-upload-card .os-upload-icon {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px;
  background: #fff; display: grid; place-items: center; border: 1px solid var(--os-line);
}
.os-upload-card .os-upload-icon svg { width: 22px; height: 22px; stroke: var(--os-primary); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.os-upload-card strong { display: block; margin-bottom: 6px; color: var(--os-primary); font-size: 14px; }
.os-upload-card span { color: var(--os-muted); font-size: 12px; }

/* Footer CTA — sticky at bottom of sidebar */
.os-sheet-foot {
  flex-shrink: 0;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--os-line);
  background: #fff;
  display: none;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}
.os-sheet-foot.is-visible {
  display: block;
}
.os-save-btn {
  width: 100%; border: 0; border-radius: 8px; padding: 14px;
  background: var(--os-primary); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: var(--os-font-heading); letter-spacing: -0.01em;
  transition: filter .15s;
}
.os-save-btn:hover { filter: brightness(1.06); }
.os-save-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

/* Theme studio + toast */
.os-studio {
  position: fixed; top: 56px; right: 16px; width: 300px; background: #fff;
  border: 1px solid var(--os-line); border-radius: 16px; padding: 16px; z-index: 40; display: none;
}
.os-studio.is-open { display: block; }
.os-studio h3 { margin: 0 0 12px; font-family: var(--os-font-heading); }
.os-field { margin-bottom: 12px; }
.os-field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.os-field input, .os-field select { width: 100%; }
.os-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.os-presets button { border: 1px solid var(--os-line); background: #fff; border-radius: 10px; padding: 8px; cursor: pointer; font-size: 12px; }

.os-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--os-primary); color: #fff; padding: 12px 18px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 200;
}
.os-toast.is-on { opacity: 1; }
.os-error { text-align: center; color: var(--os-danger); font-size: 13px; min-height: 18px; }

.os-woo-cta { margin: 16px 0 8px; }

/* Hide default WooCommerce cart when OptiStep is active */
body.single-product.optistep-product form.cart:not(#optistep-cart-form),
body.single-product.optistep-product .wp-block-woocommerce-add-to-cart-form,
body.single-product.optistep-product .woocommerce-variation-add-to-cart,
body.single-product.optistep-product .single_add_to_cart_button:not(.os-btn) {
  display: none !important;
}
body.single-product.optistep-product .entry-summary > form.cart:not(#optistep-cart-form) {
  display: none !important;
}
body.single-product.optistep-product .optistep-hidden-cart {
  display: none !important;
}
body.single-product.optistep-product .os-pdp-wrap ~ form.cart:not(#optistep-cart-form) {
  display: none !important;
}

/* ── Responsive: sidebar + storefront ── */
@media (min-width: 1024px) {
  .os-sheet { width: min(var(--os-sidebar-w), 44vw); }
}

@media (max-width: 960px) {
  .os-pdp { grid-template-columns: 1fr; padding: 24px 16px; }
  .os-store-nav { display: none; }
  .os-store-header { padding: 14px 16px; }
  .os-gallery { min-height: 280px; border-radius: 16px; }
  .os-info h1 { font-size: 24px; }
  .os-price-lg { font-size: 24px; }
}

@media (max-width: 639px) {
  /* Mobile: full-width sidebar like Lenskart app */
  .os-sheet {
    width: 100%;
    max-width: 100%;
    box-shadow: none;
  }

  .os-sheet-head {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 8px 10px;
  }

  .os-sheet-body {
    padding: 14px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .os-sheet-foot {
    padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .os-lk-stepper { padding: 12px 12px 0; }
  .os-lk-stepper::after { left: 12px; right: 12px; }
  .os-lk-name { font-size: 9px; }

  .os-panel-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .os-row { padding: 12px 14px; gap: 12px; }
  .os-row-icon { width: 44px; height: 44px; }

  .os-lens-card {
    grid-template-columns: 80px 1fr 20px;
    gap: 10px;
    padding: 10px;
  }
  .os-lens-thumb { height: 76px; }
  .os-lens-info strong { font-size: 13px; }
  .os-lens-info li { font-size: 11px; }

  .os-filters {
    margin: 0 -16px;
    padding: 0 16px 10px;
    scroll-padding-inline: 16px;
  }

  .os-picker-cols { gap: 8px; }
  .os-picker-col h4 { font-size: 12px; }
  .os-picker-opt { padding: 12px 6px; min-height: 44px; }

  .os-pick-btn { padding: 14px 12px; min-height: 48px; }
  .os-save-btn { padding: 15px; min-height: 52px; }

  .os-topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
  }
  .os-topbar > span { display: none; }

  .os-cta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .os-cta-row .os-qty { align-self: flex-start; }
  .os-cta-row .os-btn { width: 100%; text-align: center; }

  .os-toast {
    left: 16px;
    right: 16px;
    transform: none;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    text-align: center;
  }

  .os-studio {
    left: 12px;
    right: 12px;
    width: auto;
    top: auto;
    bottom: 12px;
    max-height: 70vh;
    overflow-y: auto;
  }
}

@media (max-width: 380px) {
  .os-lens-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .os-lens-thumb { height: 72px; width: 100%; }
  .os-lens-go { justify-self: end; }
  .os-rx-grid.is-split { grid-template-columns: 56px 1fr 1fr; gap: 8px 6px; }
}
