/* Report mode: role views, triage tiles, charts, visit list, print. Tokens come from app.css. */
#report{--t-urgent:#FFD21F;--t-important:#CFAB24;--t-backlog:#9C872E;--t-wait:#746F4E;--t-hatch:#FFD21F;--s1:#BF9800}

/* header */
#report .rp-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:12px 24px;margin-bottom:16px}
#report .rp-head h2{margin:4px 0 6px}
#report .rp-ctl,#report .rp-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
#report .blk>h3.mono{margin-bottom:var(--s-3)}
#report h4.mono{margin-bottom:6px}

/* layout: 7 + 5 on a wide sheet, one column on a narrow one */
#report .rp-a{grid-column:span 7}
#report .rp-b{grid-column:span 5}
#report .rp-first{grid-row:span 2}
/* Field crew: route and visit list on the left, the checks in the right column beside them. */
#report .rp-list,#report .rp-route{grid-column:1 / span 9}
#report .rp-before{grid-column:10 / span 3;grid-row:1}
#report .rp-grid:has(.rp-route) .rp-before{grid-row:1 / span 2}
#report .rp-grid>.empty{grid-column:span 12}
/* triage classes: one hue, brighter means more urgent. The label is always printed beside the swatch. */
#report .rp-sw{display:inline-block;flex:none;width:12px;height:12px;border-radius:2px}
#report .rp-urgent{background:var(--t-urgent)}
#report .rp-important{background:var(--t-important)}
#report .rp-backlog{background:var(--t-backlog)}
#report .rp-wait{background:var(--t-wait)}
#report .rp-check{background:repeating-linear-gradient(135deg,var(--t-hatch) 0 1.5px,transparent 1.5px 5px);outline:1.3px dashed var(--t-hatch);outline-offset:-1.3px}

/* brief */
#report .rp-brief{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:8px 40px;align-items:start}
#report .rp-headline{font:400 clamp(1.75rem,1rem + 1.25vw,2.25rem)/1.06 var(--font-serif);letter-spacing:-.01em;text-wrap:balance}
#report .rp-headline-xl{font-size:clamp(1.875rem,.9rem + 1.6vw,2.5rem)}

/* tiles and share bar */
#report .rp-tiles{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
#report .rp-tile{display:flex;flex-direction:column;gap:3px;padding:12px 14px}
#report .rp-tile-h{display:flex;align-items:center;gap:8px;font:600 .8125rem/1.2 var(--font-sans)}
#report .rp-tile b{font:300 2.75rem/1 var(--font-sans);letter-spacing:-.03em;margin:8px 0 2px}
#report .rp-tile b small,#report .rp-figs b small{font:400 .6875rem/1 var(--font-mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-2);margin-left:8px}
#report .rp-tile-ha{font:500 .9375rem/1.2 var(--font-sans)}
#report .rp-tile-park{font-size:.75rem;color:var(--ink-2)}
#report .rp-share{margin-top:var(--s-4)}
#report .rp-share-bar{display:flex;gap:2px;align-items:flex-end}
#report .rp-seg{display:flex;flex-direction:column;gap:4px;min-width:4px}
#report .rp-seg-l{display:block;height:1rem;font:500 .75rem/1rem var(--font-sans);color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#report .rp-seg i{display:block;height:20px;border-radius:2px}
#report .rp-seg:first-child i{border-radius:4px 2px 2px 4px}
#report .rp-seg:last-child i{border-radius:2px 4px 4px 2px}
#report .rp-legend{margin:10px 0 0;gap:4px 20px}
#report .rp-legend b{font-weight:500;color:var(--ink-2)}
#report .num,#report .rp-out b,#report .rp-counts b,#report .rp-figs b{font-variant-numeric:tabular-nums}

