:root {
  --bg: #f3f5f4;
  --panel: #ffffff;
  --ink: #14232a;
  --muted: #475960;
  --line: #c3cfcc;
  --soft: #e6eceb;
  --accent: #0b6b62;
  --accent-ink: #ffffff;
  --accent-soft: #d4ebe7;
  --brass: #8a5a00;
  --brass-soft: #f6e7c4;
  --dnd: #8c2f12;
  --dnd-soft: #f7ddd3;
  --ooo: #3d4448;
  --ooo-soft: #dfe2e4;
  --warn: #9b2d10;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --head: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --r: 6px;
  --r2: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101a1c;
    --panel: #172427;
    --ink: #e3ece9;
    --muted: #a9bab6;
    --line: #34474b;
    --soft: #1e2e31;
    --accent: #45b8aa;
    --accent-ink: #052520;
    --accent-soft: #1d3d39;
    --brass: #f0c062;
    --brass-soft: #3d3016;
    --dnd: #ffc4ad;
    --dnd-soft: #4a2418;
    --ooo: #d3d8db;
    --ooo-soft: #2c3336;
    --warn: #ffab8f;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 var(--sans); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--head); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); font-weight: 800; margin: 0 0 6px; }
h2 { font-size: 1.3rem; margin: 0 0 10px; }
h3 { font-size: 1.08rem; margin: 0; }
.masthead { padding: 22px 0 8px; }
.lede { margin: 0; max-width: 62ch; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button {
  min-height: 44px; padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--panel); cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
button.danger, .linkish.danger { color: var(--warn); }
button.small { min-height: 40px; padding: 6px 10px; font-size: 16px; }
button.x { min-width: 44px; padding: 0; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.linkish { background: none; border: 0; padding: 8px 0; text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input[type="text"], input[type="number"], input[type="date"], select, textarea {
  font-size: 16px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); width: 100%;
}
textarea { min-height: 72px; resize: vertical; }
input[aria-invalid="true"] { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.f { font-weight: 600; }
.f input, .f select { margin-top: 4px; font-weight: 400; }
.row { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 10px; }
.row .f { flex: 1 1 140px; }
.row .f.wide { flex: 3 1 240px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.err { color: var(--warn); margin: 6px 0 0; min-height: 0; }
.err:empty { display: none; }
.hint { color: var(--muted); margin: 6px 0 0; }
.note { background: var(--brass-soft); border-radius: var(--r); padding: 10px 12px; margin: 0 0 12px; }
.warn { color: var(--warn); }

/* tabs: folder tabs over one panel */
#tool { margin-top: 10px; }
.ex-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 10px; }
.ex-bar p { margin: 0; font-weight: 600; }
.stale { padding: 10px 12px; border: 1px solid var(--brass); border-radius: var(--r2); background: var(--brass-soft); }
.stale p { color: var(--ink); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--accent); }
.tabs button {
  flex: 1 1 0; border-radius: var(--r2) var(--r2) 0 0; border-bottom: 0; background: var(--soft);
  font-weight: 650; min-height: 48px; padding: 8px 6px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.panel { background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r2) var(--r2); padding: 16px; }
.panel h2 { margin-top: 0; }

.box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 4px; }
.box > summary { cursor: pointer; padding: 10px 0; min-height: 44px; list-style-position: inside; }
.sum-h { font-family: var(--head); font-weight: 700; font-size: 1.12rem; }
.sum-sub { color: var(--muted); }
#earlier { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 4px 16px 12px; }
#earlier ul { list-style: none; padding: 0; margin: 0; }
#earlier li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--soft); }
.e-btns { display: flex; gap: 6px; }

/* room types */
table.types { width: 100%; border-collapse: collapse; }
.types th { text-align: left; font-size: 16px; color: var(--muted); font-weight: 600; padding: 4px 6px 4px 0; }
.types td { padding: 4px 6px 4px 0; }
.types td:nth-child(2), .types td:nth-child(3) { width: 24%; }
.types td:last-child { width: 48px; padding-right: 0; }

/* room list */
.floor-h { margin: 14px 0 6px; font-size: 1rem; }
.floor-h span { color: var(--muted); font-weight: 400; }
.rl { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 6px 14px; }
.rl li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr) minmax(0, 1.6fr) 44px; gap: 6px; align-items: center; }

