@font-face { font-family: "Atkinson"; src: url("fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f4f1ec;
  --paper: #fffdfa;
  --ink: #1d232b;
  --muted: #545c67;
  --line: #d8d2c8;
  --line-strong: #8b8478;
  --brick: #a8401c;
  --brick-ink: #ffffff;
  --brick-soft: #f6e3da;
  --pupil: #3f4d5c;
  --inset: #2f6694;
  --meet: #b0451f;
  --event: #d29a1a;
  --closed: #e6e0d6;
  --bank: #c9bfb0;
  --warn: #8a4b00;
  --warn-soft: #fbefd9;
  --info-soft: #e7eef5;
  --focus: #2f6694;
  --font: "Atkinson", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191d;
    --paper: #1e2228;
    --ink: #ece8e2;
    --muted: #aab1ba;
    --line: #353b43;
    --line-strong: #6f7782;
    --brick: #f08a62;
    --brick-ink: #1b1310;
    --brick-soft: #3a251c;
    --pupil: #8fa1b5;
    --inset: #7fb2e0;
    --meet: #ee8a62;
    --event: #e7b84a;
    --closed: #2b3036;
    --bank: #4a4f57;
    --warn: #f3c27a;
    --warn-soft: #3a2e1a;
    --info-soft: #1f2a36;
    --focus: #8fc0ff;
  }
}

* { 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); }
a { color: var(--ink); text-decoration-color: var(--brick); text-underline-offset: 2px; }
a:hover { color: var(--brick); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.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; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

.topbar { border-bottom: 3px solid var(--brick); background: var(--paper); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.topbar nav { display: flex; gap: 16px; }
.topbar nav a { font-size: .98rem; padding: 10px 0; }

.hero { padding: 22px 0 10px; max-width: 760px; }
h1 { font-size: 2.05rem; line-height: 1.12; margin: 0 0 10px; letter-spacing: -.01em; }
.lede { margin: 0; color: var(--muted); font-size: 1.05rem; }
h2 { font-size: 1.45rem; line-height: 1.2; margin: 32px 0 12px; }
h3 { font-size: 1.08rem; margin: 18px 0 8px; }
.nojs, .banner { background: var(--warn-soft); border-left: 4px solid var(--warn); padding: 10px 14px; margin: 12px 0; }
.banner .btn { margin: 4px 6px 0 0; }

/* layout: result column on the left (sticky on wide screens), form on the right */
.layout { display: grid; gap: 18px; margin-top: 14px; }
@media (min-width: 960px) {
  .layout { grid-template-columns: 390px 1fr; align-items: start; gap: 32px; }
  .result { position: sticky; top: 12px; }
}

.result { background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; padding: 16px; }
.answer .big { margin: 0; font-size: 1.9rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.answer .of { font-size: 1.05rem; font-weight: 400; color: var(--muted); white-space: nowrap; }
.meter { position: relative; display: flex; height: 20px; margin: 14px 0 8px; background: repeating-linear-gradient(135deg, var(--closed) 0 6px, transparent 6px 10px); border: 1px solid var(--line-strong); }
.meter .seg { height: 100%; }
.seg.pupil, .sw.pupil { background: var(--pupil); }
.seg.inset, .sw.inset, .sw.twilight { background: var(--inset); }
.seg.meet, .sw.meeting { background: var(--meet); }
.seg.event, .sw.event { background: var(--event); }
.meter .mark { position: absolute; top: -6px; bottom: -6px; width: 3px; margin-left: -2px; background: var(--ink); }
.left { margin: 0; font-weight: 700; font-size: 1.08rem; }
.left.over { color: var(--brick); }
.notes { list-style: none; padding: 0; margin: 12px 0 0; }
.notes li { padding: 8px 10px; margin-bottom: 6px; font-size: .95rem; border-left: 4px solid var(--inset); background: var(--info-soft); }
.notes li.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.breakdown { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .95rem; font-variant-numeric: tabular-nums; }
.breakdown th, .breakdown td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.breakdown thead th { font-size: .85rem; color: var(--muted); font-weight: 400; }
.breakdown tbody th { font-weight: 400; }
.breakdown td:nth-child(2) { color: var(--muted); }
.breakdown tfoot th, .breakdown tfoot td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 700; }
.num { text-align: right !important; white-space: nowrap; }
.sw { display: inline-block; width: 10px; height: 10px; margin-right: 7px; vertical-align: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.share-out { margin-top: 10px; }
.share-out label { display: block; font-size: .92rem; margin-bottom: 4px; }
.share-out input { width: 100%; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper); color: var(--ink); font: 700 1rem var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brick); color: var(--ink); }
.btn.primary { background: var(--brick); border-color: var(--brick); color: var(--brick-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--brick-ink); }
.btn.ghost { border-color: transparent; text-decoration: underline; text-decoration-color: var(--brick); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .95rem; }
.btn.danger { background: var(--brick); border-color: var(--brick); color: var(--brick-ink); }
.linkish { background: none; border: 0; padding: 10px 4px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--brick); font: inherit; cursor: pointer; min-height: 44px; }

