:root {
  color-scheme: light;
  --bg: #f5f6f1;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #63706a;
  --line: #d8ded8;
  --accent: #1f6f5b;
  --accent-strong: #134d40;
  --warm: #b5642a;
  --soft: #e9efe9;
  --danger: #a13b2b;
  --shadow: 0 18px 45px rgba(23, 32, 27, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 18px;
}

.eyebrow,
.topbar-meta,
.section-heading span,
.price-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

h2 {
  font-size: 1.05rem;
}

.topbar-meta {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 32px;
}

.input-panel,
.result-panel,
.settings-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.input-panel,
.result-panel {
  padding: 22px;
}

.settings-panel {
  grid-column: 1 / -1;
  padding: 18px 22px 20px;
}

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

.segment-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.segment-control label {
  min-width: 0;
}

.segment-control input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.segment-control span {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.segment-control input:checked + span {
  background: var(--accent);
  color: #ffffff;
}

.segment-control input:focus-visible + span,
input:focus-visible {
  outline: 3px solid rgba(31, 111, 91, 0.25);
  outline-offset: 2px;
}

.field-grid {
  display: grid;
  gap: 16px;
}

.field,
.time-fields {
  display: grid;
  gap: 8px;
}

.field > span,
.time-fields > span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

.input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.input-with-unit input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 12px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
  background: transparent;
}

.input-with-unit input:focus {
  outline: 0;
}

.input-with-unit span {
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
}

.price-block {
  padding: 4px 0 20px;
  border-bottom: 1px solid var(--line);
}

.price {
  display: block;
  margin-top: 4px;
  color: var(--accent-strong);
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: 0;
}

.subprice {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}

.breakdown,
.settings-list {
  display: grid;
  margin: 0;
}

.breakdown {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  padding-top: 6px;
}

.breakdown div,
.settings-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.breakdown div:nth-last-child(-n + 2),
.settings-list div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

dt {
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
}

dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  text-align: right;
}

.settings-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 22px;
}

.settings-list dt,
.settings-list dd {
  font-size: 0.92rem;
}

.is-invalid {
  border-color: var(--danger);
}

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

  .workspace {
    grid-template-columns: 1fr;
  }

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

  .settings-list div:nth-last-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .settings-list div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  .topbar,
  .workspace {
    width: min(100% - 20px, 1180px);
  }

  .input-panel,
  .result-panel,
  .settings-panel {
    padding: 16px;
  }

  .breakdown,
  .settings-list,
  .time-grid {
    grid-template-columns: 1fr;
  }

  .breakdown div:nth-last-child(-n + 2),
  .settings-list div:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .breakdown div:last-child,
  .settings-list div:last-child {
    border-bottom: 0;
  }

  .price {
    font-size: clamp(2.1rem, 15vw, 3.2rem);
  }
}
