/*
 * Same tokens as the marketing site (web/website-astro/src/styles/main.css),
 * so the questionnaire reads as part of Simplifyd Cloud.
 */
:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --border: oklch(0.92 0.004 286.32);
  --ring: oklch(0.705 0.015 286.067);
  --primary: oklch(0.21 0.006 285.885);
  --primary-foreground: oklch(0.985 0 0);
  --canvas: #fbfbfa;
  --brand: #ec3944;
  --brand-soft: color-mix(in oklab, var(--brand) 10%, transparent);
  --ok: #059669;
  --warn: #b45309;
  --warn-soft: color-mix(in oklab, #f59e0b 12%, transparent);
  --radius: 0.625rem;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: oklch(0.141 0.005 285.823);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.18 0.005 285.823);
    --muted: oklch(0.274 0.006 286.033);
    --muted-foreground: oklch(0.705 0.015 286.067);
    --border: oklch(0.3 0.006 286.033);
    --ring: oklch(0.552 0.016 285.938);
    --primary: oklch(0.985 0 0);
    --primary-foreground: oklch(0.21 0.006 285.885);
    --canvas: oklch(0.141 0.005 285.823);
    --brand-soft: color-mix(in oklab, var(--brand) 18%, transparent);
    --ok: #34d399;
    --warn: #fbbf24;
    --warn-soft: color-mix(in oklab, #f59e0b 14%, transparent);
    --shadow-sm: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.18 0.005 285.823);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --border: oklch(0.3 0.006 286.033);
  --ring: oklch(0.552 0.016 285.938);
  --primary: oklch(0.985 0 0);
  --primary-foreground: oklch(0.21 0.006 285.885);
  --canvas: oklch(0.141 0.005 285.823);
  --brand-soft: color-mix(in oklab, var(--brand) 18%, transparent);
  --ok: #34d399;
  --warn: #fbbf24;
  --warn-soft: color-mix(in oklab, #f59e0b 14%, transparent);
  --shadow-sm: none;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--foreground);
  font: 15px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── top bar ── */

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 20px;
  background: color-mix(in oklab, var(--canvas) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.brand__logo {
  display: block;
  height: 34px;
  width: auto;
  color: var(--foreground);
}

.brand__sep {
  color: var(--border);
  font-weight: 400;
}

.brand__page {
  font-weight: 500;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved {
  font-size: 13px;
  color: var(--ok);
  opacity: 0;
  transition: opacity 0.3s;
}

.saved.is-on {
  opacity: 1;
}

/* ── layout ── */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 40px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

body[data-page="combine"] .layout {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="combine"] .steps {
  display: none;
}

.main {
  min-width: 0;
}

.main:focus,
.main:focus-visible {
  outline: none;
}

.steps {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 88px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--muted-foreground);
  font-weight: 500;
  font-size: 14px;
}

.step:hover {
  background: var(--muted);
  color: var(--foreground);
}

.step.is-active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.step__dot {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  font: 500 11px var(--font-mono);
}

.step__dot .icon {
  width: 12px;
  height: 12px;
  stroke-width: 3;
}

.step.is-active .step__dot {
  border-color: var(--foreground);
}

.step.is-done .step__dot {
  background: var(--ok);
  border-color: var(--ok);
  color: white;
}

.step--review .step__dot {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand);
}

.step__label {
  flex: 1;
  min-width: 0;
}

.step__left {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font: 500 11px/18px var(--font-mono);
  text-align: center;
}

/* ── page type ── */

.page {
  max-width: 720px;
}

.page--wide {
  max-width: none;
}

.eyebrow {
  margin: 0 0 6px;
  font: 500 12px var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
}

.title {
  margin: 0;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lede {
  margin: 10px 0 28px;
  max-width: 62ch;
  font-size: 16px;
  color: var(--muted-foreground);
  text-wrap: pretty;
}

.subtitle {
  margin: 40px 0 14px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted-foreground);
}

.small {
  font-size: 13px;
}

/* ── welcome ── */

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

.fact {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 14px;
}

.fact span {
  color: var(--muted-foreground);
}

.outline {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: o;
  border-top: 1px solid var(--border);
}

.outline li {
  counter-increment: o;
  display: grid;
  grid-template-columns: 28px 170px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.outline li::before {
  content: counter(o);
  font: 500 12px/22px var(--font-mono);
  color: var(--muted-foreground);
}

.outline span {
  color: var(--muted-foreground);
}

/* ── buttons ── */

.actions,
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

.pager {
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 36px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font: 500 14px var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--muted);
}

.btn--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn--primary:hover {
  background: color-mix(in oklab, var(--primary) 88%, var(--background));
}

.btn--add {
  width: 100%;
  justify-content: center;
  height: 48px;
  border-style: dashed;
  box-shadow: none;
  background: transparent;
  color: var(--muted-foreground);
}

.btn--add:hover {
  color: var(--foreground);
  border-color: var(--ring);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--foreground);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  cursor: pointer;
}

.link--danger {
  color: var(--brand);
  text-decoration-color: currentColor;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted-foreground);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--muted);
  color: var(--foreground);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── form ── */

