:root {
  color-scheme: light;
  --ink: #07111f;
  --muted: #53657d;
  --blue: #155eef;
  --line: #c9d5e5;
  --paper: #fff;
  --base: #f7f9fc;
  --error: #ad1b1b;
  --hover: #e8efff;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
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:hover {
  text-decoration-thickness: 2px;
}
a,
button,
input {
  touch-action: manipulation;
}
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
.skip-link {
  position: absolute;
  top: -6rem;
  left: 1rem;
  background: var(--paper);
  padding: 0.75rem;
  z-index: 2;
}
.skip-link:focus {
  top: 1rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.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;
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
main {
  max-width: 76rem;
  margin: auto;
  padding: 3rem 1.25rem 4rem;
}
.intro {
  max-width: 49rem;
  margin-bottom: 2.5rem;
}
.intro > p:first-child {
  color: var(--muted);
  font-size: 0.9rem;
}
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.5rem;
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin-top: 0;
}
h3 {
  font-size: 1.1rem;
  line-height: 1.4;
}
p {
  max-width: 72ch;
}
.worksheet {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
button,
input {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #8599b3;
  min-height: 48px;
  border-radius: 0.35rem;
}
button {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 650;
  padding: 0.6rem 0.85rem;
}
button:hover {
  background: var(--hover);
}
button.primary {
  background: var(--blue);
  color: var(--paper);
  border-color: var(--blue);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
input {
  width: 100%;
  padding: 0.6rem;
}
input[aria-invalid='true'] {
  border: 2px solid var(--error);
}
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 650;
  margin-bottom: 0.3rem;
}
.allocation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.65fr) auto;
  gap: 0.6rem;
  align-items: end;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}
.allocation-row > div {
  min-width: 0;
}
.row-error {
  grid-column: 1/-1;
  margin: 0;
}
.error {
  color: var(--error);
  font-size: 0.85rem;
}
.error:empty {
  display: none;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
.secondary {
  padding-top: 1rem;
}
.privacy,
.caption,
#hours-help {
  color: var(--muted);
  font-size: 0.85rem;
}
.privacy {
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}
.summary {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 0.35rem;
  padding: clamp(1rem, 2.4vw, 2rem);
}
.result {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -0.035em;
  margin: 1rem 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.deficit {
  color: var(--error);
}
.week-bar {
  height: 12px;
  border: 1px solid var(--line);
  background: var(--base);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 1.5rem;
}
.week-bar span {
  display: block;
  background: var(--blue);
  height: 100%;
  width: 0;
}
#allocation-caption {
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.9rem;
}
caption {
  text-align: left;
  font-weight: 650;
  padding: 1rem 0 0.5rem;
}
th,
td {
  text-align: left;
  padding: 0.6rem 0.2rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  vertical-align: top;
}
th {
  font-weight: 500;
}
thead th,
tfoot th,
tfoot td {
  font-weight: 700;
}
th:last-child,
td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
thead th:first-child {
  width: 60%;
}
#balance-note,
#status {
  font-size: 0.9rem;
}
#status {
  min-height: 1.5em;
}
.notes {
  border-top: 1px solid var(--line);
  margin-top: 3.5rem;
  padding-top: 2rem;
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
}
.notes 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;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.9rem;
}
footer a {
  padding: 0.5rem 0;
}
#print-sheet {
  display: none;
}
.notice {
  border: 1px solid var(--line);
  padding: 1rem;
}
@media (max-width: 52rem) {
  .worksheet {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
  .notes-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  main {
    padding-top: 2rem;
  }
  nav {
    gap: 1rem;
    font-size: 0.85rem;
  }
}
@media (max-width: 24rem) {
  .allocation-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr);
  }
  .remove {
    grid-column: 2;
    justify-self: end;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #eaf1fc;
    --muted: #b2c2db;
    --blue: #84b2ff;
    --line: #43536c;
    --paper: #101e31;
    --base: #07111f;
    --error: #ff9b9b;
    --hover: #233b61;
  }
  button.primary {
    color: #07111f;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
@page {
  size: auto;
  margin: 15mm;
}
@media print {
  :root {
    color-scheme: light;
    --ink: #000;
    --line: #777;
    --paper: #fff;
  }
  body {
    background: white;
    color: black;
    font:
      11pt/1.45 system-ui,
      sans-serif;
  }
  .site-header,
  main,
  footer,
  .skip-link {
    display: none !important;
  }
  #print-sheet {
    display: block;
  }
  #print-sheet h2 {
    font-size: 22pt;
    margin: 0;
  }
  table {
    font-size: 11pt;
  }
  tr {
    break-inside: avoid;
  }
  thead {
    display: table-header-group;
  }
  tfoot {
    display: table-row-group;
  }
  #print-sheet p {
    max-width: none;
  }
}