/* do first */
#report .rp-do li{display:grid;grid-template-columns:28px minmax(0,1fr) auto;gap:4px 12px;align-items:start;padding:14px 0;box-shadow:inset 0 -1px 0 var(--ring)}
#report .rp-do li:first-child{padding-top:2px}
#report .rp-do li:last-child{box-shadow:none;padding-bottom:2px}
#report .rp-rank{font:300 1.875rem/1 var(--font-sans);letter-spacing:-.03em}
#report .rp-do-h{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;min-height:24px}
#report .rp-do-h b{font:600 1rem/1.2 var(--font-sans);font-variant-numeric:tabular-nums}
#report .rp-do-h>.num{font-size:.875rem}
#report .rp-why{font-size:.8125rem;line-height:1.4;color:var(--ink-2);margin-top:2px}
#report .rp-kv{margin:8px 0 0;display:grid;gap:4px}
#report .rp-kv>div{display:grid;grid-template-columns:52px minmax(0,1fr);gap:10px;align-items:baseline}
#report .rp-kv dt,#report .rp-kv dd{margin:0}
#report .rp-kv dd{font-size:.8125rem;line-height:1.4;text-wrap:pretty}

/* effort */
#report .rp-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px}
#report .rp-field{display:flex;flex-direction:column;gap:4px;min-width:0}
#report .rp-field label{display:flex;justify-content:space-between;align-items:baseline;gap:8px;font-size:.8125rem;cursor:pointer}
#report .rp-field .mono{font-size:.625rem}
#report .rp-field input{width:100%;min-height:var(--hit);padding:0 10px;border:0;border-radius:var(--r-control);background:rgba(255,255,255,.05);box-shadow:var(--inner-ring);color:var(--ink);font:500 .9375rem/1 var(--font-sans);font-variant-numeric:tabular-nums;transition:box-shadow var(--t-state) var(--ease),background-color var(--t-state) var(--ease)}
#report .rp-field input:hover{box-shadow:inset 0 0 0 1px var(--ink-3)}
#report .rp-field input:active{background:rgba(255,255,255,.09)}
#report .rp-field input::placeholder{color:var(--ink-2);font-weight:400;font-size:.8125rem}
#report .rp-out{display:block;margin-top:var(--s-3)}
#report .rp-out>span{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 12px;align-items:baseline;padding:8px 0;box-shadow:inset 0 -1px 0 var(--ring)}
#report .rp-out>span:last-child{box-shadow:none}
#report .rp-out>span>span{font-size:.8125rem;line-height:1.35}
#report .rp-out b{grid-row:span 2;align-self:center;font:500 1.5rem/1.1 var(--font-sans);letter-spacing:-.02em;text-align:right;white-space:nowrap}
#report .rp-out small{font-size:.75rem;color:var(--ink-2)}

/* trend counts, charts, captions */
#report .rp-counts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin-bottom:var(--s-3)}
#report .rp-counts>div{display:flex;flex-direction:column;gap:2px;padding:8px 10px;border-radius:var(--r-card);background:rgba(24,33,28,.72);box-shadow:var(--inner-ring)}
#report .rp-counts b{font:500 1.375rem/1.1 var(--font-sans);letter-spacing:-.02em}
#report .rp-counts span:not(.mono){font-size:.75rem;line-height:1.25}
#report .rp-chart,#report .rp-svg{min-width:0}
#report .rp-svg{min-height:180px}
#report .rp-chart svg{touch-action:pan-y;cursor:crosshair}
#report .rp-chart svg:focus{outline:none}
#report .rp-chart svg:focus-visible{outline:2px solid var(--gorse);outline-offset:4px;border-radius:var(--r-control)}
#report .rp-chart text{font-size:.6875rem}
#report .rp-chart .val{font-size:.75rem;paint-order:stroke;stroke:var(--ground);stroke-width:3px;stroke-linejoin:round}
#report .rp-pt{stroke:var(--ground);stroke-width:1.5}
#report .rp-pt-open{fill:var(--ground)}
#report .rp-cursor{stroke:var(--ink);stroke-width:1;stroke-opacity:.45;pointer-events:none}
#report .chart-legend i.rp-dash{background:none;height:0;border-top:2px dashed currentColor}
#report .chart-legend i.rp-band{opacity:.3;width:14px}
#report .rp-cap{font-size:.75rem;line-height:1.4;color:var(--ink-2);margin-top:6px;text-wrap:pretty}
#report .rp-warn{font-size:.8125rem;line-height:1.4;color:var(--ink);padding:8px 10px;border-radius:var(--r-control);background:rgba(255,255,255,.04);box-shadow:var(--inner-ring);text-wrap:pretty}
#report .checks+.rp-warn,#report .empty+.rp-warn{margin-top:var(--s-3)}

