.device-history{box-sizing:border-box;width:100vw;width:100dvw;height:100vh;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;border-radius:0;background:#f4f7f4;color:#233f32;overflow:hidden}
.device-history::backdrop{background:#263d3299}
/* Existing valve HMI entry geometry is unchanged. */
.sensor-panel .section-heading{align-items:center;min-height:24px;margin-bottom:0}.sensor-panel .section-heading h2{margin-bottom:0}.sensor-panel [data-device-history]{font-size:10px;line-height:14px;min-height:24px;padding:3px 8px}
@media(max-width:840px){.sensor-panel [data-device-history]{min-height:44px;font-size:12px}.sensor-panel .section-heading{margin-bottom:5px}}
.dh-color-valve_open{background:#24704e}.dh-color-flow_lpm{background:#14879b}.dh-color-moisture_pct{background:#3d997c}.dh-color-weight_kg{background:#7963c4}.dh-color-temperature_c{background:#d95f45}.dh-color-humidity_pct{background:#2878b5}.dh-color-battery_v{background:#b8850d}
/* Three 200px minimum cards: fit either orientation before scrolling. */
.dh-shell{box-sizing:border-box;height:100%;display:grid;grid-template-rows:auto minmax(612px,1fr) auto;gap:6px;padding:6px 10px;overflow-y:auto;overflow-x:hidden}
.dh-sticky{min-width:0;background:#f4f7f4}.dh-heading,.dh-title-group{display:flex;align-items:center;gap:8px}.dh-heading{justify-content:space-between}.dh-title-group{min-width:0;flex-wrap:wrap;gap:2px 10px}.dh-heading h2{font-size:16px;line-height:22px;margin:0}.dh-selected-range{color:#267552;font-size:12px;font-weight:650}.dh-identity{font-size:10px;color:#728479;overflow-wrap:anywhere}.dh-close{flex-shrink:0}
.device-history button{min-height:26px;padding:3px 9px;border:1px solid #cbded2;background:#fff;border-radius:6px;color:#315b44;font:inherit;font-size:11px;line-height:18px;cursor:pointer}.device-history button:hover{background:#e9f2eb}.device-history button:focus-visible,.device-history canvas:focus-visible,.dh-readout:focus-visible{outline:2px solid #b68928;outline-offset:-2px}
.dh-periods{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));gap:4px;margin:4px 0}.dh-periods button{padding:2px 3px;font-weight:650}.dh-periods button[aria-pressed=true]{background:#267552;color:#fff;border-color:#267552}
.dh-status{display:flex;align-items:center;flex-wrap:wrap;gap:2px 12px;border-radius:5px;background:#e6eee8;padding:2px 6px;font-size:10px;line-height:16px}.dh-status>span:first-child{flex:1 1 auto}.dh-range-times{color:#657a6f;white-space:nowrap}.dh-status[data-state=error]{background:#fff0e5;color:#873d20}.dh-status .dh-retry{min-height:22px;padding:0 6px;font-size:10px;flex-shrink:0}
.dh-charts{min-width:0;min-height:612px;display:grid;grid-template-rows:repeat(3,minmax(200px,1fr));gap:6px}.dh-chart{box-sizing:border-box;min-width:0;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr);padding:4px 7px 2px;background:#fff;border:1px solid #dbe5df;border-radius:8px;overflow:hidden}.dh-chart header{min-width:0;display:flex;align-items:center;gap:8px;min-height:20px}.dh-chart h3{font-size:12px;line-height:18px;margin:0;white-space:nowrap}.dh-legend{display:flex;flex-wrap:wrap;align-items:center;gap:2px 8px;font-size:10px;line-height:16px;color:#60736a;flex-shrink:0}.dh-legend span{white-space:nowrap}.dh-legend i{display:inline-block;width:7px;height:7px;border-radius:2px;margin-right:3px}.device-history .dh-legend small{display:inline;font-size:9px}.dh-on{background:#bcdfc6}.dh-day{background:#efdfb5}.dh-night{background:#bfc7dc}
/* Reserve one readout line so cursor changes cannot shrink the plots. */
.dh-readout{flex:1;min-width:0;min-height:16px;margin:0;color:#536f5e;font-size:10px;line-height:16px;white-space:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;text-align:right}.dh-plot{min-width:0;min-height:0;overflow:hidden}.dh-plot canvas{display:block;width:100%;height:100%;touch-action:pan-y}
.device-history .dh-footer{display:flex;padding:0;align-items:center;gap:3px 12px;font-size:10px;line-height:14px;color:#687b70;flex-wrap:wrap}.dh-footer .dh-footnote{flex:1;min-width:200px}.dh-footer .dh-help{white-space:nowrap}.dh-footer .dh-close{margin-left:auto}
@media(max-width:1050px){.dh-chart header{display:grid;grid-template-columns:auto 1fr;gap:0 8px}.dh-readout{grid-column:1/-1;text-align:left}.dh-status{gap:2px 6px}.dh-range-times{white-space:normal}.dh-identity{font-size:9px}}
@media(max-width:600px){.dh-shell{padding:5px 6px}.dh-periods{grid-template-columns:repeat(5,minmax(0,1fr))}.device-history button{min-height:32px}.dh-status .dh-retry{min-height:28px}.dh-title-group{gap:0 8px}.dh-identity{flex-basis:100%}.dh-chart{padding-inline:5px}.dh-legend{gap:2px 6px}.dh-footer .dh-footnote{flex-basis:100%;order:1}.dh-footer .dh-help{font-size:9px}}
