:root {
  color-scheme: light;
  --ink: #07111f;
  --muted: #53657d;
  --blue: #155eef;
  --line: #c9d5e5;
  --paper: #fff;
  --base: #f7f9fc;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font:
    17px/1.65 system-ui,
    sans-serif;
}
a {
  color: var(--blue);
  text-underline-offset: 0.2em;
}
a,
button,
input,
select {
  touch-action: manipulation;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
.skip-link {
  position: absolute;
  top: -5rem;
  left: 1rem;
  background: var(--paper);
  padding: 0.75rem;
  z-index: 2;
}
.skip-link:focus {
  top: 1rem;
}
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem max(1.25rem, calc((100vw - 76rem) / 2));
  background: #07111f;
  color: white;
}
.site-header a {
  color: white;
  text-decoration: none;
  display: inline-block;
  padding: 0.5rem 0;
}
.brand {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  margin-right: auto;
}
.brand span {
  color: #84b2ff;
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
main {
  max-width: 76rem;
  margin: auto;
  padding: 3rem 1.25rem 4rem;
}
.intro {
  max-width: 48rem;
  margin-bottom: 2.5rem;
}
h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.07;
  letter-spacing: -0.045em;
  text-wrap: balance;
  margin: 0.7rem 0 1.25rem;
}
h2 {
  font-size: 1.4rem;
  line-height: 1.25;
  letter-spacing: -0.025em;
}
h3 {
  font-size: 1.1rem;
  line-height: 1.4;
}
p {
  max-width: 72ch;
}
button,
input,
select {
  font: inherit;
}
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
button {
  min-height: 48px;
  padding: 0.6rem 1rem;
  border: 1px solid #8599b3;
  border-radius: 0.4rem;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
}
button:hover {
  background: #e8efff;
}
button.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
input,
select {
  border: 1px solid #8599b3;
  border-radius: 0.3rem;
  padding: 0.65rem;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  min-height: 48px;
  max-width: 100%;
}
label {
  display: block;
  font-weight: 650;
  margin: 0.8rem 0 0.4rem;
}
small {
  color: var(--muted);
  font-size: 0.8rem;
  display: block;
  margin-top: 0.5rem;
}
.worksheet {
  display: grid;
  grid-template-columns: 21rem minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}
.settings {
  min-width: 0;
  padding-right: 2rem;
  border-right: 1px solid var(--line);
}
.settings h2 {
  margin-top: 0;
}
.settings .buttons {
  margin-top: 1rem;
}
.preview {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 0.3rem;
  padding: clamp(1rem, 3vw, 2rem);
  box-shadow: 0 8px 24px #07111f08;
}
.error {
  color: #ad1b1b;
  font-size: 0.9rem;
}
.error:empty {
  display: none;
}
.tool-notes {
  border-top: 1px solid var(--line);
  margin-top: 3.5rem;
  padding-top: 1rem;
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
}
.notes-grid p {
  color: var(--muted);
  font-size: 0.95rem;
}
footer {
  border-top: 1px solid var(--line);
  max-width: 76rem;
  margin: auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}
footer a {
  padding: 0.5rem 0;
}
.notice {
  padding: 1rem;
  border: 1px solid var(--line);
}
:disabled {
  cursor: default;
  opacity: 0.6;
}
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.plan {
  font-size: 1.5rem;
  line-height: 1.5;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.preview p,
#result,
small {
  overflow-wrap: anywhere;
}
.rounding,
.privacy {
  color: var(--muted);
  font-size: 0.9rem;
}
.privacy {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}
#actions {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
#actions legend {
  font-weight: 650;
  padding-right: 0.75rem;
}
#status {
  min-height: 1.5em;
  font-size: 0.85rem;
}
.print-source {
  display: none;
}
[aria-invalid='true'] {
  border: 2px solid #ad1b1b;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #edf3ff;
    --muted: #b2c3da;
    --blue: #8ab7ff;
    --line: #455775;
    --paper: #172438;
    --base: #0c1728;
  }
  button:hover {
    background: #283e5c;
  }
  button.primary {
    color: #07111f;
  }
  .error {
    color: #ffb4b4;
  }
  [aria-invalid='true'] {
    border-color: #ffb4b4;
  }
}
@media (max-width: 52rem) {
  .worksheet {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }
  .settings {
    border: 0;
    padding: 0;
  }
  .notes-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  main {
    padding-top: 2rem;
  }
  .site-header nav {
    gap: 1rem;
    font-size: 0.85rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
@page {
  margin: 15mm;
}
@media print {
  :root {
    color-scheme: light;
    --ink: #000;
    --paper: #fff;
    --base: #fff;
    --muted: #333;
    --line: #999;
  }
  .site-header,
  .skip-link,
  .intro,
  .settings,
  .tool-notes,
  footer,
  #actions,
  #status {
    display: none !important;
  }
  main {
    padding: 0;
  }
  .worksheet {
    display: block;
  }
  .preview {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .print-source {
    display: block;
  }
  .plan {
    font-size: 16pt;
  }
}
