:root {
  --bg: #e9e3d0;
  --bg-grad: #f1ecdc;
  --paper: #f7f2e3;
  --paper-edge: #cfc6aa;
  --ink: #14213d;
  --muted: #555a6b;
  --rule: #c9c1a8;
  --band: #ece5d0;
  --red: #a3201a;
  --red-soft: #f3d9d4;
  --focus: #1d4ed8;
  --btn-bg: #14213d;
  --btn-fg: #f7f2e3;
  --input-bg: #fffdf6;
  --shadow: 0 1px 0 rgba(20, 33, 61, 0.08), 0 10px 24px rgba(20, 33, 61, 0.1);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1522;
    --bg-grad: #131b2c;
    --paper: #1b2436;
    --paper-edge: #34415c;
    --ink: #ece7d6;
    --muted: #aeb4c4;
    --rule: #3a4660;
    --band: #243049;
    --red: #ff8f84;
    --red-soft: #4a2622;
    --focus: #8fb4ff;
    --btn-bg: #ece7d6;
    --btn-fg: #14213d;
    --input-bg: #121a2a;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 10px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image: linear-gradient(180deg, var(--bg-grad), var(--bg) 320px);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
}

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.6em; font-family: var(--mono); letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 6vw, 2.4rem); }
h2 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--red); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.skip { position: absolute; left: 8px; top: -60px; background: var(--btn-bg); color: var(--btn-fg); padding: 10px 14px; z-index: 10; border-radius: 4px; }
.skip:focus { top: 8px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* masthead */
.masthead { border-bottom: 4px double var(--ink); padding: 18px 0 14px; }
.masthead .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.wordmark { font-family: var(--mono); font-weight: 800; font-size: 1.7rem; letter-spacing: -0.03em; margin: 0; }
.wordmark a { text-decoration: none; }
.tagline { margin: 0; font-family: var(--mono); font-size: 0.95rem; color: var(--red); font-weight: 700; }

/* hero */
.hero { padding-top: 36px; padding-bottom: 8px; }
.lede { font-size: 1.1rem; max-width: 60ch; }
.privacy-note { display: inline-block; border: 2px solid var(--red); color: var(--red); padding: 6px 12px; border-radius: 3px; font-family: var(--mono); transform: rotate(-1deg); margin-top: 4px; }

section.wrap { padding-top: 28px; padding-bottom: 8px; }

/* paper */
.paper {
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 20px 16px;
}
@media (min-width: 600px) { .paper { padding: 28px; } }

.form .grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .form .grid { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label, legend { font-family: var(--mono); font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

input[type="text"], input[type="email"], input[type="number"], select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  font-family: var(--mono);
  color: var(--ink);
  background: var(--input-bg);
  border: 2px solid var(--ink);
  border-radius: 3px;
}
input::placeholder { color: var(--muted); opacity: 1; }

fieldset { border: 0; padding: 0; margin: 22px 0 0; min-width: 0; }
legend { padding: 0; margin-bottom: 10px; }

.shift-rows { display: grid; gap: 14px; }
.shift-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 96px;
  align-items: end;
  padding: 12px;
  border: 1px dashed var(--rule);
  border-radius: 3px;
}
.shift-row .custom { grid-column: 1 / -1; }
.shift-row .remove { grid-column: 1 / -1; justify-self: start; }
@media (min-width: 640px) {
  .shift-row { grid-template-columns: 1fr 110px auto; }
  .shift-row .custom { grid-column: 1 / 3; }
  .shift-row .remove { grid-column: auto; grid-row: 1; grid-column: 3; justify-self: end; }
}

.row-actions, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0; }

.btn {
  min-height: 46px;
  padding: 10px 20px;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 3px;
  border: 2px solid var(--btn-bg);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { color: var(--btn-fg); transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--band); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--red); border-color: transparent; text-decoration: underline; min-width: 44px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn[hidden] { display: none; }
/* Any element with the hidden attribute stays hidden, even when a class sets display. */
[hidden] { display: none !important; }

/* output */
.output { padding-top: 40px; }
.tabs { display: flex; gap: 4px; margin-top: 12px; }
.tabs [role="tab"] {
  min-height: 46px;
  padding: 8px 20px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--band);
  border: 1px solid var(--paper-edge);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--paper); border-color: var(--ink); box-shadow: inset 0 3px 0 var(--red); }
.doc { border-top-left-radius: 0; font-family: var(--mono); }
.out-actions { margin-top: 20px; }

.doc-head { border-bottom: 3px double var(--ink); padding-bottom: 12px; margin-bottom: 14px; }
.kicker { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); font-weight: 700; margin: 0 0 4px; }
.doc-company { font-size: 1.5rem; margin: 0; overflow-wrap: anywhere; }
.doc-sub { color: var(--muted); margin: 2px 0 0; font-size: 0.9rem; }

.info { display: grid; gap: 10px 20px; grid-template-columns: 1fr; margin: 0 0 16px; }
@media (min-width: 560px) { .info { grid-template-columns: 1fr 1fr; } }
.info dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.info dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.table-scroll { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { padding: 7px 6px; border-bottom: 1px dashed var(--rule); vertical-align: top; overflow-wrap: anywhere; }
.ledger thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); border-bottom: 2px solid var(--ink); text-align: left; }
.ledger .r { text-align: right; white-space: nowrap; }
.ledger thead th.r { text-align: right; }
.ledger .section th { background: var(--band); color: var(--red); text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 6px; }
.ledger .total td { font-weight: 700; border-bottom: 2px solid var(--ink); }
.ledger .grand td { font-weight: 800; font-size: 1.1rem; border-bottom: 3px double var(--ink); border-top: 2px solid var(--ink); }
.ledger .excluded td { color: var(--muted); font-style: italic; }

.fine { font-size: 0.78rem; color: var(--muted); margin: 10px 0 0; }
.due { margin: 18px 0 0; font-size: 1.1rem; }
.memo { margin-top: 18px; padding-top: 14px; border-top: 2px solid var(--rule); }
.memo h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--red); margin-bottom: 6px; }
.memo p { margin: 0; }
.stamp {
  display: inline-block;
  margin: 18px 0 0;
  padding: 6px 14px;
  border: 4px double var(--red);
  color: var(--red);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transform: rotate(-4deg);
  opacity: 0.9;
}
.doc-foot { margin: 20px 0 0; padding-top: 10px; border-top: 1px dashed var(--ink); text-align: center; font-size: 0.8rem; color: var(--muted); }

/* waitlist */
.waitlist .form { display: grid; gap: 16px; }
.radios { margin: 0; }
.radio { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-right: 14px; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 1rem; }
.radio input { width: 22px; height: 22px; accent-color: var(--red); }

/* not */
.not-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.not-list li { padding: 14px 16px; border-left: 5px solid var(--red); background: var(--paper); border-radius: 0 4px 4px 0; box-shadow: var(--shadow); }

.page-text { padding-top: 32px; padding-bottom: 24px; }
.page-text h1 { font-size: 1.7rem; }
.page-text .doc h2 { margin-top: 1.4em; font-size: 1.1rem; }

.footer { margin-top: 48px; padding: 24px 0 40px; border-top: 4px double var(--ink); font-size: 0.9rem; }
.footer p { margin: 0 0 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .btn-primary:hover { transform: none; }
}
