:root {
  --bg: #f2f3f0;
  --paper: #ffffff;
  --ink: #1b2230;
  --muted: #485160;
  --line: #c3c7ce;
  --soft: #e6e8e4;
  --accent: #8a2432;
  --accent-ink: #ffffff;
  --band: #8a2432;
  --band-alt: #3d5876;
  --err: #a3122a;
  --focus: #1f5fbf;
  --head: "Iowan Old Style", "Palatino Linotype", Palatino, "URW Palladio L", P052, "Book Antiqua", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --paper: #1f2229;
    --ink: #e8e9ec;
    --muted: #b6bbc5;
    --line: #444a55;
    --soft: #2a2e36;
    --accent: #e8909a;
    --accent-ink: #1b1114;
    --band: #c2505f;
    --band-alt: #5b7ea6;
    --err: #ff9aa6;
    --focus: #8ab4ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--body); }
main { max-width: 780px; margin: 0 auto; padding: 20px 16px 40px; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.2; font-weight: 700; }
h1 { font-size: 2.1rem; margin: 8px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; margin: 0 0 12px; }
h3 { font-size: 1.1rem; margin: 22px 0 6px; }
.lede { margin: 0 0 18px; max-width: 64ch; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.tool { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.step { padding: 4px 0 18px; border-bottom: 1px solid var(--soft); margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; min-width: 0; }
label, legend, .sub { font-weight: 600; }
.sub { margin: 10px 0 6px; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font-size: 16px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); width: 100%; max-width: 100%;
}
.field input[type="date"], .field input[type="time"] { max-width: 13rem; }
.field #count, .field #ppd, .field #dur, .field #last, .field #frontLast { max-width: 9rem; }
textarea { min-height: 150px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; line-height: 1.45; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--err); border-width: 2px; }
.err { color: var(--err); font-size: 0.95rem; }
.err:empty { display: none; }
.hint { font-weight: 400; color: var(--muted); display: block; margin: 0 0 6px; }
.pair { display: flex; flex-wrap: wrap; gap: 0 18px; }
.pair .field { flex: 1 1 10rem; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; min-height: 44px; padding: 8px 0; cursor: pointer; }
.check input, .ch-table input[type="checkbox"], .week input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 4px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.quiet { border-color: transparent; text-decoration: underline; text-underline-offset: 3px; padding-inline: 8px; }
.btn.danger { background: var(--err); color: var(--paper); border-color: var(--err); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 0.95rem; }
.btn.tiny { min-height: 40px; padding: 4px 10px; font-size: 0.9rem; font-weight: 600; }
.btn[disabled] { opacity: 0.45; cursor: default; }
.row-btns, .actions, .btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.x { min-width: 44px; min-height: 44px; border: 0; background: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); border-radius: 4px; }
.x:hover { color: var(--err); }

.plans { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 12px; margin-bottom: 8px; }
.plan-pick { flex: 1 1 14rem; margin: 0; }
.plan-btns { display: flex; gap: 4px; }
.confirm, .viewbar { flex-basis: 100%; background: var(--soft); border-radius: 4px; padding: 10px 12px; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.confirm p, .viewbar p { margin: 0; flex-basis: 100%; }
.confirm[hidden], .viewbar[hidden] { display: none; }
.store-note { background: var(--soft); padding: 10px 12px; border-radius: 4px; margin: 0 0 12px; }

details > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: 8px; color: var(--accent); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 0.5em; height: 0.5em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s; flex: none; margin-right: 2px; }
details[open] > summary::before { transform: rotate(45deg); }
details.paste, details.chapters { margin: 4px 0 12px; }
details.chapters[hidden] { display: none; }
.paste-out { margin: 8px 0 0; }
.paste-out:empty { display: none; }

