/* =====================================================
   AZSSA Program OS — Reports screen (console + phone)
   =====================================================
   One question per tab, every number opens its names. Mounted by
   /assets/reports-view.js into the console's Reports view and into
   /app/admin-reports on a phone. Uses style.css tokens; flat (no shadows),
   white = information, the blue band = the one thing to act on.
   Chart colours are validated for colour-blind separation
   (docs/design/reports-redesign.html).
   ===================================================== */

.rp {
  --rp-do: #eef2fb; --rp-do-line: #d9e1f2;
  --rp-sat: #3b5bdb; --rp-wk: #0891b2; --rp-camp: #fb923c; --rp-league: #9333ea;
  --rp-mem: #15803d; --rp-pack: #3b5bdb; --rp-prog: #fb923c; --rp-other: #94a3b8;
  --rp-tint: #eef2ff; --rp-mute: #cbd5e1; --rp-amber: #b45309; --rp-red: #dc2626;
  display: flex; flex-direction: column; gap: 16px; color: var(--text-1);
}
.rp button { font-family: inherit; }
.rp :focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* range row */
.rp-range { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rp-chip { font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--white); border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; white-space: nowrap; cursor: pointer; }
.rp-chip:hover { color: var(--text-1); border-color: #cbd5e1; }
.rp-chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.rp-dates { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
.rp-dates input { font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--white); color: var(--text-1); }
.rp-stamp { font-size: 12.5px; color: var(--text-3); }
.rp-sp { flex: 1; }
.rp-btn { font-size: 13px; font-weight: 600; border-radius: 8px; padding: 6px 12px; white-space: nowrap; cursor: pointer; background: var(--white); color: var(--navy); border: 1px solid var(--border); }
.rp-btn:hover { border-color: #cbd5e1; }
.rp-btn.is-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.rp-btn[disabled] { opacity: .5; cursor: default; }

/* tabs */
.rp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rp-tab { font-size: 14px; font-weight: 600; color: var(--text-2); background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px 9px; cursor: pointer; white-space: nowrap; }
.rp-tab:hover { color: var(--text-1); }
.rp-tab[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--navy); }
.rp-pane { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rp-loading { color: var(--text-3); font-size: 13px; padding: 24px 0; }
.rp-error { color: var(--text-2); font-size: 14px; padding: 16px 0; }

/* the one band: attendance not taken */
.rp-guard { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--rp-do); border-radius: 12px; padding: 12px 16px; }
.rp-guard b { font-weight: 650; }
.rp-guard span { color: var(--text-2); }
.rp-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--rp-amber); display: inline-block; flex: none; }
.rp-dot.red { background: var(--rp-red); } .rp-dot.gray { background: var(--text-3); }

.rp-read { font-size: 15.5px; color: var(--text-2); max-width: 88ch; margin: 0; line-height: 1.5; }
.rp-read b { color: var(--text-1); font-weight: 650; }

/* tiles */
.rp-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rp-tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rp-tile { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rp-tile .v { font-size: 28px; font-weight: 800; line-height: 1.05; color: var(--navy); letter-spacing: -.01em; }
.rp-tile .v.thin { color: var(--text-3); font-size: 21px; font-weight: 700; }
.rp-tile .l { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.rp-tile .c { font-size: 12.5px; color: var(--text-2); }
.rp-tile .d { font-size: 12px; color: var(--text-3); }
.rp-tile .d b { font-weight: 700; }
.rp-tile .d b.up { color: #15803d; } .rp-tile .d b.down { color: var(--rp-red); }
.rp-tile .top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.rp-tile svg.spark { width: 96px; height: 30px; flex: none; }
.rp-tile .rp-link { align-self: flex-start; margin-top: auto; padding-top: 6px; }
.rp-link { font-size: 12.5px; font-weight: 600; color: var(--navy); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.rp-link:hover { text-decoration: underline; }

/* cards */
.rp-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.rp-card h3 { font-size: 15px; font-weight: 700; margin: 0 0 2px; color: var(--text-1); }
.rp-card .q { font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.rp-card .foot { font-size: 12.5px; color: var(--text-3); margin: 10px 0 0; }
.rp-card .foot b { color: var(--text-2); }
.rp-card p.say { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.rp-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; }
.rp-grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* watch list */
.rp-watch-i { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); align-items: baseline; }
.rp-watch-i:last-child { border-bottom: 0; }
.rp-watch-i b { font-weight: 650; display: block; }
.rp-watch-i span { font-size: 13px; color: var(--text-2); }

/* charts */
.rp-chart { width: 100%; height: auto; display: block; overflow: visible; }
.rp-chart text { font-family: inherit; fill: var(--text-2); font-size: 11px; }
.rp-chart .ax { fill: var(--text-3); }
.rp-chart .lab { fill: var(--text-1); font-weight: 650; font-size: 11.5px; }
.rp-chart .grid { stroke: var(--border-soft); stroke-width: 1; }
.rp-chart .base { stroke: var(--border); stroke-width: 1; }
.rp-chart .hit { fill: transparent; }
.rp-chart .hit:hover { fill: rgba(30, 58, 138, .05); }
.rp-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); margin: 0 0 8px; }
.rp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.rp-cw { overflow-x: auto; }

/* horizontal bars + meters */
.rp-hb { display: grid; grid-template-columns: minmax(84px, max-content) minmax(0, 1fr) minmax(64px, max-content); gap: 7px 10px; align-items: center; font-size: 13px; }
.rp-hb .k { color: var(--text-2); white-space: nowrap; }
.rp-hb .t { height: 10px; background: var(--border-soft); border-radius: 0 4px 4px 0; position: relative; }
.rp-hb .t i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--rp-sat); }
.rp-hb .t i.mute { background: var(--rp-mute); }
.rp-hb .t i.hot { background: var(--orange); }
.rp-hb .t .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-3); }
.rp-hb .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-1); font-weight: 600; white-space: nowrap; }
.rp-hb .n small { color: var(--text-3); font-weight: 500; font-size: 12px; }
.rp-sub { font-size: 12.5px; font-weight: 700; color: var(--text-2); margin: 14px 0 8px; }