/* today */
.day-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.day-head .f { flex: 0 1 220px; }
.counts { margin: 12px 0 0; font-weight: 600; }
.empty { padding: 8px 0; }
.palette { border: 0; padding: 0; margin: 14px 0 0; }
.palette legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.pal { display: flex; flex-wrap: wrap; gap: 6px; }
.pb { min-height: 44px; padding: 6px 12px; }
.pb[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 1px; font-weight: 700; }
.fill { margin-top: 10px; }
.fl { margin-top: 14px; }
.fl-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.tile {
  min-height: 56px; padding: 4px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.15; position: relative; overflow: hidden;
}
.t-no { font-weight: 750; font-variant-numeric: tabular-nums; max-width: 100%; overflow-wrap: anywhere; text-align: center; }
.t-st { font-size: 16px; }
.st-co { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.st-so { background: var(--accent-soft); border-color: var(--accent); }
.st-dnd { background: var(--dnd-soft); color: var(--dnd); border-color: var(--dnd); }
.st-vc { background: var(--panel); }
.st-ooo { background: var(--ooo-soft); color: var(--ooo); text-decoration: line-through; }
.st-none { background: var(--panel); color: var(--muted); border-style: dashed; }
.pb.st-none { border-style: solid; color: var(--ink); }
.pb.st-pri { background: var(--brass-soft); color: var(--ink); border-color: var(--brass); }
.tile.pri { box-shadow: inset 0 7px 0 var(--brass); padding-top: 9px; }
.tile.st-ooo .t-no { text-decoration: line-through; }
.team { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.tl { list-style: none; padding: 0; margin: 0 0 6px; }
.tl li {
  display: grid; grid-template-columns: 44px minmax(0, 360px) 96px 96px 44px; gap: 6px 8px; align-items: center; justify-content: start;
  padding: 6px 0; border-bottom: 1px solid var(--soft);
}
.tl li:not(.on) .a-name { color: var(--muted); }
.on-box { margin: 0; display: flex; align-items: center; justify-content: center; min-height: 44px; }
.on-box input { width: 24px; height: 24px; accent-color: var(--accent); }
.a-f { margin: 0; font-weight: 400; color: var(--muted); font-size: 16px; }
.a-f input { margin-top: 2px; }
.team > label { margin-top: 12px; }

/* boards */
#plan p { margin: 0 0 6px; }
.board-btns { margin: 10px 0 4px; }
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 14px; margin-top: 14px; }
.board, .loose { border: 1px solid var(--line); border-radius: var(--r2); padding: 12px; container-type: inline-size; }
.loose { margin-top: 14px; border-color: var(--warn); }
.loose h3 { color: var(--warn); }
.board.drop-on, .loose.drop-on { outline: 3px solid var(--accent); }
.b-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.b-h h3 { font-size: 1.2rem; overflow-wrap: break-word; hyphens: auto; min-width: 0; }
.b-sum { margin: 4px 0 8px; color: var(--muted); }
.b-empty { color: var(--muted); margin: 0; }
table.bt { width: 100%; border-collapse: collapse; }
.bt th, .bt td { text-align: left; padding: 4px 6px 4px 0; vertical-align: middle; }
.bt thead th { font-size: 16px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); }
.bt tbody tr { border-bottom: 1px solid var(--soft); }
.bt tr.dragging { opacity: 0.5; }
.b-no { font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: break-word; hyphens: auto; min-width: 4.5em; }
/* words wrap at spaces; a word longer than the column is hyphenated, never cut at any letter */
.b-type { overflow-wrap: break-word; hyphens: auto; }
.b-st { white-space: nowrap; }
.b-cr { color: var(--muted); font-variant-numeric: tabular-nums; }
.b-note { width: 32%; }
.b-mv { width: 26%; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 4px; border: 1px solid; font-size: 16px; font-weight: 650; }
.chip.st-so { color: var(--ink); }
.pri-chip { background: var(--brass-soft); color: var(--ink); border-color: var(--brass); margin-left: 4px; }
.pri-star { display: none; }
.b-no[draggable="true"] { cursor: grab; }
@media (hover: hover) and (pointer: fine) { .b-no[draggable="true"]::before { content: "\2630"; color: var(--muted); font-weight: 400; margin-right: 6px; } }
/* narrow boards: room and type with the status beside them (under them when a long room name needs the width),
   then the note and board menu on a line of their own */
.b-tsub { display: none; }
@container (max-width: 640px) {
  .bt thead { display: none; }
  .bt, .bt tbody { display: block; }
  .bt tbody tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 10px; padding: 8px 0; }
  .bt tbody tr::after { content: ""; order: 3; flex: 0 0 100%; height: 0; }
  .bt th, .bt td { padding: 0; width: auto; }
  .bt .b-no { order: 1; flex: 1 1 calc(100% - 9.5em); max-width: 100%; }
  .bt .b-type { display: none; }
  .bt .b-tsub { display: block; font-weight: 400; color: var(--muted); overflow-wrap: break-word; hyphens: auto; }
  .bt .b-st { order: 2; margin-left: auto; white-space: nowrap; text-align: right; }
  /* a star in place of the word keeps the credit on the same line as the chips */
  .bt .pri-star { display: inline; }
  .bt .pri-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .bt .b-note { order: 4; flex: 1 1 0; min-width: 0; align-self: center; }
  .bt .b-mv { order: 5; flex: 0 0 8.5em; min-width: 0; align-self: center; }
  .bt .b-mv select { width: 100%; min-width: 0; }
}

.toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(560px, calc(100% - 32px));
  background: var(--ink); color: var(--bg); border-radius: var(--r2); padding: 10px 14px; display: flex; gap: 12px;
  align-items: center; justify-content: space-between; z-index: 10; pointer-events: none;
}
.toast button { pointer-events: auto; background: transparent; color: var(--bg); border-color: var(--bg); font-weight: 700; }

/* explainer */
.explain { max-width: 72ch; margin: 34px 0 30px; }
.explain h2 { margin-top: 28px; }
.faq h3 { margin: 20px 0 4px; }
.faq p { margin: 0; }

.foot { border-top: 1px solid var(--line); padding: 18px 0 30px; color: var(--muted); }
.sb-footer p { margin: 0 0 10px; }
.sb-more { line-height: 1.7; }
.sb-credit a, .sb-more a { color: var(--accent); }

@media (max-width: 560px) {
  .panel { padding: 12px; }
  .tl li { grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) 44px; justify-content: stretch; }
  .tl .on-box { grid-column: 1; grid-row: 1; }
  .tl .a-name { grid-column: 2 / 4; grid-row: 1; }
  .tl .x { grid-column: 4; grid-row: 1; }
  .tl .a-max { grid-column: 2; grid-row: 2; }
  .tl .a-floor { grid-column: 3; grid-row: 2; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
  .types td:nth-child(2), .types td:nth-child(3) { width: 22%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.print-sheet { display: none; }
@media print {
  @page { margin: 12mm; }
  body { background: #fff; color: #000; font: 10.5pt/1.3 var(--sans); }
  body > *:not(.print-sheet) { display: none !important; }
  .print-sheet { display: block; }
  .ps { break-after: page; }
  .ps:last-child { break-after: auto; }
  .ps-head h2 { font: 800 17pt/1.2 var(--head); margin: 0 0 3pt; }
  .ps-head p { margin: 0 0 8pt; }
  .ps-fill { display: flex; flex-wrap: wrap; gap: 4pt 18pt; font-size: 11pt; margin-top: 10pt !important; }
  .ps-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .ps-table th, .ps-table td { border: 0.75pt solid #000; padding: 3pt 4pt; text-align: left; vertical-align: top; overflow-wrap: break-word; word-break: normal; hyphens: manual; }
  .ps-table thead th { background: #e8e8e8; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .ps-table thead { display: table-header-group; }
  .ps-table tfoot { display: table-row-group; }
  .ps-table tr { break-inside: avoid; }
  .ps-table tbody td { height: 24pt; }
  .ps-run th { background: none !important; border: 0; border-bottom: 0.75pt solid #000; font-weight: 400; padding: 0 0 2pt; font-size: 9pt; }
  .ps-table col.c-room { width: 10%; }
  .ps-table col.c-type { width: 14%; }
  .ps-table col.c-st { width: 17%; }
  .ps-table col.c-note { width: 29%; }
  .ps-table col.c-in, .ps-table col.c-out { width: 11%; }
  .ps-table col.c-done { width: 8%; }
  .p-no { font-weight: 700; font-size: 12pt; overflow-wrap: normal; }
  .ps-table.wide-no col.c-room { width: 21%; }
  .ps-table.wide-no col.c-note { width: 18%; }
  .wide-no .p-no { font-size: 10.5pt; overflow-wrap: anywhere; }
  .wide-no .p-no { word-break: normal; }
  .p-pri td { font-weight: 600; }
  .tick { display: inline-block; width: 11pt; height: 11pt; border: 1pt solid #000; }
  .ps-table:not(.sum) td:last-child { text-align: center; }
  .ps-table.sum { table-layout: auto; }
  .ps-table.sum td { white-space: nowrap; }
  .ps-table.sum td:first-child, .ps-table.sum td:last-child { white-space: normal; }
  .p-cr { font-weight: 400; }
  .ps-table.sum tbody td { height: auto; }
  .ps-table.sum .n { text-align: right; }
  .ps-table.sum th.n { text-align: right; }
  .ps-table.sum tfoot th, .ps-table.sum tfoot td { font-weight: 700; }
  .ps-sign { display: flex; flex-wrap: wrap; gap: 4pt 30pt; margin-top: 16pt; break-inside: avoid; break-before: avoid; }
  .ps-sign p { margin: 0; }
  .ps-lists { margin-top: 10pt; }
  .ps-lists h3 { font: 700 11pt/1.3 var(--sans); margin: 8pt 0 2pt; break-after: avoid; }
  .ps-lists p { margin: 0; }
  .ps-key { margin: 10pt 0 0; font-size: 9pt; }
}