/* form */
.form { min-width: 0; }
.sec { border: 0; border-top: 2px solid var(--ink); margin: 0 0 20px; padding: 0 0 4px; min-width: 0; }
.sec legend { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 10px 0 6px; font-weight: 700; font-size: 1.15rem; float: left; }
.sec legend + * { clear: both; }
.sec .sum { font-weight: 400; font-size: .95rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row { display: flex; flex-wrap: wrap; gap: 10px 12px; margin: 6px 0; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field label, .lab { font-size: .92rem; color: var(--muted); }
.field.grow { flex: 1 1 200px; }
input, select { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: 4px; min-height: 44px; padding: 6px 10px; }
input[type="number"] { width: 6.5em; }
input[type="time"] { width: 8.2em; }
input[type="date"] { width: 10.5em; }
#inset-h, #fte, #sttw, #mine { width: 7em; }
#school, #teacher { width: min(100%, 22em); }
#sec-names .field { flex: 1 1 220px; }
#sec-names input { width: 100%; }
input[aria-invalid="true"] { border-color: var(--brick); box-shadow: 0 0 0 1px var(--brick); }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brick); margin: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.hint { color: var(--muted); font-size: .95rem; margin: 6px 0; }
.muted { color: var(--muted); }
.save-line { margin: 10px 0 0; color: var(--muted); font-size: .95rem; }
.confirm { background: var(--warn-soft); padding: 10px 12px; }

details.more { margin: 8px 0; }
details.more > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: var(--brick); text-underline-offset: 3px; }
.more-in { padding: 4px 0 8px 12px; border-left: 3px solid var(--line); }
.more-in .list { max-width: 520px; }

.list, .rows { list-style: none; padding: 0; margin: 4px 0 10px; }
.item { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); position: relative; }
.item .x { margin-left: auto; }
.list .item:not(.small) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
.list .item:not(.small) .grow { grid-column: 1 / 3; }
.list .item:not(.small) .x { grid-column: 3; grid-row: 1; align-self: end; }
.list .item:not(.small) input { width: 100%; }
.x { width: 44px; height: 44px; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--paper); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.x:hover { border-color: var(--brick); color: var(--brick); }
.card-row { padding-right: 54px; }
.card-row .x { position: absolute; right: 0; top: 10px; }
.card-row .tw { min-height: 44px; }
.skips { display: flex; flex-wrap: wrap; gap: 0 20px; flex-basis: 100%; }
.dates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 10px; flex-basis: 100%; }
.dates input { width: 100%; }
.card-row input[data-kind="hours"] { width: 5.5em; }
.card-row input[data-count] { width: 5em; }

