/* Shared design system for every page in /register.
   One file so the parent flow, the leader dashboard and the staff dashboard
   cannot drift apart visually. */

/* Palette from the ImpACT brand: navy #14213D and orange #F7941D. Rendered
   dark, because this is a working tool people sit in front of for an hour at a
   time, and because the navy is deep enough to be a background rather than an
   accent. The logo files are not in the repo yet — when they land, they go in
   register/img/ and only the header markup changes. */
:root {
  color-scheme: dark;
  --bg: #0b1120; --panel: #131c30; --line: #24304a; --sunk: #0a0f1c;
  --ink: #e8ecf6; --dim: #93a0bb; --accent: #F7941D; --navy: #14213D;
  --good: #3fb950; --warn: #d29922; --bad: #f85149;
  --radius: 11px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Layout ------------------------------------------------------------------ */
.wrap { max-width: 40rem; margin: 0 auto; padding: 2rem 1.1rem 5rem; }
.wrap--wide { max-width: 76rem; }
/* Bars are layout only. Stickiness comes from wrapping them in .stickytop.

   The leader portal has two bars — the header and the tab strip — and pinning
   the second with a hand-guessed `top: 3.1rem` meant it sat *on top of* the
   first whenever the header grew past that: a narrow window, or a signed-in
   email long enough to wrap. One sticky container holding both keeps them
   stacked at any height, with no magic number to get wrong. */
.bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.stickytop { position: sticky; top: 0; z-index: 5; background: var(--bg); }
.stickytop .bar:last-child { border-bottom: 1px solid var(--line); }
.stickytop .bar:not(:last-child) { border-bottom: 1px solid var(--line); }
.bar h1 { font-size: 1rem; margin: 0; font-weight: 600; }
.bar .spacer { flex: 1; }
header.centred { text-align: center; margin-bottom: 2rem; }
header.centred h1 { font-size: 1.3rem; margin: 0 0 .2rem; letter-spacing: -.01em; }
header.centred p { margin: 0; color: var(--dim); font-size: .92rem; }
main { max-width: 76rem; margin: 0 auto; padding: 1.5rem 1.25rem 5rem; }

h2 { font-size: 1.05rem; margin: 1.8rem 0 .5rem; font-weight: 600; }
h2:first-child { margin-top: 0; }
.sub, p.hint { color: var(--dim); font-size: .89rem; margin: .1rem 0 1rem; }
.muted { color: var(--dim); }
.bad { color: var(--bad); } .good { color: var(--good); } .warn { color: var(--warn); }

.card, .panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
@media (min-width: 60rem) { .grid--2 { grid-template-columns: 1fr 1fr; } }

/* Stats ------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.stat b { display: block; font-size: 1.35rem; font-weight: 600; letter-spacing: -.02em; }
.stat span { color: var(--dim); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

/* Forms ------------------------------------------------------------------- */
label { display: block; margin: .7rem 0 .2rem; font-size: .82rem; color: var(--dim); }
input, select, textarea {
  width: 100%; padding: .55rem .65rem; background: var(--sunk); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
textarea { min-height: 4.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
@media (max-width: 30rem) { .two { grid-template-columns: 1fr; } }

button {
  padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: #212734; color: var(--ink); font: inherit; cursor: pointer;
}
button:hover { background: #2a3140; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--navy); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.wide { width: 100%; }
button.small { padding: .28rem .55rem; font-size: .82rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: .55rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }

/* Tables ------------------------------------------------------------------ */
table { width: 100%; border-collapse: collapse; font-size: .89rem; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 500; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable:hover { background: #1b2029; cursor: pointer; }
tr.due td { color: var(--warn); }
.table-wrap { overflow-x: auto; }

/* Bits -------------------------------------------------------------------- */
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .71rem; border: 1px solid var(--line); }
.pill--open, .pill--active, .pill--paid { color: var(--good); border-color: #1c4227; }
.pill--draft { color: var(--dim); }
.pill--closed, .pill--scheduled { color: var(--warn); border-color: #4a3a12; }
.pill--cancelled { color: var(--bad); border-color: #4a1c19; }

.note {
  background: #23200f; border: 1px solid #4a3a12; color: #e8d9a8;
  border-radius: 8px; padding: .7rem .85rem; font-size: .85rem; margin: .8rem 0;
}
.note--info { background: #0f1d2b; border-color: #1d3a55; color: #bcd8f2; }
.err { color: var(--bad); font-size: .87rem; margin-top: .55rem; }
.total { display: flex; justify-content: space-between; align-items: baseline;
         padding: .85rem 0 .2rem; border-top: 1px solid var(--line); margin-top: .5rem; }
.total b { font-size: 1.35rem; letter-spacing: -.02em; }
code { background: var(--sunk); padding: .1em .4em; border-radius: 4px; font-size: .92em; }

.steps { display: flex; gap: .35rem; margin-bottom: 1.2rem; }
.steps i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--accent); }

/* Occupancy picker — the price is the decision, so it is the loudest thing */
.occ { display: grid; gap: .5rem; margin-top: .3rem; }
.occ label {
  display: flex; align-items: center; gap: .7rem; margin: 0;
  border: 1px solid var(--line); border-radius: 9px; padding: .75rem .85rem;
  cursor: pointer; color: var(--ink); font-size: .94rem;
}
.occ label:has(input:checked) { border-color: var(--accent); background: #16233150; }
.occ input { width: auto; margin: 0; accent-color: var(--accent); }
.occ .price { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.occ small { display: block; color: var(--dim); font-size: .77rem; }

.waiver {
  max-height: 15rem; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 8px; padding: .9rem; background: var(--sunk); font-size: .87rem;
}
.waiver h2 { font-size: .95rem; margin-top: .6rem; }

/* Rooming ----------------------------------------------------------------- */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .75rem; }
.room { border: 1px solid var(--line); border-radius: 9px; padding: .7rem .8rem; background: var(--sunk); }
.room h3 { margin: 0 0 .1rem; font-size: .92rem; }
.room .cap { color: var(--dim); font-size: .76rem; }
.room ul { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .25rem; }
.room li { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.room li .x { margin-left: auto; }
.room.over { border-color: var(--bad); }

/* Toasts ------------------------------------------------------------------ */
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 20; }
.toast { background: #212734; border: 1px solid var(--line); border-left: 3px solid var(--accent);
         padding: .6rem .9rem; border-radius: 8px; max-width: 28rem; transition: opacity .5s; font-size: .88rem; }
.toast--error { border-left-color: var(--bad); }
.toast--ok { border-left-color: var(--good); }
.toast--out { opacity: 0; }

/* Branding -----------------------------------------------------------------
   The lockup, and the typographic fallback used until register/img/ has the
   real files. Both occupy the same space, so nothing reflows when the real
   artwork lands. */
.brand { display: inline-flex; align-items: baseline; gap: .55rem; line-height: 1; }
.brand__img { height: 1.9rem; width: auto; display: block; }
.brand--compact .brand__img { height: 1.5rem; }
.brand__name {
  font-weight: 700; letter-spacing: -.02em; font-size: 1.35rem; color: var(--ink);
}
.brand__name::first-letter { color: var(--ink); }
.brand__rule {
  color: var(--accent); font-size: .62rem; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; white-space: nowrap;
}
.bar .brand { margin-right: .3rem; }
.bar .brand__name { font-size: 1rem; }
header.centred .brand, header:not(.bar) .brand { justify-content: center; }

/* Checklists --------------------------------------------------------------
   The staged-requirements list from db/015. Four states, and the visual weight
   is deliberately ordered: overdue shouts, upcoming whispers. A parent
   registering fourteen months out should be able to see at a glance that the
   greyed-out rows are not their problem yet. */
.check { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .45rem; }
.check li {
  display: flex; align-items: flex-start; gap: .65rem;
  border: 1px solid var(--line); border-radius: 9px;
  padding: .65rem .8rem; background: var(--sunk);
}
.check li .mark { flex: none; width: 1.15rem; text-align: center; font-size: .95rem; }
.check li .what { flex: 1; min-width: 0; }
.check li .what b { display: block; font-weight: 500; font-size: .92rem; }
.check li .what small { color: var(--dim); font-size: .79rem; display: block; margin-top: .12rem; }
.check li.is-complete { opacity: .62; }
.check li.is-complete .mark { color: var(--good); }
.check li.is-overdue { border-color: #4a1c19; background: #1c1012; }
.check li.is-overdue .mark { color: var(--bad); }
.check li.is-due .mark { color: var(--warn); }
.check li.is-upcoming { opacity: .45; }
.check li .go { flex: none; align-self: center; }

/* Drag-and-drop boards ----------------------------------------------------
   Used for chaperone groups. Dragging is the fast path; every action is also
   reachable by clicking, because drag-and-drop is unusable on a phone and a
   group leader is frequently on one. */
.dnd { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .75rem; }
.bin {
  border: 1px solid var(--line); border-radius: 9px; background: var(--sunk);
  padding: .7rem .8rem; min-height: 6rem; transition: border-color .12s, background .12s;
}
.bin.over { border-color: var(--accent); background: #1a2438; }
.bin h3 { margin: 0; font-size: .92rem; display: flex; align-items: center; gap: .4rem; }
.bin h3 .count { color: var(--dim); font-size: .76rem; font-weight: 400; margin-left: auto; }
.bin .lead { color: var(--accent); font-size: .78rem; margin: .15rem 0 .4rem; }
.bin ul { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .3rem; }
.chip {
  display: flex; align-items: center; gap: .4rem; font-size: .85rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: .3rem .5rem; cursor: grab;
}
.chip:active { cursor: grabbing; }
.chip.dragging { opacity: .4; }
.chip .tag { font-size: .68rem; color: var(--dim); }
.chip .x { margin-left: auto; }

/* Adults are gold, everywhere they appear. A leader glancing at a board of
   forty names has to be able to see who the grown-ups are without reading, and
   the same colour is used for the chaperone leading a group, an adult waiting
   to be given one, and an adult sitting inside somebody else's group — which
   is a thing worth noticing. */
.chip--adult {
  border-color: var(--accent); color: var(--accent);
  background: #F7941D14;
}
.chip--adult .tag { color: var(--accent); opacity: .85; }
.bin--led { border-color: #3d3218; }
.bin--led h3 { color: var(--accent); }
.bin .lead { color: var(--accent); font-size: .78rem; margin: .15rem 0 .4rem; font-weight: 500; }
.bin .lead--none { color: var(--warn); font-weight: 400; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--dim); margin-top: .5rem; }
.legend b { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .35rem; }

/* Document list ----------------------------------------------------------- */
.docs { display: grid; gap: .5rem; margin-top: .5rem; }
.doc {
  display: flex; align-items: center; gap: .7rem;
  border: 1px solid var(--line); border-radius: 9px; padding: .7rem .85rem;
  background: var(--sunk);
}
.doc .who { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
            color: var(--dim); border: 1px solid var(--line);
            border-radius: 999px; padding: .05rem .45rem; }
.doc.signed { opacity: .6; }
.doc .t { flex: 1; min-width: 0; }
.doc .t b { display: block; font-weight: 500; font-size: .92rem; }
.doc .t small { color: var(--dim); font-size: .78rem; }

/* Toasts raised while a modal is open live inside it — see toast() in app.js.
   A modal renders in the top layer, so anything appended to #toasts is drawn
   behind the backdrop and never seen. */
.toasts--modal {
  position: sticky; bottom: -1.25rem; margin: .9rem -1.25rem -1.25rem;
  padding: .75rem 1.25rem; display: grid; gap: .5rem;
  background: linear-gradient(to bottom, transparent, var(--panel) 35%);
}
.toasts--modal .toast { max-width: none; }

.gate { max-width: 24rem; margin: 5rem auto; text-align: center; }
dialog {
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem; max-width: 46rem; width: 92%;
}
dialog::backdrop { background: rgba(0,0,0,.62); }
