.balance-chart{--balance-red:light-dark(#b34b46,#e99086);--balance-green:light-dark(#33764f,#8ec99d);--balance-yellow:light-dark(#d8ac2d,#ead063);--balance-grid:light-dark(#e4e8e0,#3d4c40);--balance-axis:light-dark(#798878,#a7b5a0);--balance-ink:light-dark(#263c31,#e5eddf);--balance-muted:light-dark(#677564,#b4c1aa);--balance-surface:light-dark(#fff,#1c2920);--balance-reference:light-dark(#496b92,#9dbce2);--balance-label-width:148px;--balance-gap:16px;color:var(--balance-ink);font-family:Arial,Helvetica,sans-serif;padding:4px 0 0}
.balance-scale,.balance-row{display:grid;grid-template-columns:var(--balance-label-width) minmax(0,1fr);gap:var(--balance-gap)}
.balance-scale{height:22px;align-items:start;font-size:11px;color:var(--balance-muted)}
.balance-axis{position:relative;height:18px;font-variant-numeric:tabular-nums}
.balance-axis>span{position:absolute;transform:translateX(-50%);white-space:nowrap}
.balance-axis .balance-axis-start{left:0;transform:none}.balance-axis .balance-axis-end{right:0;transform:none}
.balance-axis-name{font-size:11px}
.balance-grid{position:relative;border-bottom:1px solid var(--balance-axis);border-top:1px solid var(--balance-grid)}
.balance-zero-axis{position:absolute;top:0;bottom:0;width:1.5px;left:calc(50% + (var(--balance-label-width) + var(--balance-gap))/2);background:var(--balance-axis)}
.balance-quarter{position:absolute;top:0;bottom:0;width:1px;background:var(--balance-grid)}
.balance-left-quarter{left:calc(25% + (var(--balance-label-width) + var(--balance-gap))*.75)}
.balance-right-quarter{left:calc(75% + (var(--balance-label-width) + var(--balance-gap))*.25)}
.balance-row{min-height:28px;align-items:stretch;position:relative}
.balance-name{display:flex;flex-direction:column;justify-content:center;padding:2px 0;min-width:0}
.balance-name strong{font-size:12px;font-weight:500;line-height:1.25}
.balance-name .balance-values{display:flex;flex-wrap:wrap;gap:0 4px;align-items:center;font-size:11px;line-height:1.25;margin:0}
.balance-name b{font-weight:400;font-size:11px;font-variant-numeric:tabular-nums;line-height:1.25;white-space:nowrap}
.balance-value-divider{color:var(--balance-muted)}
.balance-name .balance-ref-value{color:var(--balance-reference)}
.balance-lane{position:relative;min-height:28px}
.balance-bar{position:absolute;top:calc(50% - 10px);height:20px;background:var(--bar-color);border-radius:0}
.balance-chart .negative{--bar-color:var(--balance-red);background:var(--balance-red)}
.balance-chart .positive{--bar-color:var(--balance-green);background:var(--balance-green)}
.balance-chart .neutral{background:var(--balance-yellow)}
.balance-zero-mark{position:absolute;left:50%;top:calc(50% - 10px);height:20px;width:18px;transform:translateX(-9px);background:var(--balance-yellow);border-radius:3px}
.balance-summary .balance-name strong{font-weight:600}
.balance-summary .balance-bar{height:16px;top:calc(50% - 8px)}
.balance-bottom{margin-top:4px;font-size:11px;height:18px}
.balance-key{display:flex;gap:4px 12px;flex-wrap:wrap;align-items:center;font-size:11px;color:var(--balance-muted);margin:6px 0 0;line-height:1.3}
.balance-key>span{display:flex;align-items:center;gap:5px}.balance-key i{display:block;width:11px;height:8px;border-radius:1px}
.balance-missing{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:11px;white-space:nowrap;background:var(--balance-surface);color:var(--balance-muted);padding:1px 3px}
.balance-section{padding:18px 22px}.balance-section .eyebrow{margin-bottom:6px}
.balance-section h2{font-size:30px;margin-bottom:9px}
.balance-section .balance-intro{font-size:12px;color:var(--muted);line-height:1.4;margin:0 0 6px}
.balance-section .balance-note{font-size:11px;color:var(--muted);line-height:1.4;margin:7px 0 0}
.balance-section details{font-size:11px;margin:7px 0 0;padding:5px 0 0}
.balance-section details summary{font-size:11px;padding:3px 0}
.balance-section details p{font-size:12px;line-height:1.5;color:var(--muted)}
.balance-controls{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:7px 0 5px}
.balance-switch{display:flex;padding:2px;background:light-dark(#edf2e8,#2d3c2d);border-radius:6px;gap:2px;max-width:100%}
.balance-switch button{font:inherit;font-size:12px;padding:5px 13px;min-height:30px;border:0;border-radius:4px;background:transparent;color:light-dark(#4e6554,#bfceb5);cursor:pointer}
.balance-switch button[aria-pressed=true]{background:light-dark(#244d40,#b8d1a2);color:light-dark(#fff,#20351e)}
.balance-reference-select{font-size:12px!important;max-width:230px;min-height:34px!important;padding:5px 8px!important}
.balance-reference-note{font-size:11px;color:var(--muted);line-height:1.4!important;margin:4px 0 5px}
.balance-reference-marker{position:absolute;top:calc(50% - 12px);height:24px;width:5px;box-sizing:border-box;transform:translateX(-50%);background:#d9dde1;border:1px solid #000;z-index:3;border-radius:3px}
.balance-reference-range{position:absolute;height:5px;box-sizing:border-box;top:calc(50% - 2.5px);background:#d9dde1;border:1px solid #000;z-index:2;border-radius:3px}
.balance-key .reference-key{background:#d9dde1;border:1px solid #000;box-sizing:border-box;width:5px;height:14px;margin:0 3px;border-radius:3px}
.reference-note{padding:8px 0;border-top:1px solid var(--line,#dfe5d9)}
.reference-note strong,.reference-note>span{display:block}.reference-note strong{font-size:12px;font-weight:500}
.reference-note>span{font-size:11px;margin-top:2px;color:var(--muted,#657560)}
.reference-note p{font-size:12px;line-height:1.5;margin:5px 0}.reference-note a{font-size:11px}
.balance-sources-table p{font-size:12px}
@media(max-width:600px){.balance-chart{--balance-label-width:122px;--balance-gap:10px}.balance-half,.balance-quarter{display:none}.balance-section{padding:16px}.balance-section h2{font-size:26px}.balance-reference-select{max-width:100%}}
@media(max-width:420px){.balance-bottom .balance-axis-start,.balance-bottom .balance-axis-end{display:none}.balance-missing{font-size:11px;white-space:normal;text-align:center;width:100%;max-width:115px;line-height:1.2}}
@media(pointer:coarse){.balance-switch button{min-height:44px}.balance-reference-select{min-height:44px!important;font-size:16px!important}.balance-section details summary{min-height:44px;display:flex;align-items:center}}
@media print{.balance-section{break-inside:avoid}.balance-chart{--balance-label-width:147px;--balance-gap:14px}.balance-controls{display:none}.balance-section h2{font-size:23px}.balance-section details:not([open]){display:none}}

.balance-section .balance-population-summary{font-size:12px;line-height:1.5;margin:8px 0 0;color:var(--muted)}.balance-population-summary:empty{display:none}



/* All workbook topics remain compact; unscored answers never get a neutral bar. */
.balance-context .balance-lane{display:flex;align-items:center;background:var(--balance-surface);padding:3px 6px;border-top:1px solid var(--balance-grid)}
.balance-context-answer{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:6px;width:100%;font-size:11px;line-height:1.35;color:var(--balance-ink);overflow-wrap:anywhere}
.balance-context-answer small{font-size:10px;color:var(--balance-muted);white-space:nowrap}
.balance-summary{border-top:2px solid var(--balance-axis);margin-top:6px;min-height:36px}
.balance-summary .balance-name strong{font-weight:700}
@media(max-width:600px){.balance-context-answer{font-size:11px}.balance-context-answer small{display:none}}
@media print{.balance-section{break-inside:auto!important}.balance-row{break-inside:avoid;min-height:24px}.balance-lane{min-height:24px}.balance-context-answer small{font-size:8px}.balance-summary{break-inside:avoid}}

.balance-track{position:absolute;left:0;right:0;height:20px;top:calc(50% - 10px);background:color-mix(in srgb,var(--balance-muted) 6%,transparent);border-radius:2px;z-index:0}.balance-bar,.balance-zero-mark{z-index:1}.balance-missing{z-index:2}.draft-tag{font-size:9px;color:var(--balance-muted);margin-left:3px;font-weight:400}.balance-context .balance-track{display:none}.balance-summary .balance-track{height:16px;top:calc(50% - 8px)}

.reference-tag{font-size:11px;margin-left:3px;color:var(--balance-ink)}

/* Dated patient bars use the same continuous red-to-green scale. */
.balance-dates{display:flex;flex-wrap:wrap;gap:4px 18px;margin-bottom:10px;font-size:12px;color:var(--balance-ink)}
.has-comparison .balance-row,.has-comparison .balance-lane{min-height:60px}
.balance-visit-slot{position:absolute;left:0;right:0;height:28px}
.balance-visit-slot.current{top:2px}.balance-visit-slot.previous{top:30px}
.has-comparison .balance-reference-marker{top:3px;bottom:3px;height:auto;background:#d9dde1;border:1px solid #000;width:5px;box-sizing:border-box;border-radius:3px}
.has-comparison .balance-reference-range{top:26px;height:5px;background:#d9dde1;border:1px solid #000;box-sizing:border-box;border-radius:3px}
.has-comparison .balance-track{height:52px;top:4px}
.has-comparison .balance-context-answer{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:3px}
.has-comparison .balance-summary .balance-track{height:52px;top:4px}

/* Added topics share the same 28px row rhythm; ABO shares one row. */
.balance-measured .balance-lane{display:flex;align-items:center;padding:0;background:var(--balance-surface);min-width:0}
.balance-measured .balance-track{display:none}
.measurement-graph{display:flex;align-items:center;gap:8px;position:relative;width:100%;height:28px;font-size:11px;line-height:1.25}
.measurement-series{flex:1;min-width:0}
.measurement-type-series{display:flex;align-items:center;gap:4px}
.measurement-type{flex:0 0 auto;font-size:11px;color:var(--balance-ink)}
.measurement-track{position:relative;height:20px;flex:1;min-width:0;background:color-mix(in srgb,var(--balance-muted) 6%,transparent)}
.measurement-patient{position:absolute;height:20px;top:0;background:var(--balance-green)}
.measurement-patient.at-zero{width:3px!important;min-width:3px}
.measurement-reference{position:absolute;top:-2px;bottom:-2px;width:5px;transform:translateX(-50%);background:#d9dde1;z-index:3;border:1px solid #000;box-sizing:border-box;border-radius:3px}
.measurement-reference-range{position:absolute;top:7.5px;height:5px;background:#d9dde1;z-index:2;border:1px solid #000;box-sizing:border-box;border-radius:3px}
.measurement-missing{position:absolute;inset:0;text-align:center;color:var(--balance-ink);font-size:11px}
@media(max-width:420px){.measurement-graph{gap:5px}.measurement-type-series{gap:2px}}

/* One shared coordinate scale for current, previous, binary and overall patient bars. */
.balance-bar,.measurement-patient,.overall-fill,.history-score-fill,.balance-zero-mark{
 --patient-red:light-dark(#c62828,#ef7777);
 --patient-red-light:light-dark(#f4c8c6,#d8a4a1);
 --patient-green-light:light-dark(#c9ead2,#bedccc);
 --patient-green:light-dark(#208540,#72c898);
 --patient-gradient:linear-gradient(to right,var(--patient-red) 0%,var(--patient-red-light) 50%,var(--patient-green-light) 50%,var(--patient-green) 100%);
 print-color-adjust:exact;-webkit-print-color-adjust:exact;
}
.balance-zero-mark{background:linear-gradient(to right,var(--balance-yellow) 0%,light-dark(#fff0a8,#fff4b8) 50%,var(--balance-yellow) 100%)}

/* Titles remain compact, keyboard-accessible entry points to their questions. */
.topic-edit{display:flex;align-items:center;gap:6px;min-width:0;max-width:100%;padding:2px 0;border:0;background:transparent;color:inherit;font:inherit;text-align:left;text-decoration:none;cursor:pointer;overflow-wrap:anywhere}
.topic-edit:hover{text-decoration:underline;text-underline-offset:3px}
.topic-edit:focus-visible{outline:2px solid currentColor;outline-offset:3px;border-radius:3px}
.guidance-choice h3{margin:0!important;min-width:0;flex:1}
.guidance-choice .topic-edit{align-items:flex-start;gap:9px;font-weight:700;font-size:18px}
.summary-item-graph{margin:12px 0 8px;max-width:100%;padding:0}
.summary-item-axis,.summary-item-values{display:flex;justify-content:space-between;gap:8px;font-size:12px;line-height:1.4}
.summary-item-values{flex-wrap:wrap;margin-top:4px}
.summary-item-graph .balance-lane{min-height:36px}
.summary-item-graph .balance-lane:before{content:"";position:absolute;left:50%;top:0;bottom:0;width:1px;background:var(--balance-axis)}
.patient-guidance{break-inside:avoid}
.chart-sort-label{display:flex;align-items:center;gap:8px;font-size:12px}
.field-focus{outline:2px solid var(--green);outline-offset:8px;border-radius:4px}
.return-report{margin:10px 0 18px}
@media(pointer:coarse){.topic-edit{min-height:44px}}
@media print{.topic-edit{text-decoration:none}.return-report{display:none}.summary-item-graph{break-inside:avoid}.balance-name .topic-edit{padding:0}.guidance-choice .topic-edit{font-size:13pt}}
