/* Reports — library + report view. Everything is scoped under .rp.
   Colour, type and elevation resolve from css/tokens.css only. */

.rp { padding: 26px 0 64px; position: relative; z-index: 1; }
.rp h1, .rp h2 { margin: 0; font-weight: 600; letter-spacing: -.012em; }
.rp p { margin: 0; }

/* ---------------- library head ---------------- */
.rp-head { margin-bottom: 22px; }
.rp-head .eyebrow { margin-bottom: 9px; }
.rp-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.rp-head h1 { font-size: 27px; line-height: 1.16; }
.rp-sub { color: var(--ink-3); font-size: 13px; margin-top: 5px; max-width: 74ch; }
.rp-logo { height: 24px; width: auto; display: block; flex: none; opacity: .92; }

/* ---------------- library filters ---------------- */
.rp-filters {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 11px 0 13px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.rp-chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.rp-chip {
  font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); color: var(--ink-2); background: var(--bg-1);
  box-shadow: 0 0 0 0 transparent;
  transition: background .16s var(--ease), color .16s var(--ease),
              border-color .16s var(--ease), box-shadow .16s var(--ease);
  white-space: nowrap;
}
.rp-chip:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-tint); box-shadow: var(--shadow-1); }
.rp-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rp-chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.rp-chip[aria-pressed="true"]:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.rp-chip-clear { border-style: dashed; color: var(--ink-3); }
.rp-chip-clear[hidden] { display: none; }

.rp-search { position: relative; margin-left: auto; }
.rp-search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px;
  fill: none; stroke: var(--ink-4); stroke-width: 1.4; pointer-events: none; }
.rp-q {
  font: inherit; font-size: 12.5px; color: var(--ink); width: 214px; max-width: 46vw;
  padding: 6px 10px 6px 27px; border-radius: var(--r-s);
  border: 1px solid var(--line-2); background: var(--bg-1);
}
.rp-q:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
.rp-count { font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------------- library cards ---------------- */
/* One grid carries every group. The section, the heading and the card wrapper
   are all zero-box, so nothing can sit between a pointer and the card or the
   header button it was aimed at. */
.rp-groups { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }
.rp-groupbox, .rp-group-t { display: contents; }
.rp-groupbox[hidden] { display: none; }
.rp-group-h {
  grid-column: 1 / -1; margin: 20px 0 -2px -8px;
  display: flex; align-items: center; gap: 10px; width: calc(100% + 8px); cursor: pointer;
  padding: 6px 8px; border-radius: var(--r-s);
  border: 1px solid transparent; background: transparent; color: var(--ink);
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.rp-groups > .rp-groupbox:first-child .rp-group-h { margin-top: 0; }
.rp-group-h:hover { background: var(--bg-2); border-color: var(--line-2); color: var(--brand-deep); }
.rp-group-h:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rp-group-n { font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.rp-group-c { font-size: 11px; color: var(--ink-4); }
.rp-group-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.rp-group-h .rp-chev { flex: none; color: var(--ink-4); transform: rotate(90deg); transition: transform .16s var(--ease); }
.rp-group-h[aria-expanded="false"] .rp-chev { transform: rotate(0deg); }
.rp-group-h:hover .rp-chev { color: var(--brand); }

.rp-cards { display: contents; }
.rp-cards[hidden] { display: none; }
.rp-card {
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-1); transition: box-shadow .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.rp-card:hover, .rp-card:focus-visible { border-color: var(--brand); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.rp-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rp-card[hidden] { display: none; }

.rp-card-th {
  display: block; height: 92px; padding: 9px 11px 6px; overflow: hidden;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
  position: relative;
}
.rp-card-th::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--acc, var(--brand)); opacity: .82;
}
/* A thumbnail is a shape-only miniature: at 92px the real labels and legend
   from charts.js would collide, so they are suppressed and the geometry alone
   previews what the report draws. */
.rp-card-th svg { display: block; width: 100%; height: 100%; }
.rp-card-th svg text, .rp-card-th svg .sw { display: none; }
.rp-card-th svg .grid, .rp-card-th svg .axis { opacity: .35; }
.rp-th-none { display: block; height: 100%; background:
  repeating-linear-gradient(135deg, var(--bg-3) 0 6px, transparent 6px 12px); opacity: .5; }

.rp-card-b { display: flex; flex-direction: column; gap: 5px; padding: 12px 13px 13px; flex: 1; }
.rp-card-n { font-size: 13.5px; font-weight: 600; color: var(--ink); letter-spacing: -.008em; }
.rp-card-q { font-size: 12px; color: var(--ink-3); line-height: 1.42; flex: 1; }
.rp-card-m { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); }
.rp-card-p { font-size: 11px; color: var(--ink-4); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-card-r { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }
.rp-card-go {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  font-size: 11px; font-weight: 600; color: var(--brand-deep);
  opacity: 0; transform: translateX(-3px);
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.rp-card:hover .rp-card-go, .rp-card:focus-visible .rp-card-go { opacity: 1; transform: none; }
@media (hover: none) { .rp-card-go { opacity: 1; transform: none; } }

.rp-empty { margin-top: 24px; font-size: 13px; color: var(--ink-3); }

/* ---------------- report view ---------------- */
.rp-crumb { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); margin-bottom: 16px; }
.rp-crumb a { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); border-radius: 4px; }
.rp-crumb a:hover { color: var(--brand-deep); }
.rp-crumb > * + *::before { content: "\203A"; color: var(--ink-4); margin-right: 7px; }
.rp-crumb .cur { color: var(--ink); font-weight: 500; }

.rp-rhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; flex-wrap: wrap; margin-bottom: 20px; }
.rp-rhead-l { min-width: 0; flex: 1 1 420px; }
.rp-rhead-l .eyebrow { margin-bottom: 8px; }
.rp-rhead h1 { font-size: 26px; line-height: 1.16; }
.rp-rhead-r { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.rp-rhead-r .rp-logo { height: 23px; }

.rp-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
.rp-tclink-top { white-space: nowrap; }
.rp-btn {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500;
  padding: 7px 12px; border-radius: var(--r-s); border: 1px solid var(--line-2);
  background: var(--bg-1); color: var(--ink-2);
  transition: border-color .16s var(--ease), color .16s var(--ease), background .16s var(--ease);
}
.rp-btn:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-tint); }
.rp .btn-primary { font-size: 12px; padding: 7px 13px; }
.rp-xnote { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink-3); min-height: 14px; text-align: right; }

