:root {
  --crimson: #8f171d;
  --crimson-strong: #651016;
  --crimson-soft: #f9e8ea;
  --charcoal: #17191d;
  --charcoal-soft: #343840;
  --gold: #b88930;
  --gold-soft: #fbf1dc;
  --ink: #1d2430;
  --muted: #5f6876;
  --line: #d9dee7;
  --line-strong: #b9c0cc;
  --paper: #ffffff;
  --canvas: #f5f3ef;
  --panel: #fbfaf7;
  --danger: #a8191f;
  --danger-soft: #fde8ea;
  --shadow: 0 18px 42px rgba(23, 25, 29, 0.11), 0 3px 10px rgba(23, 25, 29, 0.06);
  --radius: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

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

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  letter-spacing: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: 42px;
  line-height: 1.04;
  font-weight: 850;
  overflow-wrap: break-word;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 820;
}

h3 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.22;
  font-weight: 790;
}

h4 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 760;
}

p {
  margin-bottom: 14px;
  color: var(--muted);
}

small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

::selection {
  background: var(--crimson);
  color: #fff;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(23, 25, 29, 0.12);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px) saturate(145%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
}

.brand-logo picture,
.brand-logo img {
  width: 100%;
  height: 100%;
}

.brand-logo picture {
  display: block;
}

.brand-logo img {
  object-fit: contain;
  padding: 4px;
}

.brand-copy {
  min-width: 0;
}

.brand-name,
.brand-subtitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-name {
  color: var(--charcoal);
  font-size: 16px;
  font-weight: 820;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.demo-status {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5d0a0;
  border-radius: var(--radius);
  padding: 8px 11px;
  background: var(--gold-soft);
  color: #674712;
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.page-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 34px;
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.22fr);
  gap: 22px;
  align-items: start;
}

.context-panel,
.form-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.context-panel {
  position: sticky;
  top: 96px;
}

.hero-media {
  aspect-ratio: 16 / 10;
  background: var(--charcoal);
  overflow: hidden;
}

.hero-media picture,
.hero-media img {
  width: 100%;
  height: 100%;
}

.hero-media picture {
  display: block;
}

.hero-media img {
  object-fit: cover;
}

.context-copy {
  padding: 24px;
}

.context-copy p:last-child {
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--crimson);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.context-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}

.context-metrics div {
  min-height: 86px;
  padding: 15px 14px;
  border-right: 1px solid var(--line);
}

.context-metrics div:last-child {
  border-right: 0;
}

.context-metrics dt {
  margin: 0;
  color: var(--charcoal);
  font-size: 25px;
  font-weight: 850;
  line-height: 1;
}

.context-metrics dd {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-panel {
  min-width: 0;
}

.form-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 20px;
}

