:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-alt: #f9fafb;
  --sidebar-bg: #f3f4f6;
  --panel-border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --success: #059669;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.page-shell {
  width: 100%;
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  padding-left: 280px;
}

.onboard-shell,
.onboard-view {
  display: grid;
  gap: 24px;
}

.onboard-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.onboard-view h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.sidebar,
.app-main,
.onboard-shell,
.onboard-view,
.page-stack,
.page-view,
.panel,
.topbar-copy,
.sidebar-nav,
.stack-list,
.list-grid,
.metric-grid,
.two-column-grid,
.scan-layout,
.form-grid {
  display: grid;
  gap: 20px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  height: 100vh;
  overflow-y: auto;
  align-content: start;
  gap: 10px;
  padding: 14px 12px 14px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0;
  background: linear-gradient(180deg, #2a313b 0%, #25303b 100%);
  box-shadow: none;
}

.app-main {
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.brand-shell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1d4ed8;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  gap: 4px;
}

.brand-copy strong {
  font-size: 0.96rem;
  color: #ffffff;
}

.brand-copy span,
.field-help,
.section-copy,
.stack-card p,
.metric-card p,
.module-card p,
.side-status-shell p,
.side-item-meta {
  color: var(--muted);
}

.brand-copy span {
  color: rgba(255, 255, 255, 0.74);
}

.eyebrow {
  color: #2563eb;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-store,
.side-status-shell,
.panel,
.form-card,
.metric-card,
.stack-card,
.module-card,
.stat-tile {
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: var(--panel);
}

.sidebar-store,
.side-status-shell,
.form-card {
  padding: 16px;
}

.sidebar-store,
.side-status-shell {
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
}

.sidebar-nav {
  align-content: start;
  grid-auto-rows: max-content;
  gap: 6px;
}

.side-status-shell p,
.field-help,
.section-copy,
.stack-card p,
.metric-card p,
.module-card p {
  margin: 0;
  line-height: 1.6;
}

.side-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #ffffff;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.side-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.26);
}

.side-item.active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.36);
  box-shadow: none;
}

.side-item-label {
  font-weight: 700;
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.2;
}

.side-item-meta {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  line-height: 1.25;
}

.sidebar-button {
  width: 100%;
}

.panel {
  padding: 24px;
}

.topbar {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  align-items: start;
}

.topbar h1,
.onboard-view h2,
.section-heading h2,
.module-card h3,
.stack-card strong,
.metric-card strong {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.75rem, 2.8vw, 2.4rem);
  line-height: 1.1;
}

.topbar-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

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

.stat-tile {
  padding: 18px;
  gap: 10px;
}

.stat-tile span {
  color: var(--muted);
}

.stat-tile strong {
  font-size: 1.4rem;
}

.section-heading {
  display: grid;
  gap: 12px;
}

.section-heading h2 {
  font-size: 1.4rem;
  line-height: 1.25;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.metric-card strong {
  display: block;
  font-size: 1.9rem;
  margin-bottom: 10px;
}

.two-column-grid,
.scan-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.list-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-card,
.stack-card {
  padding: 18px;
}

.module-card {
  gap: 12px;
}

.module-status,
.metric-chip,
.inline-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.module-status,
.metric-chip {
  background: #eff6ff;
  color: #1d4ed8;
}

.inline-status.is-done {
  background: #ecfdf5;
  color: #047857;
}

.inline-status.is-pending {
  background: #fef2f2;
  color: #b91c1c;
}

.form-card {
  align-content: start;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.select-field,
.text-field,
.output-field {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
}

.select-field,
.text-field {
  min-height: 46px;
  padding: 0 14px;
}

.output-field {
  min-height: 180px;
  padding: 14px;
  resize: vertical;
  line-height: 1.6;
}

.compact-output {
  min-height: 120px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-span-2 {
  grid-column: span 2;
}

.compact-list {
  gap: 12px;
}

.shopify-installation-card {
  cursor: pointer;
}

.shopify-installation-card.active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.scan-stage-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.scan-stage-tab {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.scan-stage-tab.active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.scan-journey-shell {
  display: grid;
  gap: 20px;
}

.scan-journey-viewport {
  position: relative;
  overflow: hidden;
  min-height: 70vh;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background: #ffffff;
}

.scan-journey-track {
  height: 500%;
  transition: transform 0.55s ease;
}

.scan-screen {
  display: grid;
  align-content: start;
  gap: 24px;
  height: 20%;
  padding: 28px;
}

.scan-screen-copy {
  display: grid;
  gap: 10px;
}

.scan-screen-copy h3 {
  margin: 0;
  font-size: 1.6rem;
}

.scan-screen-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
}

.progress-shell {
  overflow: hidden;
  min-height: 16px;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-bar {
  width: 0;
  height: 16px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  transition: width 0.22s ease;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.progress-meta strong {
  font-size: 1.6rem;
}

.primary-button,
.secondary-button {
  border-radius: 12px;
  border: 1px solid transparent;
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #ffffff;
}

.secondary-button {
  background: #ffffff;
  color: var(--text);
  border-color: #d1d5db;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 1120px) {
  .app-shell,
  .topbar,
  .metric-grid,
  .two-column-grid,
  .scan-layout,
  .list-grid {
    grid-template-columns: 1fr;
  }


  .scan-screen-layout {
    grid-template-columns: 1fr;
  }

  .scan-screen {
    padding: 22px;
  }

  .progress-meta {
    align-items: start;
    flex-direction: column;
  }

  .app-shell {
    padding-left: 0;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
  }

  .topbar-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .onboard-shell {
    width: min(100%, calc(100% - 20px));
    padding: 14px 0 28px;
  }

  .panel,
  .sidebar {
    padding: 16px;
  }

  .app-main {
    padding: 14px 10px 28px;
  }

  .topbar-stats,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  .topbar-actions {
    flex-direction: column;
  }
}