.group {
  margin: 0 0 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.group__title {
  float: left;
  width: 100%;
  margin: 0 0 14px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.group__note {
  clear: both;
  margin: -6px 0 14px;
  font-size: 13px;
  color: var(--muted-foreground);
}

.fields {
  clear: both;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 16px;
}

.field {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

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

.field__label {
  font-weight: 500;
  font-size: 14px;
}

.req {
  color: var(--brand);
}

.field__help {
  margin: -2px 0 2px;
  font-size: 13px;
  color: var(--muted-foreground);
}

input:not([type="radio"]):not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  font: 15px/1.4 var(--font-sans);
}

textarea {
  resize: vertical;
  min-height: 84px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 30%, transparent);
}

::placeholder {
  color: var(--muted-foreground);
  opacity: 0.7;
}

.unit {
  position: relative;
}

.unit input {
  padding-right: 64px;
}

.unit__suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font: 13px var(--font-mono);
  color: var(--muted-foreground);
  pointer-events: none;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choices--rich {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}

.choice:hover {
  border-color: var(--ring);
}

.choice:has(input:checked) {
  border-color: var(--foreground);
  background: var(--muted);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.choice input {
  margin: 3px 0 0;
  accent-color: var(--brand);
  flex: none;
}

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

.choice__label {
  font-weight: 500;
}

.choice__hint {
  font-size: 13px;
  color: var(--muted-foreground);
  line-height: 1.4;
}

/* ── service cards ── */

.services {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: calc(var(--radius) + 4px);
  text-align: center;
}

.empty span {
  color: var(--muted-foreground);
}

.card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 72px;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 6px 6px;
}

.card__toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card__toggle:hover {
  background: var(--muted);
}

.card__num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font: 600 13px var(--font-mono);
}

.card__titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card__name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card__chips:empty {
  display: none;
}

.chip {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--muted);
  font-size: 12px;
  color: var(--muted-foreground);
}

.chip--hot {
  background: var(--brand-soft);
  color: var(--brand);
}

.card__left {
  flex: none;
  font: 500 12px var(--font-mono);
  color: var(--warn);
}

.card__chev {
  display: grid;
  color: var(--muted-foreground);
  transition: transform 0.2s;
}

.card.is-open .card__chev {
  transform: rotate(90deg);
}

.card__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
}

.card__body {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--border);
}

.card__body .group {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
}

.card__body .group + .group {
  padding-top: 20px;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.confirm {
  font-size: 13px;
  color: var(--muted-foreground);
  white-space: nowrap;
}

/* ── review ── */

.notice {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 14px;
}

.notice--info {
  margin: 0 0 24px;
  background: var(--brand-soft);
}

.notice--warn {
  background: var(--warn-soft);
}

.notice--warn > .icon {
  color: var(--warn);
  margin-top: 3px;
}

.notice ul {
  margin: 6px 0;
  padding-left: 18px;
}

.notice p {
  margin: 4px 0 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 10px;
  margin: 24px 0 0;
}

.stat {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.stat strong {
  font: 600 22px/1.2 var(--font-sans);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: 13px;
  color: var(--muted-foreground);
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.product {
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--card);
}

.product__name {
  font-size: 15px;
}

.product__what {
  margin: 4px 0 10px;
  font-size: 13px;
  color: var(--muted-foreground);
}

.product__why {
  margin: 0;
  font-size: 13px;
}

.gaps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gap {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 14px;
}

.gap p {
  margin: 2px 0 0;
}

.send {
  margin-top: 40px;
  padding: 20px;
  border-radius: calc(var(--radius) + 4px);
  background: var(--brand-soft);
}

.send .subtitle {
  margin-top: 0;
}

.send p {
  margin: 0;
}

.send .actions {
  margin-top: 16px;
}

.summary__section {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.summary__section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.summary__section h3 a {
  text-decoration: none;
}

.summary__item {
  margin: 0 0 14px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}

.summary__item h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.answers {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 6px 16px;
  margin: 0;
  font-size: 14px;
}

.answers dt {
  color: var(--muted-foreground);
}

.answers dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── combine ── */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 20px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  text-align: center;
  cursor: pointer;
}

.drop .icon {
  width: 22px;
  height: 22px;
  color: var(--muted-foreground);
}

.drop.is-over,
.drop:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  background: var(--muted);
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── footer & toast ── */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted-foreground);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 14px;
  box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.4);
}

/* ── small screens ── */

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 0 16px 48px;
  }

  .steps {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 56px);
    z-index: 5;
    flex-direction: row;
    gap: 4px;
    margin: 0 -16px;
    padding: 10px 16px;
    overflow-x: auto;
    background: var(--canvas);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
  }

  .step {
    flex: none;
    padding: 6px 10px;
  }

  .step:not(.is-active) .step__label {
    display: none;
  }

  .topbar {
    padding: 0 16px;
  }

  .brand__logo {
    height: 26px;
  }

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

  .outline li {
    grid-template-columns: 24px 1fr;
  }

  .outline li span {
    grid-column: 2;
  }

  .card__left {
    display: none;
  }
}

@media (max-width: 560px) {
  .field--half {
    grid-column: 1 / -1;
  }

  .group {
    padding: 16px;
  }

  .answers {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .answers dd {
    margin-bottom: 8px;
  }

  .pager .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ── print: the review page becomes the document ── */

@media print {
  :root {
    --canvas: white;
    --card: white;
  }

  .topbar,
  .steps,
  .footer,
  .toast,
  .no-print,
  .pager,
  .actions {
    display: none !important;
  }

  .layout {
    display: block;
    padding: 0;
  }

  .page {
    max-width: none;
  }

  .product,
  .gap,
  .stat,
  .summary__item,
  .table tr {
    break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
  }
}
