/* Only what Polaris does not provide. Flat colours, no gradients or shadows
   beyond the admin's own card edge, so the page reads as part of Shopify. */
:root {
  --ink: #1a1a1a;
  --muted: #616161;
  --line: #e3e3e3;
  --soft: #f7f7f7;
  --card: #ffffff;
  --radius: 12px;

  --violet: #6d28d9;
  --violet-bg: #f1ebff;
  --green: #047857;
  --green-bg: #e3f5ec;
  --orange: #c2410c;
  --orange-bg: #fff0e3;
  --blue: #1d4ed8;
  --blue-bg: #e8efff;
  --teal: #0f766e;
  --teal-bg: #e0f5f2;
  --red: #b91c1c;
  --red-bg: #fdecec;
  --gray: #4a4a4a;
  --gray-bg: #f1f1f1;
}

body {
  margin: 0;
  background: #f1f1f1;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

.center-spinner {
  display: flex;
  justify-content: center;
  padding: 64px 0;
}
.h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.small {
  font-size: 12px;
}
.center {
  text-align: center;
}
.ellipsis {
  display: block;
  max-width: 48ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eyebrow {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
p.muted {
  margin: 2px 0 0;
}

/* Icon tiles */
.tile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.tile-small {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.tile-large {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}
.tile-xl {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}
.tile-violet { background: var(--violet-bg); color: var(--violet); }
.tile-green { background: var(--green-bg); color: var(--green); }
.tile-orange { background: var(--orange-bg); color: var(--orange); }
.tile-blue { background: var(--blue-bg); color: var(--blue); }
.tile-teal { background: var(--teal-bg); color: var(--teal); }
.tile-red { background: var(--red-bg); color: var(--red); }
.tile-gray { background: var(--gray-bg); color: var(--gray); }

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
}
.kpi-value {
  margin-top: 6px;
}
.kpi-label {
  font-size: 12px;
  color: var(--muted);
}
.kpi-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}
.kpi-meter {
  height: 6px;
  margin-top: 4px;
  border-radius: 99px;
  background: var(--gray-bg);
  overflow: hidden;
}
.kpi-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.fill-orange { background: var(--orange); }
.fill-green { background: var(--green); }
.fill-red { background: var(--red); }

/* Section heads */
.section-head,
.setup-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card-title {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

/* Setup guide */
.setup-bar {
  flex: 0 1 200px;
  height: 6px;
  border-radius: 99px;
  background: var(--gray-bg);
  overflow: hidden;
}
.setup-bar span {
  display: block;
  height: 100%;
  background: var(--green);
}
.steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  display: grid;
  grid-template-columns: 22px auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  background: var(--soft);
}
.step-body {
  display: grid;
  gap: 2px;
}
.step.done .step-body strong {
  color: var(--muted);
  text-decoration: line-through;
}
.step-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px dashed #b5b5b5;
}
.step.done .step-check {
  border: 0;
  background: var(--green);
  color: #fff;
}

/* Templates */
.templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.template {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.template:hover:not(:disabled),
.template:focus-visible {
  outline: none;
  background: var(--soft);
}
.template.accent-violet:hover:not(:disabled) { border-color: var(--violet); }
.template.accent-green:hover:not(:disabled) { border-color: var(--green); }
.template.accent-orange:hover:not(:disabled) { border-color: var(--orange); }
.template.accent-blue:hover:not(:disabled) { border-color: var(--blue); }
.template.accent-teal:hover:not(:disabled) { border-color: var(--teal); }
.template:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.template-head,
.kpi-head,
.plan-head {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.template-head {
  margin-bottom: 2px;
}
.template-title {
  font-weight: 650;
  font-size: 14px;
  line-height: 1.3;
}
.template-text {
  font-size: 13px;
  color: var(--muted);
}
.template-example {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink);
}

/* Recent offers */
.recent {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.recent li + li {
  border-top: 1px solid var(--line);
}
.recent-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 4px;
  color: inherit;
  text-decoration: none;
}
.recent-row:hover {
  background: var(--soft);
}
.recent-text {
  display: grid;
  min-width: 0;
}
.chip-flat {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--gray-bg);
  font-size: 12px;
}

/* Offer list */
.plan-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13px;
}
.plan-strip > span {
  flex: 1;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.toolbar-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 360px;
}
.toolbar-tools > * {
  flex: 1;
}
.tabs {
  display: flex;
  gap: 4px;
}
.tab {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}
.tab:hover {
  background: var(--gray-bg);
}
.tab.selected {
  background: #e7e7e7;
  color: var(--ink);
}
.tab-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: #fff;
  font-size: 11px;
  text-align: center;
}
.no-results {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.offer-cell {
  display: flex;
  gap: 10px;
  align-items: center;
}
.offer-cell-text {
  display: grid;
  min-width: 0;
}
.code-chip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--blue-bg);
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.empty {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  padding: 8px 0 20px;
}

