:root {
  --bg: #eceeef;
  --paper: #fbfbfa;
  --ink: #1b1e21;
  --muted: #464c52;
  --line: #c4cad0;
  --rule: #8e979f;
  --accent: #b93d0b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe3d6;
  --head-bg: #23272b;
  --head-ink: #f3f4f5;
  --plate: #b7893a;
  --bad: #a1240e;
  --late: #a1240e;
  --info: #1f4f7a;
  --focus: #0b6bcb;
  --sleep: rgba(35, 39, 43, .30);
  --away: rgba(35, 39, 43, .13);
  --grid: rgba(35, 39, 43, .10);
  --track: var(--paper);
  --sleep-bg: transparent;
  --edge: rgba(0, 0, 0, .45);
  --wait: var(--rule);
  --font-head: Bahnschrift, "DIN Alternate", "DIN 2014", "Barlow Semi Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151719;
    --paper: #1f2225;
    --ink: #eceff1;
    --muted: #b8c0c7;
    --line: #3a4046;
    --rule: #6b747c;
    --accent: #ff8f57;
    --accent-ink: #1b0f08;
    --accent-soft: #3a2316;
    --head-bg: #0d0f11;
    --head-ink: #eceff1;
    --plate: #c99a49;
    --bad: #ff9b85;
    --late: #ff9b85;
    --info: #9cc8f0;
    --focus: #7cc0ff;
    --sleep: rgba(255, 255, 255, .13);
    --away: rgba(255, 255, 255, .34);
    --grid: rgba(255, 255, 255, .08);
    --track: #3d434a;
    --sleep-bg: #050607;
    --edge: rgba(255, 255, 255, .6);
    --wait: #c5ccd2;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--font); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); color: var(--ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; font-weight: 700; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* header: the printer frame with the build plate under it */
.top { background: var(--head-bg); color: var(--head-ink); padding: 20px 0 16px; border-bottom: 6px solid var(--plate); }
.top h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin: 0 0 4px; letter-spacing: .01em; }
.lede { margin: 0; max-width: 62ch; color: var(--head-ink); opacity: .92; }

.tool { padding: 18px 16px 28px; }
.cols { display: grid; gap: 28px; }
@media (min-width: 980px) { .cols { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; } }
.inputs { container-type: inline-size; min-width: 0; }
.out { min-width: 0; container-type: inline-size; }
section > h2 { font-size: 1.45rem; margin: 18px 0 8px; }
.inputs section:first-child > h2, .out > h2 { margin-top: 0; }
h3.sub { font-size: 1.15rem; margin: 16px 0 6px; }

label { display: block; }
label > span { display: block; font-size: 16px; color: var(--muted); margin-bottom: 2px; }
input[type="text"], input[type="time"], input[type="date"], input[type="datetime-local"], select {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 4px; padding: 8px 9px; min-height: 44px; width: 100%; min-width: 0;
}
input[type="time"], input[type="datetime-local"], input[type="date"] { font-variant-numeric: tabular-nums; }
input[aria-invalid="true"] { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
input::placeholder { color: var(--muted); opacity: .8; }
input[type="color"] { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); }

.btn {
  font: inherit; font-size: 16px; font-weight: 600; min-height: 44px; padding: 8px 16px; border-radius: 4px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--paper); }
