:root {
  color-scheme: light;
  --page: #eff3ed;
  --ink: #172920;
  --muted: #4b6255;
  --deep-green: #114232;
  --mint: #d8efda;
  --line: #d9e2d9;
  --focus: #287451;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.5; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
h1, h2, p { margin: 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.container { width: min(100% - 2rem, 65rem); margin-inline: auto; }
.masthead {
  color: #f5fff6;
  background-color: var(--deep-green);
  background-image: linear-gradient(110deg, var(--deep-green), #286146);
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  padding-block: 1.75rem;
}
.identity { display: flex; align-items: center; gap: clamp(.6rem, 2.6vw, 1rem); min-width: 0; }
.identity-text { min-width: 0; }
.identity h1 { font-size: clamp(1.0625rem, 4.85vw, 1.9rem); line-height: 1.25; }
.app-version { margin-top: .25rem; color: #d3e9db; font-size: .8125rem; }
.company-mark {
  position: relative;
  width: clamp(2.5rem, 11vw, 3.25rem);
  aspect-ratio: 46 / 50;
  overflow: hidden;
  flex: none;
}
.company-logo {
  /* Show the 46 × 50 px shield region at (2, 10) in the 150 px-wide logo. */
  position: absolute;
  width: calc(100% * 150 / 46);
  height: auto;
  left: calc(-100% * 2 / 46);
  top: calc(-100% * 10 / 50);
}
.offline-status {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  color: #def2e5;
  background: #214737;
  border: 1px solid #518166;
  border-radius: 1rem;
  padding: .25rem .7rem;
  font-size: .875rem;
}
.offline-status[data-ready]::before {
  content: "";
  flex: none;
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: #a4dfb1;
}

.calculator-navigation {
  display: grid;
  gap: .6rem;
  margin-block: 1.25rem;
  width: min(100%, 22rem);
}
.product-choice, .post-shape-choice { display: flex; align-items: center; gap: .75rem; }
.product-choice label, .post-shape-choice label { white-space: nowrap; font-size: .875rem; font-weight: 650; }
.product-choice select { background-color: #fff; min-width: 0; }
.post-shape-choice select { width: auto; }
.product-switch {
  display: flex;
  gap: .25rem;
  padding: .25rem;
  border: 1px solid #d4dfd4;
  border-radius: .8rem;
  background: #e3ebe1;
}
.product-switch button {
  flex: 1;
  min-height: 2.75rem;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}
.product-switch button[aria-pressed="true"] { background: var(--deep-green); color: #fff; }
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
.form-card, .result-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 3px 12px #192e2010;
}
.form-card { padding: 1.4rem; }
.form-heading { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: 1rem; }
.form-heading h2 { font-size: 1.2rem; white-space: nowrap; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem .85rem; }
.field { display: grid; grid-template-rows: auto 1fr; gap: .25rem; font-size: .875rem; font-weight: 650; }
.field-wide { grid-column: 1 / -1; }
.measure { position: relative; }
.measure span {
  position: absolute;
  inset-inline-end: .65rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 500;
}
input, select {
  width: 100%;
  min-height: 2.75rem;
  padding: .48rem .6rem;
  border: 1px solid #c9d9ce;
  border-radius: .45rem;
  background: #f8faf7;
  font-size: 1rem;
  font-weight: 500;
}
input { padding-inline-end: 2.35rem; appearance: textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { appearance: none; margin: 0; }
input::placeholder { color: #5e7267; opacity: 1; }
select {
  appearance: none;
  padding-inline-end: 1.7rem;
  background-image: linear-gradient(45deg, transparent 50%, #395a49 50%), linear-gradient(135deg, #395a49 50%, transparent 50%);
  background-position: right .84rem center, right .55rem center;
  background-size: .3rem .3rem;
  background-repeat: no-repeat;
}
.compact-select { width: auto; max-width: 60%; }
.examples { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .45rem; margin: -.35rem 0 .8rem; }
.examples span { font-size: .875rem; color: var(--muted); margin-inline-end: .15rem; }
.examples button {
  min-height: 2.75rem;
  padding-inline: .6rem;
  border: 1px solid #d3e1d6;
  border-radius: .4rem;
  background: #f3f8f2;
  color: #285440;
  font-size: .875rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.examples button:hover { background: #e6f1e5; }
.field-note { margin-top: .6rem; color: var(--muted); font-size: .875rem; }
.error { margin-top: .75rem; color: #8c2b25; font-size: .9rem; font-weight: 650; }
[aria-invalid="true"] { border-color: #a03b32; }
.calculate {
  width: 100%;
  min-height: 3rem;
  margin-top: 1rem;
  border: 0;
  border-radius: .55rem;
  padding: .55rem .75rem;
  background: var(--deep-green);
  color: #fff;
  font-weight: 700;
}
.calculate:hover { background: #0d3528; }

.result-card { overflow: hidden; }
.result-summary { padding: 1.1rem 1.25rem; background: var(--mint); color: var(--deep-green); }
.result-label { font-size: 1rem; }
.result-number { margin-top: .1rem; overflow-wrap: anywhere; }
.result-value { font-size: clamp(2.5rem, 8vw, 3.5rem); font-weight: 750; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.result-unit { font-size: 1rem; font-weight: 650; }
.result-details { margin: .2rem 1.2rem; }
.result-details div { display: flex; justify-content: space-between; gap: .75rem; padding-block: .7rem; border-bottom: 1px solid #e8ede8; }
.result-details div:last-child { border-bottom: 0; }
.result-details dt { color: var(--muted); }
.result-details dd { margin: 0; min-width: 0; font-weight: 650; font-variant-numeric: tabular-nums; text-align: end; overflow-wrap: anywhere; }
.result-note { margin: .15rem 1.2rem 1rem; padding: .6rem .75rem; color: #604719; background: #fcf4e1; border-radius: .4rem; font-size: .875rem; }
.result-placeholder { color: var(--muted); padding: 1.2rem; }
.result-actions { padding: .8rem 1.2rem 1rem; border-top: 1px solid #e8ede8; }
.result-actions > .calculate { margin-top: 0; }
.review-warning { margin-bottom: .8rem; color: #8c2b25; font-size: .9rem; font-weight: 650; }
.review-fields { display: grid; gap: .65rem; }
.cost-view { padding-top: 1.25rem; }
.return-button {
  min-height: 2.75rem;
  padding: .45rem .75rem;
  border: 1px solid #c9d9ce;
  border-radius: .45rem;
  background: #fff;
  color: var(--deep-green);
  font-weight: 650;
}
.return-button:hover { background: #e6f1e5; }
.cost-heading { margin-block: .7rem 1rem; font-size: clamp(1.25rem, 4vw, 1.55rem); }
.cost-form { display: grid; gap: 1rem; }
.cost-form input { padding-inline-end: 3.5rem; }
.cost-amount-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: .25rem 1rem;
  margin-top: .5rem;
  padding: .8rem .9rem;
  border: 1px solid #c9ddcb;
  border-radius: .5rem;
  background: #e3f0e2;
  color: var(--deep-green);
  font-weight: 700;
}
.cost-amount {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 5.5vw, 1.7rem);
  font-weight: 750;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.cost-unit { font-size: .875rem; font-weight: 650; }
.cost-grand-total { margin-top: 0; border-color: var(--deep-green); background: var(--deep-green); color: #fff; }
.cost-grand-total .cost-amount { font-size: clamp(1.9rem, 7vw, 2.2rem); }
.cost-form .error { margin-top: 0; }
footer { color: var(--muted); font-size: .8125rem; padding-block: 1rem 1.4rem; }

@media (max-width: 44rem) {
  .masthead-inner { padding-block: 1rem; }
  .calculator-navigation { width: 100%; margin-block: .85rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: .85rem; }
  .form-card { padding: .9rem; }
  .result-summary { padding: .85rem 1rem; }
  .result-details { margin-inline: 1rem; }
  .result-note { margin-inline: 1rem; }
  .result-actions { padding-inline: 1rem; }
}

@media (max-width: 23rem) {
  .container { width: calc(100% - 1.25rem); }
  .form-card { padding: .7rem; }
  .fields { gap: .65rem .5rem; }
}
