:root {
  /* Engage dashboard shell, Sync blue on grey */
  --font-primary: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 10px;
  --color-success: #16A34A;
  --color-danger: #DC2626;
}

[data-theme="dark"] {
  --color-brand: oklch(0.62 0.16 255);
  --color-brand-strong: oklch(0.55 0.17 260);
  --color-brand-accent: oklch(0.8 0.11 230);
  --color-brand-soft: oklch(0.62 0.16 255 / 0.16);
  --glow: oklch(0.55 0.18 255 / 0.22);
  --grid-line: oklch(1 0 0 / 0.04);
  --color-content-bg: oklch(0.16 0.008 255);
  --color-card-bg: oklch(0.205 0.01 255);
  --color-text-primary: oklch(0.96 0.005 255);
  --color-text-secondary: oklch(0.7 0.015 255);
  --color-border: oklch(0.3 0.01 255);
  --color-sidebar-bg: oklch(0.145 0.008 255);
  --sidebar-accent: oklch(0.25 0.03 255);
  --sidebar-accent-fg: oklch(0.96 0.02 255);
  --color-input-bg: oklch(0.18 0.008 255);
}

[data-theme="light"] {
  --color-brand: oklch(0.48 0.18 264);
  --color-brand-strong: oklch(0.42 0.18 264);
  --color-brand-accent: oklch(0.45 0.14 250);
  --color-brand-soft: oklch(0.48 0.18 264 / 0.1);
  --glow: oklch(0.55 0.16 255 / 0.14);
  --grid-line: oklch(0.32 0.02 255 / 0.07);
  --color-content-bg: oklch(0.975 0.004 255);
  --color-card-bg: oklch(1 0 0);
  --color-text-primary: oklch(0.22 0.02 255);
  --color-text-secondary: oklch(0.48 0.02 255);
  --color-border: oklch(0.9 0.008 255);
  --color-sidebar-bg: oklch(0.96 0.005 255);
  --sidebar-accent: oklch(0.93 0.03 250);
  --sidebar-accent-fg: oklch(0.38 0.14 260);
  --color-input-bg: oklch(0.985 0.003 255);
  --color-success: oklch(0.48 0.13 155);
  --color-danger: oklch(0.5 0.18 25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-primary);
  background: var(--color-content-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

body:has(.sidebar) {
  display: flex;
}

.sidebar {
  width: 240px;
  background: var(--color-sidebar-bg);
  padding: 20px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 20px;
  color: var(--color-text-primary);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.logo-word {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo em,
.logo-product {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-brand-accent);
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 8px 20px color-mix(in oklch, var(--color-brand) 35%, transparent);
}

.logo-mark-lg {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  gap: 16px;
  border-top: 1px solid var(--color-border);
}

.sidebar-footer a {
  font-size: 13px;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: var(--color-brand-accent);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Each Veritas app shows a light for the other two.
   Sync is blue #1D4ED8, Creative is orange, Engage is purple.
   This app shows Creative and Engage. A light fills in only while that app is connected. */
.app-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.app-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.app-link.on { color: var(--color-text-primary); }

.app-link-name { line-height: 1; }

.link-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--light) 65%, var(--color-text-secondary));
}

.link-light.on {
  background: var(--light);
  box-shadow:
    0 0 8px 1px color-mix(in oklch, var(--light) 75%, transparent),
    0 0 0 4px color-mix(in oklch, var(--light) 28%, transparent);
  animation: linkPulse 2.2s ease-in-out infinite;
}

.light-creative { --light: #F97316; }
.light-engage { --light: #A855F7; }

@keyframes linkPulse {
  0%, 100% {
    box-shadow:
      0 0 8px 1px color-mix(in oklch, var(--light) 75%, transparent),
      0 0 0 4px color-mix(in oklch, var(--light) 28%, transparent);
  }
  50% {
    box-shadow:
      0 0 12px 2px color-mix(in oklch, var(--light) 40%, transparent),
      0 0 0 7px color-mix(in oklch, var(--light) 8%, transparent);
  }
}

.nav-item {
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: color-mix(in oklch, var(--sidebar-accent) 65%, transparent);
  color: var(--color-text-primary);
}

.nav-item.active {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-fg);
  box-shadow: inset 2px 0 0 var(--color-brand);
}

.main {
  position: relative;
  isolation: isolate;
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
  overflow-y: auto;
  background: var(--color-content-bg);
}

.main::before,
.main::after {
  content: "";
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.main::before {
  inset: 0 0 auto 0;
  height: 18rem;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
  mask-image: linear-gradient(to bottom, #000, transparent);
}

.main::after {
  top: -6rem;
  right: 0;
  width: 40rem;
  height: 18rem;
  border-radius: 999px;
  background: var(--glow);
  filter: blur(48px);
}

.main > * {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
}

.topbar h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.toggle-btn {
  background: color-mix(in oklch, var(--color-card-bg) 70%, transparent);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary { background: var(--color-brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: color-mix(in oklch, var(--color-card-bg) 70%, transparent);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(22,163,74,0.15);
  color: var(--color-success);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.paused {
  background: rgba(245,158,11,0.15);
  color: #F59E0B;
}

.dot {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.trial-timer {
  font-size: 12px;
  color: var(--color-text-secondary);
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  padding: 4px 10px;
  border-radius: 20px;
}

.card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

.card.hero {
  border-color: color-mix(in oklch, var(--color-brand) 40%, var(--color-border));
  background:
    linear-gradient(to bottom right, var(--color-brand-soft), var(--color-card-bg) 55%);
  box-shadow:
    0 0 0 1px color-mix(in oklch, var(--color-brand) 28%, transparent),
    0 8px 40px -12px color-mix(in oklch, var(--color-brand) 40%, transparent);
}

.card h2 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.muted { color: var(--color-text-secondary); font-size: 13px; margin-bottom: 16px; }

.token-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.token-form input {
  flex: 1;
  min-width: 220px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
}

.token-list {
  display: grid;
  gap: 8px;
}

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-content-bg);
}

.token-row .provider-name { font-weight: 600; font-size: 14px; }
.token-row .provider-meta { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }

.token-empty {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-card-bg);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.notice strong { color: var(--color-text-primary); font-weight: 600; }
.notice.hidden { display: none; }

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 8px;
  max-width: 520px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.form-grid input,
.form-grid select {
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  color: var(--color-text-primary) !important;
  font-size: 14px !important;
}

.hidden { display: none !important; }

.onboarding {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.onboarding-card, .modal-card {
  background: var(--color-card-bg);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
}

.onboarding-card h2 { font-size: 22px; margin: 16px 0 8px; }

.onboarding-list {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
}

.onboarding-list div {
  padding-left: 14px;
  border-left: 2px solid var(--color-brand);
}
.onboarding-card p { color: var(--color-text-secondary); margin-bottom: 20px; line-height: 1.5; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.overrides-list { margin-top: 24px; display: grid; gap: 10px; }
.override-row {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.btn-danger { background: var(--color-danger); color: #fff; }

/* ── Hero status ─────────────────────────────────────────────────────────── */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.hero-status { display: flex; align-items: center; gap: 16px; }
.hero-state { font-size: 22px; font-weight: 700; }
.hero-sub { font-size: 13px; color: var(--color-text-secondary); margin-top: 4px; }

.pulse-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 4px rgba(22,163,74,0.18);
  animation: heroPulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.pulse-dot.paused {
  background: var(--color-danger);
  box-shadow: 0 0 0 4px rgba(220,38,38,0.18);
  animation: none;
}

@keyframes heroPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(22,163,74,0.18); }
  50% { box-shadow: 0 0 0 10px rgba(22,163,74,0.05); }
}

.hero-metrics { display: flex; gap: 32px; flex-wrap: wrap; }
.metric { min-width: 92px; }

.tagline {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--color-brand-accent);
}
.metric-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.metric-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* ── Dashboard grid ──────────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 6fr 4fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}

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

.card-head h2 { margin-bottom: 0; }

/* ── Activity feed ───────────────────────────────────────────────────────── */
.activity-feed {
  margin-top: 8px;
  max-height: 420px;
  overflow-y: auto;
}

.activity-feed.tall { max-height: none; }

.activity-row {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.activity-row:last-child { border-bottom: none; }

.thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--color-content-bg);
  flex-shrink: 0;
}

.thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.activity-body { flex: 1; min-width: 0; }

.activity-title {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-title .state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
}

.activity-title .state-dot.warn { background: #F59E0B; }
.activity-title .state-dot.error { background: var(--color-danger); }

.activity-time { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }

.rule-ticks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.rule-tick {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(22,163,74,0.12);
  color: var(--color-success);
}

.link-btn {
  background: none;
  border: none;
  color: var(--color-brand-accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 12px 0 0;
}

/* ── Rules summary ───────────────────────────────────────────────────────── */
.rules-summary { display: grid; gap: 2px; margin: 8px 0 18px; }

.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

.rule-row:last-child { border-bottom: none; }
.rule-row .label { color: var(--color-text-secondary); }
.rule-row .value { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.rule-row .value.off { color: var(--color-text-secondary); font-weight: 500; }

/* ── Providers ───────────────────────────────────────────────────────────── */
.providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.provider-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.provider-name { font-size: 14px; font-weight: 600; }

.provider-state {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-success);
  margin-top: 6px;
}

.provider-state.off { color: var(--color-text-secondary); }

.provider-state .state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.provider-meta { font-size: 11px; color: var(--color-text-secondary); margin-top: 6px; }

.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }

.switch span {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.switch span::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.switch input:checked + span { background: var(--color-brand); }
.switch input:checked + span::before { transform: translateX(18px); }

.badge-success {
  background: rgba(22,163,74,0.15);
  color: var(--color-success);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Guided tour ─────────────────────────────────────────────────────────── */
.tour-launch {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  border-radius: 6px;
  padding: 9px 12px;
  margin-top: 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.tour-launch:hover { color: var(--color-text-primary); border-color: var(--color-brand); }

.support-panel {
  position: fixed;
  z-index: 50;
  right: 20px;
  /* App Bridge sets this to the height of Shopify's floating nav. It is 0 when that bar is absent. */
  bottom: calc(20px + var(--shopify-safe-area-inset-bottom, 0px));
  width: min(400px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 40px - var(--shopify-safe-area-inset-bottom, 0px)));
  display: flex;
  flex-direction: column;
  background: var(--color-card-bg);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.support-panel.hidden { display: none; }

.support-panel-page {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  max-height: none;
  margin: 20px 0 8px;
  box-shadow: none;
}

.support-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
}

.support-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: 360px;
}

.support-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
}

.support-msg-sync {
  align-self: flex-start;
  background: var(--color-brand-soft);
  color: var(--color-text-primary);
}

.support-msg-merchant {
  align-self: flex-end;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
}

.support-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 10px;
}

.support-chip {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  border-radius: 999px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.support-chip:hover { color: var(--color-text-primary); border-color: var(--color-brand); }

.support-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 0 14px 10px;
}

.support-confirm-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.support-confirm:disabled { opacity: 0.7; cursor: default; }

.support-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--color-border);
}

.support-form input {
  flex: 1;
  min-width: 0;
  background: var(--color-input-bg);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 16px;
}

.support-form .btn { flex-shrink: 0; }

@media (max-width: 900px) {
  /*
   * Shopify's nav pill is drawn by the admin over the bottom of the iframe,
   * so a fixed field on the bottom edge cannot be tapped. 96px clears that
   * pill until App Bridge publishes its real height.
   */
  .support-panel:not(.support-panel-page) {
    --support-pill-gap: max(96px, var(--shopify-safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    bottom: calc(12px + var(--support-pill-gap));
    width: auto;
    max-height: min(68vh, 560px, calc(100vh - 24px - var(--support-pill-gap)));
  }

  .support-log { max-height: 30vh; }
}

.tour { position: fixed; inset: 0; z-index: 60; }

/*
 * With the panel over part of the screen, the last sections of the page have
 * nowhere left to scroll to. This gives them the room.
 */
body.tour-active .main { padding-bottom: 64vh; }

/* One element cut out of a page-wide dim, rather than four masking panels */
.tour-spotlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.66), 0 0 0 2px var(--color-brand-accent);
  transition: all 0.2s ease;
  pointer-events: none;
}

/* Shared look. Position belongs to the two layouts below. */
.tour-card {
  position: fixed;
  overflow-y: auto;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}

/*
 * Phone layout: centred, and deliberately away from every edge. The Shopify
 * mobile app floats its own nav bar over the bottom of our page and that bar
 * swallows taps, so buttons near the bottom edge cannot be pressed at all.
 */
.tour-card.phone {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(420px, calc(100vw - 32px));
  max-height: 56vh;
  transform: translate(-50%, -50%);
}

/*
 * Desktop layout: hangs below the section it describes. Position comes from the
 * script, which measures the section, so only the size is set here.
 */
.tour-card.desktop {
  right: auto;
  bottom: auto;
  width: 360px;
  max-height: 40vh;
  transform: none;
}

/*
 * Landscape phone: left of centre so the highlighted section stays readable
 * beside it, and above centre to clear the host app's bottom bar.
 */
@media (max-height: 560px) {
  .tour-card.phone {
    top: 45%;
    left: 16px;
    width: min(380px, calc(100vw - 32px));
    max-height: 78vh;
    transform: translateY(-50%);
  }
}

.tour-step {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-secondary);
}

.tour-card h3 { font-size: 16px; font-weight: 600; margin: 6px 0 8px; }
.tour-card p { font-size: 13px; line-height: 1.55; color: var(--color-text-secondary); }

/* Sticky so the controls stay on screen even when the step text has to scroll */
.tour-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  background: var(--color-card-bg);
}

.tour-nav { display: flex; gap: 8px; }

.tour-card.phone .tour-actions .btn { padding: 11px 16px; }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}

@media (min-width: 901px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
  }
}

@media (max-width: 900px) {
  body:has(.sidebar) { flex-direction: column; }
  .sidebar { width: 100%; height: auto; padding: 14px 12px; }
  .logo { padding: 4px 8px 12px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .app-links { flex-direction: row; gap: 14px; margin-top: 8px; padding-top: 8px; }
  .nav-item { width: auto; }
  .main { padding: 18px 16px; }
  .hero { align-items: flex-start; }
  .hero-metrics { gap: 24px; }
  .topbar { flex-wrap: wrap; }
}

/* Phone in landscape: give the content the little vertical room there is */
@media (max-height: 560px) and (max-width: 1100px) {
  .sidebar { padding: 8px 12px; }
  .logo { padding: 2px 8px 8px; font-size: 15px; }
  .tour-launch { margin-top: 8px; padding: 7px 10px; }
  .sidebar-footer { padding-top: 8px; }
  .main { padding: 14px 16px; }
  .topbar { margin-bottom: 16px; }
}