/* history */
#report .rp-hist{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,5fr);gap:16px 40px;align-items:start}
#report .rp-flows{margin-top:var(--s-4)}
#report .rp-flow{margin-top:var(--s-3)}
#report .rp-flow ul{display:grid;gap:6px}
#report .rp-flow li{display:grid;grid-template-columns:minmax(0,12rem) minmax(40px,1fr) 4.75rem;gap:10px;align-items:center;font-size:.8125rem;line-height:1.3}
#report .rp-flow li>.num{text-align:right}
#report .rp-bar{display:block;height:10px}
#report .rp-bar i{display:block;height:100%;min-width:2px;border-radius:0 4px 4px 0;background:var(--s1)}

/* tables */
#report .rp-tbl th{position:static;background:transparent;text-align:right;vertical-align:bottom;padding:0 10px 6px;height:auto}
#report .rp-tbl td{height:auto;padding:8px 10px;text-align:right;vertical-align:top;line-height:1.35}
#report .rp-tbl tbody th{font:600 .8125rem/1.35 var(--font-sans);letter-spacing:0;text-transform:none;color:var(--ink);padding:8px 10px;vertical-align:top;font-variant-numeric:tabular-nums;box-shadow:inset 0 -1px 0 rgba(255,255,255,.05)}
#report .rp-tbl tbody th i{display:block;font-weight:400;color:var(--ink-2)}
#report .rp-tbl .l{text-align:left}
#report .rp-tbl .n{white-space:nowrap}
#report .rp-tbl .w{min-width:9rem;text-wrap:pretty}
#report .rp-visit .c-how{width:34%}
#report .rp-visit .c-where,#report .rp-visit .c-chk{width:19%}
#report .rp-tbl th:first-child,#report .rp-tbl td:first-child{padding-left:0}
#report .rp-tbl .geo{font:400 .75rem/1.5 var(--font-mono);white-space:nowrap}
#report .rp-tbl .badge{white-space:nowrap}
#report .rp-tbl td.tick{padding:2px 4px 2px 0;width:32px}
#report .rp-tbl td.tick label{display:grid;place-items:center;min-width:28px;min-height:32px;cursor:pointer;border-radius:var(--r-control)}
#report .rp-tbl input[type=checkbox]{width:18px;height:18px;margin:0;cursor:pointer;transition:scale var(--t-press) var(--ease)}
#report .rp-tbl td.tick label:hover{background:rgba(255,255,255,.06)}
#report .rp-tbl tr.is-done>:not(.tick):not(.rp-noprint){opacity:.5}
#report .rp-tbl td .btn{min-height:28px;min-width:44px;padding:0 10px;font-size:.75rem}
#report .rp-tbl td.rp-noprint{padding:6px 0 6px 6px}
#report .rp-link{display:inline-grid;place-items:center;width:28px;height:28px;margin:-5px 0;border-radius:var(--r-control);color:var(--ink-2);transition:color var(--t-state) var(--ease),background-color var(--t-state) var(--ease),scale var(--t-press) var(--ease)}
#report .rp-link:hover{color:var(--gorse);background:rgba(255,255,255,.05)}
#report .rp-link:active{opacity:.8}

/* visit list */
#report .rp-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin-bottom:var(--s-3)}
#report .rp-chips{display:flex;flex-wrap:wrap;gap:6px}
#report .rp-count{font-size:.8125rem;color:var(--ink-2)}
#report .rp-tools .rp-actions{margin-left:auto}
#report .rp-before .checks b{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 8px}
#report .rp-before .checks small{font-size:.625rem}

/* route for the first units */
#report .rp-route .rp-figs{margin-bottom:var(--s-3)}
#report .rp-route .rp-figs b{font-size:2rem}
#report .rp-rt{margin-top:var(--s-3)}
#report .rp-rt td{font-variant-numeric:tabular-nums}
#report .rp-rt td:first-child{width:3.5rem}
#report .rp-rt-line{font-size:.8125rem;line-height:1.4;margin-top:var(--s-3)}
#report .rp-rt-plan{font-size:.9375rem;font-weight:600;text-wrap:pretty}
#report .rp-route .rp-how{margin-top:var(--s-1)}
#report .rp-route .rp-how .lines{padding-bottom:var(--s-1)}
#report .rp-route .rp-actions{margin-top:var(--s-3)}

