/* Compact clinical workspace. Print and patient links retain the report layout. */
:root { --uab-green:#1a5632; --uab-gold:#fdb913; --ui-body:1rem; --ui-meta:0.875rem; --ui-caption:0.8125rem; --ui-surface:#fff; --ui-border:#dce5df; --ser-wash:#f0f7f2; --ser-wash-border:#cddfd3; --al-wash:#fff8e6; --al-wash-border:#eadfbd; }
.inline-error { color:#a82a2a; font-size:var(--ui-meta); line-height:1.5; margin:8px 0; }
.inline-error:empty { display:none; }
.measurement-scroll-hint { display:none; }
/* SER keeps numeric entry and dropdown suggestions, without number steppers. */
.measurement-ser input[type="number"] { appearance:textfield; -moz-appearance:textfield; }
.measurement-ser input[type="number"]::-webkit-inner-spin-button,
.measurement-ser input[type="number"]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
.patient-chart-key { display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; }
.chart-key-item { display:inline-flex; align-items:center; gap:5px; white-space:nowrap; }
.chart-eye-symbol { display:inline-block; width:16px; height:16px; flex:0 0 auto; vertical-align:middle; }
.chart-legend strong .chart-eye-symbol { margin-right:5px; }
.chart-key-line { display:inline-block; width:22px; border-top:2px solid #1a5632; }
.chart-key-line.expected { border-top-style:dashed; }
#recall-code[aria-invalid="true"] { border-color:#a82a2a; outline:1px solid #a82a2a; }
.btn-primary,.race-option.selected { color:var(--uab-green); }
.cockpit-dialog { box-sizing:border-box; width:min(760px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); padding:22px; border:1px solid #d9e1dc; border-radius:16px; color:#20352b; background:#fff; box-shadow:0 24px 80px #13291b38; overflow:hidden; }
.cockpit-dialog[open] { display:flex; flex-direction:column; }
.cockpit-dialog::backdrop { background:#142a2359; backdrop-filter:blur(3px); }
.cockpit-dialog > header,.cockpit-card > header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.cockpit-dialog > header { margin-bottom:18px; flex-shrink:0; }
.cockpit-dialog h2 { font-size:1.25rem; margin:0; }
.cockpit-dialog button,.cockpit button { min-height:44px; cursor:pointer; }
.cockpit-dialog > .dialog-footer button { padding:8px 16px; border:0; border-radius:9px; background:#eaf1ed; color:#1a5632; font-weight:600; }
.cockpit-dialog section { margin:0; padding:0; border:0; box-shadow:none; }
.cockpit-dialog #recall-panel > summary { display:none; }
.cockpit-dialog .step-heading-row { display:flex; align-items:flex-start; }
.cockpit-dialog .step-heading-row h2 { font-size:16px; }
.cockpit-dialog .step-heading-row:has(.info-disclosure[open]) { flex-wrap:wrap; }
.cockpit-dialog .info-disclosure[open] { flex:1 0 100%; }
.cockpit-dialog .info-popover { position:static; width:100%; margin-top:8px; font-size:var(--ui-meta); }
.birthday-field-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.dialog-footer { display:flex; justify-content:flex-end; gap:12px; flex-shrink:0; padding-top:12px; margin-top:12px; border-top:1px solid #e7ede9; }
.birthday-dialog .dialog-footer #clear-birthday { margin-right:auto; background:#fff; border:1px solid #cad8cd; }
#clear-birthday,#clear-demographics,#clear-demographics-main { margin:0; padding:8px 12px; border:1px solid #cad8cd; border-radius:8px; color:var(--uab-green); background:#fff; white-space:nowrap; font-size:var(--ui-meta); }
#clear-birthday:disabled,#clear-demographics:disabled { opacity:0.5; cursor:default; }
.reference-population-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px 16px; }
.population-selection-status { min-height:1.5em; margin:8px 0 0; color:var(--uab-green); font-size:var(--ui-meta); font-weight:600; }
.population-confirmed { animation:population-confirmation 650ms ease-out; }
@keyframes population-confirmation {
  0%,100% { box-shadow:0 0 0 0 rgba(26,86,50,0); }
  40% { box-shadow:0 0 0 5px rgba(26,86,50,0.22); }
}
@media (prefers-reduced-motion:reduce) { .population-confirmed { animation:none; } }
#birthday-status { font-size:12px; color:var(--uab-green); }
#birthday-status:empty { display:none; }
.workflow-step { min-width:0; }
.workflow-step > .step-heading-row { margin:10px 0 8px; }
.workflow-step h2 { margin:0; font-size:1.125rem; color:var(--uab-green); }
.cockpit-dialog .quick-birthday-picker { display:block; margin:16px 0; }
.birthday-dialog { width:min(920px,calc(100vw - 32px)); padding:16px; }
.birthday-dialog .dob-field { margin-bottom:6px; }
.birthday-dialog .quick-year-grid { grid-template-columns:repeat(auto-fit,minmax(max(44px,5.5ch),1fr)); }
.birthday-dialog .quick-picker-grid { grid-template-columns:0.8fr 1.5fr 1fr; }
.birthday-dialog .quick-day-grid { grid-template-columns:repeat(8,minmax(0,1fr)); }
.birthday-dialog .quick-picker-grid { grid-template-columns:0.9fr 1.4fr 1fr; gap:12px; }
.birthday-dialog .quick-grid { gap:4px; }
.birthday-dialog .quick-grid button { padding:5px; font-size:var(--ui-meta); }
.birthday-dialog .quick-grid button.selected { background:#1a5632; border-color:#1a5632; color:#fff; }
.birthday-dialog .reference-population-label { margin-top:10px; }
.birthday-dialog #race-grid { margin-top:8px; }
.birthday-dialog > header { margin-bottom:10px; }
.birthday-dialog .quick-birthday-picker { margin:8px 0; }
.birthday-dialog .quick-picker-label { margin:0 0 8px; }
.birthday-dialog #ser-reference-controls { margin-top:8px; }
.birthday-dialog #ser-population-summary:empty { display:none; }
.birthday-dialog .dialog-footer { margin-top:8px; padding-top:8px; }
.cockpit-dialog .code-box { margin:8px 0 18px; padding:12px; }
.cockpit-dialog #new-code { height:42px; min-height:42px; margin:8px 0; font-size:11px; }
.cockpit-dialog #recall-code { height:80px; min-height:80px; }
.cockpit-dialog .patient-material-grid { margin-top:0; }
.cockpit-dialog .material-column { padding:16px; border:1px solid #d9e1dc; border-radius:12px; background:#f8faf9; min-width:0; }
.cockpit-dialog .material-column h3 { text-align:left; font-size:var(--ui-body); margin:0 0 8px; }
.cockpit-dialog .material-help,.cockpit-dialog .qr-help { font-size:var(--ui-meta); line-height:1.5; color:#506257; margin:0 0 12px; }
.cockpit-dialog #print-patient-handout { width:100%; margin-top:12px; }
.cockpit-dialog #share-qr-code { width:120px !important; height:120px !important; }
.cockpit-dialog .qr-button { margin:8px auto; }
.cockpit-dialog .code-copy-button { margin-top:0; }
.records-panel { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.cockpit .records-panel > section { min-width:0; margin:0; padding:14px 16px; border:1px solid #d9e1dc; border-radius:12px; background:#fff; box-shadow:none; }
.records-panel .code-box { display:flex; flex-direction:column; height:100%; padding:0; margin:0; border:0; border-radius:0; background:none; box-shadow:none; }
.records-panel .code-box-heading { flex-direction:column; align-items:flex-start; gap:8px; margin-bottom:0; }
.records-panel .code-update-status { text-align:left; font-size:var(--ui-meta); line-height:1.5; }
.records-panel .latest-copy-group { display:flex; flex-direction:column; }
.records-panel .records-title { display:block; font-family:inherit; font-weight:600; font-size:1rem; line-height:1.4; color:#1a5632; margin:0; }
.records-panel .latest-copy-group > p { font-size:var(--ui-meta); line-height:1.5; color:#506257; margin:8px 0; }
.records-panel textarea { box-sizing:border-box; width:100%; border:1px solid #b8ccbf; border-radius:8px; background:#f8faf9; color:#20352b; padding:12px; }
.records-panel #new-code { height:140px; font-size:0.875rem; line-height:1.5; margin:8px 0 12px; }
.records-panel #latest-visit-preview { min-height:108px; font-family:inherit; font-size:1rem; line-height:1.5; resize:none; overflow:hidden; margin:0 0 12px; }
.cockpit-actions .records-panel .code-copy-button { width:100%; margin-top:auto; }
.cockpit-actions .records-panel .code-copy-button.copy-success { background:#21863a; color:#fff; }
.cockpit .guide-panel summary { font-size:1.125rem; line-height:1.4; }
.cockpit .guide-panel-content { font-size:1.0625rem; }
.cockpit .guide-panel-content li,.cockpit .guide-note { line-height:1.6; }
.cockpit .education-panel { margin:0; padding:0; border:0; box-shadow:none; background:none; }
.education-panel .patient-material-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:stretch; }
.education-panel .material-column { min-width:0; padding:14px 16px; border:1px solid #d9e1dc; border-radius:12px; }
.education-panel .material-column h3 { text-align:left; font-size:var(--ui-body); margin:0 0 6px; }
.education-panel .material-help,.education-panel .qr-help { margin:0 0 6px; font-size:var(--ui-meta); line-height:1.4; color:#506257; }
.education-panel #print-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(3,auto); grid-auto-flow:column; gap:0 12px; margin:0; }
.education-panel .print-option { margin:0; }
.education-panel #print-patient-handout { width:100%; margin-top:6px; }
.education-panel .material-column:nth-child(2) { display:flex; flex-direction:column; }
.education-panel .qr-button { position:relative; flex:1; width:100%; min-height:180px; margin:0; padding:0; border:0; border-radius:8px; }
.education-panel .qr-button:focus-visible { outline:3px solid #1a5632; outline-offset:3px; }
.education-panel #share-qr-code { position:absolute; inset:0; display:block; width:100%; height:100%; object-fit:contain; }
.education-panel .qr-button.hidden { display:none; }
.education-panel .qr-status { text-align:center; }
.education-panel .qr-status:empty { display:none; }
.cockpit-dialog #ser-reference-controls p { font-size:var(--ui-meta); line-height:1.5; margin:6px 0; }
.cockpit-dialog .dob-field { margin-top:0; }
.expanded-dialog { width:min(1080px,calc(100vw - 32px)); }
.expanded-chart { position:relative; height:clamp(120px,42dvh,430px); }
.expanded-reference-image { display:block; max-width:100%; max-height:calc(100dvh - 225px); width:auto; margin:auto; object-fit:contain; }
.reference-note { font-size:var(--ui-meta); line-height:1.5; margin:10px 0 0; }
.table-dialog[open] { display:flex; flex-direction:column; height:min(720px,calc(100dvh - 32px)); }
.table-dialog > header { flex-shrink:0; }
.cockpit-dialog.table-dialog .dialog-body { display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden; }
.table-history-summary { margin:0 0 12px; color:#506257; font-size:var(--ui-meta); }
.table-history-scroll { overflow:auto; scrollbar-gutter:stable; flex:1; min-height:0; border:1px solid #dce5df; border-radius:8px; }
.table-history-scroll table { border-collapse:separate; border-spacing:0; margin:0; }
.table-history-scroll th { position:sticky; top:0; z-index:1; }
.cockpit .table-dialog .patient-table th,.cockpit .table-dialog .patient-table td { padding:12px 10px; font-size:var(--ui-meta); }
.cockpit .table-dialog .patient-table td small { font-size:var(--ui-caption); }
.table-history-scroll:focus-visible { outline:3px solid #357db4; outline-offset:2px; }
.clipboard-fallback { position:fixed; left:-9999px; }
dialog.qr-modal { inset:0; width:fit-content; height:fit-content; max-width:calc(100vw - 32px); max-height:calc(100dvh - 32px); padding:0; border:0; border-radius:14px; background:#fff; overflow:hidden; }
dialog.qr-modal::backdrop { background:#142a2359; }
dialog.qr-modal:not([open]) { display:none; }
dialog.qr-modal .qr-modal-content { box-sizing:border-box; width:min(420px,calc(100vw - 32px)); }
dialog.qr-modal canvas { width:min(320px,55dvh,calc(100vw - 95px)); height:auto; }
dialog.qr-modal .qr-modal-close { position:static; width:auto; height:auto; min-height:44px; padding:8px 16px; border-radius:9px; font-size:1rem; font-weight:600; background:#eaf1ed; color:#1a5632; }
.patient-table { width:100%; border-collapse:collapse; table-layout:fixed; font-variant-numeric:tabular-nums; }
.patient-table th { text-align:left; color:#506257; font-weight:500; font-size:var(--ui-meta); background:#f5f8f6; padding:11px; }
.patient-table td { padding:12px 11px; border-bottom:1px solid #e7ede9; text-align:left; font-size:var(--ui-meta); }
.patient-table td strong { font-weight:600; }
.patient-table td small { display:block; margin-top:4px; font-size:var(--ui-caption); color:#506257; }
#data-table,#ser-data-table { min-width:0; width:100%; }
.cockpit .data-table-block + .data-table-block { padding-top:16px; border-top:1px solid #dce5df; }
.cockpit-dialog .dialog-body { min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; flex:1; }
.comparison-rate { padding:8px 0; font-size:var(--ui-meta); font-variant-numeric:tabular-nums; }
.comparison-rate > div:first-child { display:grid; grid-template-columns:2.5em minmax(0,1fr) minmax(0,1fr); gap:8px; align-items:baseline; }
.comparison-rate strong { display:flex; align-items:center; justify-content:center; box-sizing:border-box; color:#fff; background:var(--uab-green); border-radius:3px; padding:2px 4px; text-align:center; }
.comparison-rate:nth-child(2) strong { color:var(--uab-green); background:var(--uab-gold); }
.comparison-bars { margin:5px 0 0 calc(2.5em + 8px); display:grid; gap:3px; }
.comparison-bars i { display:block; height:5px; min-width:2px; background:var(--uab-green); border-radius:3px; }
.comparison-rate:nth-child(2) i { background:var(--uab-gold); }
.comparison-bars i + i { height:3px; background:repeating-linear-gradient(90deg,var(--uab-green) 0 5px,transparent 5px 8px); }
.comparison-rate:nth-child(2) .comparison-bars i + i { background:repeating-linear-gradient(90deg,var(--uab-gold) 0 5px,transparent 5px 8px); }
.cockpit-key { font-size:var(--ui-caption); color:#506257; margin:0 0 8px; }
/* One title treatment for peer cards; workflow and dialog headings stay distinct. */
.cockpit-card > header .panel-title,
#data-table-section .panel-title,
.education-panel .material-column .panel-title,
.records-panel .panel-title { font-family:inherit; font-size:var(--ui-body); font-weight:600; line-height:1.4; color:var(--uab-green); }
@media screen {
  html:has(> body.cockpit) { overflow-x:clip; }
  body.cockpit { background:#f1f4f2; color:#20352b; font-size:var(--ui-body); font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
  .cockpit .info-disclosure summary { position:relative; isolation:isolate; width:2.75rem; height:2.75rem; min-width:44px; min-height:44px; font-size:1rem; border:0; background:transparent; color:var(--uab-green); }
  .cockpit .info-disclosure summary::before { content:''; position:absolute; inset:8px; z-index:-1; border:2px solid var(--uab-green); border-radius:50%; background:#f1f7f2; }
  .cockpit .info-disclosure summary:hover,.cockpit .info-disclosure summary:focus-visible,.cockpit .info-disclosure[open] summary { color:#fff; }
  .cockpit .info-disclosure summary:hover::before,.cockpit .info-disclosure summary:focus-visible::before,.cockpit .info-disclosure[open] summary::before { background:var(--uab-green); }
  .cockpit .date-picker-button,.cockpit .measurement-remove { width:44px; height:44px; }
  .cockpit #measurement-entry-table input:not(.date-native),.cockpit #birth-date-display { min-height:44px; font-size:1rem; }
  .cockpit #measurement-entry-table .date-display,.cockpit #birth-date-display { padding-right:50px; }
  .cockpit .qr-modal-close { width:44px; height:44px; }
  .cockpit .print-option { display:flex; align-items:center; gap:10px; min-height:44px; }
  .cockpit .print-option input { flex:0 0 auto; width:20px; height:20px; }
  .cockpit .print-option label { display:flex; align-items:center; min-height:44px; margin:0; font-size:var(--ui-meta); }
  .cockpit main { max-width:1100px; padding:0 20px 24px; margin:auto; }
  .cockpit .site-header { padding:18px 0 8px; }
  .cockpit .site-logo { max-height:none; width:min(100%,600px); height:auto; }
  .cockpit #how-to-panel { font-size:var(--ui-meta); margin:0 0 12px; }
  .cockpit #input-section { padding:18px; margin:0 0 12px; border:1px solid #dce5df; border-radius:13px; background:#fff; }
  .cockpit #input-section > .step-heading-row h2 { font-size:18px; }
  .cockpit .measurement-entry-toolbar { flex-wrap:wrap; }
  .cockpit-tools { display:flex; align-items:center; flex-wrap:wrap; gap:10px; max-width:100%; }
  .cockpit-tools button { margin:0; white-space:nowrap; }
  .ser-calculator { margin:10px 0 0; border:1px solid var(--ser-wash-border); border-radius:10px; background:linear-gradient(145deg,var(--ser-wash) 0%,#fff 86%); }
  .ser-calculator summary { display:flex; justify-content:space-between; align-items:center; gap:10px; min-height:44px; box-sizing:border-box; padding:9px 13px; color:var(--uab-green); cursor:pointer; font-weight:600; }
  .ser-calculator summary::marker,.ser-calculator summary::-webkit-details-marker { display:none; }
  .ser-calculator summary::after { content:'›'; flex:0 0 auto; margin-left:auto; font-size:1.35rem; line-height:1; transform:rotate(90deg); transition:transform 120ms ease; }
  .ser-calculator[open] summary::after { transform:rotate(-90deg); }
  .ser-calculator-formula { margin:0 0 10px; color:#607068; font-size:var(--ui-caption); font-weight:500; }
  .ser-calculator-body { padding:12px 13px 13px; border-top:1px solid var(--ser-wash-border); margin:0; }
  .ser-calculator-fields { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) auto minmax(0,1fr); align-items:end; gap:6px; margin:0; }
  .ser-calculator-fields label { margin:0; color:var(--uab-green); font-size:var(--ui-meta); font-weight:600; }
  .ser-calculator-field-label { display:block; color:var(--uab-green); font-size:var(--ui-meta); font-weight:600; line-height:1.4; }
  .ser-calculator-field-label span { color:#607068; font-weight:500; }
  .ser-calculator-fields input { box-sizing:border-box; min-height:44px; margin-top:5px; background:#fff; font-size:1rem; font-variant-numeric:tabular-nums; }
  .ser-calculator-operator { align-self:center; padding-top:20px; color:#607068; font-size:1.2rem; font-weight:600; }
  .ser-calculator-result { display:flex; min-width:0; flex-direction:column; margin:0; color:#607068; }
  .ser-calculator-result output { display:flex; min-height:44px; box-sizing:border-box; align-items:center; margin-top:5px; padding:5px 10px; border:1px solid var(--ser-wash-border); border-radius:6px; background:#fff; color:var(--uab-green); font-size:1.05rem; font-weight:700; font-variant-numeric:tabular-nums; }
  .ser-calculator-fields button { grid-column:1 / -1; width:100%; white-space:nowrap; }
  .ser-calculator-status { min-height:1.35em; margin:8px 0 0; color:#506257; font-size:var(--ui-caption); }
  .ser-calculator-status:empty { display:none; }
  .measurement-entry-subrow { margin:10px 0 0; }
  .measurement-entry-subrow .ser-calculator { margin:0; }
  .measurement-entry-subrow .measurement-entry-footer { margin:8px 0 0; }
  .cockpit .comparison-settings { display:block; width:100%; text-align:left; border:1px solid #dce5df; border-radius:10px; background:#fff; padding:12px 16px; margin-bottom:14px; color:#284937; font-size:var(--ui-meta); }
  .comparison-summary-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr) minmax(0,1fr); align-items:center; gap:10px; min-height:80px; box-sizing:border-box; background:#fff; border:1px solid #dce5df; border-radius:10px; padding:12px 16px; margin-bottom:14px; }
  .cockpit .comparison-summary-row .comparison-settings { grid-column:1 / -1; grid-row:1; justify-self:start; width:fit-content; max-width:100%; min-width:0; box-sizing:border-box; border:1px solid #b8ccbf; border-radius:8px; margin:0; padding:10px 20px; line-height:1.5; text-align:left; background:#eaf1ed; font-weight:600; }
  .cockpit .comparison-summary-row .comparison-settings.has-demographics { grid-column:2; justify-self:center; border-radius:999px; border-color:#e6c55c; background:#fff1b8; text-align:center; font-size:var(--ui-body); font-weight:600; color:var(--uab-green); }
  .comparison-summary-actions { grid-column:3; grid-row:1; display:flex; justify-self:end; justify-content:flex-end; flex-wrap:wrap; gap:8px; min-width:0; max-width:100%; }
  #clear-demographics-main { min-width:0; max-width:100%; white-space:normal; overflow-wrap:anywhere; }
  .comparison-summary-actions[hidden] { display:none; }
  .patient-summary-item { display:inline-block; white-space:normal; max-width:100%; overflow-wrap:anywhere; }
  .patient-summary-item + .patient-summary-item { margin-inline-start:4px; }
  #clear-demographics-main[hidden] { display:none; }
  .cockpit-grid {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    gap:14px;
  }
  .cockpit-card { min-width:0; border:1px solid #dce5df; border-radius:13px; background:#fff; padding:16px; overflow:hidden; }
  .cockpit-grid .measurement-family-ser {
    border-color:var(--ser-wash-border);
    background:linear-gradient(145deg,var(--ser-wash) 0%,#fff 68%);
  }
  .cockpit-grid .measurement-family-al {
    border-color:var(--al-wash-border);
    background:linear-gradient(145deg,var(--al-wash) 0%,#fff 68%);
  }
  .cockpit-grid .measurement-family-ser .patient-table th { background:#e7f2ea; }
  .cockpit-grid .measurement-family-al .patient-table th { background:#fff3d5; }
  .graph-card { display:flex; flex-direction:column; }
  .graph-card > .comparison-rates { margin-top:auto; padding-top:6px; }
  .cockpit-card > header h2 { font-size:1.125rem; margin:0; }
  .cockpit-card > header { margin-bottom:6px; }
  .cockpit-card > header button { font-size:var(--ui-meta); border:0; padding:6px 8px; background:transparent; color:#1a5632; border-radius:5px; white-space:nowrap; }
  .cockpit .graph-card > header { padding:0; margin:0 0 8px; width:100%; box-sizing:border-box; text-align:left; }
  .cockpit-card .measurement-chart-block { padding:0; margin:0; border:0; box-shadow:none; }
  .cockpit-card .measurement-chart-block > h2,.cockpit-card .chart-legend,.cockpit-card .measurement-chart-block > .rate-label-key,.cockpit #growth-comparison { display:none; }
  .compact-chart { height:190px; position:relative; }
  .compact-chart > canvas { position:absolute; inset:0; width:100% !important; height:100% !important; max-height:none; }
  .cockpit #data-table-section { display:contents; }
  .cockpit #data-table-section.hidden { display:contents; }
  .cockpit #data-table-section .data-table-block.hidden { display:block; }
  .cockpit #data-table-section .data-table-block > header { min-height:3.5rem; }
  .table-empty-message { display:none; margin:0; padding:24px 0; color:#506257; font-size:var(--ui-meta); line-height:1.5; }
  .data-table-block:has(tbody:empty) .table-empty-message { display:block; }
  .cockpit #data-table-section .data-table-block { margin:0; }
  .cockpit #data-table-section table tbody tr:not(:nth-last-child(-n+3)) { display:none; }
  .cockpit #data-table-section table { margin:0; }
  .cockpit-card:not(:has(.measurement-chart-block.hidden)) > .card-empty { display:none; }
  .card-empty { color:#506257; min-height:170px; display:grid; place-items:center; font-size:var(--ui-meta); line-height:1.5; }
  .normative-card { padding:12px 16px; }
  .normative-preview { height:200px; position:relative; }
  .normative-preview > canvas { position:absolute; inset:0; width:100% !important; height:100% !important; }
  .normative-preview > img { display:block; width:100%; height:100%; object-fit:contain; margin:0 !important; }
  .normative-summary { margin:8px 0 0; font-size:var(--ui-meta); color:#506257; }
  .cockpit-actions { display:grid; grid-template-columns:1fr; gap:14px; margin-top:14px; }
  .cockpit-actions .workflow-step { display:flex; flex-direction:column; }
  .cockpit-actions .workflow-step > .step-heading-row { flex:none; align-items:center; }
  .cockpit-actions button { border:1px solid #b8ccbf; color:#1a5632; background:#fff; border-radius:10px; padding:13px; font-size:15px; font-weight:600; }
  .cockpit-actions .workflow-step > button { width:100%; }
  .cockpit footer { font-size:var(--ui-meta); line-height:1.5; padding:12px; color:#506257; }
  .cockpit .measurement-entry-heading > p,
  .cockpit #visit-count,
  .cockpit .measurement-entry-footer,
  .cockpit #measurement-entry-table th,
  .cockpit #measurement-entry-table .measurement-eye-headings th,
  .cockpit .qr-status,
  .cockpit .rate-label-key,
  .cockpit-dialog .rate-label-key,
  .birthday-dialog #birthday-status,
  .birthday-dialog .quick-picker-title,
  .birthday-dialog .quick-picker-label {
    font-size:var(--ui-meta); line-height:1.5;
  }
  .birthday-dialog .quick-grid,.birthday-dialog .race-option { font-size:var(--ui-meta); }
  .birthday-dialog #race-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .cockpit .measurement-entry-heading > p,.cockpit #visit-count { color:#506257; }
  .cockpit .normative-summary,.cockpit .patient-table td small { line-height:1.5; }
  .cockpit button:focus-visible,.cockpit-dialog button:focus-visible { outline:3px solid #357db4; outline-offset:3px; }
  /* Shared action hierarchy. Toggles, calendar icons and eye keys keep their own roles. */
  .cockpit button.ui-action-primary,.cockpit-dialog button.ui-action-primary,
  .cockpit button.ui-action-secondary,.cockpit-dialog button.ui-action-secondary {
    min-height:44px; padding:10px 14px; border:1px solid transparent; border-radius:9px;
    font:600 1rem/1.4 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  }
  .cockpit button.ui-action-primary,.cockpit-dialog button.ui-action-primary { background:var(--uab-gold); color:var(--uab-green); }
  .cockpit #add-visit { font-weight:600; padding:10px 14px; }
  .cockpit #print-patient-handout { color:var(--uab-green); }
  .cockpit button.ui-action-secondary,.cockpit-dialog button.ui-action-secondary { background:#eaf1ed; color:var(--uab-green); }
  .cockpit .ui-action-primary:disabled,.cockpit-dialog .ui-action-primary:disabled { opacity:0.55; cursor:not-allowed; }
  .cockpit .ui-action-primary.copy-success { background:#21863a; color:#fff; }
  .cockpit .ui-action-primary.copy-error { background:#b42318; color:#fff; }
  .cockpit-card > header button { font-weight:600; }
  #clear-birthday,#clear-demographics,#clear-demographics-main { font-weight:600; }
  .cockpit .measurement-entry-table-wrap { margin-top:8px; }
}
@media (min-width:721px) {
  .cockpit .measurement-entry-subrow { display:grid; grid-template-columns:28% 32% 40%; align-items:start; }
  .cockpit .measurement-entry-subrow .ser-calculator { grid-column:2; width:auto; }
  .cockpit .measurement-entry-subrow .measurement-entry-footer { grid-column:3; align-self:center; justify-self:end; margin:0; }
}
/* Keep equal outer cards, but give each print-option label enough room on tablets. */
@media (max-width:1000px) {
  .education-panel #print-options { grid-template-columns:1fr; grid-template-rows:none; grid-auto-flow:row; }
}
@media (max-width:600px) {
  .birthday-dialog { width:calc(100vw - 16px); padding:12px; }
  .birthday-dialog .quick-picker-grid { grid-template-columns:1fr; gap:10px; }
  .birthday-dialog .quick-month-grid { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .birthday-dialog .quick-year-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .birthday-dialog .quick-month-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .birthday-dialog .quick-day-grid { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .birthday-dialog .quick-grid button { font-size:var(--ui-meta); padding:4px 1px; min-width:44px; }
  .birthday-dialog .quick-picker-label { margin-bottom:6px; font-size:var(--ui-meta); }
  .cockpit main { padding:0 10px 16px; }
  .cockpit-grid { gap:12px; grid-template-columns:1fr; }
  .cockpit-card { padding:10px; }
  .cockpit-card > header { flex-wrap:wrap; gap:0; }
  .cockpit-card > header h2 { font-size:1.125rem; }
  .compact-chart { height:155px; }
  .comparison-rate > div:first-child { grid-template-columns:2.5em minmax(0,1fr); gap:4px; }
  .comparison-bars { margin-left:calc(2.5em + 4px); }
  .comparison-rate > div:first-child span:last-child { grid-column:2; }
  .cockpit .patient-table th,.cockpit .patient-table td { padding:10px 8px; font-size:var(--ui-meta); }
  .cockpit .patient-table td small { font-size:var(--ui-caption); }
  .comparison-summary-row { grid-template-columns:minmax(0,1fr) minmax(0,42%); gap:10px; padding:12px; }
  .cockpit .comparison-summary-row .comparison-settings { padding:10px 16px; line-height:1.6; }
  .cockpit .comparison-summary-row .comparison-settings.has-demographics { grid-column:1; }
  .comparison-summary-actions { grid-column:2; }
  #clear-demographics-main { white-space:normal; margin:0; }
  .normative-preview { height:200px; }
  .cockpit-dialog { padding:14px; }
  .cockpit-dialog .patient-material-grid { grid-template-columns:1fr; gap:16px; }
  .education-panel .patient-material-grid { grid-template-columns:1fr; gap:16px; }
  .education-panel .qr-button { min-height:min(70vw,320px); }
  .records-panel { grid-template-columns:1fr; }
  .education-panel #print-options { grid-template-columns:1fr; grid-template-rows:none; grid-auto-flow:row; }
  .cockpit-dialog .material-column { padding:12px; }
  .cockpit-dialog h2 { font-size:17px; }
  .cockpit-dialog #print-options { font-size:var(--ui-meta); }
  .cockpit-actions button { font-size:var(--ui-body); }
  .cockpit-actions .workflow-step > button { min-height:60px; }
  .cockpit .measurement-entry-table-wrap { overflow-x:auto; }
  .cockpit #measurement-entry-table { min-width:40rem; }
  .ser-calculator-fields button { white-space:normal; font-size:var(--ui-meta); line-height:1.25; }
  .measurement-scroll-hint { display:block; font-size:var(--ui-meta); color:#506257; line-height:1.5; margin:8px 0; }
}
@media (prefers-reduced-motion:reduce) { .cockpit * { scroll-behavior:auto !important; transition:none !important; } }
@media (max-height:650px) {
  .cockpit-dialog { padding:12px; }
  .cockpit-dialog > header { margin-bottom:8px; }
  .cockpit-dialog .code-box { margin:4px 0 10px; padding:8px; }
  .cockpit-dialog #share-qr-code { width:90px !important; height:90px !important; }
  .expanded-chart { height:30dvh; }
}
@media print {
  .workflow-step,.comparison-settings,.cockpit-tools,.cockpit-actions,.cockpit-card > header,.normative-card,.card-empty,.cockpit-key,.comparison-rates,.cockpit-dialog { display:none !important; }
  .cockpit-grid,.cockpit-card { display:block; padding:0; border:0; }
  .compact-chart { height:300px; }
  .patient-table td { padding:6px; }
}