/* Editor */
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
.preview {
  position: sticky;
  top: 16px;
}
.preview-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--violet);
}
.preview-card.accent-green { border-top-color: var(--green); }
.preview-card.accent-orange { border-top-color: var(--orange); }
.preview-card.accent-blue { border-top-color: var(--blue); }
.preview-card.accent-teal { border-top-color: var(--teal); }
.preview-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.preview-head > div {
  display: grid;
}
.preview-title {
  font-size: 15px;
}
.preview-rule {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}
.preview-cart {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: var(--soft);
}
.preview-line {
  display: flex;
  gap: 10px;
  align-items: center;
}
.preview-thumb {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e8e8e8;
  color: #8a8a8a;
}
.preview-line-text {
  display: grid;
  gap: 4px;
}
.preview-line-name {
  font-size: 13px;
  font-weight: 550;
}
.discount-pill {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  justify-self: start;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 12px;
  font-weight: 550;
}
.checklist {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}
.checklist li {
  display: flex;
  gap: 6px;
  align-items: center;
}
.checklist li.ok {
  color: var(--ink);
}
.checklist li.ok s-icon {
  color: var(--green);
}

.unlock {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.hint {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.choice > span {
  display: grid;
  gap: 2px;
}
.choice.selected {
  border: 2px solid var(--ink);
  padding: 11px;
}
.choice:disabled:not(.selected) {
  opacity: 0.5;
  cursor: not-allowed;
}

.rule-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
.rule-card.off {
  opacity: 0.6;
}
.rule-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
}
.tier-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.step-num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gray-bg);
  font-size: 12px;
  font-weight: 700;
  align-self: center;
}
.tiers {
  display: grid;
  gap: 10px;
}
.selection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.picked {
  display: grid;
  gap: 10px;
  justify-items: start;
  align-content: start;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  font-size: 13px;
}
.chip img,
.chip-ph {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gray-bg);
  color: var(--muted);
}
.chip-text {
  max-width: 22ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.chip button:hover {
  color: var(--red);
}

/* Customize */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.bar-preview-wrap {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
}
.bar-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--gray-bg);
}
.segmented button {
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  background: transparent;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.segmented button.selected {
  background: #fff;
  font-weight: 600;
}
.browser {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.browser-dots {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.browser-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d4d4d4;
}
.browser-body {
  display: flex;
  flex-direction: column;
  min-height: 150px;
  background: #fff;
}
.browser-body.at-bottom {
  flex-direction: column-reverse;
}
.bar-preview {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 550;
}
.bar-track {
  width: min(320px, 80%);
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
}
.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.bar-off {
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--soft);
}
.fake-page {
  display: grid;
  gap: 10px;
  padding: 18px;
  flex: 1;
}
.fake-page span {
  height: 12px;
  border-radius: 6px;
  background: var(--gray-bg);
}
.fake-page span:nth-child(1) { width: 40%; }
.fake-page span:nth-child(2) { width: 75%; }
.fake-page span:nth-child(3) { width: 60%; }
.color-field {
  display: grid;
  gap: 6px;
}
.color-label {
  font-size: 13px;
}
.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.swatch {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #cfcfcf;
  cursor: pointer;
  padding: 0;
}
.swatch.selected {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.swatch.custom {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: conic-gradient(#ef4444, #eab308, #22c55e, #3b82f6, #a855f7, #ef4444);
}
.swatch.custom input {
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Plans */
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.plan-card {
  position: relative;
  display: grid;
  gap: 10px;
  align-content: start;
  justify-items: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.plan-card.featured {
  border: 2px solid var(--violet);
}
.plan-card.current {
  background: #fbfffd;
}
.plan-ribbon {
  position: absolute;
  top: -11px;
  right: 16px;
  padding: 2px 10px;
  border-radius: 99px;
  background: var(--violet);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
}
.plan-card-name {
  font-weight: 650;
  font-size: 16px;
}
.plan-card-price {
  font-size: 30px;
  font-weight: 700;
}
.plan-card-price small {
  font-size: 13px;
  font-weight: 450;
  color: var(--muted);
}
.plan-features {
  display: grid;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  font-size: 13px;
}
.plan-features li {
  display: flex;
  gap: 6px;
  align-items: center;
}
.plan-features s-icon {
  color: var(--green);
}
.current-pill {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .editor {
    grid-template-columns: 1fr;
  }
  .preview {
    position: static;
  }
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .toolbar-tools {
    min-width: 0;
    width: 100%;
  }
}
@media (max-width: 600px) {
  .kpis,
  .choice-row,
  .selection {
    grid-template-columns: 1fr;
  }
  .tier-row {
    grid-template-columns: auto 1fr;
  }
  .step {
    grid-template-columns: 22px 1fr;
  }
  .step .tile,
  .step s-button {
    display: none;
  }
}
