/* Isolated chart dialog. Existing forms, alarm engine and interval lock are untouched. */
.chart-modal-open{overflow:hidden}
.sensor-actions .chart-button{background:linear-gradient(110deg,#d97925,#ff9a4b);color:#21160f;border-color:#ffac6e;font-size:16px;font-weight:750;grid-column:1/-1;min-height:50px;box-shadow:0 4px 18px #ff6a0014}
.sensor-actions .chart-button:hover{background:#ffb06b;transform:translateY(-1px)}
.chart-symbol{width:24px;height:24px;display:inline-block;flex:0 0 24px}
dialog.sensor-chart-dialog{--chart-temp:#ffb174;--chart-hum:#7edbf2;--chart-battery:#a5e1a0;padding:0;width:min(1100px,calc(100vw - 40px));max-width:1100px;max-height:calc(100dvh - 40px);border:1px solid #465366;border-radius:24px;background:linear-gradient(130deg,#172230,#101820);color:#edf4ff;box-shadow:0 28px 130px #000b;overflow:auto;overscroll-behavior:contain}
.sensor-chart-dialog::backdrop{background:#050a12bc;backdrop-filter:blur(6px)}
.chart-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding:25px 28px 21px;border-bottom:1px solid #364354;background:#141e2bf5;position:sticky;top:0;z-index:3;backdrop-filter:blur(8px)}
.chart-heading{min-width:0}.chart-head .chart-kicker{font-size:12px;font-weight:750;letter-spacing:2px;color:#ffac6e;margin:0 0 5px}.chart-head h2{font-size:30px;font-weight:740;letter-spacing:-.7px;line-height:1.25;margin:0 0 7px}.chart-head .chart-identity{font-size:15px;line-height:1.5;color:#bfcddd;margin:0;overflow-wrap:anywhere}
.chart-close{border:1px solid #42536a;background:#1c2b3b;color:#dce8f9;font-size:30px;width:46px;height:46px;flex:0 0 46px;line-height:1;border-radius:12px;display:grid;place-items:center}
.chart-close:hover{background:#314157}.chart-body{padding:24px 28px}.chart-toolbar{display:flex;gap:14px;flex-wrap:wrap;justify-content:space-between;align-items:center}.chart-periods{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px;flex:1 1 600px;padding:5px;background:#0c131e;border:1px solid #334154;border-radius:13px}
.chart-period{min-height:45px;border:1px solid transparent;border-radius:9px;background:transparent;color:#bdcada;font-size:14px;font-weight:650;padding:8px 7px;line-height:1.25;white-space:normal}
.chart-period:hover{background:#27374a;color:#fff}.chart-period[aria-pressed=true]{color:#ffcb9f;background:#482d1d;border-color:#aa6532;box-shadow:inset 0 1px 0 #ffa95622}
.chart-options{display:flex;gap:8px;align-items:center}.chart-options button{min-height:44px;padding:8px 13px;border:1px solid #3c5067;border-radius:10px;font-size:13px;font-weight:650;background:#142133;color:#d6e4f4}.chart-options .chart-live[aria-pressed=true]{color:#99e4c7;border-color:#3c7464;background:#17393055}.chart-live:before{content:"";display:inline-block;width:6px;height:6px;background:currentColor;border-radius:50%;margin-right:7px;vertical-align:middle}
.chart-body .chart-state{margin:16px 2px;color:#b4c7db;font-size:14px;min-height:23px;overflow-wrap:anywhere}.chart-body .chart-state.chart-error{color:#ffbbad;background:#5d282638;padding:10px;border:1px solid #7a4a4266;border-radius:8px}
.chart-panels{display:grid;grid-template-columns:minmax(0,1fr);gap:18px}.chart-panel{min-width:0;padding:22px 22px 9px;background:#0c1520b8;border:1px solid #34465b;border-radius:18px;overflow:hidden}.chart-temp{color:var(--chart-temp)}.chart-hum{color:var(--chart-hum)}
.chart-panel-top{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:8px}.chart-metric-title{min-width:0}.chart-metric-title h3{display:flex;align-items:center;gap:9px;margin:0 0 8px;font-size:18px;font-weight:650;color:#e4edf9}
.chart-temp .chart-symbol{color:var(--chart-temp)}.chart-hum .chart-symbol{color:var(--chart-hum)}.chart-value{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;font-variant-numeric:tabular-nums;line-height:1.15}.chart-latest{font-size:39px;font-weight:740;letter-spacing:-1px;overflow-wrap:anywhere}.chart-unit{font-size:19px;font-weight:600}.chart-value-time{display:block;font-size:12px;color:#a9bed2;margin-top:7px}
.chart-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;text-align:right;margin:7px 0 0;padding:0;max-width:58%}.chart-stats>div{min-width:0}.chart-stats dt{font-size:13px;color:#a7bed4;margin:0 0 5px}.chart-stats dd{font-size:19px;color:#e1edfa;font-weight:660;font-variant-numeric:tabular-nums;margin:0;overflow-wrap:anywhere}
.chart-plot{position:relative;min-height:238px;width:100%;min-width:0}.chart-drawing{display:block;width:100%;height:auto;overflow:visible;touch-action:pan-y}.chart-drawing:focus-visible{outline:1px solid currentColor;outline-offset:3px;border-radius:6px}.chart-axis{fill:#a3b8d0;font-size:12px;font-weight:500;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;font-variant-numeric:tabular-nums}.chart-gridline{stroke:#304257;stroke-width:1;stroke-opacity:.62}.chart-grid-vertical{stroke-opacity:.25;stroke-dasharray:3 5}.chart-line{stroke:currentColor;stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}.chart-dot{fill:currentColor;stroke:#101a28;stroke-width:1.5}.chart-last-dot{fill:currentColor;stroke:#0c1520;stroke-width:2}.chart-crosshair{stroke:#d7e8fa;stroke-width:1;stroke-dasharray:4 4;opacity:.8}.chart-selected-dot{fill:currentColor;stroke:#f8fbff;stroke-width:2}.chart-cursor{pointer-events:none}
.chart-empty{position:absolute;inset:18px 0 35px;display:grid;place-items:center;text-align:center;border:1px dashed #405069;border-radius:12px;padding:18px;background:#0d1727b0;color:#b4c5d9;font-size:16px}
.chart-selection{margin:18px 0 12px;padding:12px 15px;background:#1a293b;border:1px solid #425773;border-radius:12px;display:flex;flex-wrap:wrap;gap:5px 22px;font-size:14px;line-height:1.6;color:#b9cadd;min-height:49px}.chart-selection strong{color:#e7f1fc;font-weight:650}.chart-selected-temp{color:var(--chart-temp)}.chart-selected-hum{color:var(--chart-hum)}
.chart-body .chart-note{font-size:13px;line-height:1.65;color:#aabdd2;margin:0 0 14px}.chart-footer{border-top:1px solid #314257;padding-top:13px;display:flex;justify-content:space-between;flex-wrap:wrap;gap:4px 16px;font-size:12px;color:#93abc4}
@media(max-width:700px){dialog.sensor-chart-dialog{width:calc(100vw - 18px);max-height:calc(100dvh - 18px);border-radius:18px}.chart-head{padding:18px 17px 16px}.chart-head h2{font-size:26px}.chart-head .chart-identity{font-size:13px}.chart-head .chart-kicker{font-size:11px}.chart-close{height:44px;width:44px;flex-basis:44px}.chart-body{padding:16px}.chart-periods{grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;flex-basis:100%}.chart-period{font-size:14px;min-height:45px}.chart-options{width:100%;justify-content:space-between}.chart-options button{font-size:13px}.chart-panel{padding:18px 13px 7px}.chart-panel-top{flex-direction:column;gap:15px}.chart-metric-title{width:100%;position:relative}.chart-value{position:absolute;right:0;top:0;max-width:51%}.chart-latest{font-size:32px}.chart-unit{font-size:15px}.chart-metric-title h3{font-size:17px;max-width:48%}.chart-value-time{font-size:12px}.chart-stats{width:100%;max-width:none;margin:0;gap:10px;text-align:left;border-top:1px solid #324153;padding-top:13px}.chart-stats dt{font-size:12px}.chart-stats dd{font-size:16px}.chart-plot{min-height:220px}.chart-panels{gap:16px}.chart-selection{gap:3px 14px;font-size:13px}.chart-selection strong{flex-basis:100%}.chart-body .chart-state{font-size:13px;line-height:1.6}.chart-footer{font-size:12px}.chart-body .chart-note{font-size:12px}}
@media(max-width:360px){.chart-body{padding:12px}.chart-head{padding:15px 13px}.chart-head h2{font-size:24px}.chart-panel{padding-left:10px;padding-right:10px}.chart-latest{font-size:28px}.chart-unit{font-size:14px}.chart-metric-title h3{font-size:15px;gap:5px}.chart-stats dd{font-size:15px}.chart-axis{font-size:11px}.chart-period{font-size:13px;padding:6px 3px}}
@media(prefers-reduced-motion:reduce){.sensor-actions .chart-button{transition:none}.sensor-actions .chart-button:hover{transform:none}}

/* battery-chart-v1: a separate scale; never a percentage inferred from raw battery. */
.sensor-chart-dialog .chart-battery{color:var(--chart-battery)}
.sensor-chart-dialog .chart-battery .chart-symbol,
.sensor-chart-dialog .chart-selected-battery{color:var(--chart-battery)}
.sensor-chart-dialog [hidden]{display:none!important}
.sensor-chart-dialog .chart-head h2{overflow-wrap:anywhere}
@media(max-width:420px){.sensor-chart-dialog .chart-head h2{font-size:23px}}