.step-count {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
  color: var(--muted);
  background: var(--panel);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.progress-track {
  height: 5px;
  background: #ebe7df;
}

.progress-track span {
  display: block;
  width: 16.666%;
  height: 100%;
  background: var(--crimson);
  transition: width 180ms ease;
}

.step-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.step-tab {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 780;
}

.step-tabs li:last-child .step-tab {
  border-right: 0;
}

.step-tab:hover:not(:disabled) {
  background: var(--crimson-soft);
  color: var(--crimson-strong);
}

.step-tab.active {
  background: var(--crimson);
  color: #fff;
}

.step-tab.done:not(.active) {
  color: var(--crimson);
}

.step-tab:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.form-step {
  display: none;
  padding: 26px;
}

.form-step.active {
  display: block;
}

.step-intro {
  margin-bottom: 22px;
}

.step-intro p {
  max-width: 760px;
  margin-bottom: 0;
}

.field-grid {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
}

.sales-note {
  display: grid;
  gap: 4px;
  margin: 0 0 20px;
  border: 1px solid #e7d3a5;
  border-radius: var(--radius);
  padding: 13px 14px;
  background: var(--gold-soft);
  color: #604512;
}

.sales-note strong {
  color: #563d0d;
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.sales-note span {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

.sales-note.primary-note {
  border-color: #d7b166;
  background: linear-gradient(180deg, #fff8e8, #fbf1dc);
}

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

.field,
.rank-grid label {
  display: grid;
  gap: 7px;
}

.field span,
.rank-grid span,
.choice-field legend,
.rank-field legend {
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 780;
}

.field span small {
  margin-left: 5px;
}

.field input,
.field select,
.field textarea,
.rank-grid select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.rank-grid select:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(143, 23, 29, 0.14);
}

.field.compact {
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.field.compact span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--charcoal);
  color: #fff;
  font-size: 13px;
}

.field.error input,
.field.error select,
.field.error textarea,
.rank-grid label.error select,
.choice-field.error .choice {
  border-color: var(--danger);
  background: #fffafa;
}

.choice-field.error legend {
  color: var(--danger);
}

.choice-field,
.rank-field,
.field-block {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.choice-field legend,
.rank-field legend {
  margin: 0 0 10px;
  padding: 0;
}

.field-note {
  margin: -4px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.choice-grid,
.check-grid {
  display: grid;
  gap: 10px;
}

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

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

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

.choice,
.check {
  min-height: 76px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.choice:hover,
.check:hover {
  border-color: var(--crimson);
  background: #fff;
}

.choice:has(input:checked),
.check:has(input:checked) {
  border-color: var(--crimson);
  background: var(--crimson-soft);
  box-shadow: inset 0 0 0 1px rgba(143, 23, 29, 0.12);
}

.choice input,
.check input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--crimson);
  flex: 0 0 auto;
}

.choice strong,
.choice small {
  display: block;
}

.choice strong {
  color: var(--charcoal);
  font-size: 14px;
  line-height: 1.25;
}

.choice small {
  margin-top: 4px;
  line-height: 1.35;
}

.check {
  min-height: 48px;
  align-items: center;
}

.check span {
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 720;
}

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

.rank-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.rank-field.has-error .rank-grid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.error-message {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 760;
}

.step-actions,
.receipt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 790;
  line-height: 1.2;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.btn:focus-visible,
.step-tab:focus-visible {
  outline: 3px solid rgba(143, 23, 29, 0.2);
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn.primary:hover {
  background: var(--crimson-strong);
}

.btn.secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--charcoal);
}

.btn.secondary:hover {
  border-color: var(--crimson);
  background: var(--crimson-soft);
  color: var(--crimson-strong);
}

.brief-output {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.brief-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px;
}

.brief-section h4 {
  color: var(--crimson);
}

.brief-section dl {
  display: grid;
  gap: 9px;
  margin: 0;
}

.brief-section div {
  display: grid;
  gap: 2px;
}

.brief-section dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.brief-section dd {
  margin: 0;
  color: var(--charcoal);
  font-size: 14px;
  font-weight: 670;
  overflow-wrap: anywhere;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #e7d3a5;
  border-radius: var(--radius);
  padding: 6px 8px;
  background: var(--gold-soft);
  color: #674712;
  font-size: 12px;
  font-weight: 780;
}

.receipt-panel {
  padding: 34px 28px;
  text-align: center;
}

.receipt-logo {
  width: min(250px, 82vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
}

.receipt-logo picture,
.receipt-logo img {
  width: 100%;
  height: 100%;
}

.receipt-logo picture {
  display: block;
}

.receipt-logo img {
  object-fit: contain;
  padding: 12px;
}

.delivery-note {
  max-width: 680px;
  margin: 10px auto 0;
  color: var(--charcoal-soft);
}

.receipt-actions {
  justify-content: center;
  border-top: 0;
}

.site-footer {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto 24px;
  display: flex;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

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

  .context-panel {
    position: static;
    display: grid;
    grid-template-columns: 0.92fr 1.08fr;
  }

  .hero-media {
    min-height: 100%;
    aspect-ratio: auto;
  }

  .context-metrics {
    grid-column: 1 / -1;
  }

  h1 {
    font-size: 34px;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    padding: 12px 16px;
  }

  .page-shell,
  .site-footer {
    width: calc(100% - 24px);
    max-width: 1380px;
  }

  .context-panel {
    grid-template-columns: 1fr;
  }

  .hero-media {
    aspect-ratio: 16 / 9;
  }

  .form-panel-head {
    flex-direction: column;
  }

  .step-tabs {
    display: flex;
    overflow-x: auto;
  }

  .step-tabs li {
    flex: 0 0 110px;
  }

  .field-grid.two,
  .choice-grid.two,
  .choice-grid.three,
  .choice-grid.four,
  .rank-grid,
  .brief-output,
  .check-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 24px;
  }

  h3 {
    font-size: 20px;
  }

  .topbar {
    gap: 10px;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .demo-status {
    display: none;
  }

  .form-step,
  .form-panel-head,
  .context-copy {
    padding: 20px;
  }

  .context-metrics {
    grid-template-columns: 1fr;
  }

  .context-metrics div {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .context-metrics div:last-child {
    border-bottom: 0;
  }

  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .step-actions,
  .receipt-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .step-actions .btn,
  .receipt-actions .btn {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .context-panel,
  .step-tabs,
  .progress-track,
  .step-actions,
  .receipt-actions,
  .site-footer {
    display: none !important;
  }

  .page-shell {
    display: block;
    width: 100%;
    padding: 0;
  }

  .form-panel {
    border: 0;
    box-shadow: none;
  }

  .form-step {
    padding: 0;
  }

  .form-step:not(.active) {
    display: none !important;
  }

}