/* funder */
#report .rp-top-in{display:grid;grid-template-columns:minmax(0,5fr) minmax(0,7fr);gap:16px 40px;align-items:start;margin-bottom:var(--s-2)}
#report .rp-figs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:20px 24px}
#report .rp-figs>div{display:flex;flex-direction:column;gap:6px;padding-top:var(--s-3);box-shadow:inset 0 1px 0 var(--ring)}
#report .rp-figs b{font:300 2.75rem/1 var(--font-sans);letter-spacing:-.03em;white-space:nowrap}
#report .rp-fig-sub{font-size:.8125rem;color:var(--ink-2)}
#report .rp-steps{counter-reset:step;display:grid;gap:8px}
#report .rp-steps li{counter-increment:step;display:grid;grid-template-columns:24px minmax(0,1fr);gap:10px;align-items:baseline;font-size:.875rem;line-height:1.4;text-wrap:pretty}
#report .rp-steps li::before{content:counter(step);font:400 .6875rem/1 var(--font-mono);color:var(--ink-2)}
#report .rp-next-row{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:flex-end;gap:12px 24px}
#report .rp-next li{font-size:1rem}

/* how the ranking works */
#report .rp-how summary{display:flex;align-items:center;gap:10px;width:fit-content;min-height:var(--hit);padding:0 10px 0 2px;border-radius:var(--r-control);cursor:pointer;list-style:none;font:600 .875rem/1.2 var(--font-sans);color:var(--ink);transition:color var(--t-state) var(--ease),scale var(--t-press) var(--ease)}
#report .rp-how summary::-webkit-details-marker{display:none}
#report .rp-how summary::before{content:"";flex:none;width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;rotate:-45deg}
#report .rp-how[open]>summary::before,#report .rp-how.is-open>summary::before{rotate:45deg}
#report .rp-how summary:hover{color:var(--gorse-bright)}
#report .rp-how summary:active{opacity:.8}
#report .rp-how-in{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px 40px;padding:8px 0 4px}
#report .rp-rules>div{grid-template-columns:116px minmax(0,1fr)}
#report .rp-value{font-size:.8125rem;line-height:1.4;margin-top:var(--s-3)}

/* Narrow sheets. These follow the base rules above so that they win at equal specificity. */
@container sheet (inline-size <= 1328px){
  #report .rp-list,#report .rp-before,#report .rp-route{grid-column:span 12}
  #report .rp-before,#report .rp-grid:has(.rp-route) .rp-before{order:-1;grid-row:auto}
  #report .rp-before .checks{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:0 20px}
  #report .rp-before .checks li{box-shadow:none;padding:4px 0}
}
@container sheet (inline-size < 60rem){
  #report .rp-a,#report .rp-b{grid-column:span 12}
  #report .rp-first{grid-row:auto}
  #report .rp-brief,#report .rp-hist,#report .rp-how-in,#report .rp-top-in{grid-template-columns:minmax(0,1fr)}
  #report .rp-tiles{grid-template-columns:repeat(3,minmax(0,1fr))}
  #report .rp-figs{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (pointer:coarse){
  #report .rp-tbl td .btn,#report .rp-tbl td.tick label{min-height:44px;min-width:44px}
  #report .rp-link{width:44px;height:44px}
}
@media (prefers-reduced-motion:no-preference){
  #report .rp-how summary:active,#report .rp-link:active{scale:.96}
  #report .rp-tbl input[type=checkbox]:active{scale:.9}
}
@media (forced-colors:active){
  #report .rp-sw,#report .rp-seg i,#report .rp-bar i{forced-color-adjust:none}
  #report .rp-field input,#report .rp-counts>div,#report .rp-warn{border:1px solid CanvasText}
}