.days-grid { margin: 6px 0; max-width: 520px; }
.day-row { display: grid; grid-template-columns: 2.4em minmax(0, 1fr) minmax(0, 1fr) 4.2em; align-items: end; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.day-row input { width: 100%; padding: 6px 4px 6px 8px; }
.day-row .dname { font-weight: 700; padding-bottom: 10px; }
.day-row.off { grid-template-columns: 2.6em 1fr; }
.day-row.off { align-items: center; min-height: 44px; }
.day-row.off .dname { padding: 0; }
.wd-checks { margin: 8px 0; }
.wd-boxes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.wd-hint { margin: 8px 0 0; padding: 6px 10px; border-left: 4px solid var(--inset); background: var(--info-soft); color: var(--ink); }
.wd { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px 0 10px; border: 1.5px solid var(--line-strong); border-radius: 4px; cursor: pointer; background: var(--paper); }
.radios { margin: 6px 0; }
.pt-out { margin: 6px 0; font-weight: 700; }
.pt-out .btn { margin-left: 6px; }

/* week by week */
.weeks { margin-top: 18px; }
.weeks h2 { margin-top: 18px; }
.key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .92rem; color: var(--muted); margin: 0 0 10px; }
.key .k { margin-left: 8px; }
.key .k:first-child { margin-left: 0; }
.k, .d { display: inline-block; width: 18px; height: 18px; border: 1px solid var(--line-strong); vertical-align: middle; position: relative; }
.k.pupil, .d.pupil { background: var(--pupil); border-color: var(--pupil); }
.k.inset, .d.inset { background: var(--inset); border-color: var(--inset); }
.k.closed, .d.closed { background: var(--closed); }
.k.bank, .d.bank { background: var(--bank); }
.k.off, .d.off { background: repeating-linear-gradient(135deg, var(--line-strong) 0 2px, transparent 2px 6px); }
.d.weekend, .d.out { background: transparent; border-style: dashed; border-color: var(--line); }
.dot, .d.has::after { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--event); border: 1.5px solid var(--paper); }
.key .dot { margin-left: 8px; }
.d.has::after { content: ""; position: absolute; right: -4px; top: -4px; }
.wk-wrap { container-type: inline-size; }
.wk { width: 100%; max-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .97rem; }
.wk th, .wk td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.wk thead th { font-size: .85rem; color: var(--muted); font-weight: 400; border-bottom: 2px solid var(--ink); }
.wk tbody th { font-weight: 700; white-space: nowrap; }
.wk td.num, .wk th.num { padding-left: 14px; }
.wk tr.its td { padding-left: 12px; }
.wk .days, .wk .days-h { white-space: nowrap; }
.wk .days .d { margin-right: 4px; }
.wk .days-h span { display: inline-block; width: 18px; margin-right: 4px; text-align: center; }
.wk tr.hol th, .wk tr.hol td { color: var(--muted); font-weight: 400; background: transparent; }
.wk tr.hol th, .wk tr.undated th { white-space: normal; }
.wk tr.hol td { font-style: italic; }
.wk tr.its td { border-bottom: 1px solid var(--line); padding-top: 0; color: var(--muted); font-size: .92rem; }
.wk tr:has(+ tr.its) th, .wk tr:has(+ tr.its) td { border-bottom: 0; }
.wk tr.undated th, .wk tr.undated td { border-top: 2px solid var(--ink); }
@container (max-width: 380px) {
  .wk { font-size: .9rem; }
  .wk .days .d, .wk .days-h span { width: 13px; height: 13px; margin-right: 2px; }
  .wk th, .wk td { padding: 5px 3px; }
}
@container (max-width: 300px) {
  .wk { font-size: .82rem; }
  .wk .days .d, .wk .days-h span { width: 11px; height: 11px; margin-right: 2px; }
  .wk td.num, .wk th.num { padding-left: 6px; }
}

.prose { max-width: 760px; margin-top: 28px; }
.prose p { margin: 0 0 14px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 700; min-height: 44px; }
.faq details p { margin: 0 0 14px; }
.sources { font-size: .95rem; color: var(--muted); margin-top: 22px; }

