:root {
  --bg: #f5f8f6;
  --surface: #ffffff;
  --surface-soft: #eef7f0;
  --text: #14211a;
  --muted: #5f6f66;
  --line: #d8e5dd;
  --brand: #0f8f4f;
  --brand-strong: #08713c;
  --brand-soft: #dff4e7;
  --warning: #a26111;
  --danger: #a62323;
  --shadow: 0 18px 50px rgba(20, 33, 26, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

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

.brand small {
  color: var(--muted);
  font-size: 12px;
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  width: min(1280px, calc(100% - 32px));
  margin: 28px auto 48px;
  align-items: start;
}

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

.wizard-panel {
  overflow: hidden;
}

.estimate-panel {
  position: sticky;
  top: 88px;
  padding: 18px;
}

.estimate-panel[hidden] {
  display: none;
}

.layout:has(.estimate-panel[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

.progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  border-bottom: 1px solid var(--line);
}

.progress button {
  display: grid;
  gap: 4px;
  min-height: 68px;
  padding: 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.progress button:last-child {
  border-right: 0;
}

.progress button.is-active {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.progress strong {
  font-size: 13px;
}

.progress span {
  font-size: 12px;
}

.step {
  padding: clamp(18px, 4vw, 32px);
}

.step-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.step-heading h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
}

.step-heading p {
  margin: 0;
  color: var(--muted);
  max-width: 760px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field-label {
  font-weight: 650;
  font-size: 14px;
}

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

.field-help {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

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

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.option-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.option-card input {
  position: absolute;
  opacity: 0;
}

.option-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.option-card strong {
  display: block;
}

.option-card span {
  color: var(--muted);
  font-size: 14px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 28px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.room-count {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.counter button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.counter input {
  width: 46px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

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

.room-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.room-card summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
}

.room-card-body {
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

.room-feature-panel,
.readonly-total,
.summary-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.room-feature-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.exterior-tech-check {
  align-items: flex-start;
}

.exterior-tech-check span {
  display: grid;
  gap: 3px;
}

.exterior-tech-check strong {
  font-size: 14px;
}

.exterior-tech-check small {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
}

.summary-strip span {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.summary-strip strong {
  color: var(--brand-strong);
}

.readonly-total {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.readonly-total span,
.readonly-total small {
  color: var(--muted);
}

.readonly-total strong {
  color: var(--brand-strong);
}

.module {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.module-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.module-header h3 {
  margin: 0;
  font-size: 16px;
}

.module[hidden],
.conditional[hidden] {
  display: none;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.secondary-button {
  background: var(--brand-soft);
  color: var(--brand-strong);
  border-color: #bde6ca;
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.estimate-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.price {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 8px;
  background: var(--brand-soft);
}

.price strong {
  font-size: 30px;
  line-height: 1.1;
  color: var(--brand-strong);
}

.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 3px;
}

.pill-list,
.warning-list,
.driver-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.pill-list li {
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef7f0;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 650;
}

.driver-list,
.warning-list {
  display: grid;
}

.driver-list li,
.warning-list li {
  padding: 9px 10px;
  border-radius: 8px;
  background: #f8faf8;
  color: var(--muted);
  font-size: 13px;
}

.warning-list li {
  color: var(--warning);
  background: #fff8ed;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.summary-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-box h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

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

.table th:last-child,
.table td:last-child {
  text-align: right;
}

.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef7f0;
  color: var(--brand-strong);
}

.status.is-error {
  background: #fff0f0;
  color: var(--danger);
}

.mobile-total {
  display: none;
}

.embed-page {
  background: transparent;
}

.embed-shell {
  min-height: auto;
}

.embed-topbar {
  position: static;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: min(1280px, calc(100% - 24px));
  margin: 12px auto 0;
  background: #fff;
}

.embed-layout {
  width: min(1280px, calc(100% - 24px));
  margin: 16px auto 24px;
}

.embed-page .wizard-panel,
.embed-page .estimate-panel,
.embed-page .embed-topbar {
  box-shadow: none;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    width: min(100% - 24px, 760px);
  }

  .estimate-panel {
    position: static;
    order: -1;
  }

  .field-grid,
  .summary-grid,
  .check-grid,
  .card-grid,
  .room-count-grid {
    grid-template-columns: 1fr;
  }

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

  .top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1;
  }

  .mobile-total {
    position: sticky;
    bottom: 0;
    z-index: 12;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    background: #fff;
  }
}

@media (max-width: 560px) {
  .layout {
    margin-top: 12px;
  }

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

  .nav-row {
    flex-direction: column;
  }

  .nav-row button {
    width: 100%;
  }
}