/* Print: the report only, dark text on white. Variables are overridden so every rule above follows. */
@page{margin:12mm}
@page rp-wide{size:A4 landscape;margin:12mm}
@media print{
  html,body{overflow:visible;height:auto}
  /* The page margins take the canvas colour, which follows the colour scheme of the root: without this they print dark. */
  html:has(body[data-mode="report"]){color-scheme:light;background:#fff}
  body[data-mode="report"]{--ground:#fff;--glass:#fff;--raised:#F1F3EF;--ring:rgba(0,0,0,.18);--ink:#10140F;--ink-2:#3C443D;--ink-3:#5C665E;--grid:rgba(0,0,0,.14);--shadow:0 0 0 0 transparent;--inner-ring:inset 0 0 0 1px rgba(0,0,0,.18);background:#fff;color:var(--ink);color-scheme:light;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  body[data-mode="report"] :not(#report,#report *,:has(#report)){display:none!important}
  body[data-mode="report"] :has(#report){position:static;overflow:visible;height:auto;translate:none;transform:none}
  body[data-mode="report"] #report{position:static;inset:auto;overflow:visible;opacity:1;visibility:visible;translate:none;--t-hatch:#7A6200}
  body[data-mode="report"] #report[data-role="crew"]{page:rp-wide}
  #report .sheet-in{max-width:none;padding:0}
  #report .sheet-in.stagger>*{animation:none}
  #report .rp-ctl,#report .btn,#report .rp-chips,#report .rp-noprint,#report .rp-seg-l{display:none!important}
  #report details::details-content{content-visibility:visible}
  #report .cols{display:block}
  /* Field crew: the checks print before the visit list. The columns become a flex column so that order applies. */
  #report[data-role="crew"] .cols{display:flex;flex-direction:column}
  #report[data-role="crew"] .rp-before{order:-1}
  #report .blk{break-inside:avoid;margin:0 0 10px;-webkit-backdrop-filter:none;backdrop-filter:none;background:#fff}
  #report .rp-first,#report .rp-list,#report .rp-route{break-inside:auto}
  /* Route: the table stays on one page. Figures and rows are set smaller so that it fits under the checks on page 1. */
  #report .rp-rt{break-inside:avoid;margin-top:6px}
  #report .rp-route .rp-figs{gap:8px 16px;margin-bottom:6px}
  #report .rp-route .rp-figs>div{gap:3px;padding-top:8px}
  #report .rp-route .rp-figs b{font-size:1.5rem}
  #report .rp-rt .badge{min-height:16px}
  #report .rp-route .rp-how summary{min-height:0;padding:6px 0 2px}
  /* A card that may break across pages keeps its heading with the content after it. */
  #report .blk>:first-child{break-after:avoid}
  #report .rp-do li,#report tr,#report .rp-tile,#report .rp-flow,#report .rp-figs>div,#report .rp-chart{break-inside:avoid}
  #report .card,#report .rp-counts>div{background:#fff}
  #report .rp-warn,#report .rp-field input{background:#fff}
  #report .note{color:var(--ink-2)}
  #report .tbl{overflow:visible}
  #report .rp-tbl .w{min-width:0}
  #report .rp-tbl td,#report .rp-tbl tbody th{padding:5px 6px;font-size:.75rem}
  #report .rp-tbl th{padding:0 6px 4px}
  #report .rp-rt td,#report .rp-rt tbody th{padding:2px 6px}
  /* In a PDF a one-sided inset shadow comes out with hairlines down both sides of the box, so separators print as borders. */
  #report .rp-tbl td,#report .rp-tbl tbody th{box-shadow:none;border-bottom:1px solid rgba(0,0,0,.14)}
  #report .rp-do li,#report .rp-out>span{box-shadow:none;border-bottom:1px solid rgba(0,0,0,.18)}
  #report .rp-do li:last-child,#report .rp-out>span:last-child{border-bottom:0}
  #report .rp-figs>div{box-shadow:none;border-top:1px solid rgba(0,0,0,.18)}
  /* The funder view prints on one page: the four figures stay in one row at a smaller size. */
  #report[data-role="funder"] .rp-figs{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px 16px}
  #report[data-role="funder"] .rp-figs b{font-size:2rem}
  #report .rp-tbl tr.is-done>*{opacity:1}
  #report .rp-chart svg{cursor:auto}
  #report h2{font-size:2.25rem}
  #report a{text-decoration:none}
}