.table-box { overflow-x: auto; }
.ch-table { border-collapse: collapse; width: 100%; }
.ch-table th { text-align: left; font-size: 0.95rem; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.ch-table td { padding: 4px 6px; vertical-align: top; border-bottom: 1px solid var(--soft); }
.ch-table .c-on { width: 48px; text-align: center; }
.ch-table td.c-on { padding-top: 14px; }
.ch-table .c-page { width: 9rem; }
.ch-table .c-len { width: 4.5rem; text-align: right; padding-top: 14px; font-variant-numeric: tabular-nums; }
.ch-table .c-del { width: 48px; }
.ch-table tr.off .c-name input, .ch-table tr.off .c-len { color: var(--muted); }
.ch-table tr.off .c-name input { text-decoration: line-through; }
.ch-table .err { display: block; margin-top: 2px; }
@media (max-width: 560px) {
  .ch-table thead { display: none; }
  .ch-table, .ch-table tbody { display: block; }
  .ch-table tr { display: grid; grid-template-columns: 34px minmax(0, 1fr) 5rem 44px; grid-template-areas: "on name page del" ". len len ."; align-items: start; border-bottom: 1px solid var(--soft); padding: 4px 0; }
  .ch-table td { border: 0; padding: 2px 3px; display: block; width: auto !important; min-width: 0; }
  .ch-table input:not([type="checkbox"]) { min-width: 0; }
  .ch-table td.c-on { grid-area: on; }
  .ch-table td.c-name { grid-area: name; }
  .ch-table td.c-page { grid-area: page; }
  .ch-table td.c-del { grid-area: del; padding-left: 0; padding-right: 0; }
  .ch-table td.c-len { grid-area: len; text-align: left; padding-top: 0; color: var(--muted); font-size: 0.95rem; }
  .ch-table td.c-len:not(:empty)::after { content: " pages"; }
  .ch-table td.c-page .err { grid-column: 1 / -1; }
}

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; margin: 0 0 14px; }
.seg label { display: flex; align-items: center; gap: 8px; padding: 8px 14px; min-height: 44px; cursor: pointer; font-weight: 600; }
.seg label + label { border-left: 1px solid var(--line); }
.seg input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.seg label:has(input:checked) { background: var(--soft); }
.seg.small { margin-top: 6px; }
body:not(.is-class) .class-only, body.is-class .club-only { display: none; }
.week { border: 0; padding: 0; margin: 0 0 12px; }
.week legend { padding: 0; margin-bottom: 6px; }
.week-days { display: flex; flex-wrap: wrap; gap: 6px; }
.week-days label { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; font-weight: 600; cursor: pointer; }
.date-rows { list-style: none; margin: 0 0 8px; padding: 0; }
.date-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; }
.date-rows .to { color: var(--muted); }
.date-rows input[type="date"] { width: 11.5rem; max-width: 11.5rem; }
.date-rows .err { flex-basis: 100%; }

