:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e5e7eb;
  --border-soft: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --brand: #008060;
  --brand-dark: #004c3f;
  --brand-soft: #ecfdf5;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --rem-bg: #fee2e2;
  --rem-text: #b91c1c;
  --add-bg: #d1fae5;
  --add-text: #065f46;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* CRITIQUE-2: grid/flex items default to min-width:auto and refuse to shrink
   below their content — this caused a 424px horizontal overflow at 390px.
   Let every grid child shrink so panels track the viewport. */
.grid > *, .steps > *, .preset-grid > *, .add-rule-row > * { min-width: 0; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 14px;
}

button { font-family: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 22px; height: 22px; fill: var(--brand); flex: none; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-tagline { font-size: 10px; color: var(--muted); letter-spacing: 0.01em; white-space: nowrap; }
.wedge-chip {
  font-size: 12px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #a7f3d0;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-outline { background: #fff; border-color: #d1d5db; color: var(--text); }
.btn-outline:hover { background: #f9fafb; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.linklike {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}
.linklike:hover { text-decoration: underline; }

.hero {
  max-width: 780px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  text-align: center;
}
.hero h1 { font-size: 32px; line-height: 1.15; letter-spacing: -0.03em; margin: 0 0 14px; }
.hero-sub { color: var(--muted); font-size: 16px; line-height: 1.55; margin: 0 auto 34px; max-width: 620px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 34px; text-align: left; }
.step { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.step-num {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 700;
  display: grid; place-items: center;
  margin-bottom: 10px;
}
.step h3 { margin: 0 0 6px; font-size: 14.5px; }
.step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hero-foot { color: var(--faint); font-size: 12.5px; margin-top: 22px; }

.statsbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 9px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.stat strong { color: var(--text); font-size: 14px; }
.stat.source { font-weight: 600; color: var(--text); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.changed-stat strong { color: var(--amber); }
.statsbar .linklike { margin-left: auto; }

.grid {
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  gap: 16px;
  padding: 16px 18px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  flex: 1;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-head h2 { margin: 0; font-size: 14.5px; letter-spacing: -0.01em; }
.panel-head .hint { color: var(--faint); font-size: 12px; white-space: nowrap; }

.rules-panel { display: flex; flex-direction: column; max-height: calc(100vh - 170px); }
#ruleList { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.rules-empty {
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.rule-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 12px 10px; background: #fff; }
.rule-card.off { opacity: .5; background: #fafafa; }
.rule-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rule-num {
  width: 20px; height: 20px; flex: none;
  border-radius: 6px;
  background: var(--text); color: #fff;
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.rule-kind { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.kind-price { background: var(--brand-soft); color: var(--brand-dark); }
.kind-tag { background: #f5f3ff; color: #5b21b6; }
.kind-title { background: #eff6ff; color: #1e40af; }
.match-badge {
  margin-left: auto;
  font-size: 11px;
  color: #374151;
  background: var(--border-soft);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}
.icon-btn:hover { background: #f9fafb; color: var(--text); }
.icon-btn.del:hover { background: var(--rem-bg); color: var(--rem-text); border-color: #fecaca; }
.icon-btn:disabled { opacity: .35; cursor: default; }

.frow { display: flex; align-items: center; gap: 8px; margin: 7px 0; flex-wrap: wrap; }
.frow > label, .flabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.sub { padding-left: 10px; border-left: 2px solid var(--border-soft); margin-left: 4px; }

input[type="text"], input[type="search"], input[type="number"], input[type="email"], select, textarea {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 128, 96, .14);
}
input[type="number"] { width: 100px; }
select { cursor: pointer; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.chk input { accent-color: var(--brand); }

.entries-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.entry, .entry-head { display: grid; grid-template-columns: minmax(0, 1fr) 110px 26px; gap: 6px; align-items: center; }
.entry-head { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; padding: 0 2px; }
.mini-btn {
  border: 1px dashed #d1d5db;
  background: none;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.mini-btn:hover { color: var(--brand-dark); border-color: var(--brand); }

.rule-summary {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-soft);
  line-height: 1.45;
}

.add-rule-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 12px 10px; }
.add-btn { border-style: dashed; border-color: #cbd5e1; background: none; color: #374151; font-size: 12.5px; padding: 9px 6px; }
.add-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.rules-note { color: var(--faint); font-size: 11.5px; text-align: center; padding: 0 16px 12px; margin: 0; }

.preview-panel { display: flex; flex-direction: column; max-height: calc(100vh - 170px); }
.preview-panel .panel-head { flex-wrap: wrap; }
#searchBox { flex: 1; min-width: 180px; max-width: 300px; }
.table-wrap { overflow: auto; flex: 1; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fafb;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th.num, td.num { text-align: right; }
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
tbody tr:hover { background: #fafafa; }
.row-changed { background: var(--amber-soft); }
.row-changed:hover { background: #fdf6e3; }
.row-changed td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

.p-title { font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-sub { color: var(--faint); font-size: 11.5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: #374151; }
.muted { color: var(--faint); }

.cell-diff s { color: var(--faint); }
.cell-diff .arr { color: var(--faint); margin: 0 5px; }
.cell-diff strong { color: var(--add-text); font-weight: 700; }

.chip {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  margin: 2px 3px 2px 0;
  border-radius: 999px;
  background: var(--border-soft);
  color: #374151;
  white-space: nowrap;
}
.chip.rem { background: var(--rem-bg); color: var(--rem-text); text-decoration: line-through; }
.chip.add { background: var(--add-bg); color: var(--add-text); font-weight: 600; }

.empty-filter { padding: 30px; text-align: center; color: var(--muted); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  color: var(--faint);
  font-size: 12.5px;
}
.footer a { color: var(--brand); font-weight: 600; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

dialog {
  border: none;
  border-radius: 14px;
  padding: 20px 22px;
  width: min(720px, 92vw);
  box-shadow: 0 20px 50px rgba(16, 24, 40, .25);
}
dialog::backdrop { background: rgba(15, 23, 42, .45); }
dialog h3 { margin: 0 0 6px; font-size: 16px; }
.dialog-sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; line-height: 1.5; }
.dialog-sub code { background: var(--border-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
#pasteText { width: 100%; height: 280px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

#preflightModal { width: min(900px, 94vw); max-height: min(860px, 92vh); overflow: auto; }
.preflight-summary { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 2px 16px; padding: 12px 14px; border: 1px solid #a7f3d0; border-radius: 10px; background: var(--brand-soft); }
.preflight-summary strong { color: var(--brand-dark); font-size: 20px; font-variant-numeric: tabular-nums; }
.preflight-summary span { color: #065f46; font-size: 12px; }
.preflight-section { margin-top: 16px; }
.preflight-section h4 { margin: 0 0 7px; font-size: 13px; }
.preflight-rules, .preflight-warnings, .preflight-touched { margin: 0; padding-left: 20px; }
.preflight-rules li, .preflight-touched li { margin: 6px 0; }
.preflight-rules span, .preflight-touched span { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; }
.preflight-warnings { color: #92400e; background: var(--amber-soft); border: 1px solid #fde68a; border-radius: 8px; padding: 8px 10px 8px 28px; font-size: 12.5px; line-height: 1.5; }
.preflight-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.preflight-table { min-width: 600px; }
.preflight-table th { position: static; }
.preflight-table td { font-size: 12px; line-height: 1.45; }
.preflight-touched { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 8px 30px; font-size: 12px; }
.preflight-section summary { cursor: pointer; font-weight: 700; font-size: 13px; }

.shopify-guide { width: min(880px, 94vw); max-height: min(880px, 92vh); overflow: auto; }
.guide-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.guide-kicker { margin: 0; color: var(--brand-dark); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.guide-top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.shopify-guide h2 { margin: 8px 0; font-size: 24px; letter-spacing: -.02em; }
.guide-intro { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.guide-section { margin-top: 20px; }
.guide-section h3, .guide-callout h3, .guide-checklist h3 { margin: 0 0 8px; font-size: 15px; }
.guide-section p, .guide-section li, .guide-callout p { color: #374151; line-height: 1.55; }
.guide-section p { margin: 8px 0; }
.guide-section ol { margin: 0; padding-left: 21px; }
.guide-section li + li { margin-top: 6px; }
.guide-section code, .guide-callout code { background: var(--border-soft); border-radius: 4px; padding: 1px 4px; font-size: .92em; }
.guide-callout { padding: 14px 16px; border: 1px solid #fde68a; border-radius: 10px; background: var(--amber-soft); }
.guide-callout p { margin: 0; }
.guide-checklist { margin-top: 22px; padding: 16px; border: 2px solid var(--brand); border-radius: 10px; background: var(--brand-soft); }
.guide-checklist label { display: flex; align-items: flex-start; gap: 9px; padding: 6px 0; color: #064e3b; line-height: 1.45; cursor: pointer; }
.guide-checklist input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.guide-source-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .28);
  animation: toast-in .18s ease;
  max-width: 90vw;
}
.toast.err { background: var(--rem-text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.btn-reset { background: #fff; border-color: #fca5a5; color: #b91c1c; }
.btn-reset:hover { background: #fef2f2; border-color: #f87171; }

/* rule packs */
.preset-cards { margin: 0 auto 30px; max-width: 640px; }
.preset-head { font-size: 13px; font-weight: 700; margin-bottom: 10px; text-align: left; }
.preset-head .hint { font-weight: 500; color: var(--faint); }
.preset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: left; }
.preset-card {
  display: flex; flex-direction: column; gap: 5px;
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 12px; padding: 12px 14px;
  text-decoration: none; color: inherit;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.preset-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,128,96,.08); }
.preset-card strong { font-size: 13px; letter-spacing: -0.01em; }
.preset-card span { color: var(--muted); font-size: 12px; line-height: 1.45; }

/* pricing strip + lead capture */
.pricing-strip {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin: 0 auto 26px; padding: 14px 18px;
  background: var(--brand-soft); border: 1px solid #a7f3d0; border-radius: 12px;
}
.price-tag {
  font-size: 22px; font-weight: 800; color: var(--brand-dark); letter-spacing: -0.02em;
  white-space: nowrap;
}
.price-copy { font-size: 13px; color: #065f46; line-height: 1.5; max-width: 460px; text-align: left; }
.pricing-cta { white-space: nowrap; }

.lead-form { margin: 0 auto; max-width: 480px; }
.lead-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.lead-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.lead-row input[type="email"] { width: min(280px, 100%); }

/* statsbar guardrails */
.floor-stat { display: inline-flex; align-items: center; gap: 6px; }
.floor-stat label { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.floor-stat input { width: 84px; padding: 4px 8px; font-size: 12.5px; }
#floorNote { color: var(--amber); font-weight: 600; }

/* catalog switcher — named catalogs stored in this browser */
.catalog-stat { display: inline-flex; align-items: center; gap: 6px; }
.catalog-stat label { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.catalog-stat select { max-width: 240px; padding: 4px 8px; font-size: 12.5px; }
.cat-actions { display: inline-flex; gap: 2px; }
.cat-actions .icon-btn { width: 26px; height: 26px; font-size: 13px; line-height: 1; }
.browser-note {
  font-size: 11px; color: var(--faint); white-space: nowrap;
  border: 1px solid var(--border-soft); border-radius: 999px; padding: 2px 8px;
}
@media (max-width: 640px) {
  .catalog-stat { flex: 1 1 100%; flex-wrap: wrap; min-width: 0; }
  .catalog-stat select { flex: 1 1 110px; min-width: 0; max-width: none; }
}

.tier-notice {
  margin: 10px 18px 0;
  padding: 9px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.45;
  background: var(--amber-soft); border: 1px solid #fde68a; color: #92400e;
}
.tier-notice.warn { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

.match-badge.badge-err { background: var(--rem-bg); color: var(--rem-text); font-weight: 600; }

/* snapshots */
.snapshots { border-top: 1px solid var(--border-soft); padding: 10px 12px 4px; }
.snap-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.snap-head h3 { margin: 0; font-size: 13px; }
.snap-save { display: flex; gap: 6px; margin-bottom: 8px; }
.snap-save input { flex: 1; min-width: 0; padding: 6px 9px; font-size: 12.5px; }
.mini-btn.solid { border-style: solid; border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); white-space: nowrap; }
.mini-btn.solid:hover { background: #d1fae5; }
.snap-list { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.snap-item {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; padding: 7px 9px;
}
.snap-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
.snap-meta strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snap-meta .hint { font-size: 11px; }
.snap-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.snap-empty { color: var(--muted); font-size: 12px; line-height: 1.5; border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; }

/* undo history */
.history-panel { max-width: 1644px; margin: 0 auto 16px; width: calc(100% - 36px); }
.history-head { align-items: flex-start; }
.history-head .hint { display: block; margin-top: 3px; white-space: normal; }
.history-list { list-style: none; margin: 0; padding: 12px 16px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.history-item { border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 10px; padding: 10px 11px; min-width: 0; }
.history-meta { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.history-meta strong { color: var(--text); font-size: 13px; }
.history-meta span { color: var(--brand-dark); font-weight: 700; }
.history-rules { color: #374151; font-size: 12px; line-height: 1.45; margin: 7px 0 9px; min-height: 35px; }
.history-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.history-actions .mini-btn { flex: 1 1 120px; }
.history-empty { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; line-height: 1.5; border: 1px dashed var(--border); border-radius: 10px; padding: 11px 12px; }
.history-diff-wrap { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.history-diff-table { min-width: 680px; }
.history-diff-table th { position: sticky; top: 0; z-index: 1; }
.history-diff-table td { font-size: 12px; line-height: 1.45; }
#historyDiffLimit { margin: 9px 0 0; color: var(--muted); font-size: 12px; }

/* compare-at column visibility */
.ca-col { display: none; }
table.has-ca .ca-col { display: table-cell; }

/* pager */
.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  padding: 8px 14px; border-top: 1px solid var(--border-soft);
}
.pg-btn { width: 40px; height: 40px; font-size: 15px; }
.pg-info { font-size: 12.5px; color: var(--muted); padding: 0 6px; font-variant-numeric: tabular-nums; }

@media (max-width: 1020px) {
  .grid { grid-template-columns: 1fr; }
  .rules-panel, .preview-panel { max-height: none; }
  #ruleList { max-height: 320px; }
  .steps { grid-template-columns: 1fr; }
  .statsbar .linklike { margin-left: 0; }
}

@media (max-width: 640px) {
  .hero { padding: 34px 16px 30px; }
  .hero h1 { font-size: 25px; }
  .hero-sub { font-size: 14.5px; }
  .topbar { padding: 8px 12px; }
  .wedge-chip { white-space: normal; line-height: 1.35; }
  .preset-grid { grid-template-columns: 1fr; }
  .pricing-strip { flex-direction: column; gap: 6px; text-align: center; }
  .price-copy { text-align: center; }
  .statsbar { gap: 10px 14px; padding: 8px 12px; }
  .stat.source { max-width: 200px; }
  .grid { padding: 10px 10px; gap: 10px; }
  .add-rule-row { grid-template-columns: 1fr; }
  #searchBox { max-width: none; }
  .footer { flex-direction: column; gap: 4px; }
  .history-panel { width: calc(100% - 20px); margin-bottom: 10px; }
  .history-list { padding: 10px; grid-template-columns: 1fr; }
  #preflightModal { width: calc(100vw - 16px); padding: 16px; }
  .preflight-summary { grid-template-columns: repeat(2, 1fr); gap: 2px 8px; }
  .preflight-summary strong { font-size: 17px; }
  .preflight-summary span { font-size: 11px; }
  .preflight-actions { justify-content: stretch; flex-direction: column-reverse; }
  .preflight-actions .btn { width: 100%; }
  .shopify-guide { width: calc(100vw - 16px); padding: 16px; }
  .guide-topline { align-items: flex-start; }
  .guide-top-actions { justify-content: flex-end; }
  .guide-top-actions .btn { padding: 7px 9px; }
  .shopify-guide h2 { font-size: 21px; }
}

@media print {
  body > * { display: none !important; }
  body > #shopifyGuide[open] { display: block !important; position: static; width: auto; max-width: none; max-height: none; overflow: visible; border: 0; box-shadow: none; }
  #shopifyGuide::backdrop, .guide-top-actions { display: none !important; }
  .shopify-guide { color: #000; }
  .guide-callout, .guide-checklist { break-inside: avoid; background: #fff; }
  .guide-checklist { border-color: #000; }
}
