:root {
  --ink: #17202a;
  --muted: #637083;
  --line: #d8dee7;
  --surface: #ffffff;
  --soft: #f5f7fb;
  --accent: #0f766e;
  --accent-2: #b45309;
  --danger: #b42318;
  --good: #15803d;
  --warn: #c2410c;
  --bad: #b91c1c;
  --shadow: 0 18px 45px rgba(23, 32, 42, .08);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef7f5 0%, #f6f8fb 260px, #f6f8fb 100%);
}

h1, h2, h3, p { margin: 0; }

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

.topbar {
  min-height: 96px;
  padding: 22px clamp(18px, 4vw, 48px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(15, 118, 110, .18);
}

.topbar h1 {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  text-transform: uppercase;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.nav-link, button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

button.secondary, .nav-link {
  color: var(--accent);
  background: #fff;
}

button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.intro-band, .toolbar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow);
}

.intro-band h2, .toolbar h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.intro-band p, .toolbar p, .section-heading p {
  color: var(--muted);
  line-height: 1.45;
}

.scale-box {
  display: grid;
  grid-template-columns: repeat(5, minmax(86px, 1fr));
  gap: 8px;
  min-width: min(540px, 100%);
}

.form-hero {
  min-height: 210px;
  overflow: hidden;
}

.hero-visual {
  position: relative;
  width: min(360px, 100%);
  height: 168px;
  flex: 0 0 min(360px, 100%);
}

.hero-image {
  width: min(420px, 100%);
  height: auto;
  flex: 0 0 min(420px, 100%);
  display: block;
  border-radius: 8px;
  border: 1px solid rgba(15, 118, 110, .18);
  box-shadow: 0 16px 34px rgba(23, 32, 42, .09);
}

.visual-card {
  position: absolute;
  border-radius: 8px;
  border: 1px solid rgba(15, 118, 110, .22);
  background: #fff;
  box-shadow: 0 16px 32px rgba(23, 32, 42, .10);
}

.visual-card.one {
  width: 142px;
  height: 96px;
  left: 16px;
  top: 18px;
}

.visual-card.two {
  width: 170px;
  height: 116px;
  right: 18px;
  top: 42px;
  background: #fef7ed;
}

.visual-card.three {
  width: 128px;
  height: 72px;
  left: 82px;
  bottom: 4px;
  background: #e7f7f3;
}

.visual-card::before,
.visual-card::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  height: 9px;
  border-radius: 999px;
  background: #cbd5e1;
}

.visual-card::before { top: 22px; }
.visual-card::after { top: 46px; width: 58%; }

.visual-line {
  position: absolute;
  inset: 26px 44px auto auto;
  width: 96px;
  height: 96px;
  border: 3px solid rgba(180, 83, 9, .35);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
}

.wizard-status {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(220px, 360px) 1fr;
  gap: 18px;
  align-items: center;
  box-shadow: var(--shadow);
}

.wizard-status h2 {
  font-size: 20px;
}

.progress-wrap {
  height: 14px;
  border-radius: 999px;
  background: #e8edf3;
  overflow: hidden;
}

#progressBar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #22a184);
  transition: width .25s ease;
}

.scale-box span {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  font-size: 12px;
  text-align: center;
  color: #344054;
}

.survey-form, .dashboard-grid, .metrics-grid {
  margin-top: 20px;
}

.wizard-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.wizard-main {
  display: grid;
  gap: 14px;
}

.stepper {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}

.step-item {
  width: 100%;
  min-height: 52px;
  justify-content: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-color: transparent;
  background: transparent;
  color: #344054;
  text-align: left;
  white-space: normal;
}

.step-item span {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
}

.step-item strong {
  line-height: 1.25;
  font-size: 13px;
}

.step-item.active {
  background: #e7f7f3;
  color: #0f5e57;
}

.step-item.active span,
.step-item.done span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.scale-box.compact {
  min-width: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.panel, .metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel + .panel, #questionContainer .panel {
  margin-top: 18px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 20px;
}

.step-art {
  margin-bottom: 18px;
  padding: 18px;
  min-height: 150px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  gap: 18px;
  background: linear-gradient(135deg, #f0faf8, #fff7ed);
  border: 1px solid rgba(15, 118, 110, .14);
}

.step-art h3 {
  font-size: 24px;
  margin-bottom: 7px;
}

.step-art p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}

