:root {
  color-scheme: light;
  --text: #252525;
  --muted: #626262;
  --line: #d8d8d5;
  --accent: #a8380c;
  --error: #a51d25;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: #f5f5f4;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}
.site-header,
main,
footer {
  width: min(100% - 3rem, 68rem);
  margin-inline: auto;
}
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.brand-suffix {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
}
footer {
  color: var(--muted);
  font-size: 0.875rem;
}
main {
  padding-block: 2.75rem;
}
.intro {
  margin-bottom: 2rem;
}
h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin: 0 0 0.75rem;
}
.intro p {
  color: var(--muted);
  margin: 0;
}
h2 {
  font-size: 1.125rem;
  margin: 0 0 1rem;
  line-height: 1.4;
}
.notice {
  padding: 0.875rem 1rem;
  background: #ededeb;
  border: 1px solid #bcbcb8;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  margin: 0 0 1.5rem;
}
.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: 3.5rem;
}
form,
fieldset,
.field,
.time-grid > div {
  min-width: 0;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
.form-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.section-note,
.field-help {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}
.section-note {
  margin: -0.375rem 0 1.25rem;
}
.field-grid,
.time-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1rem;
}
.full-width {
  grid-column: 1 / -1;
}
label,
.field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}
input,
select,
button {
  font: inherit;
  color: inherit;
}
input,
select {
  width: 100%;
  min-height: 2.875rem;
  border: 1px solid #999995;
  border-radius: 0.25rem;
  background: #fff;
}
input {
  min-width: 0;
  padding: 0.625rem 0.75rem;
  font-variant-numeric: tabular-nums;
}
input:hover,
select:hover {
  border-color: var(--text);
}
input:disabled,
select:disabled {
  background: #ededeb;
  cursor: not-allowed;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  margin: 0.5rem 0 0;
  cursor: pointer;
  font-weight: 400;
}
.checkbox-label input {
  width: 1.25rem;
  min-width: 1.25rem;
  height: 1.25rem;
  min-height: 1.25rem;
  padding: 0;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-label:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.checkbox-label:active {
  color: var(--accent);
}
input[aria-invalid="true"] {
  border: 2px solid var(--error);
  padding: calc(0.625rem - 1px) calc(0.75rem - 1px);
}
.input-unit {
  display: flex;
  align-items: center;
  position: relative;
}
.input-unit input {
  padding-right: 5rem;
}
.input-unit span {
  position: absolute;
  right: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  pointer-events: none;
}
select {
  appearance: none;
  cursor: pointer;
  padding: 0.625rem 2.5rem 0.625rem 0.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23252525' stroke-width='1.5' d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.field-error {
  font-size: 0.875rem;
  color: var(--error);
  margin: 0.5rem 0 0;
}
button {
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border: 1px solid #999995;
  border-radius: 0.25rem;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
}
button:hover {
  background: #e8e8e5;
  border-color: var(--text);
}
button:active {
  background: #dcdcd8;
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.quote-panel {
  position: sticky;
  top: 1.5rem;
  min-width: 0;
  padding: 1.75rem;
  background: white;
  border: 1px solid var(--line);
  border-top: 3px solid var(--text);
}
.result-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.result-message.has-error {
  color: var(--error);
}
.result-message:empty {
  display: none;
}
.total-label {
  margin: 1.5rem 0 0.25rem;
  font-size: 0.875rem;
}
.total-price {
  margin: 0;
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.2;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.quote-context {
  font-size: 0.875rem;
  color: var(--muted);
  margin: -0.5rem 0 0;
}
.quote-section {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}
.quote-section h3 {
  margin: 0 0 0.875rem;
  font-size: 1rem;
}
.quote-section .section-note {
  margin-bottom: 0.75rem;
}
.row-note {
  display: block;
  font-size: 0.875rem;
  font-weight: 400;
}
.unit-prices dd,
.selling-net {
  font-weight: 650;
}
.breakdown {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
}
.breakdown > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.375rem;
}
.breakdown dt {
  color: var(--muted);
}
.breakdown dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}
.breakdown .subtotal {
  border-top: 1px solid var(--line);
  padding-top: 0.875rem;
  margin-top: 0.5rem;
  font-weight: 650;
}
.subtotal dt {
  color: var(--text);
}
[data-result] {
  font-variant-numeric: tabular-nums;
}
.rounding-note {
  font-size: 0.875rem;
  margin: 0.75rem 0 0;
}
.rounding-note {
  color: var(--muted);
}
footer {
  border-top: 1px solid var(--line);
  padding-block: 1.25rem 2rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .site-header,
  main,
  footer {
    width: min(100% - 2rem, 36rem);
  }
  .site-header {
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    padding-block: 1rem;
  }
  main {
    padding-block: 2rem;
  }
  .calculator-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
  .quote-panel {
    position: static;
    padding: 1.25rem;
  }
  .total-price {
    font-size: 2.5rem;
  }
}

@media (max-width: 380px) {
  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .total-price {
    font-size: 2rem;
  }
}