/* tables */
.rp-tw { overflow-x: auto; }
.rp-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 0 8px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rp-t td { padding: 9px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.rp-t tr:last-child td { border-bottom: 0; }
.rp-t .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-t .muted { color: var(--text-3); }
.rp-t td b { font-weight: 650; }
.rp-t tr.is-link { cursor: pointer; }
.rp-t tr.is-link:hover td { background: var(--bg); }

/* cohort heatmap */
.rp-coh { border-collapse: separate; border-spacing: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
.rp-coh th { font-weight: 600; color: var(--text-3); padding: 0 4px 4px; white-space: nowrap; text-align: center; }
.rp-coh th.rl { text-align: left; }
.rp-coh td { min-width: 40px; height: 28px; text-align: center; border-radius: 3px; }
.rp-coh td.rl { min-width: 0; text-align: left; color: var(--text-2); padding-right: 8px; white-space: nowrap; }
.rp-coh td.nn { min-width: 0; color: var(--text-3); padding-right: 6px; text-align: right; }
.rp-coh td.gap { background: repeating-linear-gradient(135deg, var(--border-soft) 0 4px, var(--white) 4px 8px); color: var(--text-3); }
.rp-coh td.small { font-style: italic; }

/* the ladder */
.rp-lad { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.rp-lad > div { padding: 12px; background: var(--white); border-left: 1px solid var(--border); min-width: 0; }
.rp-lad > div:first-child { border-left: 0; }
.rp-lad .v { font-size: 24px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.rp-lad .k { font-size: 12.5px; color: var(--text-1); font-weight: 600; }
.rp-lad .p { font-size: 12px; color: var(--text-3); }

/* money bridge */
.rp-bridge { display: grid; grid-template-columns: minmax(0, 1fr) auto; font-size: 14px; }
.rp-bridge > div { padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.rp-bridge .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; padding-left: 16px; }
.rp-bridge .tot { font-weight: 750; border-bottom: 0; border-top: 1px solid var(--border); }
.rp-bridge .dim { color: var(--text-2); }

/* lists */
.rp-lib { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.rp-lib h4 { font-size: 13px; font-weight: 700; margin: 0 0 6px; color: var(--text-1); }
.rp-li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); align-items: center; }
.rp-li:last-child { border-bottom: 0; }
.rp-li .rp-link { font-size: 14px; display: block; }
.rp-li span { font-size: 12.5px; color: var(--text-2); }
.rp-li .cnt { font-size: 13px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; text-align: right; }
.rp-list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rp-list-head h3 { font-size: 17px; margin: 2px 0 2px; }
.rp-list-scroll { max-height: 62vh; overflow: auto; }
.rp-list-scroll .rp-t th { position: sticky; top: 0; background: var(--white); }

@media (max-width: 900px) {
  .rp-tiles, .rp-tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-grid, .rp-grid.even, .rp-lib { grid-template-columns: minmax(0, 1fr); }
  .rp-lad { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rp-lad > div:nth-child(4) { border-left: 0; }
  .rp-lad > div:nth-child(n+4) { border-top: 1px solid var(--border); }
}
@media (max-width: 520px) {
  .rp-dates { margin-left: 0; width: 100%; }
  .rp-dates input { flex: 1; min-width: 0; }
  .rp-tile .v { font-size: 24px; }
  .rp-tile svg.spark { display: none; }
  .rp-guard { grid-template-columns: 8px minmax(0, 1fr); }
  .rp-guard .rp-btn { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: no-preference) {
  .rp-tab, .rp-chip { transition: color .12s, background .12s, border-color .12s; }
}
@media print {
  .rp-range, .rp-tabs, .rp-link, .rp-guard .rp-btn { display: none !important; }
  .rp-card, .rp-tile { break-inside: avoid; }
  .rp-list-scroll { max-height: none; overflow: visible; }
}
