:root {
  --maroon: #8c1d40;
  --gold: #ffc627;
  --ink: #191919;
  --muted: #5c6670;
  --line: #d8dde2;
  --bg: #f4f6f8;
  --panel: #fff;
  --ok: #1c7c4a;
  --warn: #a35c00;
  --err: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.05rem; }
code { font: 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; background: #eceff2; padding: .1em .35em; border-radius: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.lead { color: var(--muted); margin: 0 0 1.5rem; max-width: 70ch; }
.push { margin-left: auto; }

/* ---------- top bar ---------- */
.topbar { background: var(--maroon); color: #fff; padding: 1rem 1.5rem .5rem; }
.brand { display: flex; align-items: center; gap: .9rem; max-width: 1200px; margin: 0 auto; }
.mark {
  background: var(--gold); color: var(--maroon); font-weight: 800; font-size: 1.1rem;
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; flex: none;
}
.topbar h1 { font-size: 1.15rem; }
.topbar p { margin: 0; font-size: .82rem; opacity: .8; }

.steps { display: flex; gap: .25rem; max-width: 1200px; margin: .9rem auto 0; overflow-x: auto; }
.nav-item {
  background: none; border: 0; border-bottom: 3px solid transparent; color: rgba(255,255,255,.65);
  font: inherit; font-size: .85rem; padding: .5rem .75rem; cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: .45rem;
}
.nav-item span {
  width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
}
.nav-item.current { color: #fff; border-bottom-color: var(--gold); }
.nav-item.current span { background: var(--gold); color: var(--maroon); }
.nav-item.done { color: rgba(255,255,255,.9); }
.nav-item.done span { background: rgba(255,255,255,.35); }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 5rem; }
.step { display: none; }
.step.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; margin: 1.25rem 0;
}
.row-panel { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.actions { display: flex; gap: .6rem; margin-top: 2rem; }

/* ---------- controls ---------- */
.btn {
  background: var(--maroon); color: #fff; border: 0; border-radius: 7px;
  padding: .6rem 1.15rem; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover:not(:disabled) { background: #6f1733; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #eceff2; }
.btn.small { padding: .4rem .8rem; font-size: .87rem; }
.file-btn { display: inline-block; }
.link { background: none; border: 0; color: var(--maroon); cursor: pointer; font: inherit; text-decoration: underline; }
.link.danger { color: var(--err); }

select, input[type=text] {
  font: inherit; padding: .5rem .65rem; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; color: var(--ink);
}
input[type=range] { width: 260px; accent-color: var(--maroon); vertical-align: middle; }
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }

.dropzone { display: block; cursor: pointer; }
.dropzone input { position: absolute; opacity: 0; width: 0; height: 0; }
.dz-inner {
  border: 2px dashed var(--line); border-radius: var(--radius); background: #fff;
  padding: 3rem 1rem; text-align: center; display: grid; gap: .3rem;
}
.dz-inner strong { font-size: 1.05rem; }
.dz-inner span { color: var(--muted); font-size: .9rem; }
.dropzone:hover .dz-inner { border-color: var(--maroon); background: #fdfbfc; }

.status { margin-top: 1rem; padding: .75rem 1rem; border-radius: 7px; font-size: .92rem; display: none; }
.status.working, .status.ok, .status.err { display: block; }
.status.working { background: #eef2f6; color: var(--muted); }
.status.ok { background: #e7f4ec; color: var(--ok); }
.status.err { background: #fdeceb; color: var(--err); }

/* ---------- camp cards ---------- */
.camp-list { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.camp-card { position: relative; cursor: pointer; }
.camp-card input { position: absolute; opacity: 0; }
.camp-body {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem; height: 100%;
}
.camp-card:hover .camp-body { border-color: #b9c1c9; }
.camp-card input:checked + .camp-body { border-color: var(--maroon); border-left-color: var(--maroon); background: #fdfbfc; }
.camp-card.live .camp-body { border-left-color: var(--gold); }
.camp-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .5rem; flex-wrap: wrap; }
.camp-name { font-weight: 700; font-size: 1.05rem; }
.camp-loc { color: var(--muted); font-size: .87rem; }
.badge { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .15rem .45rem; border-radius: 4px; }
.live-badge { background: var(--gold); color: #4a3600; }
.camp-stats { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-bottom: .55rem; }
.camp-stats strong { color: var(--ink); }
.camp-groups { display: flex; gap: .3rem; flex-wrap: wrap; }

.chip { font-size: .74rem; font-weight: 600; padding: .15rem .5rem; border-radius: 20px; background: #eceff2; color: var(--ink); white-space: nowrap; }
.chip.gold { background: #fff2cc; color: #6b5200; }
.chip.maroon { background: #f6dde5; color: var(--maroon); }
.chip.pitchfork { background: #dce9f7; color: #1c4f80; }
.chip.sparky { background: #dff0e6; color: #14603a; }

.radio-row { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }

/* ---------- roles ---------- */
.roles { display: grid; gap: .5rem; margin: 1.25rem 0 .8rem; }
.role-row {
  display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(130px, .8fr) auto auto;
  gap: .7rem; align-items: center; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: .55rem .8rem;
}
.role-label { color: var(--muted); font-size: .88rem; }
.role-types summary { cursor: pointer; font-size: .85rem; color: var(--maroon); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .35rem .9rem; margin-top: .6rem; }
.type-grid label { display: flex; align-items: center; gap: .4rem; font-size: .88rem; cursor: pointer; }

/* ---------- tables ---------- */
.scroll-x { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: .87rem; margin-top: .8rem; }
table.data th, table.data td { border: 1px solid var(--line); padding: .4rem .55rem; text-align: left; vertical-align: top; }
table.data th { background: #eef1f4; font-weight: 600; font-size: .8rem; white-space: nowrap; }
table.data tbody tr:nth-child(even) { background: #fafbfc; }
table.data td.c, table.data th.c { text-align: center; }
td.detail { max-width: 380px; }
.up { color: var(--ok); font-weight: 600; }
.down { color: var(--err); font-weight: 600; }

.bar { background: #eceff2; border-radius: 3px; height: 9px; min-width: 90px; }
.bar span { display: block; height: 100%; background: var(--maroon); border-radius: 3px; }

/* ---------- summary cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin: 1rem 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.card-n { font-size: 1.9rem; font-weight: 700; line-height: 1; }
.card-n.good { color: var(--ok); }
.card-n.bad { color: var(--err); }
.card-l { font-size: .78rem; color: var(--muted); margin-top: .3rem; line-height: 1.3; }

.all-good { background: #e7f4ec; border: 1px solid #b7dfc7; color: var(--ok); padding: 1rem 1.2rem; border-radius: var(--radius); font-weight: 600; margin-top: 1rem; }

/* ---------- issues ---------- */
.issue { border-radius: 8px; padding: .8rem 1rem; margin: .6rem 0; border-left: 4px solid; }
.issue.block { background: #fdeceb; border-color: var(--err); }
.issue.warn { background: #fdf4e3; border-color: var(--warn); }
.issue-title { font-weight: 700; font-size: .92rem; }
.issue.block .issue-title { color: var(--err); }
.issue.warn .issue-title { color: var(--warn); }
.issue-detail { font-size: .88rem; margin-top: .2rem; }
.issue-items { margin: .5rem 0 0; padding-left: 1.2rem; font-size: .84rem; columns: 2; }
.ack { background: #fdeceb; border-color: #f2b8b5; }
.tolerance label { font-weight: 600; display: block; margin-bottom: .4rem; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(150%);
  background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: 8px;
  font-size: .9rem; transition: transform .22s ease; z-index: 99; max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }

/* preview is hidden on screen inside a scrolling frame, shown fully when printing */
#preview-wrap { max-width: 1200px; margin: 0 auto 4rem; padding: 0 1.5rem; }
#print-area { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; overflow-x: auto; }
#print-area .page { border-bottom: 1px dashed var(--line); padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
#print-area .page:last-child { border-bottom: 0; }

/* ---------- sign-in gate ---------- */
.gate {
  position: fixed; inset: 0; background: var(--maroon);
  display: grid; place-items: center; padding: 1.5rem; z-index: 200;
}
.gate-card {
  background: #fff; border-radius: 14px; padding: 2.5rem 2.25rem;
  max-width: 460px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.gate-card .mark { margin: 0 auto .9rem; }
.gate-card h1 { font-size: 1.4rem; }
.gate-card p { color: var(--muted); margin: .6rem 0 1.2rem; }
.gate-card .gate-err { color: var(--err); font-weight: 600; }
.gate-note { font-size: .82rem; line-height: 1.45; margin-top: 1.3rem !important; }

.user-chip { margin-left: auto; display: flex; align-items: center; gap: .7rem; font-size: .85rem; }
#user-name { opacity: .9; }
.user-chip .link { color: var(--gold); font-size: .82rem; }

/* ---------- camp configuration ---------- */
.pick-grid { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.pick {
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; background: #fff;
}
.pick.on { border-color: var(--maroon); background: #fdfbfc; }
.pick-n { font-size: .82rem; color: var(--muted); }
.thin-badge { background: #fdf4e3; color: var(--warn); }
tr.thin { background: #fffaf0 !important; }

/* ---------- review ---------- */
.review-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 1rem; }
.review-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; }
.review-block h3 { font-size: .98rem; }
.review-block table.data { margin-top: .5rem; }
tr.grand td { font-weight: 700; background: #eef1f4 !important; border-top: 2px solid var(--ink); }
.group-badge { background: #f6dde5; color: var(--maroon); }
.room-badge { background: #dce9f7; color: #1c4f80; }

/* ---------- room set picker ---------- */
.roomset-list { display: grid; gap: .7rem; margin-top: .8rem; }
.roomset { display: grid; grid-template-columns: minmax(110px, 160px) 1fr; gap: .8rem; align-items: center; }
.roomset-name { font-weight: 700; }
.roomset-opts { display: flex; gap: .5rem; flex-wrap: wrap; }
.roomset-opts .pick { align-items: flex-start; gap: .55rem; }
.roomset-opts .pick strong { display: block; font-size: .9rem; }
.roomset-opts .pick-n { display: block; font-size: .78rem; }
.default-badge { background: #e7f4ec; color: var(--ok); align-self: center; }

/* ---------- balance summary ---------- */
.summary { border-left: 4px solid var(--maroon); }
.summary-list { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .35rem; }
.summary-list li { display: grid; grid-template-columns: 20px 1fr; gap: .5rem; align-items: baseline; font-size: .93rem; }
.s-icon { font-weight: 700; text-align: center; }
.s-change .s-icon { color: var(--maroon); }
.s-info .s-icon { color: var(--muted); }
.s-watch .s-icon { color: var(--warn); }
.s-watch { color: var(--warn); }
.summary-more { margin-top: .9rem; }
.summary-more summary { cursor: pointer; font-size: .88rem; color: var(--muted); }
.marker-note { margin-top: .8rem; padding: .6rem .8rem; background: #fdf4e3; border-radius: 7px; font-size: .88rem; }
.even-c2 { margin-top: .6rem; }
#sr-bar { align-items: center; }
#sr-status.s-watch { color: var(--warn); }

/* ---------- TLDR balance summary (D-79) ---------- */
.tldr { border-left: 4px solid var(--maroon); }
.tldr-head { display: flex; align-items: center; gap: 1rem; }
.tldr-n { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--maroon); min-width: 2ch; text-align: right; }
.tldr-n.good { color: var(--ok); }
.tldr-label { font-size: 1rem; line-height: 1.35; }
.tldr-status { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .4rem; }
.tldr-status li { display: grid; grid-template-columns: 22px 1fr; gap: .5rem; align-items: baseline; font-size: 1rem; }
.tldr-status li span { font-weight: 800; text-align: center; }
.tldr-status li.ok span { color: var(--ok); }
.tldr-status li.bad { color: var(--err); font-weight: 600; }
.tldr-status li.bad span { color: var(--err); }
.tldr-more { margin-top: 1rem; }
.tldr-more summary { cursor: pointer; font-size: .87rem; color: var(--muted); }
.tldr-detail { margin: .6rem 0 0; padding-left: 1.1rem; font-size: .88rem; color: var(--muted); display: grid; gap: .25rem; }
.pick.empty { border-style: dashed; }
.pick.empty .pick-n { font-style: italic; }
tr.subhead th { font-size: .72rem; font-weight: 600; color: var(--muted); background: #f4f6f8; }
td.was { color: var(--muted); text-decoration: line-through; }
td.now { font-weight: 600; }
.same { color: var(--muted); font-style: italic; font-size: .85em; }

/* ---------- manual moves (D-100) ---------- */
table.manual select { font-size: .84rem; padding: .2rem .35rem; max-width: 210px; }
tr.hand-moved { background: #fff8e6 !important; }
tr.hand-moved td:first-child::after { content: ' · moved by hand'; font-size: .74rem; color: var(--warn); font-weight: 600; }
#manual-count { font-size: .87rem; }

/* Hand-move editor is collapsed by default (D-102) — it is a long table and most runs
   never need it. */
.manual-box { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; margin: 18px 0; }
.manual-box > summary { cursor: pointer; padding: 12px 0; display: flex; align-items: baseline; gap: 10px; list-style: none; }
.manual-box > summary::-webkit-details-marker { display: none; }
.manual-box > summary::before { content: '▸'; color: var(--muted); }
.manual-box[open] > summary::before { content: '▾'; }
.manual-box > summary h3 { margin: 0; display: inline; }
.manual-box[open] { padding-bottom: 14px; }
tr.hand-flagged td:first-child::after { content: ' · moved by hand — check'; color: #8a5a00; font-size: 11px; }