.result { padding: 4px 0 8px; }
.result:focus { outline: none; }
.problem { background: var(--soft); border-radius: 4px; padding: 12px 14px; }
.problem p { margin: 0 0 6px; }
.problem p:last-child { margin-bottom: 0; }
.summary { font-size: 1.15rem; font-weight: 600; margin: 0 0 10px; }
.ribbon { display: flex; height: 30px; gap: 2px; margin: 0 0 10px; }
.band { background: var(--band); color: #fff; min-width: 3px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; overflow: hidden; }
.band.alt { background: var(--band-alt); }
.band b { font-weight: 600; }
.why, .pins-note { margin: 0 0 8px; }
.pins-note { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.split { margin-bottom: 4px; }
.split[hidden] { display: none; }
.rows { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 4px 14px; padding: 10px 0; border-bottom: 1px solid var(--soft); align-items: start; }
.when { font-weight: 700; font-variant-numeric: tabular-nums; }
.what { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.read { font-weight: 600; }
.pp { color: var(--muted); }
.nudge { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.moved { font-size: 0.9rem; color: var(--muted); }
.kick .read { font-style: italic; }
@media (max-width: 600px) {
  .row { grid-template-columns: 1fr auto; grid-template-areas: "when nudge" "what what"; }
  .when { grid-area: when; align-self: center; }
  .what { grid-area: what; }
  .nudge { grid-area: nudge; }
}
@media (max-width: 480px) {
  .row { grid-template-columns: 1fr; grid-template-areas: "when" "what" "nudge"; }
  .nudge { margin-top: 4px; }
}

.actions { padding-top: 16px; border-top: 1px solid var(--line); margin-top: 16px; }
.actions[hidden] { display: none; }
details.more { margin-top: 12px; }
.share-box { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.share-box label { flex-basis: 100%; }
.share-box input { flex: 1 1 14rem; overflow-wrap: anywhere; }
.share-box[hidden] { display: none; }
.kept { margin-top: 8px; }
.kept ul { list-style: none; padding: 0; margin: 0; }
.kept li { padding: 8px 0; border-bottom: 1px solid var(--soft); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; }
.kept-btns { display: flex; gap: 6px; }
.examples { margin: 16px 0 0; color: var(--muted); }

.explain { margin-top: 36px; max-width: 68ch; }
.explain h2 { margin-top: 32px; }
.faq h3 { font-family: var(--body); font-size: 1.05rem; }
.faq p { margin: 0 0 8px; }
.sources { color: var(--muted); font-size: 0.95rem; margin-top: 24px; overflow-wrap: anywhere; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); background: var(--ink); color: var(--bg); padding: 10px 12px 10px 16px; border-radius: 6px; display: flex; align-items: center; gap: 8px; z-index: 20; pointer-events: none; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25); }
.toast[hidden] { display: none; }
.toast-text { flex: 1; }
.toast button { pointer-events: auto; background: none; border: 0; color: inherit; font-weight: 700; min-height: 44px; min-width: 44px; cursor: pointer; }
.toast-undo { text-decoration: underline; text-underline-offset: 3px; }
.toast-undo[hidden] { display: none; }

.site-footer { max-width: 780px; margin: 0 auto; padding: 24px 16px 48px; border-top: 1px solid var(--line); color: var(--muted); }
.sb-footer { font-size: 0.95rem; }
.sb-footer a { color: var(--ink); }
.sb-more { margin: 0 0 12px; overflow-wrap: anywhere; }
.sb-privacy, .sb-credit { margin: 4px 0; }

@media (max-width: 480px) {
  h1 { font-size: 1.75rem; }
  .tool { padding: 12px; border-left: 0; border-right: 0; border-radius: 0; margin: 0 -16px; }
  .seg label { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }


/* the blank template page shows its sheets on screen too */
.crumbs { margin: 4px 0 8px; color: var(--muted); }
.tpl-actions { border-top: 0; padding-top: 0; margin: 0 0 16px; }
.print-root.show { display: block; }
@media screen {
  .show .sheet { background: #fff; color: #1b2230; border: 1px solid var(--line); border-radius: 4px; padding: 20px; margin: 0 0 16px; overflow-x: auto; }
  .show .p-title { font-size: 1.4rem; margin: 0 0 6px; }
  .show .p-lines { display: flex; gap: 24px; margin: 8px 0 14px; }
  .show .p-lines span { flex: 1; border-bottom: 1px solid #1b2230; padding-bottom: 14px; font-weight: 600; }
  .show .p-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .show .p-table th, .show .p-table td { border: 1px solid #555; padding: 6px 8px; text-align: left; height: 34px; }
  .show .p-date, .show .p-pages, .show .p-host { width: 22%; }
  .show .marks { display: flex; gap: 12px; flex-wrap: wrap; }
  .show .sheet { padding: 14px; }
  .show .mark { width: 150px; height: 420px; border: 1px dashed #666; border-top: 10px solid #8a2432; padding: 12px 10px; overflow: hidden; }
  .show .m-title { font-family: var(--head); font-weight: 700; margin: 0 0 4px; }
  .show .m-head { font-size: 0.9rem; margin: 6px 0 0; }
  .show .m-lines { list-style: none; padding: 0; margin: 0; }
  .show .m-lines li { height: 26px; border-bottom: 1px solid #999; }
}
@media screen and (max-width: 600px) { .show .mark + .mark { display: none; } .show .p-table th { font-size: 0.9rem; padding: 4px; } }

/* ---------------------------------------------------------------- print */
.print-root { display: none; }
@page { margin: 0.5in; }
@media print {
  :root { --ink: #000; }
  body { background: #fff; color: #000; font: 11pt/1.35 var(--body); }
  body > *:not(.print-root):not(main) { display: none !important; }
  main { padding: 0; max-width: none; }
  main > *:not(.print-root) { display: none !important; }
  .print-root { display: block; }
  body[data-print="marks"] .sheet.sched, body:not([data-print="marks"]) .sheet.marks { display: none; }
  .p-title { font-family: var(--head); font-size: 22pt; font-weight: 700; line-height: 1.2; margin: 0 0 4pt; }
  .p-sub { margin: 0 0 12pt; font-size: 11.5pt; }
  .p-table { width: calc(100% - 2px); margin-left: 1px; border-collapse: collapse; table-layout: fixed; }
  .p-table th, .p-table td { border: 1px solid #555; padding: 5pt 6pt; text-align: left; vertical-align: top; }
  .p-table th { font-size: 10pt; background: none; border-bottom: 2px solid #000; }
  .p-table thead { display: table-header-group; }
  .p-table tr { break-inside: avoid; }
  .p-table small { font-size: 10pt; }
  .p-date { width: 1.7in; white-space: nowrap; }
  .p-pages { width: 1.2in; white-space: nowrap; }
  .p-n { width: 0.55in; text-align: right !important; }
  .p-host { width: 0.85in; }
  .sheet.sched.more { break-before: page; }
  .p-cont { font-family: var(--body); font-size: 11pt; font-weight: 400; }
  .roomy .p-table td { padding: 9pt 7pt; font-size: 12pt; }
  .p-table td { line-height: 1.35; }
  .dense .p-table th, .dense .p-table td { padding: 2.5pt 5pt; font-size: 10pt; line-height: 1.35; }
  .denser .p-table th, .denser .p-table td { padding: 1.5pt 4pt; font-size: 10pt; line-height: 1.2; }
  .denser .p-title { font-size: 18pt; }
  .denser .p-sub { margin-bottom: 8pt; }
  .p-foot { margin-top: 10pt; font-size: 10pt; }
  .blank .p-table td { height: 0.62in; }
  .p-lines { display: flex; gap: 0.3in; margin: 6pt 0 14pt; }
  .p-lines span { flex: 1; border-bottom: 1px solid #000; padding-bottom: 14pt; font-weight: 600; }
  .sheet.marks { display: flex; gap: 0.1in; align-items: flex-start; flex-wrap: wrap; }
  .mark { width: 1.7in; height: 7in; border: 1px dashed #666; padding: 0.3in 0.12in 0.12in; position: relative; overflow: hidden; break-inside: avoid; overflow-wrap: anywhere; }
  .show .mark { border-top: 1px dashed #666; }
  .mark::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 0.14in; background: #8a2432; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .m-title { font-family: var(--head); font-weight: 700; font-size: 12pt; line-height: 1.2; margin: 0 0 4pt; }
  .m-club { font-size: 10pt; line-height: 1.25; margin: 0 0 6pt; }
  .m-list { list-style: none; padding: 0; margin: 8pt 0 0; font-size: 10pt; line-height: 1.25; }
  .m-list li { margin: 0 0 8pt; break-inside: avoid; }
  .m-list b { display: block; }
  .m-blank { border-bottom: 1px solid #000; padding-bottom: 14pt; }
  .m-head { font-size: 10pt; margin: 8pt 0 0; }
  .m-lines li { height: 0.42in; border-bottom: 1px solid #888; margin: 0; }
  .m-more { position: absolute; bottom: 0.1in; left: 0.12in; font-size: 10pt; margin: 0; }
  .marks.tight .m-title { font-size: 11pt; margin: 0 0 2pt; }
  .marks.tight .m-club { margin: 0 0 3pt; }
  .marks.tight .m-list { margin-top: 4pt; line-height: 1.15; }
  .marks.tight .m-list li { margin: 0 0 4pt; }
}
/* the same bookmark layout, laid out off screen so app.js can measure where each strip fills up */
.mark-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; font: 11pt/1.35 var(--body); color: #000; }
.mark-measure .mark { box-sizing: border-box; width: 1.7in; height: 7in; border: 1px dashed #666; padding: 0.3in 0.12in 0.12in; position: relative; overflow: hidden; overflow-wrap: anywhere; }
.mark-measure .m-title { font-family: var(--head); font-weight: 700; font-size: 12pt; line-height: 1.2; margin: 0 0 4pt; }
.mark-measure .m-club { font-size: 10pt; line-height: 1.25; margin: 0 0 6pt; }
.mark-measure .m-list { list-style: none; padding: 0; margin: 8pt 0 0; font-size: 10pt; line-height: 1.25; }
.mark-measure .m-list li { margin: 0 0 8pt; }
.mark-measure .m-list b { display: block; }
.mark-measure .m-more { position: absolute; bottom: 0.1in; left: 0.12in; font-size: 10pt; margin: 0; }
.mark-measure.tight .m-title { font-size: 11pt; margin: 0 0 2pt; }
.mark-measure.tight .m-club { margin: 0 0 3pt; }
.mark-measure.tight .m-list { margin-top: 4pt; line-height: 1.15; }
.mark-measure.tight .m-list li { margin: 0 0 4pt; }

.paste-out .jump { font-weight: 600; white-space: nowrap; }