.undo { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 20; display: flex; width: max-content; align-items: center; gap: 12px; background: var(--ink); color: var(--bg); padding: 8px 10px 8px 16px; border-radius: 6px; max-width: calc(100% - 24px); box-shadow: 0 4px 18px rgba(0, 0, 0, .25); }
.undo .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); }

footer { border-top: 1px solid var(--line); margin-top: 32px; padding: 18px 0 28px; color: var(--muted); font-size: .95rem; }
footer a { color: var(--ink); }
.sb-footer p { margin: 0 0 8px; }

.print-sheet { display: none; }

/* part-time page */
.crumbs { font-size: .95rem; padding-top: 12px; color: var(--muted); }
.crumbs a { display: inline-block; padding: 8px 0; }
.pt-layout { display: grid; gap: 18px; margin-top: 10px; max-width: 900px; }
@media (min-width: 760px) { .pt-layout { grid-template-columns: 1fr 360px; align-items: start; gap: 32px; } }
.pt-form { border-top: 2px solid var(--ink); padding-top: 8px; }
.pt-result .big { margin: 0; font-size: 1.7rem; font-weight: 700; }
.pt-result .of { font-size: 1.05rem; font-weight: 400; color: var(--muted); }
.pt-result .pct { margin: 2px 0 8px; font-weight: 700; }
.pt-result .breakdown th { font-weight: 400; }

@media (max-width: 480px) {
  h1 { font-size: 1.7rem; }
  .answer .big { font-size: 1.6rem; }
  .topbar nav { gap: 12px; }
  .result { padding: 14px 12px; }
}
@media (max-width: 359px) {
  .breakdown { font-size: .88rem; }
  .breakdown th, .breakdown td { padding: 6px 2px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* ---------- print: only the calendar sheet ---------- */
@page { margin: 13mm 12mm; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #999; }
  body { background: #fff; color: #000; font-size: 10pt; }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; font-family: var(--font); }
  .ps-head h2 { font-size: 16pt; margin: 0 0 2pt; }
  .ps-head p { margin: 0 0 1pt; font-size: 10pt; }
  .ps-total { font-size: 12pt; margin: 8pt 0 6pt; }
  .ps-bd { border-collapse: collapse; width: 60%; min-width: 110mm; font-size: 10pt; margin-bottom: 6pt; }
  .ps-bd th, .ps-bd td { text-align: left; padding: 2pt 6pt 2pt 0; border-bottom: .5pt solid #999; font-weight: 400; }
  .ps-bd thead th { font-weight: 700; border-bottom: 1pt solid #000; }
  .ps-bd tfoot th, .ps-bd tfoot td { font-weight: 700; border-top: 1pt solid #000; border-bottom: 0; }
  .ps-notes { margin: 4pt 0 6pt; padding-left: 14pt; font-size: 9.5pt; }
  .ps-cal { font-size: 9.5pt; margin: 4pt 0 6pt; }
  .ps-wk { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 9pt; font-variant-numeric: tabular-nums; }
  .ps-wk col.c-wk { width: 15mm; }
  .ps-wk col.c-d { width: 13mm; }
  .ps-wk col.c-n { width: 20mm; }
  .ps-wk th, .ps-wk td { padding: 2pt 3pt; border: .5pt solid #999; text-align: left; vertical-align: top; overflow-wrap: break-word; }
  .ps-wk thead th { font-weight: 700; background: #fff; border-bottom: 1pt solid #000; }
  .ps-wk thead { display: table-header-group; }
  .ps-wk tbody.pw { break-inside: avoid; page-break-inside: avoid; }
  .ps-wk tbody th { font-weight: 700; white-space: nowrap; }
  .ps-wk td.cl { color: #444; font-size: 7.5pt; white-space: nowrap; overflow: hidden; }
  .ps-wk td.ins { font-size: 8pt; }
  .ps-wk tr.hol th, .ps-wk tr.hol td { color: #444; font-style: italic; font-weight: 400; }
  .ps-wk .nt { font-size: 8.5pt; }
  .ps-foot { font-size: 8.5pt; color: #333; margin-top: 6pt; }
}
