:root {
  color-scheme: light;
  --ink: #10222b;
  --muted: #60727b;
  --line: #d7e3e3;
  --soft-line: #e7eeee;
  --paper: #fbfefd;
  --surface: #ffffff;
  --tint: #eef9f7;
  --teal: #078a80;
  --teal-dark: #06645d;
  --blue: #216b9c;
  --amber: #fff4d6;
  --amber-line: #ecc55d;
  --amber-ink: #7a5510;
  --shadow: 0 22px 60px rgba(19, 61, 71, 0.13);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fbfb 0%, #edf6f4 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

main {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 58px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: end;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(3rem, 7vw, 5.4rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.02rem, 2vw, 1.22rem);
  line-height: 1.55;
}

.review-note {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--amber-line);
  border-radius: 8px;
  background: var(--amber);
  color: var(--amber-ink);
}

.review-note span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: #fff9e8;
  font-weight: 900;
}

.review-note p {
  margin: 0;
  line-height: 1.5;
}

.tool-shell {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.unit-bar,
.mode-buttons,
.preset-buttons,
.form-actions,
.example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.unit-bar {
  margin-bottom: 18px;
}

.toggle,
.mode,
.preset-buttons button,
.example-list button,
.secondary-action {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.toggle,
.mode {
  min-width: 116px;
  min-height: 42px;
}

.toggle.active,
.mode.active,
.preset-buttons button.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(420px, 1.04fr);
  gap: 22px;
}

.calculator-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.calculator-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  width: 100%;
  margin-bottom: 10px;
  font-weight: 850;
}

.preset-buttons {
  margin-bottom: 12px;
}

.preset-buttons button,
.example-list button {
  min-height: 42px;
  padding: 0 16px;
}

.input-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 80px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--tint);
  color: var(--muted);
  font-weight: 750;
}

.input-row strong {
  color: var(--ink);
  text-align: right;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #bfd1d1;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 760;
}

input {
  padding: 0 12px;
}

select {
  padding: 0 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(7, 138, 128, 0.24);
  outline-offset: 2px;
}

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

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

.time-fields label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 780;
}

.hidden-for-mode {
  opacity: 0.52;
}

.hint {
  margin: 0;
  padding: 12px;
  border: 1px solid #b7dceb;
  border-radius: 8px;
  background: #eff9ff;
  color: #275d75;
  line-height: 1.45;
}

.primary-action,
.secondary-action {
  min-height: 50px;
  padding: 0 20px;
}

.primary-action {
  flex: 1 1 180px;
  border: 0;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  font-weight: 850;
}

.primary-action:hover,
.toggle.active:hover,
.mode.active:hover {
  background: var(--teal-dark);
}

.secondary-action {
  flex: 1 1 140px;
}

.result-panel {
  padding: 18px;
}

.result-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.result-heading p {
  margin: 0;
  color: var(--teal);
  font-size: 1.18rem;
  font-weight: 900;
}

.result-heading span {
  max-width: 360px;
  color: var(--muted);
  text-align: right;
}

.result-heading span.error {
  color: #9d312b;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-grid article {
  min-width: 0;
  padding: 16px 12px;
  border: 1px solid #b9d9d6;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7fffe 0%, #eef9f7 100%);
  text-align: center;
}

.metric-grid span,
.metric-grid small {
  display: block;
  color: var(--muted);
  font-weight: 750;
}

.metric-grid strong {
  display: block;
  margin: 7px 0 4px;
  color: var(--teal-dark);
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.05;
}

.split-table-wrap {
  overflow-x: auto;
}

.split-table-wrap h2 {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f5f8f8;
  color: #31454e;
  font-size: 0.86rem;
}

tr:last-child td {
  border-bottom: 0;
}

.total-row td {
  background: #eaf8f3;
  color: var(--teal-dark);
  font-weight: 850;
}

.example-list {
  margin-top: 16px;
}

.content-grid,
.examples-section,
.faq-section,
.method-section {
  margin-top: 22px;
}

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

.content-grid article,
.method-section,
.examples-section,
.faq-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.content-grid p,
.method-section p,
.examples-section p,
.faq-section p {
  color: #465b63;
  line-height: 1.7;
}

.method-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
}

.check-list {
  margin: 0;
  padding-left: 22px;
  color: #465b63;
  line-height: 1.75;
}

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

.example-cards article {
  padding: 16px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.example-cards h3 {
  margin-bottom: 8px;
}

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

details {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

summary {
  padding: 14px 16px;
  font-weight: 850;
  cursor: pointer;
}

details p {
  margin: 0;
  padding: 0 16px 16px;
}

@media (max-width: 980px) {
  .hero,
  .workspace,
  .content-grid,
  .method-section {
    grid-template-columns: 1fr;
  }

  .review-note {
    max-width: none;
  }

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

@media (max-width: 640px) {
  main {
    width: min(100% - 24px, 1240px);
    padding-top: 22px;
  }

  h1 {
    font-size: clamp(2.55rem, 14vw, 4rem);
  }

  .tool-shell,
  .calculator-panel,
  .result-panel,
  .content-grid article,
  .method-section,
  .examples-section,
  .faq-section {
    padding: 14px;
  }

  .input-grid,
  .time-fields,
  .metric-grid,
  .example-cards {
    grid-template-columns: 1fr;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .input-row strong {
    text-align: left;
  }

  .result-heading {
    display: grid;
  }

  .result-heading span {
    text-align: left;
  }
}
