/* Muster. One stylesheet, no build step. */
:root {
  --bg: #f2f4f3;
  --surface: #ffffff;
  --ink: #17201e;
  --muted: #5a6965;
  --line: #d5dcd9;
  --brand: #1b5e4f;
  --brand-dark: #113d34;
  --side: #10312a;
  --side-ink: #cfe0da;
  --ok: #1c7447;      --ok-bg: #e1f2e8;
  --warn: #94590a;    --warn-bg: #fbefd3;
  --bad: #ab332b;     --bad-bg: #f8e2df;
  --radius: 6px;
  --font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
h1 { font-size: 1.7rem; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: 1.1rem; margin: 0 0 .7rem; font-weight: 700; }
h3 { font-size: .95rem; margin: 1.1rem 0 .4rem; font-weight: 700; }
p { margin: 0 0 .8rem; }
small, .muted { color: var(--muted); }
:focus-visible { outline: 3px solid #e3a21a; outline-offset: 1px; }

/* ---------- App shell ---------- */
body.app { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 1.1rem .7rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side a { color: var(--side-ink); text-decoration: none; display: block; padding: .42rem .7rem; border-radius: var(--radius); }
.side a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side a.on { background: #f2f4f3; color: var(--side); font-weight: 700; }
.side .org { font-size: 1.15rem; font-weight: 700; color: #fff; padding: .2rem .7rem .9rem; letter-spacing: -0.01em; }
.side .org:hover { background: none; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.14); }
.side-foot .linkbtn { color: var(--side-ink); padding: .42rem .7rem; }
.navtoggle, .navbtn { display: none; }
.main { padding: 1.8rem 2.2rem 4rem; max-width: 1180px; width: 100%; }
.main.wide { max-width: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head .sub { margin: .25rem 0 0; color: var(--muted); }
.crumb { margin: 0 0 .15rem; font-size: .9rem; }
.crumb a::before { content: "‹ "; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Public pages ---------- */
body.public { background: var(--bg); }
.pub-head { background: var(--side); padding: .9rem 1.2rem; }
.pub-head a { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.pub-main { max-width: 34rem; margin: 2rem auto 4rem; padding: 0 1.1rem; }
.pub-main.wide { max-width: 64rem; }

/* ---------- Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; }
.panel > h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.panel > h2 a, .panel > h2 small { font-size: .88rem; font-weight: 400; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2 { padding: .9rem 1.2rem 0; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.cols.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.empty { color: var(--muted); padding: .4rem 0; margin: 0; }
.panel.flush .empty { padding: 1rem 1.2rem; }

.flash { padding: .65rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: #b5dcc5; color: #0f4a2c; }
.flash.warn { background: var(--warn-bg); border-color: #ecd49b; color: #5e3804; }
.flash.bad { background: var(--bad-bg); border-color: #e9bab5; color: #6d1c16; }

/* ---------- Tables ---------- */
table { border-collapse: collapse; width: 100%; }
table.list th { text-align: left; font-size: .82rem; font-weight: 600; color: var(--muted); padding: .55rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; background: #f8faf9; }
table.list td { padding: .55rem .8rem; border-bottom: 1px solid #e8ecea; vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td { background: #f8faf9; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list td.tight { white-space: nowrap; width: 1%; }
.scroll { overflow-x: auto; }
tr.head-row td { background: #eef2f0; font-weight: 700; font-size: .88rem; }

/* ---------- Buttons ---------- */
.btn, button.btn { display: inline-block; font: inherit; font-weight: 600; padding: .45rem .9rem; border-radius: var(--radius); border: 1px solid #b9c4c0; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.danger { color: var(--bad); border-color: #dcb1ad; }
.btn.danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: .18rem .55rem; font-size: .85rem; font-weight: 500; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn.danger { color: var(--bad); }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: .85rem; }
.field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.field > span i { font-weight: 400; color: var(--muted); font-style: normal; }
.field small { display: block; margin-top: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=datetime-local], input[type=number], input[type=search], input[type=tel], input[type=file], select, textarea {
  font: inherit; color: inherit; width: 100%; padding: .42rem .6rem; border: 1px solid #b4bfbb; border-radius: var(--radius); background: #fff; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid rgba(27,94,79,.25); outline-offset: 0; }
.check { display: flex; gap: .45rem; align-items: baseline; margin-bottom: .45rem; }
.check input { flex: none; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1rem; }
.row { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.row .field { margin-bottom: 0; flex: 1 1 9rem; }
.row .field.narrow { flex: 0 1 7rem; }
.form-foot { display: flex; gap: .6rem; align-items: center; margin-top: .6rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filters input, .filters select { width: auto; }
.filters input[type=search] { min-width: 15rem; }
fieldset { border: 0; padding: 0; margin: 0 0 .9rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: .3rem; }
.checks { display: flex; flex-wrap: wrap; gap: .1rem 1.2rem; }

/* ---------- Small pieces ---------- */
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .05rem .5rem; border-radius: 99px; background: #e9eeec; color: #3d4b47; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: #edf1ef; border-radius: 99px; padding: .12rem .3rem .12rem .65rem; font-size: .9rem; }
.chip.plain { padding-right: .65rem; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0 .25rem; border-radius: 99px; }
.chip button:hover { color: var(--bad); }
dl.facts { display: grid; grid-template-columns: 8rem 1fr; gap: .35rem .8rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; text-decoration: none; color: inherit; display: block; }
.stat b { display: block; font-size: 1.5rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.alert b { color: var(--bad); }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .45rem 0; border-bottom: 1px solid #e8ecea; }
ul.plain li:last-child { border-bottom: 0; }
.pager { display: flex; gap: .6rem; align-items: center; padding: .8rem 1.2rem; }
details.more > summary { cursor: pointer; color: var(--brand); font-weight: 600; margin-bottom: .6rem; }
.note { border-left: 3px solid var(--line); padding: .1rem 0 .1rem .8rem; margin-bottom: .8rem; }
.note p { margin: 0; white-space: pre-wrap; }
.pre { white-space: pre-wrap; }

/* ---------- Requests to serve ---------- */
.ask { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .7rem 0; border-bottom: 1px solid #e8ecea; }
.ask:last-child { border-bottom: 0; }
.ask .when { font-weight: 700; }
.ask .acts { display: flex; gap: .4rem; align-items: center; }

/* ---------- Plan page ---------- */
.slot { display: flex; align-items: baseline; gap: .5rem; padding: .22rem 0; }
.slot .who { flex: 1; min-width: 0; }
.slot .who small { display: block; }
.slot > .no-print { white-space: nowrap; }
.slot.open .who { color: var(--bad); font-style: italic; }
.pos-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .8rem; padding: .55rem 0; border-top: 1px solid #e8ecea; }
.pos-row:first-of-type { border-top: 0; }
.pos-name { font-weight: 600; }
.pos-name small { display: block; font-weight: 400; }
.assign { display: flex; gap: .35rem; margin-top: .3rem; }
.assign select { padding: .2rem .4rem; font-size: .9rem; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--warn); flex: none; }
.dot.C { background: var(--ok); } .dot.D { background: var(--bad); } .dot.U { background: #d9a02b; }
td.item-header { font-weight: 700; background: #eef2f0; }

/* ---------- Roster matrix: the heart of the app ---------- */
.matrix-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: calc(100vh - 11rem); }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: .9rem; }
table.matrix th, table.matrix td { border-right: 1px solid #e3e8e6; border-bottom: 1px solid #e3e8e6; padding: .4rem .6rem; vertical-align: top; text-align: left; }
table.matrix thead th { position: sticky; top: 0; background: var(--side); color: #fff; z-index: 2; min-width: 9.5rem; font-weight: 600; }
table.matrix thead th a { color: #fff; }
table.matrix thead th small { display: block; color: var(--side-ink); font-weight: 400; }
table.matrix th.pos { position: sticky; left: 0; background: #f8faf9; z-index: 1; min-width: 9rem; font-weight: 600; }
table.matrix thead th.pos { z-index: 3; background: var(--side); }
table.matrix tr.team th { background: #e6ece9; position: sticky; left: 0; font-size: .82rem; color: var(--brand-dark); }
table.matrix tr.team td { background: #e6ece9; }
table.matrix td.off { background: #f6f7f7; }
.m-name { display: flex; align-items: baseline; gap: .35rem; white-space: nowrap; }
.m-name.D { text-decoration: line-through; color: var(--muted); }
.m-open { color: var(--bad); font-size: .85rem; }
.m-add summary { cursor: pointer; color: var(--brand); font-size: .82rem; list-style: none; display: inline-block; }
.m-add summary::-webkit-details-marker { display: none; }
.m-add form { margin-top: .3rem; display: flex; gap: .25rem; }
.m-add select { font-size: .85rem; padding: .15rem .3rem; min-width: 8rem; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .88rem; color: var(--muted); margin: .7rem 0 0; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--surface); }
.cal .dow { font-size: .8rem; font-weight: 600; color: var(--muted); padding: .35rem .5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f8faf9; }
.cal .day { min-height: 6.4rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem .35rem; min-width: 0; }
.cal .day.out { background: #f5f7f6; }
.cal .day.out .dnum { color: #9aa6a2; }
.cal .dnum { font-size: .85rem; font-weight: 600; display: inline-block; min-width: 1.5rem; text-align: center; border-radius: 99px; }
.cal .day.today .dnum { background: var(--brand); color: #fff; }
.cal a.ev { display: block; font-size: .8rem; line-height: 1.25; padding: .12rem .35rem; margin-top: .15rem; border-radius: 4px; background: #dcebe5; color: var(--brand-dark); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal a.ev.plan { background: #e7e3f4; color: #3b2d73; }
.cal a.ev.pending { background: var(--warn-bg); color: var(--warn); }
.cal a.ev:hover { filter: brightness(.95); }
.cal-nav { display: flex; align-items: center; gap: .6rem; }
.cal-nav h2 { margin: 0; min-width: 11rem; text-align: center; }

/* ---------- Check-in station ---------- */
.station input[type=search] { font-size: 1.15rem; padding: .6rem .8rem; }
.count { font-size: 2.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  body.app { display: block; }
  .side { position: static; height: auto; padding: .6rem .7rem; }
  .side-top { display: flex; justify-content: space-between; align-items: center; }
  .side .org { padding-bottom: .2rem; }
  .navbtn { display: block; padding: .35rem .8rem; border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius); cursor: pointer; color: #fff; }
  .side nav, .side-foot { display: none; }
  .navtoggle:checked + .side nav, .navtoggle:checked + .side .side-foot { display: flex; flex-direction: column; margin-top: .6rem; }
  .main { padding: 1.1rem 1rem 3rem; }
  .cols, .cols.even, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); }
  .cal .day { min-height: 4.2rem; }
  .pos-row { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  dl.facts { grid-template-columns: 6.5rem 1fr; }
}
@media (max-width: 520px) { .grid2 { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 1.4rem; } }

/* ---------- Print: rosters and run sheets go on paper ---------- */
@media print {
  body.app { display: block; background: #fff; }
  .side, .actions, .filters, .flash, .no-print, .m-add, .assign, form.inline, .btn { display: none !important; }
  .main { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; }
  .matrix-wrap { max-height: none; overflow: visible; border: 0; }
  table.matrix thead th, table.matrix thead th.pos { position: static; background: #fff; color: #000; border-bottom: 2px solid #000; }
  table.matrix thead th a, table.matrix thead th small { color: #000; text-decoration: none; }
  table.matrix th.pos { position: static; }
  a { color: inherit; text-decoration: none; }
}

/* Buttons that look like links or badges shouldn't wrap or show a default border */
.linkbtn { white-space: nowrap; }
button.badge { border: 0; cursor: pointer; font-family: inherit; }

/* ---------- Version 2 ---------- */
.navcount { display: inline-block; min-width: 1.3rem; text-align: center; font-size: .75rem; font-weight: 700; background: #e3a21a; color: #1b1300; border-radius: 99px; padding: 0 .35rem; margin-left: .3rem; }

/* Workflow board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(14.5rem, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: .4rem; align-items: start; }
.lane { background: #e6ebe9; border-radius: var(--radius); padding: .7rem; min-height: 8rem; }
.lane h2 { font-size: .95rem; display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.lane h2 small { font-weight: 400; }
.lane-note { font-size: .85rem; margin: 0 0 .5rem; }
a.card { display: flex; flex-direction: column; gap: .15rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .65rem; margin-bottom: .5rem; text-decoration: none; color: inherit; font-size: .92rem; }
a.card:hover { border-color: var(--brand); }

/* Chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 11rem); min-height: 22rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem 1.2rem; }
.msg { margin-bottom: .9rem; max-width: 44rem; }
.msg-meta { font-size: .85rem; }
.msg-meta span { color: var(--muted); }
.msg-meta form { visibility: hidden; }
.msg:hover .msg-meta form, .msg:focus-within .msg-meta form { visibility: visible; }
.msg-body { background: #eef2f0; border-radius: 4px 12px 12px 12px; padding: .45rem .75rem; display: inline-block; overflow-wrap: anywhere; }
.msg.mine { margin-left: auto; text-align: right; }
.msg.mine .msg-body { background: #d3e8df; border-radius: 12px 4px 12px 12px; text-align: left; }
.chat-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { resize: none; }
ul.rooms li a { font-size: 1.02rem; }

/* Availability calendar and legend swatches */
.cal.avail .day { min-height: 4.4rem; }
.cal.avail .day.no { background: repeating-linear-gradient(135deg, #f3f4f4, #f3f4f4 6px, #e6e9e8 6px, #e6e9e8 12px); }
.cal.avail .day.away { background: var(--bad-bg); }
.cal a.ev.plan.mine { background: #3b2d73; color: #fff; font-weight: 600; }
.sw { display: inline-block; width: 1rem; height: .8rem; border-radius: 3px; border: 1px solid var(--line); background: #fff; }
.sw.no { background: repeating-linear-gradient(135deg, #f3f4f4, #f3f4f4 3px, #cfd5d3 3px, #cfd5d3 6px); }
.sw.away { background: var(--bad-bg); }
.sw.plan { background: #e7e3f4; }
.sw.mine { background: #3b2d73; }
.assign select, .m-add select { max-width: 100%; }
@media (max-width: 860px) { .chat { height: calc(100vh - 13rem); } }
@media print { .chat-form, .board + .cols { display: none; } }
