@font-face {
  font-family: "Source Sans 3";
  src: url("./source-sans-3.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f7f6f0;
  --sheet: #fbf9f1;
  --wash: #efede4;
  --ink: #162746;
  --muted: #3e5065;
  --gold: #bc9555;
  --gold-ink: #69491f;
  --line: #d1ccbd;
  --outline: #938772;
  --serif: "Times New Roman", Times, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font: 400 100%/1.5 var(--sans);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, textarea, input { font: inherit; }

.worksheet {
  width: min(53.125rem, 100% - 2 * clamp(1rem, 4vw, 2.5rem));
  margin-inline: auto;
  padding-block: clamp(1.45rem, 4vw, 3rem) 2.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: .5rem 1.25rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--gold);
}

h1, h2, p { margin: 0; }
h1, h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -.025em;
}
h1 {
  font-size: clamp(2.25rem, 5.3vw, 3.2rem);
  line-height: 1;
}
h2 {
  font-size: 1.65rem;
  line-height: 1.12;
}

.page-header p, .section-note { color: var(--muted); }
.page-header > div > p { margin-top: .35rem; }
.plan-tools {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: .28rem;
}
.plan-tools > .save-status { margin-top: 0; }
.save-status { font-size: .875rem; }
.save-status[data-error] { color: #8d2a49; }

.print-button {
  min-height: 2.5rem;
  padding: .35rem .8rem;
  border: 1px solid var(--ink);
  border-radius: .25rem;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.print-button:hover { background: var(--wash); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.plan-control { margin-top: .9rem; }
.plan-picker, .rename-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
.plan-picker label, .rename-form label { font-weight: 600; }
.plan-picker select, .rename-form input, .plan-control button {
  min-width: 0;
  min-height: 2.65rem;
  padding: .35rem .65rem;
  border: 1px solid var(--outline);
  border-radius: .25rem;
  color: var(--ink);
  background: var(--sheet);
  font: inherit;
}
.plan-picker select { flex: 1 1 6.5rem; max-width: 19rem; }
.plan-control button {
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.plan-control button:hover { background: var(--wash); }
.plan-control .rename-button, .rename-form button[type="button"] {
  padding-inline: .25rem;
  border-color: transparent;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: .18em;
}
.plan-control .add-plan {
  margin-left: auto;
  border-color: var(--ink);
  color: var(--sheet);
  background: var(--ink);
}
.plan-control .add-plan:hover { background: #263e62; }
.add-plan span { margin-right: .18em; color: #e6c98e; }
.rename-form {
  margin-top: .55rem;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: .25rem;
  background: var(--sheet);
}
.rename-form input { flex: 1 1 8rem; background: #fffdf7; }
[hidden], .print-plan-name { display: none; }

.plan-sheet {
  margin-top: .9rem;
  border: 1px solid var(--line);
  border-radius: .375rem;
  background: var(--sheet);
}

.panel {
  display: grid;
  grid-template-columns: minmax(9.5rem, 1fr) minmax(0, 3fr);
  align-items: start;
  gap: .6rem clamp(1rem, 3vw, 1.65rem);
  padding: .9rem clamp(.8rem, 2.8vw, 1.5rem);
}
.panel + .panel { border-top: 1px solid var(--line); }
.goal-panel {
  background: var(--wash);
  border-radius: .3125rem .3125rem 0 0;
}

.section-note {
  margin-top: .25rem;
  font-size: 1rem;
}

textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 2.5rem;
  field-sizing: content;
  padding: .4rem .65rem;
  border: 1px solid var(--outline);
  border-radius: .25rem;
  resize: vertical;
  background: #fffdf7;
  color: var(--ink);
  overflow-wrap: anywhere;
}
textarea::placeholder { color: var(--muted); opacity: 1; }
.goal-input { min-height: 4.25rem; }

.strategy-content { min-width: 0; }
.strategy-input { font-weight: 600; }
.strategy-input::placeholder { font-weight: 400; }
.actions-label {
  margin: .6rem 0 .25rem;
  color: var(--muted);
  font-size: .9375rem;
  font-weight: 600;
}
.rows { margin: 0; padding-left: 1.6rem; }
.rows li { min-width: 0; padding-left: .25rem; }
.rows li + li { margin-top: .38rem; }
.rows li::marker {
  color: var(--gold-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.print-value { display: none; }

@media (max-width: 39rem) {
  .panel { grid-template-columns: minmax(0, 1fr); }
  .section-note { margin-top: .15rem; }
  textarea { min-height: 2.75rem; }
}

@media (max-width: 29rem) {
  .page-header { flex-direction: column; align-items: stretch; }
  .plan-tools { flex-direction: row-reverse; justify-content: space-between; align-items: center; }
  .plan-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; }
  .plan-picker label { grid-column: 1 / -1; }
  .plan-picker select { width: 100%; max-width: none; }
  .rename-form label { flex-basis: 100%; }
}

@media print {
  :root, .plan-sheet, .panel, .goal-panel { background: white; color: black; }
  .worksheet { width: 100%; padding: 0; }
  .panel { break-inside: avoid; }
  .plan-tools, .plan-control, textarea { display: none; }
  .print-plan-name {
    display: block;
    margin-top: .6rem;
    font: 400 1.35rem/1.2 var(--serif);
    overflow-wrap: anywhere;
  }
  .print-value {
    display: block;
    min-height: 1.25rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    border-bottom: 1px solid #aaa;
    padding: .14rem 0;
  }
}