.btn.quiet { background: transparent; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; padding-left: 4px; padding-right: 4px; }
.btn.small { min-height: 36px; padding: 4px 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.linkish { font: inherit; font-size: 16px; background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 10px 0; min-height: 44px; }
.x { flex: none; width: 44px; height: 44px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; border-radius: 4px; cursor: pointer; align-self: end; }
.x:hover { border-color: var(--rule); color: var(--ink); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }

/* rows of prints, printers and away times: one ruled list, no cards */
.rows { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.rows > li { padding: 10px 0 8px; border-bottom: 1px solid var(--line); }
.job-grid { display: grid; gap: 6px 8px; grid-template-columns: 7.5rem minmax(0, 1fr) 3.6rem 44px; }
.job-grid .j-name { grid-column: 1 / 4; grid-row: 1; }
.job-grid .x { grid-column: 4; grid-row: 1; }
.job-grid .j-time { grid-column: 1; }
.job-grid .j-fil { grid-column: 2; }
.job-grid .j-n { grid-column: 3 / 5; }
@container (max-width: 440px) {
  .job-grid { grid-template-columns: 5.4rem minmax(0, 1fr) 3.6rem; }
  .job-grid .j-name { grid-column: 1 / 3; }
  .job-grid .x { grid-column: 3; justify-self: end; }
  .job-grid .j-time { grid-column: 1; grid-row: 2; }
  .job-grid .j-fil { grid-column: 2; grid-row: 2; }
  .job-grid .j-n { grid-column: 3; grid-row: 2; }
}
@container (min-width: 560px) {
  .job-grid { grid-template-columns: minmax(0, 1.3fr) 6.4rem minmax(0, 1fr) 4.2rem 44px; }
  .job-grid .j-name, .job-grid .j-time, .job-grid .j-fil, .job-grid .j-n, .job-grid .x { grid-row: 1; grid-column: auto; }
}
.j-due { max-width: 17rem; margin-top: 6px; }
.row-msg { margin: 2px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.5em; }
.row-msg.bad { color: var(--bad); }
.row-msg.ask { color: var(--info); }
.row-msg:empty { display: none; }

.p-top, .a-top { display: flex; gap: 8px; align-items: end; }
.a-top { flex-wrap: wrap; }
.p-name, .a-name { flex: 1; min-width: 0; }
.a-top label:not(.a-name) { width: 8.6rem; flex: none; }
@container (max-width: 470px) {
  .a-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .a-top .a-name { grid-column: 1 / 3; grid-row: 1; margin-right: 52px; }
  .a-top .x { grid-column: 2; grid-row: 1; justify-self: end; }
  .a-top label:not(.a-name) { width: auto; }
  .days-btns { flex-wrap: nowrap; gap: 4px; flex: 1 1 100%; }
  .day-btn { flex: 1 1 0; width: auto; min-width: 0; }
  .inputs fieldset.line legend { width: 100%; float: none; margin-bottom: 4px; }
  .inputs fieldset.line { flex-wrap: nowrap; }
  .inputs fieldset.line label { flex: 1 1 0; min-width: 0; flex-direction: column; align-items: stretch; gap: 2px; color: var(--muted); }
  .inputs fieldset.line input { width: auto; flex: 1; min-width: 0; }
}
.can { display: flex; gap: 8px; align-items: baseline; margin-top: 8px; }
.can-l { color: var(--muted); flex: none; }
.chips, .days-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 16px; min-height: 40px; padding: 4px 12px 4px 8px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); display: inline-flex; align-items: center; gap: 7px;
}
.chip[aria-pressed="false"] { background: transparent; color: var(--muted); text-decoration: line-through; border-style: dashed; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 1px solid var(--rule); flex: none; }
.more { margin-top: 6px; }
.more summary { cursor: pointer; color: var(--ink); min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: ""; width: 12px; height: 12px; background: currentColor; clip-path: polygon(10% 0, 90% 50%, 10% 100%); flex: none; }
.more[open] summary::before { clip-path: polygon(0 10%, 100% 10%, 50% 90%); }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 8px 12px; padding: 4px 0 6px; }
.a-days { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; margin-top: 8px; }
.day-btn {
  font: inherit; font-size: 16px; font-weight: 600; width: 40px; height: 44px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--rule); background: transparent; color: var(--muted);
}
.day-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.day-btn:disabled { opacity: .45; cursor: default; }
.a-date { display: flex; align-items: center; gap: 8px; }
.a-date > span { margin: 0; white-space: nowrap; }
.a-date input { width: 11rem; }

.fils { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.fil { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.fil-msg { flex: 1 1 100%; margin: 0; }
.fil-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.spools { display: flex; align-items: center; gap: 8px; }
.spools > span { margin: 0; }
.spools input { width: 3.6rem; text-align: center; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; }
fieldset.line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 4px 0 6px; }
fieldset.line legend { float: left; width: 6.2rem; margin-right: 0; }
fieldset.line label { display: flex; align-items: center; gap: 8px; }
fieldset.line input { width: 8.8rem; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); margin: 0; }
.checks { margin-top: 14px; }
.start-row { margin-top: 14px; }
.start-row > label { font-weight: 600; }
.start-in { display: flex; flex-wrap: wrap; gap: 8px; max-width: 22rem; }
.start-in input { flex: 1 1 14rem; width: auto; }

