/* PROSTERO history charts v1 */
:root{
  --hist-grid:color-mix(in srgb,var(--edge,#cbd5e1) 72%,transparent);
  --hist-text:var(--ink,#0f172a);
  --hist-muted:var(--muted,#64748b);
  --hist-bg:color-mix(in srgb,var(--card,#fff) 96%,transparent);
  --hist-1:#2563eb;--hist-2:#f59e0b;--hist-3:#ef4444;--hist-4:#16a34a;
  --hist-5:#7c3aed;--hist-6:#0891b2;--hist-7:#db2777;--hist-8:#475569;
}
.historyPanel{display:grid;gap:14px}.historyToolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}.historyTitleBox{min-width:0}.historyTitle{font-size:20px;font-weight:1000;letter-spacing:-.35px}.historySubtitle{margin-top:4px;color:var(--hist-muted);font-size:12px;font-weight:750}.historyRanges{display:flex;gap:7px;flex-wrap:wrap}.historyRange,.historyRefresh{appearance:none;border:1px solid var(--edge,#dbe3ee);background:var(--card,#fff);color:var(--hist-text);border-radius:12px;padding:9px 12px;font:inherit;font-size:12px;font-weight:900;cursor:pointer;transition:.16s ease}.historyRange:hover,.historyRefresh:hover{transform:translateY(-1px);box-shadow:0 7px 18px rgba(15,23,42,.08)}.historyRange.active{color:#fff;background:linear-gradient(135deg,var(--accent2,#1d4ed8),var(--accent,#2563eb));border-color:transparent}.historyRange:disabled,.historyRefresh:disabled{opacity:.55;cursor:wait;transform:none}.historyMeta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:11px}.historyMetaPill{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:6px 9px;background:color-mix(in srgb,var(--accentSoft,#dbeafe) 70%,var(--card,#fff));color:var(--hist-muted);font-size:11px;font-weight:900}.historyStatusDot{width:7px;height:7px;border-radius:50%;background:#22c55e}.historyGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.historyChartCard{position:relative;min-width:0;background:var(--hist-bg);border:1px solid color-mix(in srgb,var(--accent,#2563eb) 11%,var(--edge,#dbe3ee));border-radius:22px;padding:15px 15px 11px;box-shadow:0 12px 28px rgba(15,23,42,.06);overflow:hidden}.historyChartCard.wide{grid-column:1/-1}.historyChartHead{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:9px}.historyChartTitle{font-size:15px;font-weight:1000}.historyChartSub{font-size:11px;color:var(--hist-muted);font-weight:750;margin-top:3px}.historyLegend{display:flex;justify-content:flex-end;gap:6px;flex-wrap:wrap}.historyLegendBtn{appearance:none;border:1px solid var(--edge,#dbe3ee);background:var(--card,#fff);color:var(--hist-text);border-radius:999px;padding:5px 8px;font:inherit;font-size:10px;font-weight:900;cursor:pointer;display:inline-flex;align-items:center;gap:5px}.historyLegendBtn.off{opacity:.42}.historySwatch{width:8px;height:8px;border-radius:50%;background:var(--swatch)}.historySvgWrap{position:relative;width:100%;min-height:225px}.historySvg{display:block;width:100%;height:225px;overflow:visible}.historySvg text{font-family:inherit;fill:var(--hist-muted);font-size:11px;font-weight:750}.historySvg .historyGridLine{stroke:var(--hist-grid);stroke-width:1;vector-effect:non-scaling-stroke}.historySvg .historyPath{fill:none;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.historySvg .historyPoint{stroke-width:1.5;vector-effect:non-scaling-stroke}.historyCursor{stroke:color-mix(in srgb,var(--hist-text) 42%,transparent);stroke-width:1;stroke-dasharray:4 4;vector-effect:non-scaling-stroke}.historyTooltip{position:absolute;z-index:5;pointer-events:none;min-width:145px;max-width:230px;padding:9px 10px;border-radius:12px;background:color-mix(in srgb,var(--card,#fff) 96%,transparent);border:1px solid var(--edge,#dbe3ee);box-shadow:0 12px 30px rgba(15,23,42,.16);font-size:11px;color:var(--hist-text);opacity:0;transform:translate(-50%,-105%);transition:opacity .08s ease}.historyTooltip.show{opacity:1}.historyTooltipTime{font-weight:1000;margin-bottom:5px}.historyTooltipRow{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:4px}.historyTooltipLabel{display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--hist-muted)}.historyTooltipLabel span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.historyTooltipDot{display:inline-block;flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--tip-color);box-shadow:0 0 0 2px color-mix(in srgb,var(--tip-color) 18%,transparent)}.historyTimeline{min-height:220px}.historyTimeline .historySvg{height:auto;min-height:220px}.historyEmpty{display:grid;place-items:center;text-align:center;min-height:260px;padding:28px;border:1px dashed var(--edge,#cbd5e1);border-radius:20px;background:color-mix(in srgb,var(--card,#fff) 82%,transparent)}.historyEmptyIcon{font-size:38px;opacity:.55}.historyEmptyTitle{font-size:17px;font-weight:1000;margin-top:8px}.historyEmptyText{max-width:520px;margin-top:6px;color:var(--hist-muted);font-size:12px;line-height:1.6;font-weight:700}.historyLoading{display:flex;align-items:center;gap:9px;color:var(--hist-muted);font-weight:850}.historySpinner{width:18px;height:18px;border-radius:50%;border:2px solid color-mix(in srgb,var(--accent,#2563eb) 20%,transparent);border-top-color:var(--accent,#2563eb);animation:historySpin .75s linear infinite}@keyframes historySpin{to{transform:rotate(360deg)}}.historyFoot{color:var(--hist-muted);font-size:11px;font-weight:700;line-height:1.5;margin:0 2px}.historyError{padding:13px;border-radius:14px;background:#fff1f2;color:#be123c;border:1px solid #fecdd3;font-size:12px;font-weight:850}.historyStateLegend{display:flex;gap:8px;flex-wrap:wrap;margin-top:7px}.historyStateKey{display:inline-flex;align-items:center;gap:5px;color:var(--hist-muted);font-size:10px;font-weight:850}.historyStateKey i{display:inline-block;width:10px;height:7px;border-radius:3px;background:var(--swatch)}
@media(max-width:820px){.historyGrid{grid-template-columns:1fr}.historyChartCard.wide{grid-column:auto}.historyToolbar{align-items:flex-start}.historyRanges{width:100%}.historyRange{flex:1 1 auto}.historyChartHead{flex-direction:column}.historyLegend{justify-content:flex-start}.historySvgWrap{overflow-x:auto}.historySvg{min-width:560px}.historyTimeline .historySvg{min-width:620px}.historyTooltip{display:block;max-width:min(230px,calc(100vw - 38px));font-size:12px}.historyTooltip.touch{z-index:20}}
@media(max-width:520px){.historyChartCard{padding:13px 10px 8px}.historyRanges{gap:5px}.historyRange,.historyRefresh{padding:8px 9px}.historyTitle{font-size:18px}}

@media(max-width:820px){.historySvgWrap{touch-action:pan-x pan-y}.historyTooltip.show{opacity:1}.historyTooltipRow{gap:10px}.historyTooltipTime{font-size:11px}}

/* V3: current data first + tooltip beside cursor */
.historySvgWrap{
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;
}
.historyTooltip{
  transform:none;
  will-change:left,top,opacity;
}
.historyTooltip.sideRight::before,
.historyTooltip.sideLeft::before{
  content:"";
  position:absolute;
  top:18px;
  width:8px;
  height:8px;
  background:inherit;
  border-left:1px solid var(--edge,#dbe3ee);
  border-bottom:1px solid var(--edge,#dbe3ee);
}
.historyTooltip.sideRight::before{
  left:-5px;
  transform:rotate(45deg);
}
.historyTooltip.sideLeft::before{
  right:-5px;
  transform:rotate(225deg);
}

/* AHU_EGA_HISTORY_STATES_TOOLTIP_V5 */
.historyStateCanvasV4{
  cursor:crosshair;
  touch-action:pan-y;
}
.historyStateTooltipV4{
  position:fixed;
  z-index:2147483000;
  min-width:210px;
  max-width:min(330px,calc(100vw - 20px));
  padding:10px 12px;
  border:1px solid rgba(148,163,184,.32);
  border-radius:14px;
  background:rgba(15,23,42,.96);
  color:#fff;
  box-shadow:0 14px 34px rgba(15,23,42,.28);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  pointer-events:none;
  font:700 12px/1.35 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.historyStateTooltipV4[hidden],
.historyStateCrosshairV4[hidden]{display:none!important}
.historyStateTooltipTimeV4{
  margin-bottom:7px;
  padding-bottom:6px;
  border-bottom:1px solid rgba(255,255,255,.14);
  color:#e2e8f0;
  font-weight:900;
}
.historyStateTooltipRowV4{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:3px 0;
}
.historyStateTooltipNameV4{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:#f8fafc;
}
.historyStateTooltipValueV4{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:84px;
  padding:3px 7px;
  border-radius:999px;
  font-size:10px;
  font-weight:1000;
  letter-spacing:.02em;
  white-space:nowrap;
}
.historyStateTooltipValueV4.on{background:#dcfce7;color:#166534}
.historyStateTooltipValueV4.off{background:#e2e8f0;color:#334155}
.historyStateTooltipValueV4.na{background:#fef3c7;color:#92400e}
.historyStateCrosshairV4{
  position:fixed;
  z-index:2147482999;
  width:1px;
  background:rgba(71,85,105,.72);
  box-shadow:0 0 0 1px rgba(255,255,255,.30);
  pointer-events:none;
}
@media(max-width:820px){
  .historyStateTooltipV4{
    display:block;
    min-width:190px;
    max-width:calc(100vw - 16px);
    padding:9px 10px;
    border-radius:13px;
    font-size:11px;
  }
  .historyStateTooltipValueV4{min-width:76px;font-size:9px}
}