/* headline figure */
.rp-figure {
  display: flex; align-items: stretch; gap: 30px; flex-wrap: wrap;
  padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg-1); box-shadow: var(--shadow-1); margin-bottom: 20px;
}
.rp-fig-main { flex: 1 1 300px; min-width: 0; }
.rp-fig-v { font-family: var(--serif); font-size: 44px; line-height: 1.02; letter-spacing: -.022em; color: var(--ink); }
.rp-fig-u { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.rp-fig-n { font-size: 12px; color: var(--ink-3); margin-top: 8px; max-width: 56ch; line-height: 1.5; }

.rp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 18px 26px;
  flex: 1 1 340px; margin: 0; padding-left: 26px; border-left: 1px solid var(--line); align-content: center; }
.rp-stat-l { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
.rp-stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  cursor: pointer; text-align: left; padding: 4px 6px; margin: -4px -6px;
  border: 1px solid transparent; border-radius: var(--r-s); background: transparent;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .16s var(--ease);
}
.rp-stat:hover { background: var(--bg-2); border-color: var(--line-2); transform: translateY(-1px); }
.rp-stat:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rp-stat .rp-chev { position: absolute; opacity: 0; }
.rp-stat { position: relative; padding-right: 18px; }
.rp-stat .rp-chev { right: 4px; top: 8px; color: var(--brand); transition: opacity .16s var(--ease); }
.rp-stat:hover .rp-chev, .rp-stat:focus-visible .rp-chev { opacity: 1; }
.rp-stat-v { font-size: 14px; color: var(--ink); font-weight: 500; }
.rp-stat:hover .rp-stat-v { color: var(--brand-deep); }
.rp-stat-s { font-size: 11px; color: var(--ink-3); }
.rp-note { font-size: 12px; color: var(--ink-2); min-height: 16px; margin: -12px 0 16px; padding: 0 2px; }

/* panels */
.rp-panel-chart, .rp-panel-grid, .rp-panel-ev {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-1);
  box-shadow: var(--shadow-1); margin-bottom: 20px; overflow: hidden; }
