/* Longevello health tools. Loaded only by tool pages (and published only while a tool is built). */
.tool{margin-top:8px;background:var(--paper);border-radius:var(--r-md);box-shadow:0 0 0 1px var(--line);padding:22px 18px 24px}
.tool-nojs{margin:0;font-size:16px;color:var(--muted)}
.tool-form{display:grid;gap:18px}
.tool-form fieldset{border:0;margin:0;padding:0;min-width:0}
.tool-form legend,.tf>label,.tf-sub label{display:block;font-weight:600;font-size:16px;color:var(--ink);margin-bottom:8px;padding:0}
.tf-row{display:flex;gap:12px;flex-wrap:wrap}
.tf-sub{flex:1 1 120px;min-width:0}
.tf-sub label{font-weight:500;font-size:15px;margin-bottom:6px}
.tf-u{font-weight:400;color:var(--muted)}
.tool-form input[type=text],.tool-form select{display:block;width:100%;max-width:340px;min-height:48px;padding:10px 14px;font:inherit;font-size:18px;color:var(--ink);background:#fff;border:1.5px solid var(--line);border-radius:12px}
.tool-form select{max-width:100%;font-size:16px}
.tool-form input[type=text]:focus,.tool-form select:focus{outline:3px solid var(--saffron);outline-offset:1px;border-color:var(--forest)}
.tool-form [aria-invalid=true]{border-color:var(--terracotta-text)}
.tf-opts{display:flex;flex-wrap:wrap;gap:8px 18px}
.tf-opt{display:inline-flex;align-items:center;gap:9px;min-height:44px;font-size:16px;cursor:pointer}
.tf-opt input{width:20px;height:20px;margin:0;accent-color:var(--forest)}
.tf-hint{margin:6px 0 0;font-size:14.5px;color:var(--muted)}
.tf-err{margin:8px 0 0;font-size:15px;font-weight:600;color:var(--terracotta-text)}
.tf-err[hidden]{display:none}
.tool-btns{display:flex;flex-wrap:wrap;gap:12px;align-items:center}
.tool-btn{min-height:48px;padding:12px 26px;border:0;border-radius:999px;background:var(--forest);color:var(--cream);font:inherit;font-weight:600;font-size:16px;cursor:pointer}
.tool-btn:hover{background:var(--forest-deep)}
.tool-btn:focus-visible,.tool-reset:focus-visible{outline:3px solid var(--saffron);outline-offset:2px}
.tool-reset{min-height:44px;padding:10px 16px;border:0;background:none;color:var(--forest);font:inherit;font-size:15px;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.tool-result:empty{display:none}
.tool-result{margin-top:20px}
.tr-box{border-top:2px solid var(--forest);padding-top:16px}
.tr-head{margin:0;font-family:var(--display);font-size:26px;line-height:1.2;letter-spacing:-.01em;color:var(--forest-deep)}
.tr-lines{margin:12px 0 0;padding-left:1.2em;font-size:17px;line-height:1.55}
.tr-lines li+li{margin-top:8px}
.tr-lines li::marker{color:var(--terracotta)}
.tr-lines a{color:var(--forest);font-weight:600}
.tr-note{margin:12px 0 0;font-size:15px;color:var(--muted)}
.tool-privacy{margin:16px 0 0;font-size:14.5px;color:var(--muted)}
.tool-list{list-style:none;margin:8px 0 0;padding:0;border-bottom:1px solid var(--line)}
.tool-list li{border-top:1px solid var(--line)}
.tool-list li+li{margin-top:0}
.tool-list a{display:block;min-height:44px;padding:16px 6px;text-decoration:none;color:var(--ink);border-radius:8px}
.tool-list a:hover{background:var(--paper)}
.tool-list .tl-t{display:block;font-family:var(--display);font-size:22px;line-height:1.25;color:var(--forest)}
.tool-list a:hover .tl-t{text-decoration:underline;text-underline-offset:4px}
.tool-list .tl-a{display:block;margin-top:4px;font-size:16px;line-height:1.5;color:var(--muted)}
.t-quote{font-style:italic}
.t-info{margin-top:40px;font-size:15.5px;color:var(--muted)}
@media (min-width:640px){.tool{padding:28px 30px 30px}}
[dir=rtl] .tf-opt input{margin:0}
[dir=rtl] .tr-lines{padding-left:0;padding-right:1.2em}
.tf>label.tf-opt{display:inline-flex;font-weight:400;margin:0}
/* Shared result charts and private export actions. */
.tr-charts{margin-top:24px;min-width:0}
.tr-chart{margin:12px 0;min-width:0;break-inside:auto}
.tr-chart figcaption{font-weight:600;font-size:16px;overflow-wrap:anywhere}
.tr-chart svg{display:block;width:100%;max-width:560px;height:auto;margin:8px auto;overflow:visible;font:12px var(--body, sans-serif);color:var(--ink)}
.tr-chart svg text{fill:var(--ink)}
.tr-track,.tr-grid-bg{fill:#e9eceb;stroke:#9ca8a3}
.tr-band{stroke:#fff;stroke-width:.8}
.tr-tone-low{fill:#a7bbc7}
.tr-tone-healthy{fill:#90bc9a}
.tr-tone-caution{fill:#e5bd58}
.tr-tone-high{fill:#df976b}
.tr-tone-higher{fill:#8b493b}
.tr-chart svg .tr-zone-label{paint-order:stroke;stroke:#fff;stroke-width:3;stroke-linejoin:round;fill:#172b24;font-size:11px}
.tr-marker{stroke:#142b24;stroke-width:2;fill:#fff}
.tr-marker-tip{fill:#142b24}
.tr-grid-line{stroke:#53675d;stroke-width:.5;stroke-dasharray:3 3}
.tr-label-line{stroke:#596b62;stroke-width:.65;fill:none}
.tr-inside-label{font-size:12px;font-weight:600}
.tr-chart svg .tr-light-label{fill:#fff}
.tr-segment-label{font-size:12px;font-weight:600}
.tr-date-label{font-size:10px}
.tr-cutoff,.tr-axis-end,.tr-event-index{font-size:10px}
.tr-marker-label{font-size:12px;font-weight:600}
.tr-actions{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin-top:24px}
.tr-export-privacy{flex-basis:100%;margin:0;font-size:14px;color:var(--muted)}
.tr-print-meta{display:none}
@media print{
  @page{margin:16mm;size:A4}
  html,body{background:#fff!important;color:#172b24!important;font-size:11pt!important}
  body>*:not(main),main>*:not(.p-body),.p-body>.wrap>*:not(.tool):not(.page-prose),
  .tool>*:not(#tool-result),.page-prose>*:not(#sources):not(.t-info),.tr-actions{display:none!important}
  .p-body,.wrap,.p-col,.tool,.tool-result,.page-prose{display:block!important;width:auto!important;max-width:none!important;margin:0!important;padding:0!important;box-shadow:none!important;border:0!important}
  .tr-print-meta{display:block!important}
  .tr-print-meta h1{font-size:20pt;margin:8px 0}
  .tr-print-meta p{margin:6px 0;overflow-wrap:anywhere}
  .tr-head{font-size:18pt}
  .tr-box{border:0}
  .tr-lines{font-size:11pt}
  .tr-chart svg{max-width:420px;print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .tr-chart{break-inside:auto;page-break-inside:auto;break-before:avoid;page-break-before:avoid}
  .tr-head,.tr-meaning-title,.tr-meaning,.tr-lines,.tr-lines li,.tr-chart figcaption{break-after:avoid;page-break-after:avoid}
  .tr-charts{break-before:avoid;page-break-before:avoid;margin-top:12px}
  .tr-chart svg{break-inside:avoid;page-break-inside:avoid}
  .tr-data-table{break-inside:auto;page-break-inside:auto}
  .tr-data-table tr{break-inside:avoid;page-break-inside:avoid}
  .tr-meaning-title{font-size:13pt;margin:10px 0 5px}
  .tr-meaning{margin:5px 0;font-size:11pt}
  .tr-lines{margin-top:6px;line-height:1.35}
  .tr-lines li+li{margin-top:4px}
  #sources,.t-info{display:block!important;font-size:10pt}
  #sources a{overflow-wrap:anywhere}
  #sources a::after{content:' (' attr(href) ')';font-size:9pt}
}

/* BP legends use the same palette as the classified grid cells. */
.tr-grid-legend{list-style:none;padding:0;margin:0 auto 16px;max-width:560px;display:flex;flex-wrap:wrap;gap:8px 16px;font-size:14px;line-height:1.5}
.tr-grid-legend li{display:flex;align-items:center;gap:8px;max-width:100%}
.tr-swatch{display:inline-block;flex:0 0 16px;width:16px;height:16px;border:1px solid #596b62}
.tr-swatch-low{background:#a7bbc7}.tr-swatch-healthy{background:#90bc9a}.tr-swatch-caution{background:#e5bd58}.tr-swatch-high{background:#df976b}.tr-swatch-higher{background:#8b493b}
.tr-zone.tr-shade-severe{fill:#593650}.tr-swatch.tr-shade-severe{background:#593650}
.tr-unclassified{fill:#e9eceb}
@media print{.tr-swatch{print-color-adjust:exact;-webkit-print-color-adjust:exact}}

/* Neutral arithmetic charts: colours carry no health rating. */
.tr-tone-neutral{fill:#a7bbc7}.tr-tone-secondary{fill:#d1d8dc}
.tr-data-table{width:100%;margin-top:1rem;font-size:.9rem;border-collapse:collapse}
.tr-data-table caption{text-align:start;font-weight:600}
.tr-data-table th,.tr-data-table td{padding:.35rem;text-align:start;overflow-wrap:anywhere}
.tr-data-table td{font-variant-numeric:tabular-nums}
.tr-input-summary{overflow-wrap:anywhere;font-size:.9rem}
.tool-form input[type=text]{direction:ltr;text-align:start}
.tr-box [dir=ltr]{unicode-bidi:isolate}

/* Keep the batch 2 graphic on a print page; let its factual table flow after it. */
@media print{
  .tr-batch2{break-inside:auto}
  .tr-batch2 svg{max-width:320px;break-inside:avoid;page-break-inside:avoid}
  .tr-batch2 .tr-data-table{break-inside:auto}
  .tr-batch2 .tr-data-table tr{break-inside:avoid}
}
