/* PCN Funding Split.
 *
 * Phase F3. Written for this service on the shell's own tokens (`--hs-*`); the monolith's page styled itself with
 * a long sheet plus many `style` attributes, none of which this service's Content Security Policy admits. Every width,
 * colour and state is a class. Show/hide is the `hidden` attribute, kept authoritative below. Tables scroll inside
 * their own box so the document never gains a horizontal scrollbar.
 */
:root {
  --pfs-border: var(--hs-border, #dfe4ec);
  --pfs-ink: var(--hs-ink, #1f2937);
  --pfs-mut: var(--hs-ink-muted, #55637a);
  --pfs-surface: var(--hs-surface, #fff);
  --pfs-accent: var(--hs-aqua, #0d5bb8);
  --pfs-tint: #f0f4ff;
  --pfs-good: #166534;
  --pfs-bad: #b91c1c;
  --pfs-radius: 10px;
}

/* Width: the shell's `.content-inner` already caps the page at 1560px and centres it, as it does for Cloud-Based Telephony
   (`.cbt-wrap { max-width: none; margin: 0; padding: 0 }`), so this wrapper adds no cap of its own. */
.pfs-wrap { max-width: none; margin: 0; padding: 0 0 48px; color: var(--pfs-ink); }
.pfs-wrap [hidden] { display: none !important; }
.pfs-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.pfs-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--pfs-accent); margin: 0 0 3px; }
.pfs-title { font-size: 1.75rem; font-weight: 800; margin: 0 0 14px; line-height: 1.2; }
.pfs-attribution, .pfs-basis { background: var(--pfs-tint); border-left: 4px solid var(--pfs-accent); border-radius: 0 6px 6px 0; padding: 14px 18px; font-size: 13px; color: #374151; margin-bottom: 16px; line-height: 1.55; }
.pfs-basis summary { cursor: pointer; font-weight: 700; }
.pfs-basis ul { margin: 10px 0 0; padding-left: 18px; }
.pfs-basis li { margin: 0 0 6px; }
.pfs-card { background: var(--pfs-surface); border: 1px solid var(--pfs-border); border-radius: var(--pfs-radius); box-shadow: 0 1px 6px rgba(0,0,0,0.06); padding: 16px 20px; margin-bottom: 16px; }
.pfs-head { font-size: 16px; font-weight: 700; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid #e8edf2; }
.pfs-note { font-size: 13px; color: #4b5563; margin: 0 0 10px; line-height: 1.5; }
.pfs-status { font-size: 12px; color: #4b5563; margin: 8px 0 0; min-height: 1em; }
.pfs-chipwrap { display: block; max-width: 460px; }
.pfs-warn { background: #fef3c7; color: #5c3a05; border: 1px solid #e6c34a; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin: 0 0 16px; }
.pfs-provisional { background: #fff7ed; color: #7c2d12; border: 1px solid #fdba74; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.pfs-error { background: #fff3f3; border: 1px solid #e74c3c; border-radius: 4px; padding: 10px 14px; font-size: 13px; color: #9b1c1c; margin: 10px 0 0; }
.pfs-forthcoming, .pfs-arrs-link { font-size: 13px; color: #4b5563; margin: 12px 0 0; }

/* Positioned, so a visually hidden caption inside the table is contained by this scroll box. */
.pfs-scroll { overflow-x: auto; position: relative; margin-bottom: 12px; }
.pfs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pfs-table caption { text-align: left; }
.pfs-table th, .pfs-table td { padding: 8px 10px; border-bottom: 1px solid #eef1f5; text-align: left; vertical-align: top; }
.pfs-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #4f5d6b; background: #f8fafc; white-space: nowrap; }
.pfs-table tbody th { font-weight: 600; }
.pfs-table .pfs-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pfs-table tfoot th, .pfs-table tfoot td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--pfs-border); }
.pfs-table .pfs-recon th, .pfs-table .pfs-recon td { font-weight: 400; font-size: 12px; color: #4b5563; background: none; border-top: 0; }
.pfs-sub { display: block; font-size: 11px; font-weight: 400; color: #596273; margin-top: 2px; white-space: normal; }
.pfs-na { color: #7a4a00; font-weight: 600; white-space: normal; }
.pfs-fig { font-weight: 700; }
.pfs-inactive th, .pfs-inactive td { color: #596273; background: #fafafa; }

.pfs-dl { margin: 12px 0 0; display: grid; gap: 10px; }
.pfs-dl > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: baseline; border-top: 1px solid #eef1f5; padding-top: 10px; }
.pfs-dl dt { font-size: 13px; color: #374151; }
.pfs-dl dd { margin: 0; font-size: 15px; text-align: right; }

.pfs-input { width: 100%; padding: 6px 10px; font-size: 13px; border: 1px solid #ced4da; border-radius: 4px; background: #fff; color: var(--pfs-ink); box-sizing: border-box; min-height: 34px; }
.pfs-beds { width: 110px; }
.pfs-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 10px; }
.pfs-btn { background: #fff; border: 1px solid #9aa5b5; color: #1f2937; padding: 7px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; min-height: 36px; }
.pfs-btn:hover { background: #f3f6fb; }
.pfs-btn:focus-visible, .pfs-input:focus-visible { outline: 3px solid #0d5bb8; outline-offset: 2px; }
.pfs-btn-primary { background: var(--pfs-accent); border-color: var(--pfs-accent); color: #fff; font-weight: 600; }
.pfs-btn-primary:hover { background: #0a4a96; }
.pfs-btn-quiet { border-color: transparent; color: #9b1c1c; }
.pfs-btn[disabled] { opacity: .6; cursor: progress; }
.pfs-stale-note { background: #fef3c7; color: #5c3a05; border: 1px solid #e6c34a; border-radius: 6px; padding: 6px 12px; font-size: 13px; font-weight: 700; margin: 8px 0; }
/* Stale figures stay readable (a dark grey that keeps the contrast ratio, never a faded one) but are struck through, and the
   note beside them says why, so neither colour nor the line is the only cue. */
.pfs-stale { color: #4b5563; text-decoration: line-through; }
.pfs-stale .pfs-fig, .pfs-stale .pfs-na { color: #4b5563; font-weight: 400; text-decoration: inherit; }
.pfs-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: #374151; }

/* Dashboard (UI parity): four separate summary cards, a population strip, a grouped breakdown. Tints are subtle and
   never the only cue: every group also has a text heading. */
.pfs-subhead { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--pfs-mut); margin: 24px 0 10px; }
.pfs-pick { padding: 14px 20px; }
.pfs-pickrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.pfs-pickrow .pfs-status { margin: 0; }
.pfs-chips { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pfs-chip { font-size: 12px; background: #f3f6fb; border: 1px solid var(--pfs-border); border-radius: 999px; padding: 3px 10px; color: #374151; }
.pfs-chip-warn { background: #fff7ed; border-color: #fdba74; color: #7c2d12; }
.pfs-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.pfs-kcard { background: var(--pfs-surface); border: 1px solid var(--pfs-border); border-top: 4px solid var(--pfs-accent); border-radius: var(--pfs-radius); padding: 12px 14px; box-shadow: 0 1px 6px rgba(0,0,0,0.06); min-width: 0; }
.pfs-kcard-npp { border-top-color: #0f766e; }
.pfs-kcard-arrs { border-top-color: #7c3aed; }
.pfs-kcard-care { border-top-color: #b45309; }
.pfs-klabel { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #4f5d6b; }
.pfs-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border: 1px solid #9aa5b5; border-radius: 999px; font-size: 10px; letter-spacing: 0; text-transform: none; font-weight: 700; color: #374151; background: #f8fafc; }
.pfs-kval { font-size: 1.5rem; font-weight: 800; line-height: 1.25; margin: 4px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pfs-kval .pfs-fig { font-weight: 800; }
.pfs-kval .pfs-na { font-size: 1rem; }
.pfs-ksub { font-size: 12px; color: #4b5563; line-height: 1.4; }
.pfs-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.pfs-kpi { background: #f8fafc; border: 1px solid var(--pfs-border); border-radius: 8px; padding: 8px 12px; min-width: 0; }
.pfs-kpival { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pfs-grouped thead th { border-bottom: 1px solid var(--pfs-border); }
.pfs-grouped th, .pfs-grouped td { padding-left: 8px; padding-right: 8px; }
/* Column headings may wrap to two lines so the table needs less width before it has to scroll. */
.pfs-grouped thead th { white-space: normal; line-height: 1.25; }
.pfs-grouped .pfs-g { text-align: center; border-left: 1px solid var(--pfs-border); }
.pfs-grouped .pfs-g-pop { background: #f1f5f9; }
.pfs-grouped .pfs-g-core, .pfs-grouped .pfs-g-ea { background: #eef4ff; }
.pfs-grouped .pfs-g-care { background: #fff7ed; }
.pfs-grouped .pfs-g-total { background: #e8eefb; }
.pfs-grouped .pfs-g-npp { background: #ecfdf5; border-left: 2px solid #0f766e; }
.pfs-grouped tbody td.pfs-g-npp, .pfs-grouped tfoot td.pfs-g-npp { background: #f4fdf9; }
.pfs-grouped tbody td[data-col="core_registered"], .pfs-grouped tbody td[data-col="core_adjusted"], .pfs-grouped tbody td[data-col="enhanced_access"] { background: #fafcff; }
.pfs-grouped tbody td[data-col="beds"], .pfs-grouped tbody td[data-col="care_home_premium"] { background: #fffaf5; }
.pfs-grouped tbody td[data-col="total"] { font-weight: 700; }
.pfs-grouped .pfs-g-practice { min-width: 9.5rem; white-space: normal; }
.pfs-grouped .pfs-inactive td { background: #fafafa; }
.pfs-grouped .pfs-sub { white-space: normal; }
.pfs-wrap .pfs-note { max-width: none; }
.pfs-pick .pfs-head { margin: 0; }

@media (max-width: 1100px) {
  .pfs-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .pfs-cards, .pfs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pfs-kval { font-size: 1.25rem; }
}
@media (max-width: 420px) {
  .pfs-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .pfs-card { padding: 16px; }
  .pfs-dl > div { grid-template-columns: 1fr; }
  .pfs-dl dd { text-align: left; }
}
@media print {
  .pfs-actions, .pfs-chipwrap { display: none; }
  .pfs-card { box-shadow: none; break-inside: avoid; }
}
