:root {
  --lab-navy: #0d3767;
  --lab-ink: #17324d;
  --lab-muted: #52687b;
  --lab-teal: #237767;
  --lab-line: #dce5ed;
  --lab-paper: #f3f6fa;
}
* { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; color: var(--lab-ink); background: var(--lab-paper); font-family: Arial, Helvetica, sans-serif; font-size: 1rem; line-height: 1.65; }
body > .container-fluid { padding-inline: 0; }
a { color: var(--lab-navy); }
button, input, select, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid #358b9c !important; outline-offset: 3px; }
p, h1, h2, h3, th, td { overflow-wrap: break-word; }
.skip-link { position: fixed; left: 12px; top: -100px; z-index: 11000; background: white; color: var(--lab-navy); padding: 12px 18px; border-radius: 8px; }
.skip-link:focus { top: 12px; }

/* The original, full-resolution logo is displayed without a colour filter. */
.navbar { margin: 0; padding: 18px 24px; background: var(--lab-navy) !important; border: 0; border-radius: 0; box-shadow: 0 3px 12px #17324d18; }
.navbar > .container-fluid, .navbar > .container { width: 100%; max-width: 1800px; padding: 0; gap: 16px 24px; flex-wrap: wrap; }
.navbar-brand { min-width: 0; max-width: 100%; height: auto; padding: 0; margin-right: auto; color: white !important; white-space: normal; }
.app-brand { display: flex; align-items: center; gap: 24px; min-width: 0; }
.brand-logo { display: block; flex: 0 0 252px; width: 252px; max-width: 100%; padding: 8px; background: white; border-radius: 4px; line-height: 0; }
.brand-logo img { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 2048 / 639; object-fit: contain; filter: none; opacity: 1; transform: none; image-rendering: auto; }
.app-heading { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-width: 290px; padding-left: 24px; border-left: 1px solid #ffffff45; }
.app-title { color: white; font-family: Georgia, 'Times New Roman', serif; font-size: 1.5rem; line-height: 1.18; }
.app-subtitle { color: #e2edf6; font-size: .889rem; line-height: 1.5; font-weight: 400; }
.navbar-collapse { flex-grow: 0; min-width: 0; }
.navbar-nav { gap: 5px; align-items: stretch; }
.navbar .nav-link, .navbar .navbar-nav > li > a { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 13px; border-radius: 7px; color: #f1f6fb !important; font-size: .889rem; font-weight: 600; line-height: 1.4; white-space: normal; text-align: center; }
.navbar .nav-link:hover, .navbar .navbar-nav > li > a:hover { background: #ffffff19; color: white !important; }
.navbar .nav-link.active, .navbar .navbar-nav .active > a { background: #247b6c !important; color: white !important; box-shadow: inset 0 0 0 1px #ffffff30; }
.navbar-toggler, .navbar-toggle { min-height: 48px; border: 1px solid #ffffff80; color: white; border-radius: 7px; padding: 10px 14px; gap: 10px; align-items: center; justify-content: center; font-size: 1rem; }
.navbar-toggler-icon { filter: brightness(0) invert(1); width: 1.15em; height: 1.15em; }
.navbar-toggle .icon-bar { background: white; }

.dashboard-wrap, .page-wrap { max-width: 1800px; margin: 0 auto; padding: 26px 24px 36px; }
.global-notice { max-width: 1752px; margin: 18px auto 0; padding: 15px 20px; border: 1px solid #dec486; border-radius: 9px; background: #fff8e9; color: #6c501a; font-size: .944rem; }
.error-notice { border-color: #dfadad; background: #fff2f2; color: #8b3030; }
.dashboard-intro { margin-bottom: 24px; }
.dashboard-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; }
.dashboard-intro h1 { font-size: 1.55rem; line-height: 1.25; margin: 9px 0 8px; font-weight: 700; }
.eyebrow { color: var(--lab-teal); font-size: .889rem; font-weight: 700; letter-spacing: .07em; }
.run-pill { display: inline-flex; padding: 6px 12px; border: 1px solid var(--lab-line); border-radius: 100px; background: white; color: var(--lab-muted); font-size: .889rem; font-variant-numeric: tabular-nums; }
.dashboard-layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 20px; align-items: start; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "dag stage numbers" "km adjusted forest" "interpretation interpretation median"; gap: 18px; min-width: 0; align-items: stretch; }
.dag-card { grid-area: dag; } .stage-card { grid-area: stage; } .numbers-card { grid-area: numbers; }
.km-card { grid-area: km; } .adjusted-card { grid-area: adjusted; } .forest-card { grid-area: forest; }
.interpretation-card { grid-area: interpretation; } .median-card { grid-area: median; }

/* Settings remain mounted when folded away. */
.control-panel { min-width: 0; background: #edf3f8; border: 1px solid #d3dfe8; border-radius: 12px; }
.control-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 18px; list-style: none; color: var(--lab-ink); font-size: 1rem; font-weight: 700; cursor: pointer; }
.control-panel summary::-webkit-details-marker { display: none; }
.control-toggle { font-size: 1.4rem; font-weight: 400; }
.control-panel:not([open]) .control-toggle { transform: rotate(-90deg); }
.control-body { padding: 0 18px 20px; }
.settings-intro { margin: 0 0 22px; padding-bottom: 15px; border-bottom: 1px solid #d3dfe8; }
.settings-intro p { font-size: .889rem; color: var(--lab-muted); margin: 0 0 8px; }
.shiny-input-container { min-width: 0; max-width: 100%; }
.control-panel .shiny-input-container { width: 100%; margin-bottom: 24px; }
.control-label, .form-label, .data-filters label, .advanced-columns label { color: var(--lab-ink); font-size: .944rem; font-weight: 600; margin-bottom: 9px; }
.control-panel .radio, .control-panel .form-check { font-size: .944rem; margin: 8px 0; }
.radio label, .checkbox label { display: inline-block; min-height: 44px; padding-top: 8px; padding-bottom: 8px; cursor: pointer; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--lab-navy); width: 19px; height: 19px; vertical-align: middle; }
.control-panel .radio label { padding-left: 29px; }
.form-control, .form-select, .selectize-input, .selectize-dropdown, .selectize-input input { font-size: 1rem !important; line-height: 1.5; }
.form-control, .form-select, .selectize-input { min-height: 46px; }
.selectize-input { padding: 10px 12px; }
.irs { font-family: inherit; }
.irs--shiny { height: 64px; }
.irs--shiny .irs-bar, .irs--shiny .irs-single { background: #28699a; border-color: #28699a; }
.irs--shiny .irs-single, .irs--shiny .irs-from, .irs--shiny .irs-to { top: -1px; font-size: .944rem; line-height: 1.25; padding: 3px 6px; }
.irs--shiny .irs-min, .irs--shiny .irs-max { font-size: .889rem; line-height: 1.3; padding: 3px; color: #52687b; }
.irs--shiny .irs-grid-text { font-size: .889rem; color: var(--lab-muted); }
.irs--shiny .irs-handle { width: 25px; height: 25px; top: 19px; border: 3px solid #28699a; background: white; cursor: pointer; }
.irs--shiny .irs-handle::after { content: ""; position: absolute; inset: -11px; }
.input-note { color: var(--lab-muted); font-size: .889rem; line-height: 1.6; margin: -10px 0 24px; }
.scenario-box { margin: 24px 0 20px; padding-top: 18px; border-top: 1px solid #d3dfe8; }
.scenario-box h3 { font-size: 1rem; margin: 0 0 10px; font-weight: 700; }
.scenario-box p { font-size: .944rem; margin: 0; color: var(--lab-muted); }
.btn { min-height: 46px; padding: 11px 15px; border-radius: 7px; font-size: .944rem; line-height: 1.4; font-weight: 600; white-space: normal; }
.btn-primary { background: var(--lab-navy); border-color: var(--lab-navy); color: white; }
.btn-primary:hover { background: #15497f; border-color: #15497f; }
.run-button { width: 100%; min-height: 50px; }
.secondary-actions { display: grid; gap: 10px; margin-top: 10px; }
.secondary-actions .btn { width: 100%; background: white; border: 1px solid #c4d4e0; color: #294b66; }
.action-note { margin: 18px 0; }
.sample-details { display: grid; gap: 7px; padding-top: 17px; border-top: 1px solid #d3dfe8; color: var(--lab-muted); font-size: .889rem; }
.sample-details b { color: var(--lab-ink); }

.lab-card { min-width: 0; padding: 20px; border: 1px solid var(--lab-line); border-radius: 12px; background: white; box-shadow: 0 2px 6px #17324d04; }
.card-heading { margin-bottom: 13px; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-heading h2 { margin: 7px 0 0; color: var(--lab-ink); font-size: 1.111rem; font-weight: 700; line-height: 1.4; }
.card-heading > p { margin: 5px 0 0; color: var(--lab-muted); font-size: .889rem; line-height: 1.55; }
.lab-dag { display: block; width: 100%; height: 300px; }
.card-note, .small-note, .table-tip { margin: 12px 0 0; color: var(--lab-muted); font-size: .889rem; line-height: 1.6; }
.small-note, .table-tip { margin-bottom: 16px; }
.key-note { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; margin-top: 20px; padding: 16px; border-radius: 8px; background: #eef7ef; color: #355d3d; }
.key-note i { padding-top: 5px; }
.key-note p { font-size: .889rem; line-height: 1.6; margin: 0; }
.adjusted-caption { margin-top: 16px; padding: 13px; background: #f4f8fb; border-radius: 8px; }
.interpretation-callout { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 14px; padding: 18px; border-radius: 9px; background: #eaf4f8; }
.interpretation-callout > i { font-size: 1.3rem; color: #306a85; padding-top: 5px; }
.interpretation-callout p { margin: 0 0 10px; color: #36566d; font-size: .944rem; line-height: 1.65; }
.interpretation-callout p:last-child { margin-bottom: 0; }
.run-notes { margin-top: 22px; padding: 17px 20px; border: 1px solid #dfc68e; border-radius: 9px; background: #fff9ed; color: #725725; font-size: .944rem; }
.run-notes summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.run-notes li + li { margin-top: 9px; }

/* Only wide tables scroll sideways, not the whole page. */
.table-scroll, .patient-table-host { width: 100%; min-width: 0; max-width: 100%; }
.table-scroll-hint { margin: 8px 0 0; color: var(--lab-muted); font-size: .889rem; line-height: 1.6; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border-radius: 4px; }
.lab-table { width: 100%; border-collapse: collapse; color: var(--lab-ink); font-size: .889rem; font-variant-numeric: tabular-nums; }
.lab-table th { background: #f5f8fb; font-weight: 600; color: #405b72; text-align: left; }
.lab-table th, .lab-table td { padding: 13px 9px; border-bottom: 1px solid #e8eef3; vertical-align: middle; }
.lab-table th:not(:first-child), .lab-table td:not(:first-child) { text-align: right; }
.lab-table tbody tr:last-child td { border-bottom: 0; }
.hr-table td:nth-child(2) { font-size: 1.111rem; font-weight: 700; }
.hr-table td:last-child { white-space: nowrap; }
.hr-table th:first-child, .hr-table td:first-child { min-width: 94px; }
.risk-block { margin-top: 8px; }
.risk-block h3 { font-size: .889rem; font-weight: 600; margin: 0 0 7px; }
.risk-table { min-width: 410px; }
.risk-table th, .risk-table td { padding: 7px 5px; border: 0; background: transparent; }
.risk-table tbody tr:first-child td:first-child { color: #237767; }
.risk-table tbody tr:nth-child(2) td:first-child { color: #286da1; }
.risk-table td:first-child { white-space: nowrap; }
.survival-summary-table { min-width: 950px; }
.codebook-table { min-width: 470px; }
.codebook-table th, .codebook-table td { text-align: left !important; vertical-align: top; }
.codebook-table td:first-child { white-space: nowrap; }

.page-wrap { padding-top: 32px; padding-bottom: 48px; }
.reading-page { max-width: 1340px; }
.page-heading { margin-bottom: 30px; }
.page-heading-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.page-heading h1 { margin: 12px 0; font-size: clamp(1.65rem, 2.5vw, 2rem); line-height: 1.25; font-weight: 700; }
.page-lead { max-width: 1150px; color: var(--lab-muted); font-size: 1rem; line-height: 1.7; margin: 0; }
.two-column, .info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.page-wrap .lab-card { padding: 24px; }
.page-wrap .lab-card > p { color: #405e75; font-size: 1rem; line-height: 1.75; margin-bottom: 16px; }
.page-wrap .lab-card > p:last-child { margin-bottom: 0; }
.page-wrap .lab-card .card-note { font-size: .889rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; }
.metric-tile { min-width: 0; display: flex; flex-direction: column; padding: 22px; border: 1px solid var(--lab-line); border-radius: 11px; background: white; }
.metric-tile > span { font-size: .944rem; color: #405e75; font-weight: 600; }
.metric-tile > strong { font-size: 1.9rem; color: var(--lab-navy); font-weight: 700; margin: 7px 0; font-variant-numeric: tabular-nums; }
.metric-tile > small { font-size: .889rem; color: var(--lab-muted); }
.results-options, .data-filters { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 24px; }
.results-options .shiny-input-container { width: auto; margin: 0; flex: 1 1 350px; }
.results-options label { font-size: .944rem; color: #405e75; }
.data-filters > .shiny-input-container { flex: 1 1 200px; width: auto; margin: 0; }
.spaced-card { margin-top: 22px; }
.summary-horizon { font-weight: 600; }
.interpretation-feature { border-left: 5px solid #288573; background: #f7fcfa; }
.experiment-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 10px; }
.advanced-columns { align-items: start; }
.advanced-columns .shiny-input-container { width: 100%; max-width: none; margin-bottom: 28px; }
.stacked-cards { display: grid; gap: 22px; min-width: 0; }
.model-code { max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 20px; border-radius: 9px; color: #294b66; background: #f1f5f9; font-size: .889rem; line-height: 1.9; }
.inline-warning { padding: 15px; color: #735719 !important; background: #fff6e3; border-radius: 8px; font-size: .944rem !important; }
.info-grid .source-note { font-size: .889rem !important; color: var(--lab-muted) !important; }
.references-card { margin-top: 24px; }
.reference-list { padding-left: 24px; margin: 0; }
.reference-list li { margin-top: 20px; color: var(--lab-muted); font-size: .944rem; }
.reference-list li:first-child { margin-top: 0; }
.reference-list a { font-weight: 600; text-underline-offset: 3px; }
.reference-list span { display: block; margin-top: 5px; font-size: .889rem; }
.dataTables_wrapper, .dt-container { color: #405e75; font-size: .944rem; width: 100%; min-width: 0; }
.dataTables_wrapper input, .dataTables_wrapper select, .dt-container input, .dt-container select { max-width: 100%; min-height: 44px; padding: 8px; border: 1px solid #b9cbd9; border-radius: 6px; background: white; font-size: 1rem; }
.dataTables_filter label, .dataTables_length label { white-space: normal; }
.dataTables_filter input { max-width: 220px; }
.dataTables_scrollBody, .dt-scroll-body { -webkit-overflow-scrolling: touch; }
.dataTables_wrapper .dataTables_paginate .paginate_button, .dt-paging .dt-paging-button { min-width: 44px; min-height: 44px; }
table.dataTable { width: 100% !important; }
table.dataTable thead th { background: #f4f7fa; font-weight: 600; color: #37566f; }
table.dataTable td, table.dataTable th { padding: 13px 11px !important; font-size: .944rem; }
.lab-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px 24px; max-width: 1800px; padding: 24px; margin: 0 auto; border-top: 1px solid var(--lab-line); color: var(--lab-muted); font-size: .889rem; }
.shiny-output-error-validation, .shiny-notification { padding: 16px; font-size: .944rem; border-radius: 8px; }
.plotly.html-widget { width: 100% !important; min-width: 0; }
.js-plotly-plot .plotly .nsewdrag { touch-action: pan-y !important; }

/* Tap, click or use the keyboard to open the same explanation. */
.lab-help { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; gap: 9px; min-width: 44px; min-height: 44px; margin: 0; padding: 8px; border: 1px solid #cbdce7; border-radius: 8px; background: #f5f9fc; color: #204f73; font-size: .889rem; font-weight: 600; line-height: 1.4; cursor: pointer; }
.lab-help:hover { background: #e6f0f7; border-color: #98b7cd; }
.lab-help-labelled { padding: 9px 13px; flex: 0 1 auto; text-align: left; }
.help-mark { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 22px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 16px; line-height: 1; }
.modal-dialog { max-width: 720px; margin: 22px auto; }
.modal-content { max-height: calc(100vh - 44px); max-height: calc(100dvh - 44px); display: flex; flex-direction: column; border-radius: 12px; color: var(--lab-ink); background: white; }
.modal-header, .modal-footer { flex: 0 0 auto; padding: 19px 24px; }
.modal-title { font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
.modal-body { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 22px 24px; }
.modal-header .btn-close, .modal-header .close { min-width: 44px; min-height: 44px; }
.lab-help-content .help-intro { font-size: 1rem; margin: 0 0 24px; line-height: 1.7; }
.lab-help-content section { margin: 0 0 21px; }
.lab-help-content h3 { margin: 0 0 7px; font-size: 1.056rem; font-weight: 700; }
.lab-help-content p { margin: 0; font-size: .944rem; line-height: 1.7; }
.lab-help-content .help-note { padding: 16px; background: #edf5f9; border-radius: 8px; color: #37596f; }

@media (max-width: 1559px) {
  .navbar > .container-fluid, .navbar > .container { flex-wrap: wrap !important; }
  .navbar-brand { flex-basis: 100%; }
  .app-heading { max-width: 520px; }
  .navbar-collapse { flex-basis: 100%; }
  .navbar-nav { width: 100%; justify-content: space-between; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "dag stage" "numbers forest" "km adjusted" "interpretation median"; }
  .global-notice { margin-inline: 24px; }
}
@media (min-width: 768px) {
  .navbar .navbar-toggler, .navbar .navbar-toggle { display: none !important; }
  .navbar .navbar-collapse { display: flex !important; }
}
@media (max-width: 1199px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .control-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
  .control-body > * { min-width: 0; }
  .control-body > .input-note, .settings-intro, .scenario-box, .run-button, .secondary-actions, .sample-details, .control-body > .shiny-html-output { grid-column: 1 / -1; }
  .control-body > .shiny-input-container:has(#true_hr), .control-body > .shiny-input-container:has(#confounding) { grid-column: 1 / -1; }
  .control-body > .input-note { margin-top: -8px; }
  .secondary-actions { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column, .info-grid { grid-template-columns: 1fr; }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .navbar-nav { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 799px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "dag" "stage" "numbers" "km" "adjusted" "forest" "interpretation" "median"; }
  .lab-dag { height: auto; max-height: 320px; }
  .dashboard-wrap, .page-wrap { padding: 20px 16px 32px; }
  .global-notice { margin-inline: 16px; }
}
@media (max-width: 767px) {
  .navbar { padding: 16px; }
  .navbar > .container-fluid, .navbar > .container { gap: 14px; }
  .navbar-brand { margin: 0; width: 100%; }
  .app-brand { flex-wrap: wrap; gap: 16px; }
  .brand-logo { width: 252px; flex-basis: 252px; }
  .app-heading { padding: 0; border: 0; max-width: 100%; }
  .app-title { font-size: 1.4rem; }
  .app-subtitle { display: none; }
  .navbar .navbar-toggler, .navbar .navbar-toggle { display: inline-flex !important; width: 100%; }
  .navbar .navbar-collapse { flex-basis: 100%; width: 100%; }
  .navbar .navbar-collapse:not(.show):not(.in):not(.collapsing) { display: none !important; }
  .navbar .navbar-collapse.show, .navbar .navbar-collapse.in { display: block !important; }
  .navbar-nav { display: grid !important; grid-template-columns: 1fr 1fr; padding-top: 10px; margin: 0; }
  .navbar .nav-link { min-height: 50px; }
  .page-heading h1 { font-size: 1.65rem; }
  .dashboard-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .toolbar-actions { justify-content: flex-start; }
  .page-heading-top { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .lab-card, .page-wrap .lab-card { padding: 18px; }
  .results-options { align-items: stretch; flex-direction: column; }
  .results-options .shiny-input-container { flex: 0 1 auto; }
  .data-filters { display: grid; grid-template-columns: minmax(0, 1fr); }
  .data-filters > .shiny-input-container, .data-filters > .btn { width: 100%; }
  .experiment-buttons { flex-direction: column; }
  .experiment-buttons .btn { width: 100%; }
  .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { float: none; text-align: left; margin: 10px 0 15px; }
  .dataTables_filter input { display: block; margin: 8px 0 0 !important; width: 100%; max-width: 100%; }
  .lab-footer { padding: 22px 16px; align-items: flex-start; flex-direction: column; }
  .modal-dialog { max-width: calc(100% - 20px); margin: 10px auto; }
  .modal-content { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .modal-body { padding: 18px; }
  .modal-header, .modal-footer { padding: 16px 18px; }
}
@media (max-width: 479px) {
  .dashboard-wrap, .page-wrap { padding-inline: 12px; }
  .navbar { padding-inline: 12px; }
  .lab-card, .page-wrap .lab-card { padding: 15px 12px; }
  .control-body { display: block; padding: 0 16px 18px; }
  .secondary-actions { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-tile { padding: 20px; }
  .dashboard-intro h1 { font-size: 1.45rem; }
  .hr-table th, .hr-table td { padding: 12px 6px; }
  .interpretation-callout { grid-template-columns: 1fr; gap: 8px; padding: 16px; }
  .model-code { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* A clear patient range, without intermediate numbers under the slider. */
.patient-count-control { min-width: 0; margin-bottom: 24px; }
.patient-count-control .shiny-input-container { width: 100%; margin-bottom: 0; }
.patient-count-control .irs-grid,
.patient-count-control .irs-min,
.patient-count-control .irs-max { display: none !important; }
.patient-count-control .irs--shiny { height: 50px; }
.slider-endpoints { display: flex; justify-content: space-between; gap: 18px; color: var(--lab-muted); font-size: .889rem; font-variant-numeric: tabular-nums; }

/* The values remain available without mouse hover or precise tapping. */
.forest-values { margin: 10px 0 0; border: 1px solid var(--lab-line); border-radius: 8px; background: #f7fafc; }
.forest-values > summary { min-height: 48px; padding: 11px 13px; color: #204f73; font-size: .944rem; font-weight: 600; cursor: pointer; }
.forest-estimate-list { margin: 0; padding: 0 12px 10px; font-size: .889rem; }
.forest-estimate { padding: 12px 8px; border-top: 1px solid var(--lab-line); border-radius: 4px; }
.forest-estimate dt { font-weight: 600; }
.forest-estimate dd { margin: 4px 0 0; }
.forest-estimate dd strong, .forest-estimate dd span { display: block; }
.forest-estimate dd span { color: var(--lab-muted); }
.forest-estimate.is-selected { background: #e8f2f7; box-shadow: inset 3px 0 #28699a; }
.lab-help, .forest-values > summary, .control-panel > summary { touch-action: manipulation; }
.card-title-row h2 { min-width: 0; }
.lab-help:not(.lab-help-labelled) { width: 44px; height: 44px; flex: 0 0 44px; }
.lab-help-labelled > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.js-plotly-plot .plotly .nsewdrag { touch-action: pan-y pinch-zoom !important; }

/* Keep the help title and Close button available in portrait and landscape. */
.lab-help-modal .modal-dialog { width: calc(100% - 20px); max-width: 720px; margin: max(10px, env(safe-area-inset-top, 0px)) auto; }
.lab-help-modal .modal-content {
  max-height: calc(var(--lab-viewport-height, 100vh) - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
.lab-help-modal .modal-header, .lab-help-modal .modal-footer { flex-shrink: 0; }
.lab-help-modal .modal-body { min-height: 0; overflow-y: auto; }
.lab-help-modal .modal-title { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .lab-help-modal .modal-footer .btn { min-width: 100px; min-height: 48px; }
  .lab-help-labelled { max-width: 100%; }
}
@media (max-height: 480px) {
  .lab-help-modal .modal-header, .lab-help-modal .modal-footer { padding-top: 10px; padding-bottom: 10px; }
  .lab-help-modal .modal-title { font-size: 1.1rem; }
}