.mini-illustration {
  position: relative;
  height: 124px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid rgba(15, 118, 110, .18);
  overflow: hidden;
}

.mini-illustration span {
  position: absolute;
  border-radius: 8px;
  background: var(--accent);
  opacity: .9;
}

.mini-illustration span:nth-child(1) {
  width: 70px;
  height: 70px;
  left: 18px;
  top: 18px;
  background: #0f766e;
}

.mini-illustration span:nth-child(2) {
  width: 82px;
  height: 18px;
  right: 18px;
  top: 30px;
  background: #b45309;
}

.mini-illustration span:nth-child(3) {
  width: 112px;
  height: 18px;
  right: 18px;
  top: 66px;
  background: #64748b;
}

.mini-illustration.B span:nth-child(1),
.mini-illustration.G span:nth-child(1) {
  border-radius: 50%;
}

.mini-illustration.C span:nth-child(1),
.mini-illustration.H span:nth-child(1) {
  height: 88px;
  top: 26px;
}

.mini-illustration.open span:nth-child(1) {
  width: 112px;
  height: 56px;
  border-radius: 8px 8px 8px 2px;
}

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

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: #344054;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

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

.question-list {
  display: grid;
  gap: 10px;
}

.question-row {
  display: grid;
  grid-template-columns: 62px minmax(240px, 1fr) 310px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qid {
  color: var(--accent);
  font-weight: 800;
}

.qtext {
  line-height: 1.42;
}

.rating {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.rating label {
  display: block;
  position: relative;
  font-weight: 700;
}

.rating input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.rating input:checked + span {
  border-color: var(--accent);
  background: #dff4ef;
  color: #0f5e57;
}

.open-list {
  display: grid;
  gap: 14px;
}

.form-actions, .toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.form-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 18px;
  padding: 14px;
  background: rgba(246, 248, 251, .92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 8px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.login-shell {
  display: grid;
  min-height: calc(100vh - 180px);
  place-items: center;
}

.login-card {
  width: min(560px, 100%);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-visual {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 42%, #0f766e 42% 58%, transparent 58%),
    radial-gradient(circle at 50% 36%, #b45309 0 11px, transparent 12px),
    #e7f7f3;
  border: 1px solid rgba(15, 118, 110, .22);
}

.thank-you {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}

.thank-you h2 {
  font-size: 34px;
  margin-bottom: 8px;
}

.thank-you p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 18px;
}

.metric small {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.metric span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
}

.heatmap {
  display: grid;
  gap: 10px;
}

.heat-row {
  display: grid;
  grid-template-columns: 170px 1fr 74px;
  gap: 10px;
  align-items: center;
}

.bar {
  height: 16px;
  border-radius: 999px;
  background: #e8edf3;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.status-low { background: #fee2e2; color: var(--bad); }
.status-mid { background: #ffedd5; color: var(--warn); }
.status-high { background: #dcfce7; color: var(--good); }

.score-pill {
  border-radius: 999px;
  padding: 6px 9px;
  text-align: center;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  background: var(--soft);
  color: #344054;
}

.risk-list {
  display: grid;
  gap: 10px;
}

.risk-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-2);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.risk-item strong {
  display: block;
  margin-bottom: 4px;
}

.risk-item span {
  color: var(--muted);
  line-height: 1.42;
}

.open-answer-grid {
  display: grid;
  gap: 12px;
}

.open-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.open-card h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.open-card p {
  color: var(--muted);
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .intro-band, .toolbar, .section-heading {
    display: grid;
  }

  .input-grid, .dashboard-grid, .metrics-grid, .wizard-layout, .wizard-status, .thank-you {
    grid-template-columns: 1fr;
  }

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

  .step-art {
    grid-template-columns: 1fr;
  }

  .mini-illustration {
    display: none;
  }

  .question-row {
    grid-template-columns: 52px 1fr;
  }

  .rating {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .scale-box {
    grid-template-columns: 1fr;
  }

  .scale-box.compact, .stepper {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    height: 120px;
  }

  .heat-row {
    grid-template-columns: 1fr 74px;
  }

  .heat-row .bar {
    grid-column: 1 / -1;
    order: 3;
  }
}