/* notes and bars */
.bar { background: var(--paper); border: 2px solid var(--ink); padding: 10px 12px; margin: 0 0 14px; }
.bar p { margin: 0 0 8px; }
.bar-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.note { margin: 0 0 14px; padding: 8px 12px; border-left: 0; background: var(--accent-soft); }
.jump { margin: 0 0 14px; font-variant-numeric: tabular-nums; }
@media (min-width: 980px) { .jump { display: none; } }
.info { color: var(--info); margin: 0 0 10px; }

/* the plan */
.summary { font-size: 1.15rem; font-weight: 600; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.unfit { border-top: 2px solid var(--bad); padding-top: 4px; margin-bottom: 14px; }
.unfit h3 { color: var(--bad); margin: 6px 0; font-size: 1.15rem; }
.unfit ul { margin: 0; padding-left: 20px; }
.unfit li { margin-bottom: 6px; }
.day { margin: 0 0 22px; }
.day h3 { font-size: 1.2rem; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--ink); }
.tl { margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.axis, .lane { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 8px; align-items: center; }
.lane { margin-top: 4px; }
.lane-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; color: var(--muted); }
.ticks { position: relative; height: 1.4em; color: var(--muted); }
.tick { position: absolute; top: 0; font-size: 16px; transform: translateX(-1px); padding-left: 3px; border-left: 1px solid var(--rule); line-height: 1.3; }
.track {
  position: relative; height: 32px; background-color: var(--track); border: 1px solid var(--line); overflow: hidden;
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px); background-size: calc(100% / 24) 100%;
}
.sh { position: absolute; top: 0; bottom: 0; }
.sh-S { background: repeating-linear-gradient(135deg, var(--sleep) 0 3px, transparent 3px 7px) var(--sleep-bg); }
.sh-W { background: repeating-linear-gradient(135deg, var(--away) 0 2px, transparent 2px 9px); }
.wait { position: absolute; top: 8px; bottom: 8px; border: 2px dashed var(--wait); border-left: 0; }
.setup { position: absolute; top: 9px; bottom: 9px; background: var(--rule); }
.pbar {
  position: absolute; top: 3px; bottom: 3px; background: var(--c); color: var(--t); border: 1px solid var(--edge);
  border-radius: 3px; overflow: hidden; min-width: 3px;
}
.pbar span { display: block; padding: 0 5px; font-size: 16px; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--t); }
.pbar.late { outline: 2px solid var(--late); outline-offset: 1px; }
@container (max-width: 480px) {
  .axis, .lane { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .axis .lane-name { display: none; }
  .lane { margin-top: 6px; }
}
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: 0 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.todo time { font-weight: 700; font-variant-numeric: tabular-nums; grid-row: span 2; }
.todo .who { font-weight: 600; }
.todo .what { grid-column: 2; }
.todo li.late .what { color: var(--late); }
.todo li.quiet-day { display: block; color: var(--muted); }
.help { margin: -2px 0 8px; color: var(--muted); }
.plan-note { color: var(--muted); margin: 6px 0 12px; }
.idle { margin: 0 0 12px; padding-left: 20px; }
.idle li { margin-bottom: 2px; }
.idle .linkish { color: var(--ink); padding: 0; min-height: 0; text-align: left; }
.tl-key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; color: var(--muted); }
.k { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sw { display: inline-block; width: 28px; height: 18px; border: 1px solid var(--line); background-color: var(--track); flex: none; }
/* the key's swatches are drawn like the bars: asleep on its own dark ground in dark mode */
.sw.sh-S { background-color: var(--sleep-bg); }
.sw-p { background: linear-gradient(90deg, #d0312d 0 34%, #2f6bd8 34% 67%, #f2c12e 67%); border-color: var(--edge); border-radius: 3px; }
.sw-setup { background: linear-gradient(var(--rule), var(--rule)) center / 100% 6px no-repeat, var(--track); }
.sw-wait { background: linear-gradient(90deg, var(--wait) 50%, transparent 50%) 0 4px / 6px 2px repeat-x, linear-gradient(90deg, var(--wait) 50%, transparent 50%) 0 12px / 6px 2px repeat-x, var(--track); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 10px 0; }
.print-pick { display: flex; align-items: center; gap: 8px; }
.print-pick select { width: auto; max-width: 13rem; }
.small-note { margin: 0 0 10px; color: var(--muted); }
.earlier { margin: 12px 0; }
.earlier summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.earlier ul { list-style: none; padding: 0; margin: 0; }
.earlier li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.start-over { margin: 6px 0 0; }

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px));
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 4px; z-index: 20;
  display: flex; gap: 12px; align-items: center;
}
.toast .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }

