/* Client portal report pages (2026-10-13).
   Phone first; no JavaScript (D74): accordions are <details>, pages are routes.
   Colours: the four severity bands are the ONLY styling source for findings
   (portal_common BAND_COLOURS_HEX); the brand greens come from custom.css.
   The page hues below (--pg-*) are decoration only: a pastel tint, a deeper
   accent and a deep tone per section page. They never encode severity. */

:root {
    --rp-gold: #C8A951;
    --rp-gold-soft: #F6EFD8;
    --rp-green-soft: #E6F2EE;
    --rp-ink: #1f2d2a;
    --rp-muted: #586864;   /* 4.5:1 or better on white and on every page tint */
    --rp-track: #e9ecef;
    --rp-radius: 1rem;

    /* Page hue defaults (the green of the findings page); .rp-page-* override. */
    --pg-tint: #EEF6F1;      /* card and header band background */
    --pg-tint-2: #DCEDE3;    /* summary rows, icon circles, chip borders */
    --pg-accent: #3F7D52;    /* 4px card edge, open accordion border */
    --pg-deep: #2B5E3C;      /* icon colour on --pg-tint-2 (5:1 or better) */
}

/* One hue per page; body ink #1f2d2a is 11:1 or better on every tint. */
.rp-page-findings      { --pg-tint: #EEF6F1; --pg-tint-2: #DCEDE3; --pg-accent: #3F7D52; --pg-deep: #2B5E3C; --pg-icon: "\f6fe"; }
.rp-page-images        { --pg-tint: #EEF3F6; --pg-tint-2: #DCE7ED; --pg-accent: #5B8296; --pg-deep: #3F6275; --pg-icon: "\f302"; }
.rp-page-understanding { --pg-tint: #EAF2F8; --pg-tint-2: #D6E7F3; --pg-accent: #4A7FA7; --pg-deep: #2F6389; --pg-icon: "\f518"; }
.rp-page-plan          { --pg-tint: #F8F3E6; --pg-tint-2: #F0E6C8; --pg-accent: #A8852A; --pg-deep: #7D5F0C; --pg-icon: "\f4be"; }
.rp-page-next-steps    { --pg-tint: #F8EEEC; --pg-tint-2: #F1DDD9; --pg-accent: #B8665A; --pg-deep: #98443A; --pg-icon: "\f274"; --pg-bullet: "\f061"; }
.rp-page { min-width: 0; }

/* Round icon badge (page header; the section h2 draws the same circle). */
.rp-icon-badge { flex: 0 0 auto; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--pg-tint-2); color: var(--pg-deep); display: inline-grid; place-items: center; font-size: 1rem; }

body.portal { color: var(--rp-ink); }

/* ---- cards ------------------------------------------------------------- */
.rp-card { border: 0; border-radius: var(--rp-radius); background: #fff; }
.rp-card .card-body { padding: 1.25rem; }
@media (min-width: 768px) { .rp-card .card-body { padding: 1.75rem; } }

.rp-hero {
    background: linear-gradient(135deg, var(--orga-primary, #0B5B48) 0%, var(--orga-secondary, #0A7F67) 100%);
    color: #fff;
    border-radius: var(--rp-radius);
}
.rp-hero .rp-kicker { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.rp-hero h1 { font-size: 1.45rem; font-weight: 700; margin: .25rem 0 .25rem; }
@media (min-width: 768px) { .rp-hero h1 { font-size: 1.9rem; } }
.rp-hero .rp-date { opacity: .85; font-size: .9rem; }
.rp-hero .rp-intro { opacity: .95; margin-top: .75rem; }
.rp-hero .btn-light { color: var(--orga-primary, #0B5B48); font-weight: 600; }

/* ---- score ring (inline SVG) ------------------------------------------ */
.rp-ring { width: 128px; height: 128px; display: block; margin: 0 auto; }
.rp-ring-bg { fill: none; stroke: rgba(255,255,255,.25); stroke-width: 10; }
.rp-ring-val { fill: none; stroke-width: 10; stroke-linecap: round; }
.rp-ring-good .rp-ring-val { stroke: #CFEFD9; }
.rp-ring-fair .rp-ring-val { stroke: var(--rp-gold); }
.rp-ring-low  .rp-ring-val { stroke: #F3B08A; }
.rp-ring-num { fill: #fff; font-size: 34px; font-weight: 700; }
.rp-ring-den { fill: rgba(255,255,255,.8); font-size: 13px; }
.rp-score-label { font-weight: 600; text-align: center; margin-top: .35rem; }

/* ---- severity bars (same scale as the PDF grid) ------------------------ */
.sev-grid { display: grid; grid-template-columns: 1fr; gap: .9rem 1.25rem; }
@media (min-width: 576px) { .sev-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 992px) { .sev-grid-3 { grid-template-columns: 1fr 1fr 1fr; } }
.sev-item { min-width: 0; }
.sev-label { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .92rem; margin-bottom: .3rem; }
.sev-label .sev-name { font-weight: 600; overflow-wrap: anywhere; }
.sev-label .sev-band { font-size: .78rem; color: var(--rp-muted); white-space: nowrap; }
.sev-track { position: relative; height: 16px; border-radius: 999px; background: var(--rp-track); overflow: hidden; }
.sev-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; display: flex; align-items: center; justify-content: flex-end; padding-right: .45rem; color: #fff; font-size: .72rem; font-weight: 700; min-width: 2.4rem; }
.sev-w-1 { width: 20%; } .sev-w-2 { width: 40%; } .sev-w-3 { width: 60%; } .sev-w-4 { width: 80%; } .sev-w-5 { width: 100%; }
.sev-fill.band-normal { background: #3F7D52; }
.sev-fill.band-mild { background: #7A9A3F; }
.sev-fill.band-moderate { background: #C98A2E; }
.sev-fill.band-severe { background: #B3452F; }
.sev-legend { font-size: .8rem; color: var(--rp-muted); margin-top: .75rem; }

/* ---- level dots for the DS-3 measurements (1-6 device level) ---------- */
.lvl-list { list-style: none; padding: 0; margin: 0; }
.lvl-item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid #eef1f0; }
.lvl-item:last-child { border-bottom: 0; }
.lvl-item .lvl-name { font-weight: 600; }
.lvl-item .lvl-value { font-size: .8rem; color: var(--rp-muted); }

/* ---- zone band grid (hair loss) --------------------------------------- */
.zone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (min-width: 768px) { .zone-grid { grid-template-columns: repeat(5, 1fr); } }
.zone-tile { border-radius: .85rem; overflow: hidden; background: #fff; border: 1px solid #e3e8e6; }
.zone-tile .zone-head { padding: .45rem .6rem; color: #fff; font-weight: 600; font-size: .85rem; }
.zone-tile .zone-body { padding: .55rem .6rem; font-size: .82rem; color: var(--rp-muted); }
.zone-tile .zone-body strong { color: var(--rp-ink); }
.zone-head.band-normal { background: #3F7D52; }
.zone-head.band-mild { background: #7A9A3F; }
.zone-head.band-moderate { background: #C98A2E; }
.zone-head.band-severe { background: #B3452F; }

/* ---- page tiles on the cover ------------------------------------------ */
.rp-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (min-width: 768px) { .rp-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .rp-tiles { grid-template-columns: repeat(5, 1fr); } }
.rp-tile { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; border-radius: .9rem; background: #fff; color: inherit; text-decoration: none; border: 1px solid #e3e8e6; transition: transform .12s ease, box-shadow .12s ease; min-height: 7.5rem; }
.rp-tile:hover, .rp-tile:focus-visible { transform: translateY(-2px); box-shadow: 0 .5rem 1.25rem rgba(11,91,72,.12); color: inherit; }
.rp-tile { border-top: 3px solid var(--pg-accent); }
.rp-tile .rp-tile-icon { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--pg-tint-2); color: var(--pg-deep); display: grid; place-items: center; font-size: 1rem; }
.rp-tile .rp-tile-title { font-weight: 700; }
.rp-tile .rp-tile-lead { font-size: .8rem; color: var(--rp-muted); }
.rp-tile .rp-tile-n { font-size: .72rem; color: var(--rp-muted); margin-top: auto; }

/* ---- sticky page navigation ------------------------------------------- */
.rp-nav { position: sticky; top: 0; z-index: 20; background: var(--orga-light, #f7fafc); padding: .5rem 0; margin: 0 calc(var(--bs-gutter-x, 1.5rem) * -.5) .75rem; }
.rp-nav-scroll { display: flex; gap: .4rem; overflow-x: auto; padding: 0 calc(var(--bs-gutter-x, 1.5rem) * .5); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rp-nav-scroll::-webkit-scrollbar { display: none; }
.rp-pill { flex: 0 0 auto; white-space: nowrap; border-radius: 999px; padding: .4rem .85rem; font-size: .88rem; font-weight: 600; color: var(--orga-primary, #0B5B48); background: #fff; border: 1px solid #d7e3df; text-decoration: none; }
.rp-pill:hover { background: var(--rp-green-soft); color: var(--orga-primary, #0B5B48); }
.rp-pill.active { background: var(--orga-primary, #0B5B48); color: #fff; border-color: var(--orga-primary, #0B5B48); }
.rp-pill .fa-solid, .rp-pill .fas { margin-right: .35rem; }
@media (min-width: 992px) { .rp-nav { display: none; } }

.rp-side { position: sticky; top: 1rem; }
.rp-side .rp-side-link { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-radius: .7rem; color: var(--rp-ink); text-decoration: none; font-weight: 600; }
.rp-side .rp-side-link:hover { background: var(--rp-green-soft); }
.rp-side .rp-side-link.active { background: var(--orga-primary, #0B5B48); color: #fff; }
.rp-side .rp-side-link .rp-side-n { margin-left: auto; font-size: .75rem; opacity: .7; }

/* Section-page header band: the page tint with its accent edge. */
.rp-page-head { margin-bottom: 1rem; padding: .9rem 1rem; background: var(--pg-tint); border-left: 4px solid var(--pg-accent); border-radius: var(--rp-radius); }
@media (min-width: 768px) { .rp-page-head { padding: 1.1rem 1.5rem; } }
.rp-page-head .rp-kicker { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--rp-muted); }
.rp-page-head h1 { font-size: 1.5rem; font-weight: 700; margin: .25rem 0 0; display: flex; align-items: center; gap: .65rem; }
.rp-page-head .rp-lead { color: var(--rp-muted); margin-top: .35rem; }

.rp-pager { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.rp-pager .btn { flex: 1 1 0; }

/* ---- sections ---------------------------------------------------------- */
/* A section card takes its page's tint and a 4px accent edge. */
.rp-card.rp-section { background: var(--pg-tint); border-left: 4px solid var(--pg-accent); overflow-wrap: break-word; }
.rp-section h2 { font-size: 1.15rem; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.rp-section > .card-body > h2:not(.rp-h2-own)::before { content: var(--pg-icon, none); font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .8rem; flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 50%; background: var(--pg-tint-2); color: var(--pg-deep); display: inline-grid; place-items: center; }

/* Long text: readable measure, airy leading, paragraphs apart. */
.rp-section p { line-height: 1.6; max-width: 68ch; margin-bottom: .75rem; }
.rp-section p:last-child { margin-bottom: 0; }
/* h3 inside a section is a small-caps kicker, like .rp-kicker. */
.rp-section h3 { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rp-muted); margin: 1.1rem 0 .5rem; }
.rp-section .sev-track { background: #fff; box-shadow: inset 0 0 0 1px var(--pg-tint-2); }
.rp-section .rp-callout { background: #fff; border-left-color: var(--pg-accent); }

/* Exclusive accordions (name="rp-acc"): tinted header row, round chevron
   badge before the title, accent border on the open one, body on white. */
details.rp-acc { border: 1px solid var(--pg-tint-2); border-radius: .8rem; padding: 0; margin-bottom: .6rem; background: #fff; overflow: hidden; scroll-margin-top: 4.5rem; }
@media (min-width: 992px) { details.rp-acc { scroll-margin-top: 1rem; } }   /* the pill bar is hidden */
details.rp-acc[open] { border-color: var(--pg-accent); }
details.rp-acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; font-weight: 600; background: var(--pg-tint-2); color: var(--rp-ink); }
details.rp-acc > summary::-webkit-details-marker { display: none; }
details.rp-acc > summary::before { content: "\f054"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .65rem; flex: 0 0 auto; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #fff; color: var(--pg-deep); display: grid; place-items: center; transition: transform .15s ease; }
details.rp-acc[open] > summary::before { transform: rotate(90deg); background: var(--pg-accent); color: #fff; }
details.rp-acc > summary:focus-visible { outline: 3px solid var(--pg-accent); outline-offset: -3px; }
details.rp-acc > .rp-acc-body { padding: 1rem; background: #fff; }
details.rp-acc > .rp-acc-body p:last-child { margin-bottom: 0; }

.rp-img { display: block; aspect-ratio: 1 / 1; width: 100%; object-fit: cover; border-radius: .8rem; background: #eef1f0; }
.rp-img-caption { font-size: .8rem; color: var(--rp-muted); text-align: center; margin-top: .3rem; }
.rp-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.rp-thumbs > a, .rp-tiles > a, .zone-grid > div, .sev-grid > div { min-width: 0; }
.rp-thumbs .rp-img { border-radius: .6rem; }

.rp-timeline { list-style: none; padding: 0 0 0 1.25rem; margin: 0; border-left: 3px solid var(--pg-tint-2); }
.rp-timeline li { position: relative; padding: 0 0 .9rem .5rem; }
.rp-timeline li::before { content: ""; position: absolute; left: calc(-1.25rem - 3px - 5px); top: .35rem; width: 13px; height: 13px; border-radius: 50%; background: var(--pg-accent); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--pg-tint-2); }
.rp-timeline .rp-when { font-weight: 700; text-transform: capitalize; }

.rp-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.rp-steps li { counter-increment: step; display: flex; gap: .75rem; padding: .45rem 0; }
.rp-steps li::before { content: counter(step); flex: 0 0 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--pg-tint-2); color: var(--pg-deep); font-weight: 700; display: grid; place-items: center; font-size: .85rem; }

.rp-callout { background: var(--rp-gold-soft); border-left: 4px solid var(--rp-gold); border-radius: .6rem; padding: .8rem 1rem; }
.rp-glance-title { font-size: .95rem; font-weight: 700; margin-bottom: .6rem; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.rp-glance-title a { font-size: .82rem; font-weight: 600; }
/* Key findings and next steps: a list of white chips, check or arrow icon. */
.rp-findings { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.rp-findings li { position: relative; margin: 0; padding: .65rem .85rem .65rem 2.75rem; background: #fff; border: 1px solid var(--pg-tint-2); border-radius: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
.rp-findings li::before { content: var(--pg-bullet, "\f00c"); font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .7rem; position: absolute; left: .75rem; top: .65rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--pg-tint-2); color: var(--pg-deep); display: grid; place-items: center; }
.rp-disclaimer { font-size: .8rem; color: var(--rp-muted); }
