/* ARRS Calculator.
 *
 * Phase A3. 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 {
  --arrs-border: var(--hs-border, #dfe4ec);
  --arrs-ink: var(--hs-ink, #1f2937);
  --arrs-mut: var(--hs-ink-muted, #55637a);
  --arrs-surface: var(--hs-surface, #fff);
  --arrs-accent: var(--hs-aqua, #0d5bb8);
  --arrs-tint: #f0f4ff;
  --arrs-good: #166534;
  --arrs-bad: #b91c1c;
  --arrs-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. */
.arrs-wrap { max-width: none; margin: 0; padding: 0 0 48px; color: var(--arrs-ink); }
.arrs-wrap [hidden] { display: none !important; }
.arrs-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.arrs-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--arrs-accent); margin: 0 0 3px; }
.arrs-title { font-size: 1.75rem; font-weight: 800; margin: 0 0 14px; line-height: 1.2; }
.arrs-attribution, .arrs-basis { background: var(--arrs-tint); border-left: 4px solid var(--arrs-accent); border-radius: 0 6px 6px 0; padding: 14px 18px; font-size: 13px; color: #374151; margin-bottom: 16px; line-height: 1.55; }
.arrs-basis summary { cursor: pointer; font-weight: 700; }
.arrs-basis ul { margin: 10px 0 0; padding-left: 18px; }
.arrs-basis li { margin: 0 0 6px; }
.arrs-card { background: var(--arrs-surface); border: 1px solid var(--arrs-border); border-radius: var(--arrs-radius); box-shadow: 0 1px 6px rgba(0,0,0,0.06); padding: 16px 20px; margin-bottom: 16px; }
.arrs-head { font-size: 16px; font-weight: 700; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid #e8edf2; }
.arrs-note { font-size: 13px; color: #4b5563; margin: 0 0 10px; line-height: 1.5; }
.arrs-status { font-size: 12px; color: #4b5563; margin: 8px 0 0; min-height: 1em; }
.arrs-chipwrap { display: block; max-width: 460px; }
.arrs-warn { background: #fef3c7; color: #5c3a05; border: 1px solid #e6c34a; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin: 0 0 16px; }
.arrs-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; }
.arrs-error { background: #fff3f3; border: 1px solid #e74c3c; border-radius: 4px; padding: 10px 14px; font-size: 13px; color: #9b1c1c; margin: 10px 0 0; }
.arrs-forthcoming { font-size: 13px; color: #4b5563; margin: 12px 0 0; }

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

.arrs-dl { margin: 12px 0 0; display: grid; gap: 10px; }
.arrs-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; }
.arrs-dl dt { font-size: 13px; color: #374151; }
.arrs-dl dd { margin: 0; font-size: 15px; text-align: right; }

.arrs-input { width: 100%; padding: 6px 10px; font-size: 13px; border: 1px solid #ced4da; border-radius: 4px; background: #fff; color: var(--arrs-ink); box-sizing: border-box; min-height: 34px; }
.arrs-beds { width: 110px; }
.arrs-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 10px; }
.arrs-btn { background: #fff; border: 1px solid #9aa5b5; color: #1f2937; padding: 7px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; min-height: 36px; }
.arrs-btn:hover { background: #f3f6fb; }
.arrs-btn:focus-visible, .arrs-input:focus-visible { outline: 3px solid #0d5bb8; outline-offset: 2px; }
.arrs-btn-primary { background: var(--arrs-accent); border-color: var(--arrs-accent); color: #fff; font-weight: 600; }
.arrs-btn-primary:hover { background: #0a4a96; }
.arrs-btn-quiet { border-color: transparent; color: #9b1c1c; }
.arrs-btn[disabled] { opacity: .6; cursor: progress; }
.arrs-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. */
.arrs-stale { color: #4b5563; text-decoration: line-through; }
.arrs-stale .arrs-fig, .arrs-stale .arrs-na { color: #4b5563; font-weight: 400; text-decoration: inherit; }
.arrs-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. */
.arrs-subhead { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--arrs-mut); margin: 24px 0 10px; }
.arrs-pick { padding: 14px 20px; }
.arrs-pickrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.arrs-pickrow .arrs-status { margin: 0; }
.arrs-chips { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.arrs-chip { font-size: 12px; background: #f3f6fb; border: 1px solid var(--arrs-border); border-radius: 999px; padding: 3px 10px; color: #374151; }
.arrs-chip-warn { background: #fff7ed; border-color: #fdba74; color: #7c2d12; }
.arrs-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.arrs-kcard { background: var(--arrs-surface); border: 1px solid var(--arrs-border); border-top: 4px solid var(--arrs-accent); border-radius: var(--arrs-radius); padding: 12px 14px; box-shadow: 0 1px 6px rgba(0,0,0,0.06); min-width: 0; }
.arrs-kcard-npp { border-top-color: #0f766e; }
.arrs-kcard-arrs { border-top-color: #7c3aed; }
.arrs-kcard-care { border-top-color: #b45309; }
.arrs-klabel { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #4f5d6b; }
.arrs-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; }
.arrs-kval { font-size: 1.5rem; font-weight: 800; line-height: 1.25; margin: 4px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.arrs-kval .arrs-fig { font-weight: 800; }
.arrs-kval .arrs-na { font-size: 1rem; }
.arrs-ksub { font-size: 12px; color: #4b5563; line-height: 1.4; }
.arrs-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.arrs-kpi { background: #f8fafc; border: 1px solid var(--arrs-border); border-radius: 8px; padding: 8px 12px; min-width: 0; }
.arrs-kpival { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.arrs-grouped thead th { border-bottom: 1px solid var(--arrs-border); }
.arrs-grouped th, .arrs-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. */
.arrs-grouped thead th { white-space: normal; line-height: 1.25; }
.arrs-grouped .arrs-g { text-align: center; border-left: 1px solid var(--arrs-border); }
.arrs-grouped .arrs-g-pop { background: #f1f5f9; }
.arrs-grouped .arrs-g-core, .arrs-grouped .arrs-g-ea { background: #eef4ff; }
.arrs-grouped .arrs-g-care { background: #fff7ed; }
.arrs-grouped .arrs-g-total { background: #e8eefb; }
.arrs-grouped .arrs-g-npp { background: #ecfdf5; border-left: 2px solid #0f766e; }
.arrs-grouped tbody td.arrs-g-npp, .arrs-grouped tfoot td.arrs-g-npp { background: #f4fdf9; }
.arrs-grouped tbody td[data-col="core_registered"], .arrs-grouped tbody td[data-col="core_adjusted"], .arrs-grouped tbody td[data-col="enhanced_access"] { background: #fafcff; }
.arrs-grouped tbody td[data-col="beds"], .arrs-grouped tbody td[data-col="care_home_premium"] { background: #fffaf5; }
.arrs-grouped tbody td[data-col="total"] { font-weight: 700; }
.arrs-grouped .arrs-g-practice { min-width: 9.5rem; white-space: normal; }
.arrs-grouped .arrs-inactive td { background: #fafafa; }
.arrs-grouped .arrs-sub { white-space: normal; }
.arrs-wrap .arrs-note { max-width: none; }
.arrs-pick .arrs-head { margin: 0; }

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

/* ARRS Calculator additions. */
.arrs-cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 8px; }
.arrs-kcard-ceiling { border-top-color: #7c3aed; }
.arrs-kcard-max { border-top-color: #0d5bb8; }
.arrs-kcard-cost { border-top-color: #0f766e; }
.arrs-kcard-est { border-top-color: #b45309; }
.arrs-kcard-head { border-top-color: #475569; }
.arrs-kval-small { font-size: 1rem; font-weight: 700; }
.arrs-ksub-inline { font-size: 12px; font-weight: 400; color: #4b5563; }
.arrs-over { color: #7a3a00; font-weight: 800; }
.arrs-form { margin: 0; }
.arrs-fieldset { border: 1px solid var(--arrs-border); border-radius: 8px; padding: 8px 14px 10px; margin: 0 0 12px; min-width: 0; }
.arrs-fieldset legend { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--arrs-mut); padding: 0 6px; }
.arrs-radios { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.arrs-radio, .arrs-check { display: inline-flex; align-items: center; gap: 6px; margin: 4px 16px 4px 0; font-size: 13px; cursor: pointer; }
.arrs-radio input, .arrs-check input { width: 18px; height: 18px; accent-color: var(--arrs-accent); }
.arrs-radio input:focus-visible, .arrs-check input:focus-visible { outline: 3px solid #0d5bb8; outline-offset: 2px; }
.arrs-policies { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.arrs-policies legend { width: auto; }
.arrs-label { display: block; font-size: 13px; font-weight: 700; margin: 0 0 4px; }
.arrs-assume { margin-top: 12px; padding-top: 10px; border-top: 1px solid #eef1f5; }
.arrs-hint { font-size: 12px; color: #4b5563; margin: 4px 0 0; }
.arrs-actions .arrs-hint { margin: 0; }
.arrs-short { width: 7.5rem; }
.arrs-mid { width: 10rem; }
.arrs-table select.arrs-input { width: auto; min-width: 7rem; max-width: 100%; }
.arrs-table select.arrs-short { min-width: 5.5rem; width: auto; }
#arrs-posts select[name="post_role"] { min-width: 17rem; }
.arrs-submit { margin: 4px 0 18px; }
.arrs-minorhead { font-size: 13px; font-weight: 800; margin: 14px 0 6px; }
.arrs-capped th, .arrs-capped td { background: #fffaf0; }
.arrs-illustration { border-left: 6px solid #f59e0b; }
.arrs-banner { font-size: 14px; }
.arrs-errors { border-color: #e74c3c; background: #fff8f8; }
.arrs-errors:focus-visible, #arrs-results-head:focus-visible { outline: 3px solid #0d5bb8; outline-offset: 2px; }
.arrs-btn[hidden] { display: none; }
.arrs-hide-row { display: none; }
@media (max-width: 1100px) { .arrs-cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .arrs-cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } #arrs-posts select[name="post_role"] { min-width: 13rem; } }
@media (max-width: 480px) { .arrs-cards-4 { grid-template-columns: minmax(0, 1fr); } }
#arrs-mhp-result tbody th, #arrs-sp-result tbody th { min-width: 11rem; }
#arrs-mhp-result thead th { white-space: normal; min-width: 8rem; }

/* Optional sections: a native disclosure that works without scripting. The summary keeps the section's name and its
   "Provisional illustration" tag visible while closed, so the qualification is never hidden with the entry rows. */
.arrs-optional > summary { cursor: pointer; list-style: none; }
.arrs-optional > summary::-webkit-details-marker { display: none; }
.arrs-optional > summary .arrs-head { display: inline; margin: 0; padding: 0; border: 0; font-size: 16px; }
.arrs-optional > summary::before { content: "\25B8"; display: inline-block; margin-right: 8px; color: var(--arrs-accent); font-size: 16px; }
.arrs-optional[open] > summary::before { content: "\25BE"; }
.arrs-optional > summary:focus-visible { outline: 3px solid #0d5bb8; outline-offset: 3px; border-radius: 4px; }
.arrs-optional[open] > summary { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #e8edf2; }
.arrs-tag-warn { background: #fff7ed; border-color: #fdba74; color: #7c2d12; }
.arrs-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.arrs-list-cols { column-gap: 28px; }
@media (min-width: 1100px) { .arrs-list-cols { columns: 2; } .arrs-list-cols li { break-inside: avoid; } }
@media (max-width: 900px) { .arrs-two { grid-template-columns: minmax(0, 1fr); } }