/* below the tool */
.explain { max-width: 1200px; padding-bottom: 28px; }
.explain section { max-width: 70ch; }
.explain h2 { font-size: 1.45rem; margin: 30px 0 8px; padding-top: 14px; border-top: 2px solid var(--ink); }
.faq h3 { font-size: 1.12rem; margin: 18px 0 4px; }
.faq p { margin: 0; }
.explain li { margin-bottom: 4px; }

.site-foot { background: var(--head-bg); color: var(--head-ink); padding: 22px 0; margin-top: 20px; border-top: 6px solid var(--plate); }
.sb-footer p { margin: 0 0 10px; font-size: 16px; }
.sb-footer a { color: var(--head-ink); }
.sb-more { line-height: 1.8; }
.missing { padding: 30px 0; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
html { scroll-behavior: smooth; }

/* ---------- printing: only the day sheet ---------- */
.print-root { display: none; }
@page { margin: 14mm 13mm; }
@media print {
  :root { --ink: #111; --muted: #333; --line: #999; --rule: #666; --paper: #fff; --sleep: rgba(0, 0, 0, .28); --away: rgba(0, 0, 0, .12); --grid: rgba(0, 0, 0, .12); --track: #fff; --sleep-bg: transparent; --late: #8a1c0b; --edge: #000; --wait: #333; }
  body { background: #fff; color: #111; font-size: 11pt; }
  body > *:not(#print) { display: none !important; }
  .print-root { display: block !important; }
  .print-root * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .p-head h1 { font-size: 18pt; margin: 0 0 2pt; }
  .p-head p { margin: 0 0 8pt; }
  .p-day { width: 100%; border-collapse: collapse; margin: 0 0 12pt; table-layout: fixed; }
  .p-day th { text-align: left; font-weight: normal; padding: 0; }
  .p-day h2 { font-size: 13pt; margin: 0 0 3pt; padding-bottom: 2pt; border-bottom: 1.5pt solid #111; }
  .p-day tr { break-inside: avoid; }
  .p-day tbody.keep { break-inside: avoid; }
  .p-day td { vertical-align: top; padding: 2.5pt 0; border-bottom: .5pt solid #aaa; font-size: 10.5pt; }
  .p-day tr.tl-row td { padding: 0; }
  .p-day col.k-box { width: 6mm; }
  .p-day col.k-t { width: 19.5mm; }
  .p-day td.c-t { font-weight: 700; font-variant-numeric: tabular-nums; }
  .p-day tr.late td { color: #8a1c0b; }
  .p-day tr.quiet-day td { color: #333; font-style: italic; }
  .wait { top: 5pt; bottom: 5pt; border-color: #333; }
  .box { display: block; width: 3.6mm; height: 3.6mm; border: .9pt solid #111; margin-top: .6mm; }
  .tl { margin: 2pt 0 4pt; }
  .axis, .lane { grid-template-columns: 26mm minmax(0, 1fr); gap: 2mm; }
  .lane-name { font-size: 9.5pt; color: #111; }
  .tick { font-size: 8.5pt; color: #333; }
  .ticks { height: 1.2em; }
  .track { height: 18pt; border-color: #888; background-color: #fff; }
  .pbar { top: 1.5pt; bottom: 1.5pt; border-color: #000; }
  .pbar span { font-size: 8.5pt; line-height: 14pt; }
  .setup { top: 6pt; bottom: 6pt; background: #666; }
  .p-blank col.k-p { width: 32mm; }
  .p-blank th { text-align: left; font-weight: 700; padding: 0 0 2pt; border-bottom: 1.5pt solid #111; }
  .p-blank td { height: 9.5mm; padding: 0; vertical-align: middle; }
  .p-blank td + td { border-left: .5pt solid #ccc; }
  .tl-key { font-size: 9.5pt; color: #333; gap: 2pt 10pt; margin: 0 0 8pt; }
  .tl-key .k { gap: 4pt; }
  .sw { width: 7mm; height: 3.6mm; border-color: #888; }
  .p-unfit { break-inside: avoid; border-top: 1.5pt solid #111; margin-top: 6pt; }
  .p-unfit h3 { font-size: 12pt; margin: 4pt 0; color: #111; }
  .p-unfit ul { margin: 0; padding-left: 14pt; }
  .p-note { font-size: 9.5pt; color: #333; margin: -4pt 0 8pt; }
}