.rp-panel-t { display: contents; }
.rp-panel-h { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; cursor: pointer; text-align: left; color: var(--ink);
  padding: 13px 18px; border: 0; border-bottom: 1px solid var(--line); background: var(--bg-2);
  transition: background .16s var(--ease), color .16s var(--ease); }
.rp-panel-h:hover { background: var(--brand-tint); color: var(--brand-deep); }
.rp-panel-h:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.rp-panel-n { font-size: 13px; font-weight: 600; letter-spacing: -.012em; margin-right: auto; }
.rp-panel-h .rp-chev { flex: none; color: var(--ink-4); transform: rotate(90deg); transition: transform .16s var(--ease), color .16s var(--ease); }
.rp-panel-h[aria-expanded="false"] .rp-chev { transform: rotate(0deg); }
.rp-panel-h:hover .rp-chev { color: var(--brand); }
.rp-gridwrap[hidden], .rp-scroll[hidden], .rp-ev[hidden] { display: none; }
.rp-tag { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }

.rp-scroll { overflow-x: auto; overflow-y: hidden; padding: 20px 18px 18px; }
.rp-canvas { min-width: 640px; }
.rp-canvas svg { display: block; width: 100%; height: auto; max-width: 100%; }
.rp-canvas-main { min-width: 720px; }
.rp-canvas-none { min-width: 0; display: flex; align-items: center; justify-content: center;
  min-height: 180px; border: 1px dashed var(--line-2); border-radius: var(--r-s); background: var(--bg-2); }
.rp-canvas-none p { font-size: 12px; color: var(--ink-3); }
.rp-card-th .rp-canvas-none { min-height: 0; height: 100%; border: 0; background: transparent; }

.rp-gridwrap { padding: 4px 0 0; }
.rp-none { padding: 20px 18px; font-size: 12.5px; color: var(--ink-3); }
.rp-ev { padding: 18px; }

/* method + related */
.rp-foot { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; margin-bottom: 22px; }
.rp-method, .rp-related { border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-1); padding: 17px 19px; }
.rp-foot h2 { font-size: 12px; letter-spacing: .01em; margin-bottom: 10px; }
.rp-method ul { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 7px; }
.rp-method li { font-size: 12px; color: var(--ink-3); line-height: 1.55; }
.rp-tclink { display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--brand); border-radius: 4px; }
.rp-tclink-top { padding: 7px 4px 7px 8px; }
.rp-tclink:hover { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 3px; }
.rp-ext { flex: none; }

.rp-related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rp-related li + li { border-top: 1px solid var(--line); }
.rp-related a { display: flex; flex-direction: column; gap: 2px; padding: 9px 0; border-radius: 4px; }
.rp-related a:hover .rp-rel-n { color: var(--brand-deep); }
.rp-rel-n { font-size: 12.5px; color: var(--ink); font-weight: 500; }
.rp-rel-q { font-size: 11.5px; color: var(--ink-4); line-height: 1.45; }

/* pager */
.rp-pager { display: flex; justify-content: space-between; gap: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.rp-page { display: flex; flex-direction: column; gap: 2px; max-width: 48%; border-radius: var(--r-s); padding: 4px 2px; }
.rp-page-n2 { text-align: right; align-items: flex-end; }
.rp-page-l { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
.rp-page-n { font-size: 13px; color: var(--ink); font-weight: 500; }
.rp-page:hover .rp-page-n { color: var(--brand-deep); }

.rp-missing { padding: 40px 0 60px; }
.rp-missing h1 { font-size: 22px; margin-bottom: 8px; }
.rp-missing p { font-size: 13px; color: var(--ink-3); margin-bottom: 16px; }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .rp-foot { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .rp-figure { gap: 20px; }
  .rp-stats { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
  .rp-rhead-r { align-items: flex-start; }
  .rp-actions { justify-content: flex-start; }
  .rp-xnote { text-align: left; }
}
@media (max-width: 620px) {
  .rp { padding-top: 18px; }
  .rp-head h1, .rp-rhead h1 { font-size: 21px; }
  .rp-fig-v { font-size: 34px; }
  .rp-groups { grid-template-columns: 1fr; }
  .rp-search { margin-left: 0; width: 100%; }
  .rp-q { width: 100%; max-width: none; }
  .rp-scroll { padding: 14px 12px; }
  .rp-figure { padding: 18px 16px; }
  .rp-panel-h { padding: 11px 14px; }
}
