/* Prescribing Analytics (NHSBSA EPD) benchmarking dashboard.
 *
 * Phase 4C.49A. The monolith's `<style>` block from website/prescribing.html, taken at monolith commit
 * cb02cf0 with no selector, value or colour changed except: the `i` selector (a Font Awesome glyph there,
 * inline SVG here), which is the same declaration on `svg`; and `.rx-wrap`, whose 1200px marketing
 * column is the normal full-width tool layout (the shell supplies the gutter). The additions are at the
 * end and are listed there: they exist because the Content Security Policy admits no style attribute and
 * no inline style element, so the monolith's were moved here. The picker's chip and modal are
 * `tools/shared/static/tools/shared/picker.v1.css`, not this file.
 */
  :root { --rx-border:#e6ebf1; --rx-ink:#0f172a; --rx-mut:#64748b; --rx-soft:#94a3b8;
          --rx-good:#15803d; --rx-goodbg:#e8f6ec; --rx-bad:#b91c1c; --rx-badbg:#fdeaea;
          --rx-amber:#b45309; --rx-amberbg:#fef6e7;
          --rx-practice:#0d5bb8; --rx-pcn:#16a085; --rx-icb:#8e44ad; --rx-national:#94a3b8; }

  .rx-wrap { max-width:none; margin:0; padding:0; }
  .rx-lead { color:var(--rx-mut); font-size:15px; margin:0 0 18px; max-width:840px; }
  .rx-attribution { background:#f6f8fc; border:1px solid var(--rx-border); border-left:3px solid var(--rx-practice); border-radius:8px; padding:13px 17px; font-size:13px; color:#4b5563; margin-bottom:18px; }

  .rx-card { background:#fff; border:1px solid var(--rx-border); border-radius:12px; padding:20px; margin-bottom:18px; box-shadow:0 1px 2px rgba(15,23,42,.04); }
  .rx-h { font-size:16px; font-weight:800; color:var(--rx-ink); margin:0 0 3px; }
  .rx-sub { font-size:13px; color:var(--rx-mut); margin:0 0 14px; }

  .rx-controls { display:flex; flex-wrap:wrap; align-items:center; gap:14px; }
  .rx-modes { display:inline-flex; background:#eef2f7; border-radius:9px; padding:3px; }
  .rx-mode { border:none; background:none; padding:8px 18px; font-size:13px; font-weight:700; color:var(--rx-mut); border-radius:7px; cursor:pointer; }
  .rx-mode.active { background:#fff; color:var(--rx-ink); box-shadow:0 1px 2px rgba(15,23,42,.12); }
  .rx-monthwrap { display:flex; align-items:center; gap:8px; }
  .rx-ctl-label { font-size:12px; font-weight:700; color:var(--rx-mut); }
  .rx-month { border:1px solid #d1d9e0; border-radius:9px; padding:9px 12px; font-size:14px; color:var(--rx-ink); background:#fff; }
  .rx-msg { font-size:13px; color:var(--rx-bad); margin-top:10px; }

  .rx-tabs { display:flex; flex-wrap:wrap; gap:8px; margin:18px 0; }
  .rx-tab { display:inline-flex; align-items:center; gap:8px; border:1px solid var(--rx-border); background:#fff; color:var(--rx-mut); padding:9px 15px; border-radius:9px; font-size:13px; font-weight:700; cursor:pointer; }
  .rx-tab.active { background:var(--rx-practice); color:#fff; border-color:var(--rx-practice); }
  .rx-panel { display:none; }
  .rx-panel.active { display:block; }

  .rx-context { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin:8px 0 16px; }
  .rx-context h2 { font-size:22px; font-weight:800; color:var(--rx-ink); margin:0; }
  .rx-context .meta { font-size:13px; color:var(--rx-mut); }

  .rx-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; }
  .rx-kpi { border:1px solid var(--rx-border); border-radius:10px; padding:14px 16px; background:#fff; }
  .rx-kpi .k-l { font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color:var(--rx-mut); }
  .rx-kpi .k-v { font-size:24px; font-weight:800; color:var(--rx-ink); margin-top:4px; }
  .rx-kpi .k-d { font-size:12px; font-weight:700; margin-top:3px; }
  .rx-kpi .k-d.good { color:var(--rx-good); }
  .rx-kpi .k-d.bad { color:var(--rx-bad); }
  .rx-kpi .k-d.neutral { color:var(--rx-mut); }

  .rx-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
  @media (max-width:860px){ .rx-grid2 { grid-template-columns:1fr; } }
  .rx-chart-box { position:relative; min-height:240px; }

  table.rx-table { width:100%; border-collapse:collapse; font-size:13px; }
  table.rx-table th { text-align:left; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--rx-mut); padding:9px 10px; border-bottom:2px solid var(--rx-border); }
  table.rx-table td { padding:9px 10px; border-bottom:1px solid #f1f4f8; }
  table.rx-table tr.me { background:#eef6ff; font-weight:700; }
  td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }

  .rx-chip { display:inline-block; padding:2px 9px; border-radius:20px; font-size:11.5px; font-weight:700; }
  .rx-chip.good { background:var(--rx-goodbg); color:var(--rx-good); }
  .rx-chip.bad { background:var(--rx-badbg); color:var(--rx-bad); }
  .rx-chip.neutral { background:#eef1f6; color:var(--rx-mut); }

  .rx-gauge { height:14px; border-radius:8px; background:linear-gradient(90deg,#dc2626,#f59e0b,#84cc16,#16a34a,#2563eb); position:relative; margin:16px 0 24px; }
  .rx-gauge .pin { position:absolute; top:-7px; width:4px; height:28px; background:#0f172a; border-radius:2px; transform:translateX(-50%); }
  .rx-gauge .pin::after { content:attr(data-val); position:absolute; top:30px; left:50%; transform:translateX(-50%); font-size:11px; font-weight:800; color:#0f172a; white-space:nowrap; }
  .rx-quants { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; }
  .rx-quant { border:1px solid var(--rx-border); border-radius:8px; padding:8px; text-align:center; }
  .rx-quant .q-l { font-size:9px; font-weight:800; text-transform:uppercase; color:var(--rx-mut); }
  .rx-quant .q-v { font-size:14px; font-weight:800; color:var(--rx-ink); }

  .rx-savings { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:14px; }
  .rx-save { border:1px solid var(--rx-border); border-radius:10px; padding:16px; }
  .rx-save .s-l { font-size:12px; font-weight:700; color:var(--rx-mut); }
  .rx-save .s-v { font-size:26px; font-weight:800; margin-top:4px; }
  .rx-save .s-v.over { color:var(--rx-bad); }
  .rx-save .s-v.under { color:var(--rx-good); }
  .rx-save .s-sub { font-size:11.5px; color:var(--rx-soft); margin-top:4px; }

  .rx-insight { display:flex; gap:11px; align-items:flex-start; padding:10px 12px; border-radius:8px; font-size:13.5px; margin-bottom:8px; }
  .rx-insight.good { background:var(--rx-goodbg); color:#14532d; }
  .rx-insight.bad { background:var(--rx-badbg); color:#7f1d1d; }
  .rx-insight.neutral { background:#eef1f6; color:#334155; }
  .rx-insight svg { margin-top:2px; }
  .rx-chapbar { height:10px; border-radius:5px; background:#e2e8f0; overflow:hidden; min-width:60px; }
  .rx-chapbar > span { display:block; height:100%; background:#0d5bb8; border-radius:5px; }
  .rx-ind { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:9px 12px; border-radius:8px; margin-bottom:7px; background:#f8fafc; border:1px solid var(--rx-border); }
  .rx-ind .i-l { font-size:13px; color:var(--rx-ink); font-weight:600; }
  .rx-ind .i-l small { display:block; color:var(--rx-soft); font-weight:400; font-size:11px; }
  .rx-ind .i-v { font-size:16px; font-weight:800; white-space:nowrap; }
  .rx-ind .i-v small { color:var(--rx-soft); font-weight:600; font-size:11px; }
  .rx-ind.good .i-v { color:var(--rx-good); } .rx-ind.bad .i-v { color:var(--rx-bad); }
  .rx-quad { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:8px; }
  .rx-quad .q { border:1px solid var(--rx-border); border-radius:10px; padding:16px; text-align:center; }
  .rx-quad .q.on { border-color:var(--rx-practice); background:#eef6ff; box-shadow:0 0 0 1px var(--rx-practice) inset; }
  .rx-quad .q .qt { font-size:11px; font-weight:800; text-transform:uppercase; color:var(--rx-mut); }
  .rx-quad .q .qv { font-size:20px; font-weight:800; color:var(--rx-ink); margin-top:4px; }
  .rx-callout { background:var(--rx-amberbg); border:1px solid #f7e2b8; border-left:3px solid var(--rx-amber); border-radius:8px; padding:13px 16px; font-size:13.5px; color:#7a4d09; }
  .rx-note { background:#eff6ff; border:1px solid #bfdbfe; border-radius:8px; padding:12px 15px; font-size:12.5px; color:#1e3a5f; margin-bottom:16px; }
  .rx-empty { text-align:center; color:var(--rx-soft); padding:60px 20px; font-size:15px; }

  /* compare autocomplete */
  .rx-csearch { position:relative; display:flex; align-items:center; gap:10px; border:1px solid #d1d9e0; border-radius:10px; padding:11px 14px; background:#fff; flex:1; }
  .rx-csearch input { flex:1; border:none; outline:none; font-size:15px; color:var(--rx-ink); background:none; }
  .rx-ac { position:absolute; top:calc(100% + 6px); left:0; right:0; background:#fff; border:1px solid var(--rx-border); border-radius:10px; box-shadow:0 18px 44px rgba(15,23,42,.18); max-height:300px; overflow-y:auto; display:none; z-index:50; }
  .rx-ac.show { display:block; }
  .rx-ac-item { display:flex; gap:12px; padding:10px 14px; cursor:pointer; border-bottom:1px solid #f5f7f9; }
  .rx-ac-item:hover, .rx-ac-item.active { background:#f0f6ff; }
  .rx-ac-item .c { font-size:11px; font-weight:800; color:#0d5bb8; min-width:58px; }
  .rx-cchip { display:inline-flex; align-items:center; gap:8px; background:#eef6ff; border:1px solid #cfe3fb; border-radius:20px; padding:6px 12px; font-size:12.5px; font-weight:700; color:#1e3a5f; }
  .rx-cchip .x { cursor:pointer; color:#b91c1c; font-weight:800; }

/* ---- Phase 4C.49A additions ---------------------------------------------------------------------
 * Each replaces a `style=""` attribute of the source's template, with the same declarations. */
.rx-ico { width:1em; height:1em; vertical-align:-.125em; fill:none; stroke:currentColor; stroke-width:2;
  stroke-linecap:round; stroke-linejoin:round; flex:none; }
[data-rx-hidden] { display:none; }
.rx-eyebrow { font-size:11px; font-weight:800; letter-spacing:.09em; text-transform:uppercase; color:var(--rx-practice); margin:0 0 3px; }
.rx-title { font-size:28px; font-weight:800; color:var(--rx-ink); margin:0 0 6px; }
.rx-chipwrap { display:inline-flex; }
.rx-chipwrap[hidden] { display:none; }
.rx-mt18 { margin-top:18px; }
.rx-mt16 { margin-top:16px; }
.rx-mt14 { margin-top:14px; }
.rx-empty .rx-ico { width:34px; height:34px; color:#cbd5e1; }
.rx-empty p { margin-top:14px; }
.rx-cmp-controls { margin:4px 0 12px; }
.rx-cmp-chips { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.rx-csearch > .rx-ico { color:#b6bfc8; }
.rx-ac-item.rx-ac-none { color:#b6bfc8; cursor:default; }
.rx-tab .rx-ico { font-size:14px; }
.rx-attribution .rx-ico { margin-right:4px; }
.rx-note .rx-ico { margin-right:4px; }
.rx-sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
/* the source's tables are wider than a phone; they scroll inside their card rather than the page */
#rx-scope-table, #rx-chapters, #rx-clinical .rx-card, #rx-lb-cost, #rx-lb-generic, #rx-league-table, #rx-cmp-table, #rx-risers, #rx-fallers { overflow-x:auto; }
.rx-tabs { overflow-x:auto; flex-wrap:wrap; }
.rx-month { max-width:100%; }
/* The source's five-box distribution row is five `1fr` tracks, which cannot shrink below the widest value
   (min-content), so on a phone the card grew past the screen. Zero-minimum tracks let the boxes narrow. */
.rx-quants { grid-template-columns:repeat(5,minmax(0,1fr)); gap:6px; }
.rx-quant { min-width:0; padding:8px 4px; }
.rx-quant .q-l, .rx-quant .q-v { overflow-wrap:anywhere; }
@media (max-width:480px) { .rx-quant .q-v { font-size:12px; } }
.rx-grid2 > *, .rx-kpis > * { min-width:0; }
