:root {
  color-scheme: light;
  --ink: #15252a;
  --muted: #657579;
  --line: #e2e9e8;
  --surface: #ffffff;
  --canvas: #f4f7f6;
  --green: #16785f;
  --green-dark: #0c5946;
  --green-soft: #e7f4ef;
  --amber: #8a5b12;
  --amber-soft: #fff7e8;
  --red: #b4443e;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1040px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-size: 14px;
}

.version,
.required-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.page-shell {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
  padding: 50px 0 42px;
}

.intro {
  margin: 0 0 28px 4px;
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(29px, 5vw, 38px);
  letter-spacing: -0.055em;
  line-height: 1.25;
}

.intro-copy {
  max-width: 570px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.setup-card,
.saved-section,
.result-section {
  margin-bottom: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgb(26 55 49 / 4%);
}

.section-heading,
.result-heading,
.risk-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading {
  margin-bottom: 25px;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: -0.035em;
}

.required-note {
  padding: 6px 10px;
  border-radius: 20px;
  background: #f1f5f4;
}

.field {
  margin-bottom: 21px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.required {
  color: var(--red);
}

select,
.amount-input,
.small-input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #d6e0de;
  border-radius: 10px;
  background: white;
}

select {
  padding: 0 14px;
  color: var(--ink);
}

.amount-input,
.small-input {
  display: flex;
  align-items: center;
  padding: 0 14px;
}

.amount-input:focus-within,
.small-input:focus-within,
select:focus {
  border-color: var(--green);
  outline: 3px solid rgb(22 120 95 / 12%);
}

.amount-input input,
.small-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-variant-numeric: tabular-nums;
}

.amount-input input {
  font-size: 17px;
  font-weight: 650;
}

.amount-input > span,
.small-input > span {
  color: var(--muted);
}

.input-meta {
  display: flex;
  min-height: 23px;
  justify-content: space-between;
  gap: 12px;
  padding-top: 5px;
  font-size: 12px;
}

.amount-reading {
  color: var(--muted);
}

.field-error {
  color: var(--red);
}

.form-error {
  margin: -9px 0 10px;
  color: var(--red);
  font-size: 12px;
}

.quick-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.quick-amounts button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8faf9;
  color: #39504d;
  font-size: 12px;
  font-weight: 650;
}

.quick-amounts button:hover {
  border-color: #9dc7b8;
  background: var(--green-soft);
}

.advanced-settings {
  margin: 0 0 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.advanced-settings summary {
  padding: 15px 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.advanced-settings summary span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.settings-note {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-bottom: 16px;
}

.settings-grid .field {
  margin: 0;
}

.settings-grid .field label {
  font-size: 12px;
}

.small-input {
  min-height: 42px;
}

.small-input input {
  font-size: 14px;
}

.simulation-notice {
  display: flex;
  gap: 10px;
  margin: 0 0 20px;
  padding: 13px 14px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: #765116;
}

.notice-icon {
  flex: 0 0 18px;
  display: grid;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.simulation-notice p {
  margin: 0;
  font-size: 12px;
}

.simulation-notice strong {
  display: block;
  margin-bottom: 2px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 17px;
  border: 0;
  border-radius: 10px;
  font-weight: 750;
}

.primary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: var(--green);
  color: white;
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 12px;
}

.secondary-button:hover {
  background: #f4f8f6;
}

.result-section {
  padding: 28px;
}

.result-heading {
  align-items: center;
  margin-bottom: 20px;
}

.estimate-card {
  margin-bottom: 27px;
  padding: 21px;
  border: 1px solid #cde5db;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff8f4, #f7fbf9);
}

.estimate-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #41665a;
  font-size: 13px;
  font-weight: 700;
}

.draft-badge {
  padding: 3px 7px;
  border-radius: 5px;
  background: #fff2d8;
  color: #805713;
  font-size: 10px;
}

.estimated-budget {
  margin: 9px 0 17px;
  color: var(--green-dark);
  font-size: clamp(29px, 6vw, 38px);
  font-weight: 800;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.calculation-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 11px;
}

.calculation-breakdown strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
}

.formula-note {
  margin: 14px 0 0;
  padding-top: 11px;
  border-top: 1px solid #dcebe5;
  color: var(--muted);
  font-size: 11px;
}

.risk-heading {
  align-items: flex-end;
  margin-bottom: 9px;
}

.risk-heading h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.count-badge {
  display: inline-grid;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  place-items: center;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 11px;
}

.draft-caption {
  margin-bottom: 0;
  color: var(--amber);
  font-size: 11px;
}

.risk-disclaimer {
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 11px;
}

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

.risk-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.risk-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 750;
}

.risk-detail {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.risk-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 5px;
}

.risk-tag {
  padding: 3px 7px;
  border-radius: 5px;
  background: #f1f5f4;
  color: #4d605d;
  font-size: 10px;
}

.risk-tag.high {
  background: #fff0ed;
  color: #a13d34;
}

.result-actions {
  margin-top: 19px;
}

.save-status {
  display: block;
  min-height: 20px;
  margin-top: 7px;
  color: var(--green-dark);
  font-size: 12px;
}

.saved-section {
  margin-top: 24px;
}

.saved-heading {
  align-items: center;
  margin-bottom: 16px;
}

.saved-projects {
  display: grid;
  gap: 9px;
}

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed #d5e0dd;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.saved-project {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.saved-project h3 {
  margin: 0 0 3px;
  font-size: 13px;
}

.saved-project p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.delete-button {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--muted);
  font-size: 11px;
}

.delete-button:hover {
  border-color: #e7b4ae;
  color: var(--red);
}

.storage-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.footer-note {
  padding: 7px 4px;
  color: #7a8987;
  font-size: 11px;
  text-align: center;
}

.footer-note span {
  padding: 0 5px;
}

[hidden] {
  display: none !important;
}

.form-error:empty {
  display: none;
}

@media (max-width: 600px) {
  .topbar {
    height: 58px;
    padding: 0 17px;
  }

  .page-shell {
    width: min(100% - 28px, 760px);
    padding: 34px 0 30px;
  }

  .intro {
    margin-left: 1px;
  }

  .setup-card,
  .saved-section,
  .result-section {
    padding: 21px 18px;
    border-radius: 14px;
  }

  .section-heading {
    margin-bottom: 20px;
  }

  .settings-grid {
    gap: 10px;
  }

  .risk-item {
    grid-template-columns: 1fr;
  }

  .risk-tags {
    justify-content: flex-start;
  }

  .draft-caption {
    max-width: 95px;
    text-align: right;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .intro,
  .setup-card,
  .saved-section,
  .footer-note,
  .result-actions,
  #print-button {
    display: none !important;
  }

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

  .result-section {
    display: block !important;
    border: 0;
    box-shadow: none;
  }
}
