:root {
  color-scheme: light;
  --ink: #0B0D12; --ink-2: #2A2F3A; --slate: #5F6675; --line: #DCE0E8; --chalk: #F2F4F8; --paper: #fff;
  --blue: #0E4DD4; --blue-deep: #0A3AA3; --blue-tint: #E8EEFC;
  --gold: #F5B921; --gold-tint: #FFF6DC;
  --green: #1B8A4C; --green-tint: #E6F5EC; --red: #D12E2E; --red-tint: #FDECEC; --amber: #B26A00; --amber-tint: #FFF1D6;
  --display: "Agdasima", "Arial Narrow", Impact, sans-serif;
  --body: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --side: 232px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--chalk); color: var(--ink); font: 14px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; text-transform: uppercase; line-height: 1; }
h1 { font-size: 40px; font-style: italic; letter-spacing: .01em; }
h2 { font-size: 24px; letter-spacing: .03em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 20px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid #23262E; margin-bottom: 10px; }
.side .brand img { width: 38px; height: auto; }
.side .brand b { font-family: var(--display); font-size: 22px; font-style: italic; text-transform: uppercase; line-height: 1; display: block; }
.side .brand small { font-family: var(--display); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #C9CFDA; font-weight: 500; }
.side a.nav:hover { background: #171A22; text-decoration: none; color: #fff; }
.side a.nav.on { background: var(--blue); color: #fff; }
.side a.nav svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; flex: none; }
.side .sep { margin: 10px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #6B7280; }
.side .foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid #23262E; font-size: 12px; color: #6B7280; }
.side .foot a { color: #9AA1B0; }
.topbar { display: none; }
main { padding: 26px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--slate); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 9px; border: 1.5px solid var(--ink); background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: #23262E; }
.btn.primary { background: var(--blue); border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-deep); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #fff; border-color: var(--ink); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--line); }
.btn.danger:hover { background: var(--red-tint); border-color: var(--red); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; fill: none; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; height: 40px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; padding: 0 12px; font-size: 15px;
}
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235F6675' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
label.lbl, .lbl { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; height: 40px; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { width: 260px; }
.filters select { width: auto; min-width: 140px; }
.filters .btn { height: 40px; }

/* ---------- cards / tables ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.card .hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card .hd h2 { font-size: 20px; }
.card .bd { padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: block; color: inherit; }
.stat:hover { text-decoration: none; border-color: var(--blue); }
.stat small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); }
.stat b { display: block; font-family: var(--display); font-size: 40px; line-height: 1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.warn { background: var(--gold-tint); border-color: #F1D68C; }
.stat.bad b { color: var(--red); }
.tbl-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl th { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); background: #FAFBFD; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #FAFBFD; }
.tbl td.muted, .muted { color: var(--slate); }
.tbl .name { font-weight: 600; display: block; }
.tbl .sub { display: block; font-size: 12px; color: var(--slate); }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.ck { width: 34px; }
.tbl input.jersey { width: 64px; height: 32px; text-align: center; font-weight: 600; padding: 0 6px; }
.empty { padding: 40px; text-align: center; color: var(--slate); }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.3; background: #EEF0F4; color: var(--ink-2); }
.pill.paid { background: var(--green-tint); color: var(--green); }
.pill.past_due { background: var(--red-tint); color: var(--red); }
.pill.due_soon { background: var(--amber-tint); color: var(--amber); }
.pill.eval { background: var(--blue-tint); color: var(--blue); }
.pill.muted { background: #F1F2F5; color: #8A91A0; font-weight: 500; }
.pill.st-active { background: var(--green-tint); color: var(--green); }
.pill.st-lead { background: var(--blue-tint); color: var(--blue); }
.pill.st-inactive { background: #F1F2F5; color: #8A91A0; }
.pill.team { background: var(--ink); color: #fff; }
.pill.nt { background: var(--gold); color: var(--ink); font-family: var(--display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.pill.F { background: #FCE7F1; color: #B0286E; } .pill.M { background: var(--blue-tint); color: var(--blue); }
.pill.sg-new { background: #EEF0F4; color: var(--ink-2); }
.pill.sg-contacted { background: var(--blue-tint); color: var(--blue); }
.pill.sg-evaluated { background: #EDE7FA; color: #5B33B8; }
.pill.sg-offered { background: var(--amber-tint); color: var(--amber); }
.pill.sg-enrolled { background: var(--green-tint); color: var(--green); }
.pill.sg-rostered { background: var(--ink); color: #fff; }

/* ---------- pipeline board ---------- */
.stagebar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 22px; }
.stagebar a { display: block; padding: 10px 12px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); color: inherit; }
.stagebar a:hover { text-decoration: none; border-color: var(--blue); }
.stagebar small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); }
.stagebar b { font-family: var(--display); font-size: 30px; line-height: 1; display: block; margin-top: 2px; font-variant-numeric: tabular-nums; }
.board { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #E9ECF2; border-radius: 12px; padding: 10px; min-height: 120px; }
.col .ch { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 10px; }
.col .ch b { font-family: var(--display); font-size: 20px; text-transform: uppercase; letter-spacing: .03em; }
.col .ch span { font-family: var(--display); font-size: 18px; color: var(--slate); font-variant-numeric: tabular-nums; }
.col .ch small { display: block; font-size: 11px; color: var(--slate); font-family: var(--body); font-weight: 400; text-transform: none; letter-spacing: 0; }
.cardp { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.cardp.stale { border-left: 3px solid var(--gold); }
.cardp .n { font-weight: 600; display: block; }
.cardp .m { font-size: 12px; color: var(--slate); display: block; margin-top: 2px; }
.cardp .f { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.cardp select { height: 30px; font-size: 12px; padding: 0 26px 0 8px; border-radius: 7px; background-position: right 6px center; width: auto; max-width: 100%; }
.cardp .age { font-size: 11px; color: var(--slate); white-space: nowrap; }
.cardp .age.hot { color: var(--amber); font-weight: 700; }
.stagebtns { display: flex; flex-wrap: wrap; gap: 6px; }
.stagebtns button { height: 32px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; font-weight: 600; font-size: 13px; cursor: pointer; }
.stagebtns button:hover { border-color: var(--ink); }
.stagebtns button.cur { background: var(--ink); color: #fff; border-color: var(--ink); cursor: default; }
.stagebtns button.done { background: #EEF0F4; color: var(--slate); }
@media (max-width: 900px) { .stagebar { grid-template-columns: repeat(3, 1fr); } .board { grid-template-columns: repeat(6, 240px); } }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; background: var(--green-tint); color: var(--green); }
.flash.err { background: var(--red-tint); color: var(--red); }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--slate); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding-top: 2px; }
.kv dd { margin: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue-tint); color: var(--blue); display: inline-grid; place-items: center; font-family: var(--display); font-size: 17px; font-weight: 700; flex: none; }
.rowflex { display: flex; align-items: center; gap: 12px; }
.bulk { display: none; align-items: center; gap: 10px; padding: 10px 14px; background: var(--blue-tint); border: 1px solid #C7D5F8; border-radius: 10px; margin-bottom: 12px; }
.bulk.show { display: flex; }
.bulk select { width: auto; height: 34px; }
.login { max-width: 380px; margin: 60px auto; }
.login .card .bd { padding: 26px; }
.hint { font-size: 12px; color: var(--slate); margin-top: 6px; }
.import-src { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.import-src:last-child { border-bottom: 0; }
.import-src b { display: block; font-size: 15px; }
.import-src p { margin: 4px 0 0; color: var(--slate); }

.mailframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 8px; background: #F2F4F8; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #EEF0F4; padding: 1px 5px; border-radius: 4px; }

/* ---------- print roster ---------- */
.print-page { max-width: 820px; margin: 0 auto; padding: 32px; background: #fff; }
.print-page .ph { display: flex; align-items: center; gap: 16px; border-bottom: 4px solid var(--blue); padding-bottom: 14px; margin-bottom: 18px; }
.print-page .ph img { width: 56px; }
.print-page h1 { font-size: 36px; }

/* Grid children must be allowed to shrink, or a wide table pushes the whole page sideways. */
.shell > *, main, .card, .two > *, .stack > *, .tbl-wrap, .form-grid > * { min-width: 0; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; gap: 4px; background: var(--ink); color: #fff; padding: 8px 10px; position: sticky; top: 0; z-index: 5; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar img { width: 30px; margin-right: 6px; flex: none; }
  .topbar a { color: #C9CFDA; font-weight: 600; white-space: nowrap; padding: 8px 10px; border-radius: 6px; font-size: 14px; flex: none; }
  .topbar a.on { background: var(--blue); color: #fff; }
  .topbar a.out { margin-left: auto; color: #8A91A0; font-weight: 500; }
  main { padding: 16px 14px 60px; }
  h1 { font-size: 32px; }
  .page-head { margin-bottom: 14px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }
  .two { grid-template-columns: 1fr; }
  input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea { font-size: 16px; } /* stops iOS zoom */
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters input[type=search] { grid-column: 1 / -1; width: 100%; }
  .filters select { width: 100%; min-width: 0; }
  .filters .btn { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat b { font-size: 32px; }
  .bulk { flex-wrap: wrap; }
  .bulk select { flex: 1 1 140px; }
  .kv { grid-template-columns: 96px 1fr; }
  .mailframe { height: 420px; }
  .board { scroll-snap-type: x mandatory; grid-template-columns: repeat(6, 82vw); gap: 10px; }
  .form-grid[style] { grid-template-columns: 1fr !important; }
  .col { scroll-snap-align: start; }
}

/* ---------- stacked tables on phones (JS adds data-l labels from the header row) ---------- */
@media (max-width: 700px) {
  .tbl[data-stack] thead { display: none; }
  .tbl[data-stack] tr { display: block; position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tbl[data-stack] tr:last-child { border-bottom: 0; }
  .tbl[data-stack] tbody tr:hover td { background: transparent; }
  .tbl[data-stack] td { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; border: 0; white-space: normal; text-align: left; }
  .tbl[data-stack] td.r { text-align: left; }
  .tbl[data-stack] td::before { content: attr(data-l); flex: 0 0 100px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); padding-top: 3px; }
  .tbl[data-stack] td:not([data-l])::before, .tbl[data-stack] td[data-l=""]::before { display: none; }
  .tbl[data-stack] td[data-primary] { display: block; font-size: 16px; padding-bottom: 6px; }
  .tbl[data-stack] td[data-primary]::before { display: none; }
  .tbl[data-stack] td.ck { position: absolute; right: 14px; top: 12px; width: auto; padding: 0; }
  .tbl[data-stack] td.ck input { width: 22px; height: 22px; }
  .tbl[data-stack] td:empty { display: none; }
  .tbl[data-stack] .sub { display: inline; margin-left: 6px; }
  .tbl[data-stack] td[data-primary] .sub { display: block; margin-left: 0; }
  .tbl[data-stack] td[data-act] { justify-content: flex-start; gap: 8px; padding-top: 8px; }
  .tbl[data-stack] td[data-act]::before { display: none; }
  .tbl[data-stack] input.jersey { width: 72px; }
  .tbl:not([data-stack]) td, .tbl:not([data-stack]) th { white-space: normal; }
}
@media print {
  .side, .topbar, .actions, .flash { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  body { background: #fff; }
}
