:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1c2330; --muted: #5d6878; --line: #dfe3ea;
  --accent: #5b2d90; --accent-text: #fff; --accent-soft: #efe8f7;
  --ok: #1d7a46; --ok-soft: #e3f4ea; --warn: #96600a; --warn-soft: #fdf1d8;
  --bad: #b3261e; --bad-soft: #fbe6e4; --info-soft: #e5eefb; --info: #1f55a5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --surface: #1d2129; --text: #e6e9ee; --muted: #9aa4b2; --line: #313743;
    --accent: #b48be6; --accent-text: #17111f; --accent-soft: #2c2340;
    --ok: #6fd39a; --ok-soft: #173224; --warn: #f0c060; --warn-soft: #3a2e12;
    --bad: #ff9088; --bad-soft: #401c19; --info-soft: #1a2a44; --info: #8fb8f5;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 10px 20px; }
header.top .brand { font-weight: 700; color: var(--text); margin-right: 8px; }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
header.top nav a { padding: 5px 10px; border-radius: 6px; color: var(--text); }
header.top nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
header.top .who { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 24px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; min-width: 130px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.plain { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; min-height: 1.6em; }
form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=search], input[type=number], input[type=password], input[type=file], input[type=date], input[type=email], textarea, select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 9px; max-width: 100%; }
button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: 6px; padding: 6px 14px; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn:hover { text-decoration: none; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
.row { margin-bottom: 12px; } .helptext { color: var(--muted); font-size: 12px; display: block; }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: 4px 0; font-size: 13px; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--info-soft); color: var(--info); }
.msg.success { background: var(--ok-soft); color: var(--ok); }
.msg.error { background: var(--bad-soft); color: var(--bad); }
.msg.warning { background: var(--warn-soft); color: var(--warn); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.cutoffs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.cutoffs input { width: 100%; }
details { border-top: 1px solid var(--line); padding: 8px 0; }
details.card { border: 1px solid var(--line); padding: 16px; } details summary { cursor: pointer; font-weight: 600; }
.pager { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.login { max-width: 360px; margin: 10vh auto; }
.choices { display: grid; gap: 8px; }
label.choice { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: 15px; margin: 0; cursor: pointer; }
label.choice input { margin-top: 4px; }
.small { font-size: 12px; }
main:has(.builder) { max-width: none; }
.builder { display: grid; grid-template-columns: minmax(230px, 280px) 1fr; gap: 14px; align-items: start; }
.builder .columns { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; }
.pool, .teamcol { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.pool { max-height: 82vh; overflow-y: auto; position: sticky; top: 8px; }
.teamcol { flex: 0 0 250px; }
.teamcol.locked { opacity: .75; }
.pool.over, .teamcol.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.summary { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.summary b { color: var(--text); } .summary .sep { flex-basis: 100%; height: 0; }
.pcard { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px;
  padding: 6px 8px; margin-bottom: 6px; background: var(--bg); }
.pcard[draggable=true] { cursor: grab; }
.pcard.friend-ok { border-left-color: var(--ok); } .pcard.friend-apart { border-left-color: var(--bad); }
.pcard .line { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.pcard .tags { justify-content: flex-start; flex-wrap: wrap; gap: 3px; margin: 3px 0; }
.pcard .badge { font-size: 11px; padding: 0 6px; }
.pcard select { width: 100%; font-size: 12px; padding: 2px 4px; }
#builder.busy { opacity: .6; pointer-events: none; }
@media (max-width: 760px) { .builder { grid-template-columns: 1fr; } .pool { position: static; max-height: 40vh; } }
input[type=time] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }
main:has(.week) { max-width: 1500px; }
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: start; }
.day h2 { border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.slotcard { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.slotcard.full { border-left-color: var(--line); } .slotcard.over { border-left-color: var(--bad); }
.slotcard.excluded { opacity: .55; border-left-color: var(--line); }
.slotcard .line { display: flex; justify-content: space-between; margin-bottom: 4px; }
.slotteam { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; padding: 3px 0; border-top: 1px dashed var(--line); }
.slotteam .small { display: block; }
.slotcard select { width: 100%; font-size: 12px; padding: 2px 4px; margin-top: 4px; }
.allocrow { display: grid; grid-template-columns: minmax(170px, 1.2fr) repeat(5, minmax(120px, 1fr)) auto; gap: 10px; align-items: end; padding: 12px; margin-bottom: 8px; }
.allocrow .who { align-self: center; } .allocrow select, .allocrow input { width: 100%; }
@media (max-width: 1100px) { .allocrow { grid-template-columns: 1fr 1fr; } }

/* checks, exports, public page */
details.check summary { cursor: pointer; }
ul.findings { margin: 8px 0 0; padding-left: 20px; }
ul.findings li { margin: 2px 0; }
.exportrow { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
.exportrow .what { flex: 1 1 260px; }
.exportrow select { min-width: 180px; }
main.public { max-width: 1100px; margin: 0 auto; }
ol.players { margin: 10px 0 0; padding-left: 22px; columns: 2; }

/* skill levels: one row of tick options per skill */
.levels { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.levels label { display: inline-flex; align-items: center; gap: 5px; margin: 0; cursor: pointer;
  color: var(--text); font-size: 15px; padding: 2px 8px; border: 1px solid var(--line);
  border-radius: 999px; }
.levels label:hover { border-color: var(--accent); }
.levels label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent);
  font-weight: 600; }
.levels label.none { color: var(--muted); font-size: 13px; margin-left: 4px; }
.levels input { margin: 0; accent-color: var(--accent); cursor: pointer; }

/* a cell of badges wraps onto more lines rather than widening its column */
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
