
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root{
  --bg:#050b18;
  --bg2:#07162a;
  --panel:#0b2038;
  --panel2:#0d2947;
  --panel3:#102f50;
  --line:rgba(104,194,255,.20);
  --line2:rgba(255,255,255,.075);
  --text:#f6fbff;
  --muted:#9cb2c8;
  --muted2:#6f879f;
  --cyan:#25c8ff;
  --blue:#4f7cff;
  --violet:#a86cff;
  --pink:#ff4fa3;
  --green:#57f26d;
  --lime:#b8f64a;
  --amber:#ffc247;
  --orange:#ff8d45;
  --teal:#28e2d2;
  --red:#ff5570;
  --radius:24px;
  --shadow:0 22px 60px rgba(0,0,0,.34);
}

*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{
  min-height:100vh;color:var(--text);
  font-family:"Manrope",Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:
    radial-gradient(800px 420px at 12% -8%,rgba(38,135,255,.28),transparent 65%),
    radial-gradient(700px 430px at 100% 18%,rgba(171,74,255,.15),transparent 65%),
    radial-gradient(600px 500px at 65% 100%,rgba(0,226,210,.08),transparent 70%),
    linear-gradient(145deg,#07182f 0%,#040c1b 52%,#020611 100%);
  overflow-x:hidden;
}
body:before{
  content:"";position:fixed;inset:0;pointer-events:none;z-index:-1;
  background-image:
    linear-gradient(rgba(255,255,255,.018) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.018) 1px,transparent 1px);
  background-size:46px 46px;
  mask-image:linear-gradient(to bottom,rgba(0,0,0,.65),transparent 85%);
}
button,input,select{font:inherit}
button{cursor:pointer}
svg{display:block}
.app{display:flex;min-height:100vh}

/* ---------- SIDEBAR ---------- */
.sidebar{
  position:sticky;top:14px;
  width:230px;min-width:230px;height:calc(100vh - 28px);
  margin:14px 12px 14px 14px;padding:18px 12px 12px;
  display:flex;flex-direction:column;
  background:linear-gradient(180deg,rgba(8,28,55,.97),rgba(3,11,24,.98));
  border:1px solid rgba(94,191,255,.18);border-radius:28px;
  box-shadow:var(--shadow),inset 0 1px rgba(255,255,255,.04);
  z-index:100;
}
.sidebar-logo{
  display:flex;align-items:center;justify-content:center;gap:10px;
  padding:4px 4px 20px;border-bottom:1px solid rgba(255,255,255,.07);
}
.sidebar-logo-icon{
  width:62px;height:62px;padding:0;border-radius:20px;
  filter:drop-shadow(0 0 18px rgba(37,200,255,.22));
}
.sidebar-logo-icon img{width:100%;height:100%;object-fit:contain}
.sidebar-logo-text{display:flex;flex-direction:column;color:#fff;font-family:"Space Grotesk";font-size:16px;line-height:.95;letter-spacing:1px}
.sidebar-logo-text b:last-child{color:var(--cyan)}
.sidebar-menu{display:flex;flex-direction:column;gap:7px;margin-top:18px}
.menu-item{
  min-height:50px;display:flex;align-items:center;gap:12px;padding:10px 12px;
  color:#93a9bf;text-decoration:none;border:1px solid transparent;border-radius:16px;transition:.22s ease;
}
.menu-item:hover{color:#fff;background:rgba(52,141,255,.10);transform:translateX(2px)}
.menu-item.active{
  color:#fff;
  background:linear-gradient(105deg,rgba(37,131,255,.38),rgba(125,69,255,.15));
  border-color:rgba(76,190,255,.22);
  box-shadow:inset 3px 0 var(--cyan),0 12px 26px rgba(0,80,190,.15);
}
.menu-icon{width:25px!important;height:25px!important;min-width:25px!important;display:grid!important;place-items:center;font-size:0!important}
.menu-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.menu-text{font-size:13px!important;font-weight:800;letter-spacing:.1px}
.sidebar-bottom{
  margin-top:auto;padding:12px;display:flex;gap:9px;
  background:linear-gradient(135deg,rgba(87,242,109,.06),rgba(255,255,255,.025));
  border:1px solid rgba(87,242,109,.13);border-radius:16px;
}
.sidebar-bottom i{width:8px;height:8px;flex:0 0 8px;margin-top:4px;border-radius:50%;background:var(--green);box-shadow:0 0 13px var(--green)}
.sidebar-bottom b{display:block;color:var(--green);font-size:10px;letter-spacing:.5px}
.sidebar-bottom span{display:block;color:#718aa2;font-size:9px;margin-top:4px}
.sidebar-date{margin-top:8px;padding:11px;display:flex;gap:9px;color:#829ab0;background:rgba(255,255,255,.025);border-radius:16px}
.date-icon{font-size:22px;color:var(--cyan);line-height:1}
.sidebar-date div{min-width:0}.sidebar-date b,.sidebar-date span{display:block}
.sidebar-date b:first-child{color:#b3c7d9;font-size:9px}.sidebar-date span{margin-top:3px;font-size:9px}.sidebar-date b:last-child{margin-top:5px;color:#fff;font-size:12px}

/* ---------- MAIN + UNIVERSAL TOPBAR ---------- */
.main-content{flex:1;min-width:0;padding:20px 34px 32px 14px}
.app-topbar{
  min-height:82px;margin-bottom:18px;padding:10px 13px;
  display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:15px;
  background:linear-gradient(135deg,rgba(9,34,65,.90),rgba(6,20,40,.82));
  border:1px solid rgba(92,193,255,.18);border-radius:22px;
  box-shadow:0 18px 45px rgba(0,0,0,.20),inset 0 1px rgba(255,255,255,.04);
  backdrop-filter:blur(20px);
}
.topbar-brand{display:flex;align-items:center;gap:10px;min-width:190px}
.topbar-logo{
  width:54px;height:54px;display:grid;place-items:center;
  border-radius:17px;background:linear-gradient(145deg,rgba(37,200,255,.13),rgba(168,108,255,.08));
  border:1px solid rgba(37,200,255,.18);filter:drop-shadow(0 0 14px rgba(37,200,255,.16));
}
.topbar-logo img{width:100%;height:100%;object-fit:contain}
.topbar-brandtext{font-family:"Space Grotesk";line-height:.9;letter-spacing:1.2px}
.topbar-brandtext strong{display:block;font-size:16px}.topbar-brandtext span{display:block;margin-top:4px;color:var(--cyan);font-size:13px;font-weight:700}
.topbar-page{min-width:0}.topbar-page small{display:block;color:var(--cyan);font-size:9px;font-weight:900;letter-spacing:2px}.topbar-page strong{display:block;margin-top:3px;font-family:"Space Grotesk";font-size:25px;letter-spacing:-.6px}
.topbar-time{
  min-width:178px;padding:9px 12px;display:flex;align-items:center;gap:10px;
  background:linear-gradient(145deg,rgba(22,83,132,.70),rgba(8,31,57,.88));
  border:1px solid rgba(37,200,255,.28);border-radius:17px;
}
.topbar-calendar{width:42px;height:42px;display:grid;place-items:center;color:var(--cyan);font-size:24px;border-radius:13px;background:rgba(37,200,255,.09);border:1px solid rgba(37,200,255,.18)}
.topbar-time b{display:block;color:#dbe8f4;font-size:10px;font-weight:800}.topbar-time strong{display:block;margin-top:2px;color:var(--cyan);font-family:"Space Grotesk";font-size:14px;letter-spacing:.3px}
.page-section{display:none}.page-section.active-page{display:block}
.page-heading{margin:0 2px 13px;min-height:0}.page-heading p{color:var(--muted);font-size:12px;line-height:1.5}
.page-heading small,.page-heading h1,.page-heading .header-time{display:none}

/* ---------- PANELS ---------- */
.status-card,.large-panel{
  background:
    radial-gradient(500px 220px at 100% 0%,rgba(48,136,255,.10),transparent 70%),
    linear-gradient(145deg,rgba(10,39,72,.94),rgba(4,17,34,.97));
  border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow),inset 0 1px rgba(255,255,255,.03);
}
.meter-status{
  min-height:132px;padding:18px 20px;display:flex;align-items:center;justify-content:space-between;gap:20px;
  border-left:4px solid var(--green);
}
.meter-status.alert{border-left-color:var(--red);border-color:rgba(255,85,112,.35)}
.status-main{display:flex;align-items:center;gap:14px}
.status-emblem{
  position:relative;width:64px;height:64px;flex:0 0 64px;display:grid;place-items:center;
  color:var(--green);border-radius:20px;
  background:radial-gradient(circle at 50% 40%,rgba(87,242,109,.18),rgba(87,242,109,.03) 62%);
  border:1px solid rgba(87,242,109,.28);
  box-shadow:inset 0 0 24px rgba(87,242,109,.05),0 0 24px rgba(87,242,109,.08);
}
.status-emblem:before,.status-emblem:after{content:"";position:absolute;border-radius:50%;border:1px solid rgba(87,242,109,.18)}
.status-emblem:before{inset:7px}.status-emblem:after{inset:-4px;border-style:dashed;opacity:.45}
.status-emblem svg{width:42px;height:42px;position:relative;z-index:1}
.emblem-ring{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-dasharray:54 20;opacity:.65}
.emblem-check{fill:none;stroke:currentColor;stroke-width:4;stroke-linecap:round;stroke-linejoin:round}
.emblem-spark{fill:none;stroke:var(--amber);stroke-width:2;stroke-linecap:round}
.status-emblem.alert{color:#fff;border-color:rgba(255,85,112,.45);background:rgba(255,85,112,.10)}
.status-emblem.alert:before,.status-emblem.alert:after{border-color:rgba(255,85,112,.24)}
.status-main>div:last-child>span{display:block;color:#8ea8be;font-size:9px;font-weight:900;letter-spacing:1.7px}
.status-main strong{display:inline-block;margin-top:5px;padding:6px 12px;color:#e5ffdc;font-size:16px;line-height:1;border-radius:10px;background:rgba(87,242,109,.12)}
.status-main strong.alert{color:#fff;background:rgba(255,85,112,.14)}
.status-main p{margin-top:7px;color:#9bb1c7;font-size:11px}
.connection-grid{display:grid;grid-template-columns:repeat(4,minmax(78px,1fr));gap:8px;min-width:410px}
.connection-chip{min-height:53px;padding:8px 10px;display:flex;align-items:center;gap:8px;background:rgba(255,255,255,.035);border:1px solid rgba(115,190,235,.13);border-radius:14px}
.connection-chip i{width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--green);box-shadow:0 0 11px var(--green)}
.connection-chip span{color:#839bb1;font-size:8px;font-weight:900;letter-spacing:1px}.connection-chip small{display:block;margin-top:3px;color:var(--green);font-size:9px;font-weight:900;white-space:nowrap}

/* ---------- METRICS ---------- */
.dashboard-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:14px}
.metric-card{
  --accent:var(--cyan);position:relative;overflow:hidden;min-height:224px;display:flex;gap:14px;padding:20px;
  background:linear-gradient(145deg,rgba(12,45,81,.95),rgba(4,19,38,.98));
  border:1px solid rgba(116,188,235,.16);border-left:4px solid var(--accent);border-radius:22px;
  box-shadow:0 18px 42px rgba(0,0,0,.28),inset 0 1px rgba(255,255,255,.025);
  transition:transform .22s ease,border-color .22s ease;
}
.metric-card:hover{transform:translateY(-3px);border-color:color-mix(in srgb,var(--accent) 45%,transparent)}
.metric-card:after{content:"";position:absolute;right:-55px;bottom:-70px;width:180px;height:180px;border-radius:50%;border:1px solid color-mix(in srgb,var(--accent) 15%,transparent);box-shadow:0 0 90px color-mix(in srgb,var(--accent) 10%,transparent)}
.metric-card.voltage{--accent:#2bb7ff}.metric-card.current{--accent:#b46cff}.metric-card.power{--accent:#67ef62}.metric-card.energy{--accent:#ffc247}.metric-card.frequency{--accent:#28e2d2}.metric-card.pf{--accent:#ff5da9}
.metric-icon{width:58px;height:58px;min-width:58px;display:grid;place-items:center;color:var(--accent);background:linear-gradient(145deg,rgba(255,255,255,.055),rgba(255,255,255,.018));border:1px solid color-mix(in srgb,var(--accent) 55%,transparent);border-radius:18px;box-shadow:inset 0 0 20px color-mix(in srgb,var(--accent) 8%,transparent)}
.metric-icon svg{width:30px;height:30px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.metric-content{flex:1;min-width:0;position:relative;z-index:1}.metric-title{display:flex;align-items:center;justify-content:space-between;gap:8px;color:#f7fbff;font-size:17px;font-weight:900}
.status-dot{width:9px;height:9px;flex:0 0 9px;border-radius:50%;background:var(--green);box-shadow:0 0 9px var(--green),0 0 18px rgba(87,242,109,.24)}.status-dot.bad{background:var(--red);box-shadow:0 0 10px var(--red)}
.metric-value{margin-top:28px;color:#fff;font-family:"Space Grotesk";font-size:42px;line-height:1;font-weight:700;letter-spacing:-1.4px;white-space:nowrap}.metric-value small{margin-left:5px;color:var(--accent);font-family:"Manrope";font-size:14px;font-weight:900;letter-spacing:0}
.metric-line{height:4px;margin-top:25px;border-radius:99px;background:linear-gradient(90deg,var(--accent),color-mix(in srgb,var(--accent) 35%,transparent));box-shadow:0 0 14px color-mix(in srgb,var(--accent) 32%,transparent)}.metric-content p{margin-top:10px;color:#91a8bd;font-size:10px}

/* ---------- CHART / LOWER ---------- */
.large-panel{padding:20px;margin-top:14px}.panel-title{display:flex;align-items:center;justify-content:space-between;gap:15px}.panel-title h2{font-family:"Space Grotesk";color:#f7fbff;font-size:18px}.panel-title p{margin-top:5px;color:#8fa7bc;font-size:11px}
.chart-live{padding:6px 10px;color:var(--green);font-size:9px;font-weight:900;border:1px solid rgba(87,242,109,.23);background:rgba(87,242,109,.07);border-radius:99px}
.graph-controls{margin:14px 0 9px;display:flex;align-items:center;justify-content:space-between;gap:12px}.graph-controls label{display:flex;align-items:center;gap:9px;color:#8fa7bc;font-size:10px}.graph-controls select,.panel-title>select{min-height:36px;padding:0 11px;color:#eaf4ff;background:#071b34;border:1px solid rgba(90,165,225,.2);border-radius:10px;outline:none}
.chart-container{width:100%;height:310px;overflow:hidden;border-radius:14px;background:linear-gradient(180deg,rgba(255,255,255,.015),transparent)}.chart-container canvas{width:100%;height:100%;display:block;touch-action:none}.chart-footer{display:flex;justify-content:space-between;margin-top:8px;color:#71879b;font-size:10px}
.lower-grid{display:grid;grid-template-columns:1.25fr .75fr;gap:14px}.summary-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:16px}.summary-grid>div{min-width:0;padding:14px;background:rgba(255,255,255,.032);border:1px solid var(--line2);border-radius:15px}.summary-grid em{display:block;color:var(--cyan);font-style:normal;font-size:18px;font-weight:900}.summary-grid span{display:block;margin-top:7px;color:#8098ae;font-size:9px;font-weight:800}.summary-grid b{display:block;margin-top:6px;color:#fff;font-family:"Space Grotesk";font-size:16px;line-height:1.15}.system-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:16px}.system-grid>div{padding:12px;color:var(--green);background:rgba(255,255,255,.032);border:1px solid var(--line2);border-radius:14px;font-size:12px}.system-grid span{display:inline-block;margin-left:7px;color:#9db2c5;font-size:9px}.system-grid b{display:block;margin-top:4px;color:#e9f4ff;font-size:10px}

/* ---------- HISTORY ---------- */
.history-panel{padding:20px}.history-intro{display:flex;align-items:center;gap:14px;padding:15px;background:linear-gradient(120deg,rgba(37,200,255,.08),rgba(168,108,255,.06),rgba(255,255,255,.015));border:1px solid var(--line2);border-radius:18px}.history-icon{width:52px;height:52px;flex:0 0 52px;display:grid;place-items:center;color:var(--cyan);font-family:"Space Grotesk";font-weight:800;font-size:14px;border:1px solid rgba(37,200,255,.30);background:linear-gradient(145deg,rgba(37,200,255,.13),rgba(168,108,255,.08));border-radius:16px;box-shadow:0 0 22px rgba(37,200,255,.07)}.history-icon.month{font-size:26px}.history-intro h2{font-family:"Space Grotesk";font-size:19px}.history-intro p{margin-top:5px;color:#8ea6bb;font-size:10px;line-height:1.65}.history-note{margin-top:12px;padding:13px 15px;display:flex;gap:10px;color:#93a9bc;background:linear-gradient(90deg,rgba(37,200,255,.055),rgba(168,108,255,.035));border:1px solid rgba(37,200,255,.14);border-radius:15px}.history-note>span{width:21px;height:21px;flex:0 0 21px;display:grid;place-items:center;color:var(--cyan);font-weight:900;border:1px solid rgba(37,200,255,.32);border-radius:50%}.history-note p{font-size:10px;line-height:1.55}.history-note b{color:#e1f1ff}

/* ---------- TABLE ---------- */
.table-wrap{width:100%;overflow-x:auto;margin-top:16px;border-radius:16px;border:1px solid rgba(100,170,225,.10)}table{width:100%;min-width:650px;border-collapse:collapse}th,td{padding:13px 12px;text-align:left;border-bottom:1px solid rgba(100,170,225,.08);font-size:10px}th{color:#728aa1;background:rgba(255,255,255,.028);font-weight:900;letter-spacing:.3px}td{color:#cbd9e6}tbody tr:last-child td{border-bottom:0}tbody tr:hover td{background:rgba(39,140,255,.045)}td strong{color:#f5fbff;font-family:"Space Grotesk"}.alarm-parameter{color:#dbe9f5;font-weight:700}.alarm-value{color:var(--amber)}.alarm-condition{display:inline-flex;padding:5px 8px;color:#ff8798;background:rgba(255,85,112,.08);border:1px solid rgba(255,85,112,.14);border-radius:999px;font-size:9px}

/* ---------- ALARM ---------- */
.alarm-banner{display:flex;align-items:center;gap:14px;padding:16px;border:1px solid rgba(87,242,109,.16);background:linear-gradient(100deg,rgba(87,242,109,.06),rgba(37,200,255,.025));border-radius:17px}.alarm-banner.alert{border-color:rgba(255,85,112,.28);background:linear-gradient(100deg,rgba(255,85,112,.09),rgba(168,108,255,.03))}.alarm-banner>span{font-size:27px;filter:drop-shadow(0 0 8px rgba(255,194,71,.24))}.alarm-banner b{font-family:"Space Grotesk";font-size:16px}.alarm-banner p{margin-top:4px;color:#8ea5ba;font-size:10px}.alarm-list{display:grid;grid-template-columns:repeat(5,1fr);gap:9px;margin-top:12px}.alarm-list>div{padding:13px;background:rgba(255,255,255,.03);border:1px solid var(--line2);border-radius:14px;color:#8fa6bb;font-size:9px}.alarm-list strong{display:block;margin-top:6px;color:var(--green);font-size:10px}.alarm-list strong.alert{color:var(--red)}
.secondary,.primary{min-height:37px;padding:0 13px;border-radius:11px;font-size:10px;font-weight:800}.secondary{color:#b4c7d8;background:rgba(255,255,255,.035);border:1px solid rgba(100,170,225,.16)}.primary{color:#fff;background:linear-gradient(135deg,#237dff,#25c8ff);border:1px solid rgba(80,190,255,.35);box-shadow:0 9px 20px rgba(0,105,220,.22)}.actions{display:flex;align-items:center;gap:12px;margin-top:15px}#saved{color:var(--green);font-size:10px}

/* ---------- SETTINGS / ABOUT / FOOTER ---------- */
.settings .setting-row{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:14px 0;border-bottom:1px solid rgba(100,170,225,.08)}.settings .setting-row:last-child{border-bottom:0}.setting-row b{font-size:11px}.setting-row span{display:block;margin-top:4px;color:#839aaf;font-size:9px}.setting-row input,.alarm-settings input{width:90px;height:35px;padding:0 9px;color:#fff;background:#06182f;border:1px solid rgba(90,165,225,.20);border-radius:9px;outline:none}.alarm-settings{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin-top:14px}.alarm-settings>label{padding:12px;background:rgba(255,255,255,.025);border:1px solid var(--line2);border-radius:13px;color:#8da4ba;font-size:10px}.alarm-settings>label>div{margin-top:8px;color:#cbd8e5}.green{color:var(--green)}.about{text-align:center;padding:28px}.about>img{width:92px;height:92px;margin:0 auto;filter:drop-shadow(0 0 24px rgba(37,200,255,.22))}.about h2{margin-top:10px;font-family:"Space Grotesk";font-size:22px}.about>p{max-width:700px;margin:8px auto 0;color:#8fa7bc;font-size:11px;line-height:1.65}.about-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:20px;text-align:left}.about-grid>div,.about-extra>div{padding:13px;background:rgba(255,255,255,.025);border:1px solid var(--line2);border-radius:14px}.about-grid span{display:block;color:#7089a0;font-size:9px}.about-grid b{display:block;margin-top:5px;color:#e8f3fc;font-size:10px}.about-extra{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px;text-align:left}.about-extra h3{font-size:11px}.about-extra p{margin-top:5px;color:#8fa7bc;font-size:9px;line-height:1.6}footer{display:flex;justify-content:space-between;gap:15px;margin-top:18px;padding:15px 4px 0;border-top:1px solid rgba(255,255,255,.06);color:#758ca1;font-size:9px}footer strong{color:#d8e6f2}footer strong b{color:var(--cyan)}

/* ---------- MOBILE ---------- */
.mobile-bottom-nav{display:none}

@media(max-width:1150px){
  .sidebar{width:190px;min-width:190px}.main-content{padding:18px 20px 28px 8px}.topbar-brand{min-width:160px}.topbar-time{min-width:160px}.connection-grid{min-width:350px}.dashboard-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.lower-grid{grid-template-columns:1fr}.about-grid{grid-template-columns:repeat(2,1fr)}
}

@media(max-width:700px){
  body{padding-bottom:86px;background:radial-gradient(650px 300px at 50% -10%,rgba(38,135,255,.28),transparent 68%),radial-gradient(500px 300px at 100% 50%,rgba(168,108,255,.10),transparent 70%),linear-gradient(160deg,#06182e 0%,#030b18 65%,#020611 100%)}
  .app{display:block;min-height:100vh}.sidebar{display:none!important}
  .main-content{width:100%;padding:9px 10px 100px}
  .app-topbar{
    position:sticky;top:0;z-index:900;
    min-height:70px;margin:0 -10px 14px;padding:8px 10px;
    grid-template-columns:auto 1fr auto;gap:8px;border-radius:0 0 20px 20px;
    background:rgba(4,17,34,.91);backdrop-filter:blur(22px);
    border-left:0;border-right:0;border-top:0;
  }
  .topbar-brand{min-width:0;gap:7px}.topbar-logo{width:44px;height:44px;border-radius:14px}.topbar-brandtext strong{font-size:12px}.topbar-brandtext span{font-size:9px;margin-top:3px}
  .topbar-page{padding-left:2px}.topbar-page small{font-size:6.5px;letter-spacing:1.3px}.topbar-page strong{font-size:17px;letter-spacing:-.3px}
  .topbar-time{min-width:91px;width:91px;padding:7px 6px;justify-content:center;gap:6px;border-radius:14px}.topbar-calendar{width:29px;height:29px;border-radius:9px;font-size:17px}.topbar-time b{font-size:7px}.topbar-time strong{font-size:10px}
  .page-heading{margin:0 3px 10px}.page-heading p{font-size:10px}
  .meter-status{padding:14px;display:block;min-height:0;border-left-width:3px}
  .status-main{gap:10px}.status-emblem{width:54px;height:54px;min-width:54px;border-radius:17px}.status-emblem svg{width:36px;height:36px}.status-main strong{font-size:14px}.status-main p{font-size:9px}
  .connection-grid{width:100%;min-width:0;grid-template-columns:repeat(2,1fr);margin-top:12px}.connection-chip{min-height:46px;padding:8px}.connection-chip span{font-size:7px}.connection-chip small{font-size:8px}
  .dashboard-grid{grid-template-columns:1fr;gap:10px;margin-top:10px}.metric-card{min-height:174px;padding:16px;border-radius:19px}.metric-icon{width:50px;height:50px;min-width:50px;border-radius:16px}.metric-icon svg{width:27px;height:27px}.metric-title{font-size:15px}.metric-value{font-size:36px;margin-top:23px}.metric-line{margin-top:20px}.metric-content p{font-size:8.5px}
  .large-panel{padding:15px;border-radius:19px;margin-top:10px}.panel-title h2{font-size:16px}.panel-title p{font-size:9.5px}.chart-container{height:245px}.graph-controls{align-items:flex-start;flex-direction:column}.graph-controls select{width:100%}
  .summary-grid{grid-template-columns:repeat(2,1fr);gap:8px}.summary-grid>div{padding:11px}.summary-grid b{font-size:14px}.system-grid{grid-template-columns:1fr 1fr}
  .history-intro{align-items:flex-start;padding:12px}.history-icon{width:46px;height:46px;min-width:46px}.history-intro h2{font-size:16px}.history-intro p{font-size:9px}.table-wrap{margin-top:12px}table{min-width:650px}th,td{padding:11px 10px;font-size:9px}
  .alarm-list{grid-template-columns:repeat(2,1fr)}.alarm-list>div:last-child{grid-column:1/-1}.alarm-settings{grid-template-columns:1fr}.about-grid{grid-template-columns:repeat(2,1fr)}.about-extra{grid-template-columns:1fr}footer{flex-direction:column;text-align:center;gap:5px;padding-bottom:4px}
  .mobile-bottom-nav{
    position:fixed;left:7px;right:7px;bottom:7px;height:72px;z-index:2000;
    display:grid;grid-template-columns:repeat(5,1fr);gap:3px;padding:5px;
    background:rgba(5,17,34,.95);border:1px solid rgba(95,183,255,.22);border-radius:23px;
    box-shadow:0 18px 45px rgba(0,0,0,.55),inset 0 1px rgba(255,255,255,.04);backdrop-filter:blur(22px)
  }
  .mobile-nav-item{min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;color:#8298ad;text-decoration:none;border-radius:17px;font-size:7.5px;font-weight:800}
  .mobile-nav-item.active{color:#fff;background:linear-gradient(145deg,rgba(36,129,255,.60),rgba(116,68,255,.25));box-shadow:inset 0 0 0 1px rgba(58,160,255,.22),0 6px 18px rgba(23,102,220,.16)}
  .nav-icon{width:25px;height:25px;display:grid;place-items:center}.nav-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.mobile-nav-item.active .nav-icon{color:var(--cyan)}
}

@media(max-width:420px){
  .main-content{padding-left:8px;padding-right:8px}.app-topbar{margin-left:-8px;margin-right:-8px;padding-left:8px;padding-right:8px;grid-template-columns:auto 1fr auto;gap:6px}.topbar-logo{width:40px;height:40px}.topbar-brandtext strong{font-size:11px}.topbar-brandtext span{font-size:8px}.topbar-page strong{font-size:15px}.topbar-page small{font-size:6px}.topbar-time{width:86px;min-width:86px;padding:6px 5px}.topbar-time b{font-size:6.5px}.topbar-time strong{font-size:9.5px}.metric-card{min-height:168px;padding:14px}.metric-value{font-size:33px}.mobile-bottom-nav{left:5px;right:5px;height:69px}.mobile-nav-item{font-size:7px}
}
@supports(padding:max(0px)){
  @media(max-width:700px){.app-topbar{padding-top:max(8px,env(safe-area-inset-top));}.mobile-bottom-nav{bottom:max(7px,env(safe-area-inset-bottom));}}
}

/* =====================================================
   REVISION 3 — HIGH CONTRAST / ALARM STATE / POWER TRIANGLE
   ===================================================== */
:root{
  --text:#ffffff;
  --muted:#b6c9dd;
  --muted2:#8da6bd;
  --cyan:#00d9ff;
  --blue:#328cff;
  --violet:#b45cff;
  --pink:#ff3d9a;
  --green:#54ff5e;
  --lime:#c8ff3d;
  --amber:#ffd23f;
  --orange:#ff8a24;
  --teal:#18f0d0;
  --red:#ff365e;
}
body{font-family:"Manrope",sans-serif;font-size:14px}
button,input,select{font-family:inherit}
.page-heading p,.panel-title p,.history-intro p,.alarm-banner p,.about>p{font-size:13px;color:#b6c9dd}
.page-heading p{font-weight:600}
.panel-title h2,.history-intro h2{font-family:"Space Grotesk",sans-serif;font-weight:700}

/* Stronger status emblem: shield when normal, warning triangle when alarm. */
.status-emblem{position:relative;overflow:visible;background:linear-gradient(145deg,rgba(0,217,255,.14),rgba(84,255,94,.06));border:1px solid rgba(0,217,255,.42)!important;box-shadow:inset 0 0 24px rgba(0,217,255,.08),0 0 22px rgba(0,217,255,.10)}
.status-icon{position:absolute;width:70%;height:70%;inset:15%;overflow:visible}
.status-icon-normal{opacity:1;transform:scale(1);transition:.25s ease}
.status-icon-alert{opacity:0;transform:scale(.7);transition:.25s ease}
.status-emblem.alert{background:linear-gradient(145deg,rgba(255,54,94,.24),rgba(255,138,36,.08));border-color:rgba(255,54,94,.75)!important;box-shadow:inset 0 0 28px rgba(255,54,94,.12),0 0 26px rgba(255,54,94,.18)}
.status-emblem.alert .status-icon-normal{opacity:0;transform:scale(.7)}
.status-emblem.alert .status-icon-alert{opacity:1;transform:scale(1)}
.emblem-orbit,.emblem-shield,.emblem-check,.emblem-core,.emblem-warning,.emblem-warning-mark,.emblem-pulse{fill:none;stroke-linecap:round;stroke-linejoin:round}
.emblem-orbit{stroke:#00d9ff;stroke-width:2;stroke-dasharray:5 5}.emblem-shield{stroke:#54ff5e;stroke-width:3}.emblem-check{stroke:#fff;stroke-width:4}.emblem-core{fill:#c8ff3d;stroke:none}.emblem-warning{fill:rgba(255,54,94,.18);stroke:#ff365e;stroke-width:3}.emblem-warning-mark{stroke:#fff;stroke-width:4}.emblem-pulse{fill:#ffd23f;stroke:none}

/* Entire dashboard gains a red atmosphere while any parameter is in alarm. */
.app.alarm-active .main-content{background:radial-gradient(700px 320px at 50% 15%,rgba(255,54,94,.12),transparent 70%)}
.app.alarm-active .app-topbar{border-color:rgba(255,54,94,.45);box-shadow:0 10px 40px rgba(255,54,94,.08)}

.metric-card{transition:background .25s ease,border-color .25s ease,box-shadow .25s ease,transform .25s ease}
.metric-card.alert{background:linear-gradient(145deg,rgba(95,13,38,.92),rgba(42,12,29,.94))!important;border-color:rgba(255,54,94,.72)!important;box-shadow:inset 0 0 50px rgba(255,54,94,.10),0 16px 40px rgba(255,30,70,.10)}
.metric-card.alert .metric-line{background:linear-gradient(90deg,#ff365e,#ff8a24)!important;box-shadow:0 0 14px rgba(255,54,94,.45)}
.metric-card.alert .metric-icon{border-color:rgba(255,54,94,.62);background:rgba(255,54,94,.10)}
.metric-card.alert .status-dot{background:#ff365e!important;box-shadow:0 0 14px #ff365e!important}
.status-dot.bad{background:#ff365e!important;box-shadow:0 0 14px #ff365e!important}

/* Larger type for readability */
.metric-title{font-size:18px;font-weight:800}
.metric-value{font-size:50px;font-weight:800;letter-spacing:-1.5px}
.metric-value small{font-size:18px;font-weight:800}
.metric-content p{font-size:11px;color:#9db6cc}
.connection-chip span{font-size:10px}.connection-chip small{font-size:12px}
.status-main>div:last-child>span{font-size:13px}.status-main strong{font-size:20px}.status-main p{font-size:12px}
.summary-grid span{font-size:11px}.summary-grid b{font-size:19px}
th,td{font-size:12px}th{font-size:11px}.alarm-list>div{font-size:12px}.alarm-list strong{font-size:13px}

/* Power triangle */
.power-triangle-panel{margin-top:14px;overflow:hidden;background:linear-gradient(135deg,rgba(7,30,57,.96),rgba(12,17,45,.96));border-color:rgba(0,217,255,.25)}
.triangle-live{padding:7px 11px;border-radius:999px;color:#54ff5e;background:rgba(84,255,94,.08);border:1px solid rgba(84,255,94,.25);font-size:10px;font-weight:900;letter-spacing:.8px}
.power-triangle-layout{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(250px,.7fr);gap:20px;align-items:center;margin-top:10px}
.power-triangle-visual{min-height:255px;display:grid;place-items:center;border:1px solid rgba(0,217,255,.12);border-radius:20px;background:radial-gradient(circle at 50% 50%,rgba(0,217,255,.06),transparent 65%),rgba(255,255,255,.018)}
.power-triangle-visual svg{width:100%;max-width:520px;height:auto}
.triangle-fill{fill:url(#triFill);stroke:none}.triangle-line{fill:none;stroke:#00d9ff;stroke-width:4;filter:url(#triGlow);stroke-linecap:round;stroke-linejoin:round}.triangle-angle{fill:none;stroke:#ffd23f;stroke-width:3}.triangle-label{font-family:"Space Grotesk";font-size:13px;font-weight:800}.triangle-label.active{fill:#54ff5e}.triangle-label.reactive{fill:#b45cff}.triangle-label.apparent{fill:#ff3d9a}.triangle-cos{fill:#c9d9e8;font-family:"Manrope";font-size:11px;font-weight:700}.triangle-cos tspan{fill:#ffd23f}.triangle-values{display:grid;grid-template-columns:1fr 1fr;gap:10px}.triangle-value{padding:16px;border-radius:16px;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.035)}.triangle-value span{display:block;color:#9db6cc;font-size:11px;font-weight:700}.triangle-value strong{display:block;margin-top:7px;font-family:"Space Grotesk";font-size:21px}.triangle-value.active{border-color:rgba(84,255,94,.28)}.triangle-value.active strong{color:#54ff5e}.triangle-value.reactive{border-color:rgba(180,92,255,.28)}.triangle-value.reactive strong{color:#b45cff}.triangle-value.apparent{border-color:rgba(255,61,154,.28)}.triangle-value.apparent strong{color:#ff3d9a}.triangle-value.pf{border-color:rgba(255,210,63,.28)}.triangle-value.pf strong{color:#ffd23f}

/* New chart: glowing area + sharper grid */
.dashboard-chart-panel{background:linear-gradient(145deg,rgba(7,29,55,.97),rgba(12,16,42,.96))}
.chart-container{border:1px solid rgba(0,217,255,.14);background:radial-gradient(circle at 50% 100%,rgba(0,217,255,.07),transparent 60%),rgba(1,10,22,.25);box-shadow:inset 0 0 35px rgba(0,217,255,.035)}
.chart-live{color:#54ff5e!important;background:rgba(84,255,94,.08)!important;border-color:rgba(84,255,94,.28)!important}

.history-date.today{color:#00d9ff;text-shadow:0 0 10px rgba(0,217,255,.22)}

@media(max-width:700px){
  .main-content{padding-top:8px}
  .page-heading p{font-size:12px}
  .metric-card{min-height:190px;padding:18px}
  .metric-title{font-size:18px}.metric-value{font-size:45px}.metric-value small{font-size:16px}.metric-content p{font-size:10px}
  .status-main strong{font-size:19px}.status-main p{font-size:11px}.connection-chip span{font-size:9px}.connection-chip small{font-size:11px}
  .panel-title h2{font-size:19px}.panel-title p{font-size:11px}.history-intro h2{font-size:19px}.history-intro p{font-size:11px}
  .power-triangle-layout{grid-template-columns:1fr;gap:12px}.power-triangle-visual{min-height:220px}.triangle-values{grid-template-columns:1fr 1fr}.triangle-value{padding:13px}.triangle-value strong{font-size:17px}
  th,td{font-size:11px;padding:13px 11px}
  .alarm-list strong{font-size:13px}
}
@media(max-width:420px){
  .metric-value{font-size:40px}.metric-card{min-height:182px}.triangle-values{gap:7px}.triangle-value strong{font-size:15px}.triangle-value span{font-size:9px}
}

/* =====================================================
   REVISION 4 — POLISHED MOBILE HEADER + STATUS EMBLEMS
   ===================================================== */
.status-emblem{
  width:76px;height:76px;min-width:76px;
  display:grid;place-items:center;position:relative;overflow:hidden;
  border-radius:22px!important;
  background:linear-gradient(145deg,rgba(0,217,255,.16),rgba(84,255,94,.13))!important;
  border:1px solid rgba(0,217,255,.48)!important;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.035),inset 0 -12px 24px rgba(0,0,0,.16),0 10px 26px rgba(0,217,255,.10);
}
.status-emblem:before,.status-emblem:after{content:none!important}
.status-icon{position:absolute!important;inset:9px!important;width:58px!important;height:58px!important;overflow:visible!important}
.emblem-ring{fill:none;stroke:rgba(0,217,255,.48);stroke-width:2;stroke-dasharray:3 5}
.emblem-shield-fill{fill:rgba(84,255,94,.16);stroke:none}
.emblem-shield{fill:none;stroke:#54ff5e;stroke-width:3;stroke-linejoin:round}
.emblem-check{fill:none;stroke:#ffffff;stroke-width:4.5;stroke-linecap:round;stroke-linejoin:round}
.emblem-core{fill:#c8ff3d;stroke:#06182b;stroke-width:1.5}
.emblem-warning{fill:rgba(255,54,94,.22);stroke:#ff365e;stroke-width:3;stroke-linejoin:round}
.emblem-warning-inner{fill:rgba(255,138,36,.18);stroke:#ff8a24;stroke-width:1.5;stroke-linejoin:round}
.emblem-warning-mark{fill:none;stroke:#ffffff;stroke-width:4.5;stroke-linecap:round}
.emblem-warning-dot{fill:#ffd23f;stroke:none}
.status-emblem.alert{
  background:linear-gradient(145deg,rgba(255,54,94,.22),rgba(255,138,36,.15))!important;
  border-color:rgba(255,54,94,.72)!important;
  box-shadow:inset 0 0 0 1px rgba(255,138,36,.10),inset 0 -12px 24px rgba(120,0,25,.16),0 10px 28px rgba(255,54,94,.14);
}

/* Stronger status badge so state is readable even without glow. */
.status-main strong{border:1px solid rgba(84,255,94,.28);background:linear-gradient(135deg,rgba(84,255,94,.18),rgba(200,255,61,.08));box-shadow:inset 0 0 18px rgba(84,255,94,.06)}
.status-main strong.alert{border-color:rgba(255,54,94,.38);background:linear-gradient(135deg,rgba(255,54,94,.22),rgba(255,138,36,.12));color:#fff}

/* Mobile topbar: larger logo, stronger typography and clearer date/time block. */
@media(max-width:700px){
  .app-topbar{
    min-height:86px;padding:10px 12px!important;
    grid-template-columns:auto minmax(88px,1fr) auto!important;
    gap:10px!important;border-radius:0 0 22px 22px!important;
  }
  .topbar-brand{gap:8px!important}
  .topbar-logo{width:56px!important;height:56px!important;border-radius:18px!important;border-color:rgba(0,217,255,.32)!important;box-shadow:0 0 24px rgba(0,217,255,.13),inset 0 0 18px rgba(0,217,255,.07)}
  .topbar-brandtext strong{font-size:14px!important;letter-spacing:1.1px!important}
  .topbar-brandtext span{font-size:10px!important;letter-spacing:1.5px!important;margin-top:4px!important}
  .topbar-page{padding-left:0!important}
  .topbar-page small{font-size:7.5px!important;letter-spacing:1.5px!important;white-space:nowrap}
  .topbar-page strong{font-size:20px!important;letter-spacing:-.4px!important;margin-top:4px!important}
  .topbar-time{
    width:118px!important;min-width:118px!important;height:58px;padding:7px 8px!important;
    gap:8px!important;border-radius:18px!important;
    background:linear-gradient(145deg,rgba(20,91,146,.78),rgba(7,28,52,.94))!important;
    border-color:rgba(0,217,255,.38)!important;box-shadow:inset 0 0 20px rgba(0,217,255,.05),0 8px 24px rgba(0,0,0,.18)
  }
  .topbar-calendar{width:34px!important;height:34px!important;min-width:34px!important;border-radius:11px!important;font-size:19px!important}
  .topbar-time b{font-size:9px!important;line-height:1.1!important}
  .topbar-time strong{font-size:13px!important;line-height:1.1!important;margin-top:3px!important;letter-spacing:.1px!important}
  .status-emblem{width:68px;height:68px;min-width:68px;border-radius:20px!important}
  .status-icon{inset:7px!important;width:54px!important;height:54px!important}
}
@media(max-width:420px){
  .app-topbar{min-height:82px;padding:9px 10px!important;gap:7px!important}
  .topbar-logo{width:50px!important;height:50px!important;border-radius:17px!important}
  .topbar-brandtext strong{font-size:12px!important}.topbar-brandtext span{font-size:9px!important}
  .topbar-page small{font-size:6.5px!important}.topbar-page strong{font-size:18px!important}
  .topbar-time{width:108px!important;min-width:108px!important;height:54px!important;padding:6px!important}
  .topbar-calendar{width:31px!important;height:31px!important;min-width:31px!important;font-size:17px!important}
  .topbar-time b{font-size:8px!important}.topbar-time strong{font-size:12px!important}
}

/* =====================================================
   ENERGY METER V3 — LIGHT INDUSTRIAL DESIGN OVERRIDE
   ===================================================== */
:root{
  --page:#f4f7f6;--surface:#ffffff;--surface-2:#f8faf9;--ink:#17231f;--muted:#68756f;
  --line:#dfe7e3;--cyan:#00a9c7;--violet:#7c4dff;--lime:#4b9f2d;--amber:#e39a16;
  --teal:#008f8c;--coral:#ef476f;--shadow:0 12px 30px rgba(28,45,38,.08);
}
html,body{background:var(--page)!important;color:var(--ink)!important;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important}
body{font-size:15px}.app{background:var(--page)!important;min-height:100vh}.main-content{background:var(--page)!important}
.sidebar{background:#10211d!important;border-right:0!important;box-shadow:8px 0 28px rgba(16,33,29,.08)!important}
.sidebar-logo-text b{color:#fff!important}.sidebar-bottom,.sidebar-date{background:rgba(255,255,255,.07)!important;border-color:rgba(255,255,255,.1)!important}
.menu-item{color:#b9c8c2!important}.menu-item.active{background:linear-gradient(135deg,#1d4037,#245d4e)!important;color:#fff!important;box-shadow:inset 3px 0 0 #53d6a3!important}
.menu-icon{color:inherit!important}.app-topbar{background:rgba(255,255,255,.92)!important;border:1px solid var(--line)!important;box-shadow:var(--shadow)!important;backdrop-filter:blur(14px)}
.topbar-brandtext strong,.topbar-brandtext span{color:var(--ink)!important}.topbar-page small{color:#80908a!important}.topbar-page strong{color:#17231f!important}.topbar-time{background:#eef7f3!important;border:1px solid #cfe5dc!important;color:#1c3029!important}.topbar-time strong{color:#008f8c!important}
.page-heading p{color:var(--muted)!important;font-size:15px!important}.large-panel,.status-card,.metric-card{background:var(--surface)!important;border:1px solid var(--line)!important;box-shadow:var(--shadow)!important;color:var(--ink)!important}
.status-card{border-left:5px solid #53d6a3!important}.status-card.alert{border-left-color:#ef476f!important;background:linear-gradient(90deg,#fff,#fff7f8)!important}.status-emblem{background:#eaf8f1!important;border:1px solid #bfe6d1!important;box-shadow:none!important}.status-emblem.alert{background:#fff0f2!important;border-color:#ffc1cc!important}.emblem-shield-fill{fill:#d6f3e5!important}.emblem-shield{stroke:#1aa66a!important}.emblem-check{stroke:#11865a!important}.emblem-ring{stroke:#70d8ad!important}.emblem-core{fill:#efb03b!important}.emblem-warning{fill:#ffe0e6!important;stroke:#ef476f!important}.emblem-warning-inner{fill:#fff!important;stroke:#ef476f!important}.emblem-warning-mark,.emblem-warning-dot{stroke:#d72d55!important;fill:#d72d55!important}
.status-main>div:last-child>span{color:#75847d!important}.status-main>div:last-child>strong{color:#18322a!important}.status-main>div:last-child>p{color:#65746e!important}.connection-chip{background:#f5f8f7!important;border:1px solid #e1e9e5!important}.connection-chip span{color:#56665f!important}.connection-chip small{color:#1b9a6d!important}
.metric-card{position:relative;overflow:hidden}.metric-card:after{content:"";position:absolute;right:-28px;bottom:-30px;width:110px;height:110px;border-radius:50%;opacity:.12;background:currentColor}.metric-card.voltage{color:#008fb0!important;border-top:4px solid #00a9c7!important}.metric-card.current{color:#6842d9!important;border-top:4px solid #7c4dff!important}.metric-card.power{color:#4a8d2d!important;border-top:4px solid #71b83f!important}.metric-card.energy{color:#bd7b00!important;border-top:4px solid #f0ad1b!important}.metric-card.frequency{color:#007f7b!important;border-top:4px solid #00a39f!important}.metric-card.pf{color:#d22f58!important;border-top:4px solid #ef476f!important}.metric-card.alert{background:#fff1f3!important;border-color:#ffb5c2!important;box-shadow:0 14px 32px rgba(239,71,111,.14)!important;color:#c6284e!important}.metric-card.alert .metric-line{background:#ef476f!important}.metric-icon{background:currentColor!important;color:#fff!important;box-shadow:none!important}.metric-content,.metric-title span,.metric-content p{color:inherit!important}.metric-title span{color:#41524b!important}.metric-value{font-size:42px!important;color:#17231f!important;font-weight:800!important;letter-spacing:-1.8px}.metric-value small{font-size:17px!important;color:#68756f!important}.metric-line{background:currentColor!important;opacity:.72!important}.metric-content p{color:#7a8882!important}
.panel-title h2{color:#17231f!important;font-weight:800!important;letter-spacing:-.4px}.panel-title p{color:#738079!important}.triangle-live,.chart-live{background:#edf8f3!important;color:#168a65!important;border:1px solid #cce9dc!important}.graph-controls label,.graph-controls select{color:#50615a!important}.graph-controls select{background:#fff!important;border:1px solid #d6e1dc!important;color:#24352e!important}
.chart-container{background:#fbfdfc!important;border:1px solid #e3ebe7!important;border-radius:18px!important}.chart-footer{color:#7b8983!important}.summary-grid>div{background:#f7faf8!important;border:1px solid #e1e9e5!important}.summary-grid em{background:#eaf5f1!important;color:#168a65!important}.summary-grid span{color:#6d7b75!important}.summary-grid b{color:#17231f!important;font-size:20px!important}.system-grid>div{background:#f7faf8!important;border:1px solid #e1e9e5!important;color:#168a65!important}.system-grid span{color:#5f7069!important}.system-grid b{color:#17231f!important}
.history-intro,.history-note{color:var(--ink)!important}.history-intro p,.history-note p{color:#68756f!important}.history-icon{background:#eef7f3!important;color:#148f70!important;border-color:#cfe6db!important}.history-table{color:#25352e!important}.history-table thead{background:#f0f5f2!important}.history-table th{color:#62716b!important}.history-table td{border-color:#e6ece9!important}.history-table tbody tr:hover{background:#f8fbfa!important}.history-date.today{color:#008f8c!important}.alarm-banner{background:#f4faf7!important;border:1px solid #d6e8df!important;color:#21362d!important}.alarm-banner.alert{background:#fff1f3!important;border-color:#ffc1cb!important}.alarm-list>div{background:#f7faf8!important;border:1px solid #e1e9e5!important;color:#586860!important}.alarm-list strong{color:#168a65!important}.alarm-list strong.alert{color:#d62f52!important}.settings input,.settings select{background:#fff!important;border-color:#d5e0db!important;color:#1f3029!important}.primary{background:#123f34!important;color:#fff!important}.secondary{background:#f3f6f4!important;border:1px solid #d8e2dd!important;color:#3f5049!important}.about{color:#24352e!important}.about-grid>div,.about-extra>div{background:#f7faf8!important;border-color:#e1e9e5!important}.about-grid span{color:#718078!important}.about-grid b{color:#1d3028!important}footer{color:#7a8781!important}
.mobile-bottom-nav{background:rgba(255,255,255,.96)!important;border:1px solid #dfe8e3!important;box-shadow:0 10px 28px rgba(24,48,39,.12)!important}.mobile-nav-item{color:#718079!important}.mobile-nav-item.active{color:#008f8c!important;background:#edf8f4!important}
.app.alarm-active{background:linear-gradient(180deg,#fff8f9 0%,#f4f7f6 30%)!important}.app.alarm-active .app-topbar{border-color:#ffc2cc!important}.app.alarm-active .topbar-time{background:#fff0f2!important;border-color:#ffc2cc!important}.app.alarm-active .topbar-time strong{color:#d62f52!important}
/* V3 additions */
.v3-badge{display:inline-flex;align-items:center;gap:7px;padding:7px 11px;border-radius:999px;background:#f0f6f3;border:1px solid #d9e8e1;color:#52635b;font-size:12px;font-weight:750}.v3-badge strong{color:#17231f}.v3-badge .pulse{width:8px;height:8px;border-radius:50%;background:#39ad76}.peak-card{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:20px 22px;border-radius:18px;background:linear-gradient(135deg,#fff7e8,#fff);border:1px solid #f2dfbd}.peak-card .peak-label{font-size:12px;color:#8b7652;font-weight:800;text-transform:uppercase;letter-spacing:.08em}.peak-card strong{display:block;font-size:28px;color:#8c5d00;margin-top:5px}.peak-card small{color:#7b817e}.quality-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px}.quality-chip{padding:12px;border:1px solid #e0e8e4;border-radius:14px;background:#fafcfb}.quality-chip b{display:block;font-size:12px;color:#68756f}.quality-chip strong{display:block;margin-top:4px;font-size:15px;color:#173128}.quality-chip.ok{border-top:3px solid #4caf78}.quality-chip.bad{border-top:3px solid #ef476f;background:#fff4f5}.alarm-duration{font-variant-numeric:tabular-nums;color:#b32645;font-weight:800}.last-data-card{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}.last-data-card>div{padding:13px;border-radius:14px;background:#f7faf8;border:1px solid #e1e9e5}.last-data-card span{display:block;font-size:11px;color:#75827c}.last-data-card b{display:block;margin-top:4px;color:#183229}
@media(max-width:800px){.quality-grid{grid-template-columns:repeat(2,1fr)}.last-data-card{grid-template-columns:1fr 1fr}.metric-value{font-size:37px!important}.app-topbar{background:#fff!important}.page-heading p{font-size:14px!important}}
@media(max-width:430px){.quality-grid{grid-template-columns:1fr 1fr}.metric-value{font-size:35px!important}.topbar-logo{width:46px!important;height:46px!important}.topbar-brandtext strong{font-size:13px!important}.topbar-brandtext span{font-size:9px!important}.topbar-page strong{font-size:17px!important}.topbar-time{width:100px!important;min-width:100px!important}.topbar-time b{font-size:8px!important}.topbar-time strong{font-size:11px!important}.large-panel{border-radius:18px!important}.panel-title h2{font-size:19px!important}}

/* =========================================================
   ENERGY METER V3.1 — HIGH CONTRAST LIGHT INDUSTRIAL UI
   ========================================================= */
:root{
  --page:#f2f6f4;
  --page2:#e9f0ed;
  --surface:#ffffff;
  --surface2:#f8fbfa;
  --surface3:#f1f6f4;
  --ink:#17231f;
  --ink2:#34443e;
  --muted:#65756e;
  --muted2:#8a9892;
  --border:#dce7e2;
  --shadow:0 14px 38px rgba(38,65,55,.10);
  --cyan:#00a7c7;
  --violet:#7c4dff;
  --green:#51a83f;
  --amber:#e5a817;
  --teal:#079d96;
  --pink:#e84883;
  --red:#e53955;
  --warning:#e68a18;
}
body{
  color:var(--ink)!important;
  background:
    radial-gradient(900px 450px at 5% -10%,rgba(0,185,214,.10),transparent 65%),
    radial-gradient(700px 420px at 100% 10%,rgba(124,77,255,.07),transparent 65%),
    linear-gradient(145deg,#f7faf9 0%,#eef4f1 55%,#e8efec 100%)!important;
}
body:before{opacity:.45;background-image:linear-gradient(rgba(22,45,37,.035) 1px,transparent 1px),linear-gradient(90deg,rgba(22,45,37,.035) 1px,transparent 1px)!important}
.sidebar{
  background:linear-gradient(180deg,#102b24,#0a1f1a)!important;
  border-color:rgba(92,213,170,.25)!important;
  box-shadow:0 20px 50px rgba(26,55,45,.18)!important;
}
.sidebar-logo-text{color:#fff!important}.sidebar-logo-text b:last-child{color:#54e5d1!important}
.menu-item{color:#c2d4ce!important}.menu-item:hover{color:#fff!important;background:rgba(66,220,180,.12)!important}
.menu-item.active{color:#fff!important;background:linear-gradient(135deg,#2e826a,#1d5d4d)!important;border-color:rgba(99,236,197,.28)!important;box-shadow:0 10px 24px rgba(30,112,88,.18)!important}
.sidebar-bottom,.sidebar-date{background:rgba(255,255,255,.07)!important;border-color:rgba(255,255,255,.08)!important;color:#d6e5df!important}
.sidebar-bottom span,.sidebar-date span{color:#9db5ad!important}
.main-content{color:var(--ink)!important}
.app-topbar{
  background:rgba(255,255,255,.94)!important;
  border-color:var(--border)!important;
  box-shadow:0 10px 28px rgba(35,62,52,.07)!important;
}
.topbar-brandtext strong,.topbar-page strong{color:#17231f!important}
.topbar-brandtext span,.topbar-page small{color:#0aa2a5!important}
.topbar-time{background:linear-gradient(135deg,#f0fbf8,#f7fbfa)!important;border-color:#cde4db!important}
.topbar-time b{color:#5c7068!important}.topbar-time strong{color:#008f8c!important}
.page-heading p{color:#60716a!important}
.large-panel,.meter-status{
  background:rgba(255,255,255,.96)!important;
  border-color:var(--border)!important;
  box-shadow:var(--shadow)!important;
}
.panel-title h2,.history-intro h2{color:#17231f!important}.panel-title p,.history-intro p{color:#66766f!important}
.status-main>div:last-child>span{color:#6d7d76!important}
.status-main>div:last-child>strong{color:#173128!important}
.status-main>div:last-child>p{color:#66776f!important}
.status-emblem{
  color:#079d96!important;background:linear-gradient(145deg,#effaf7,#ffffff)!important;
  border-color:#bfe5db!important;box-shadow:0 8px 24px rgba(7,157,150,.10)!important;
}
.status-emblem.alert{color:#e53955!important;background:#fff1f3!important;border-color:#ffc0c9!important}
.status-emblem.offline{color:#e68a18!important;background:#fff8ea!important;border-color:#f1d5a4!important}
.meter-status.alert{border-left-color:#e53955!important}.meter-status.offline{border-left-color:#e68a18!important}
.connection-chip{background:#f6faf8!important;border-color:#dce8e3!important}.connection-chip span{color:#566760!important}.connection-chip small{color:#218c6f!important}
.metric-card{
  background:var(--surface)!important;
  border:1px solid var(--border)!important;
  border-top:4px solid var(--accent)!important;
  border-left:1px solid var(--border)!important;
  box-shadow:0 12px 30px rgba(40,65,55,.08)!important;
}
.metric-card.voltage{--accent:#00a7c7;background:linear-gradient(145deg,#f0fbfd,#fff)!important}
.metric-card.current{--accent:#7c4dff;background:linear-gradient(145deg,#f7f2ff,#fff)!important}
.metric-card.power{--accent:#58a93d;background:linear-gradient(145deg,#f4faef,#fff)!important}
.metric-card.energy{--accent:#e4a719;background:linear-gradient(145deg,#fff9e9,#fff)!important}
.metric-card.frequency{--accent:#079d96;background:linear-gradient(145deg,#edfafa,#fff)!important}
.metric-card.pf{--accent:#e84883;background:linear-gradient(145deg,#fff1f6,#fff)!important}
.metric-card.offline{background:linear-gradient(145deg,#f7f9f8,#fff)!important;border-top-color:#b8c6c0!important}
.metric-card.alert{background:linear-gradient(145deg,#fff0f3,#fff)!important;border-color:#ffb3bf!important;border-top-color:#e53955!important;box-shadow:0 14px 34px rgba(229,57,85,.12)!important}
.metric-icon{
  background:color-mix(in srgb,var(--accent) 9%,white)!important;
  color:var(--accent)!important;
  border-color:color-mix(in srgb,var(--accent) 35%,#dce7e2)!important;
  box-shadow:none!important;
}
.metric-icon svg{stroke:currentColor!important;fill:none!important;opacity:1!important}
.metric-title,.metric-title span{color:#2b3a35!important}.metric-value{color:#17231f!important;font-weight:800!important}.metric-value small{color:var(--accent)!important}.metric-content p{color:#73827c!important}
.status-dot{background:#39b86f!important;box-shadow:0 0 0 4px rgba(57,184,111,.10)!important}.status-dot.bad{background:#e53955!important;box-shadow:0 0 0 4px rgba(229,57,85,.10)!important}.status-dot.unknown{background:#e3a328!important;box-shadow:0 0 0 4px rgba(227,163,40,.10)!important}
.v3-overview-panel{background:#fff!important}
.peak-card{background:linear-gradient(135deg,#fff8e8,#fff)!important;border-color:#f0dfbc!important}
.quality-chip{background:#f8fbfa!important;border-color:#dce7e2!important}.quality-chip b{color:#65766e!important}.quality-chip strong{color:#173128!important}.quality-chip.ok{border-top-color:#51a83f!important}.quality-chip.bad{background:#fff1f3!important;border-top-color:#e53955!important}.quality-chip.unknown{background:#fff9ee!important;border-top-color:#e3a328!important}
.last-data-card>div{background:#f7faf8!important;border-color:#dce7e2!important}.last-data-card span{color:#718079!important}.last-data-card b{color:#173128!important}
.power-triangle-panel{background:#fff!important;border-color:#dce7e2!important}
.triangle-live{background:#edf8f3!important;color:#198463!important;border-color:#c9e6d9!important}
.power-triangle-visual{background:linear-gradient(145deg,#fbfefd,#f4faf7)!important;border-color:#dceae5!important}
.power-triangle-visual svg{filter:none!important}
.triangle-line{stroke:#00a7c7!important;filter:none!important;stroke-width:5!important}
.triangle-fill{fill:url(#triFill)!important;opacity:.65}
.triangle-label{font-size:14px!important;font-weight:900!important;paint-order:stroke;stroke:#fff;stroke-width:4px;stroke-linejoin:round}
.triangle-label.active{fill:#43a63c!important}.triangle-label.reactive{fill:#7c4dff!important}.triangle-label.apparent{fill:#e84883!important}.triangle-cos{fill:#60736b!important;font-size:12px!important;paint-order:stroke;stroke:#fff;stroke-width:4px}.triangle-cos tspan{fill:#d59400!important}
.triangle-values .triangle-value{background:#fff!important;border-color:#dce7e2!important}.triangle-value span{color:#71817a!important}.triangle-value.active{border-top:3px solid #51a83f!important}.triangle-value.reactive{border-top:3px solid #7c4dff!important}.triangle-value.apparent{border-top:3px solid #e84883!important}.triangle-value.pf{border-top:3px solid #e3a328!important}
.triangle-value.active strong{color:#51a83f!important}.triangle-value.reactive strong{color:#7c4dff!important}.triangle-value.apparent strong{color:#e84883!important}.triangle-value.pf strong{color:#d39400!important}
.dashboard-chart-panel{background:#fff!important}.chart-container{background:#fbfdfc!important;border-color:#dce7e2!important}.chart-footer{color:#75837d!important}
.summary-grid>div,.system-grid>div{background:#f7faf8!important;border-color:#dce7e2!important}.summary-grid span,.system-grid span{color:#687971!important}.summary-grid b,.system-grid b{color:#17231f!important}
.history-intro{background:linear-gradient(110deg,#effaf8,#faf7ff,#fff8ec)!important;border-color:#dce7e2!important}.history-icon{background:#f1f8f5!important;color:#0a947f!important;border-color:#cfe5dc!important}
.history-table{color:#25352e!important}.history-table thead{background:#edf4f1!important}.history-table th{color:#566860!important}.history-table td{color:#31423b!important;border-color:#e2ebe7!important}.history-table tbody tr:nth-child(even){background:#f8fbfa!important}.history-table tbody tr:hover{background:#eef8f4!important}.history-date.today{color:#008f8c!important}
.alarm-banner{background:#f3faf7!important;border-color:#d4e8de!important;color:#21362d!important}.alarm-banner.alert{background:#fff0f3!important;border-color:#ffc0c9!important}.alarm-banner.offline{background:#fff8ea!important;border-color:#f1d5a4!important}
.alarm-list>div{background:#f7faf8!important;border-color:#dce7e2!important;color:#586960!important}.alarm-list strong{color:#168a65!important}.alarm-list strong.alert{color:#d62f52!important}
.alarm-parameter,.alarm-value{color:#3b4b45!important}.alarm-condition{background:#fff0f3!important;color:#d62f52!important;border-color:#ffc2cc!important}
.settings input,.settings select{background:#fff!important;border-color:#d5e0db!important;color:#1f3029!important}.primary{background:#12604d!important;color:#fff!important}.secondary{background:#f3f6f4!important;border-color:#d8e2dd!important;color:#3f5049!important}
.theme-switcher{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:16px}.theme-choice{display:flex;align-items:center;gap:13px;text-align:left;padding:15px 16px;background:#f7faf8;border:1px solid #dce7e2;border-radius:17px;color:#24352e;transition:.2s}.theme-choice:hover{transform:translateY(-2px);border-color:#a9cfc0}.theme-choice.active{background:#eef9f5;border-color:#42aa88;box-shadow:0 8px 22px rgba(37,132,103,.10)}.theme-icon{width:40px;height:40px;display:grid;place-items:center;border-radius:13px;background:#fff;color:#0b9c88;font-size:21px}.theme-choice b{display:block;font-size:14px}.theme-choice small{display:block;margin-top:3px;color:#718079;font-size:11px}
.about{color:#24352e!important}.about-grid>div,.about-extra>div{background:#f7faf8!important;border-color:#dce7e2!important}.about-grid span{color:#718078!important}.about-grid b{color:#1d3028!important}
footer{display:grid!important;grid-template-columns:1.1fr 1fr 1fr;gap:18px;margin-top:18px;padding:20px 4px 8px;color:#68776f!important;border-top:1px solid #dce7e2!important;font-size:11px!important}.footer-brand,.footer-meta{display:flex;flex-direction:column;gap:5px}.footer-brand strong{color:#33443d}.footer-brand b{color:#078f7f}.footer-meta span{color:#7b8882}
.mobile-bottom-nav{background:rgba(255,255,255,.96)!important;border-color:#dfe8e3!important;box-shadow:0 10px 28px rgba(24,48,39,.12)!important}.mobile-nav-item{color:#718079!important}.mobile-nav-item.active{color:#008f8c!important;background:#edf8f4!important}
.app.alarm-active{background:linear-gradient(180deg,#fff7f8 0%,#f5f8f6 30%)!important}.app.alarm-active .app-topbar{border-color:#ffc2cc!important}.app.alarm-active .topbar-time{background:#fff0f2!important;border-color:#ffc2cc!important}.app.alarm-active .topbar-time strong{color:#d62f52!important}

/* ---------- DARK MODE ---------- */
html[data-theme="dark"] body{
  --page:#07100d;--page2:#0b1713;--surface:#0e1c17;--surface2:#12231d;--surface3:#162a23;
  --ink:#eff8f4;--ink2:#c4d7cf;--muted:#9db4aa;--muted2:#71877d;--border:#29453b;
  background:radial-gradient(900px 450px at 5% -10%,rgba(0,185,214,.12),transparent 65%),radial-gradient(700px 420px at 100% 10%,rgba(124,77,255,.10),transparent 65%),linear-gradient(145deg,#0b1914,#07100d 60%,#050b08)!important;
}
html[data-theme="dark"] .app-topbar,html[data-theme="dark"] .large-panel,html[data-theme="dark"] .meter-status,html[data-theme="dark"] .dashboard-chart-panel{background:#0e1c17!important;border-color:#29453b!important;color:#eff8f4!important}
html[data-theme="dark"] .topbar-brandtext strong,html[data-theme="dark"] .topbar-page strong,html[data-theme="dark"] .panel-title h2,html[data-theme="dark"] .history-intro h2,html[data-theme="dark"] .metric-value,html[data-theme="dark"] .metric-title span,html[data-theme="dark"] .summary-grid b,html[data-theme="dark"] .system-grid b{color:#eff8f4!important}
html[data-theme="dark"] .topbar-time{background:#12251e!important;border-color:#315448!important}html[data-theme="dark"] .topbar-time b{color:#9bb2a8!important}
html[data-theme="dark"] .page-heading p,html[data-theme="dark"] .panel-title p,html[data-theme="dark"] .history-intro p,html[data-theme="dark"] .metric-content p,html[data-theme="dark"] .summary-grid span,html[data-theme="dark"] .system-grid span{color:#9db4aa!important}
html[data-theme="dark"] .metric-card.voltage{background:#10252a!important}html[data-theme="dark"] .metric-card.current{background:#17122a!important}html[data-theme="dark"] .metric-card.power{background:#142317!important}html[data-theme="dark"] .metric-card.energy{background:#28200f!important}html[data-theme="dark"] .metric-card.frequency{background:#0d2524!important}html[data-theme="dark"] .metric-card.pf{background:#28141d!important}
html[data-theme="dark"] .metric-card.offline{background:#14201c!important}html[data-theme="dark"] .metric-card.alert{background:#32151c!important}
html[data-theme="dark"] .metric-icon{background:color-mix(in srgb,var(--accent) 16%,#0e1c17)!important}
html[data-theme="dark"] .power-triangle-visual,html[data-theme="dark"] .triangle-values .triangle-value,html[data-theme="dark"] .chart-container,html[data-theme="dark"] .summary-grid>div,html[data-theme="dark"] .system-grid>div,html[data-theme="dark"] .quality-chip,html[data-theme="dark"] .last-data-card>div,html[data-theme="dark"] .history-table tbody tr:nth-child(even),html[data-theme="dark"] .alarm-list>div{background:#12231d!important;border-color:#29453b!important}
html[data-theme="dark"] .history-table,html[data-theme="dark"] .history-table td{color:#d9e8e2!important}html[data-theme="dark"] .history-table thead{background:#182c25!important}html[data-theme="dark"] .history-table th{color:#a8bdb5!important}
html[data-theme="dark"] .theme-choice{background:#12231d;border-color:#29453b;color:#e8f3ef}.theme-choice small{color:#8fa69c}.theme-choice.active{background:#17342a;border-color:#42aa88}
html[data-theme="dark"] footer{border-color:#29453b!important;color:#8fa69c!important}
html[data-theme="dark"] .alarm-banner{background:#14251f!important;border-color:#315448!important;color:#e8f3ef!important}
html[data-theme="dark"] .alarm-banner.alert{background:#35171f!important;border-color:#74313e!important}
html[data-theme="dark"] .alarm-banner.offline{background:#30240f!important;border-color:#6e5725!important}
html[data-theme="dark"] .settings input,html[data-theme="dark"] .settings select{background:#12231d!important;border-color:#315448!important;color:#eff8f4!important}
html[data-theme="dark"] .mobile-bottom-nav{background:rgba(9,20,16,.96)!important;border-color:#29453b!important}.mobile-nav-item{color:#8fa69c!important}.mobile-nav-item.active{color:#58dbc4!important;background:#17342a!important}

@media(max-width:800px){
  .theme-switcher{grid-template-columns:1fr}
  .quality-grid{grid-template-columns:repeat(2,1fr)}
  .last-data-card{grid-template-columns:1fr 1fr}
  .metric-value{font-size:40px!important}
  .power-triangle-layout{grid-template-columns:1fr;gap:12px}
  .power-triangle-visual{min-height:240px;padding:10px}
  .triangle-values{grid-template-columns:1fr 1fr}
  footer{grid-template-columns:1fr 1fr;gap:12px}
}
@media(max-width:430px){
  .metric-card{min-height:205px;padding:18px}
  .metric-icon{width:52px;height:52px;min-width:52px;border-radius:16px}
  .metric-icon svg{width:28px;height:28px}
  .metric-value{font-size:36px!important;margin-top:22px}
  .metric-value small{font-size:15px!important}
  .triangle-label{font-size:11px!important;stroke-width:5px!important}
  .triangle-cos{font-size:9px!important}
  .triangle-values{gap:8px}.triangle-value{padding:13px!important}.triangle-value strong{font-size:18px!important}
  footer{grid-template-columns:1fr;padding-bottom:20px}
}

/* =====================================================
   FINAL READABILITY + ALARM/HISTORY REFINEMENT
   ===================================================== */
.history-table tbody tr {
  background:#ffffff;
}
.history-table tbody tr:nth-child(even) {
  background:#f7faf8;
}
.history-table tbody tr td {
  color:#263831 !important;
  font-weight:500;
}
.history-table tbody tr td strong {
  color:#1d3028 !important;
}
.history-table .history-date {
  color:#263831 !important;
}
.history-table .history-date.today {
  color:#008f7f !important;
}
.history-intro h2 {
  color:#1b3028 !important;
}
.history-intro p {
  color:#5f7068 !important;
}
.history-icon svg {
  width:27px;
  height:27px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.alarm-banner-icon {
  width:50px;
  height:50px;
  min-width:50px;
  display:grid;
  place-items:center;
  border-radius:16px;
  background:#e9f7f1;
  color:#168d6d;
  border:1px solid #c9e7da;
}
.alarm-banner-icon svg {
  width:28px;
  height:28px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.alarm-parameter-card {
  position:relative;
  display:grid !important;
  grid-template-columns:auto 1fr;
  grid-template-rows:auto auto;
  column-gap:9px;
  align-items:center;
  padding:12px !important;
  color:#344840 !important;
}
.alarm-param-icon {
  grid-row:1 / 3;
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border-radius:11px;
}
.alarm-param-icon svg {
  width:19px;
  height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.alarm-param-name {
  font-size:10px;
  font-weight:800;
  color:#65766e !important;
}
.alarm-parameter-card strong {
  margin-top:2px !important;
  color:#168a65 !important;
  font-size:12px !important;
}
.alarm-parameter-card.voltage .alarm-param-icon{background:#e5f6fb;color:#0788a8}
.alarm-parameter-card.current .alarm-param-icon{background:#eee9ff;color:#7051d8}
.alarm-parameter-card.power .alarm-param-icon{background:#eaf7e8;color:#4a9d3e}
.alarm-parameter-card.frequency .alarm-param-icon{background:#e4f7f5;color:#008f88}
.alarm-parameter-card.pf .alarm-param-icon{background:#fff3dc;color:#c58a13}
.alarm-parameter-card strong.alert{color:#d62f52 !important}
.alarm-history-table tbody tr { background:#ffffff; }
.alarm-history-table tbody tr:nth-child(even){background:#f8fbfa}
.alarm-history-table th{color:#566860 !important;background:#edf4f1 !important}
.alarm-history-table td{color:#31423b !important;border-color:#e2ebe7 !important}
.alarm-history-table .alarm-parameter,.alarm-history-table .alarm-value{color:#263831 !important}
.alarm-history-table .alarm-condition{background:#fff0f3 !important;color:#d62f52 !important;border:1px solid #ffc2cc}

html[data-theme="dark"] .history-table tbody tr,
html[data-theme="dark"] .alarm-history-table tbody tr { background:#101f19 !important; }
html[data-theme="dark"] .history-table tbody tr:nth-child(even),
html[data-theme="dark"] .alarm-history-table tbody tr:nth-child(even) { background:#12231d !important; }
html[data-theme="dark"] .history-table tbody tr td,
html[data-theme="dark"] .history-table tbody tr td strong,
html[data-theme="dark"] .history-table .history-date,
html[data-theme="dark"] .alarm-history-table td,
html[data-theme="dark"] .alarm-history-table .alarm-parameter,
html[data-theme="dark"] .alarm-history-table .alarm-value { color:#e5f2ed !important; }
html[data-theme="dark"] .history-table .history-date.today { color:#61dfc5 !important; }
html[data-theme="dark"] .history-intro h2 { color:#f0faf6 !important; }
html[data-theme="dark"] .history-intro p { color:#9eb6ac !important; }
html[data-theme="dark"] .history-table th,
html[data-theme="dark"] .alarm-history-table th { color:#b7cbc3 !important; background:#182d25 !important; }
html[data-theme="dark"] .alarm-banner-icon { background:#17352b; color:#61dfc5; border-color:#315b4b; }
html[data-theme="dark"] .alarm-param-name { color:#a5bbb2 !important; }
html[data-theme="dark"] .alarm-parameter-card { color:#e5f2ed !important; background:#12231d !important; border-color:#29453b !important; }
html[data-theme="dark"] .alarm-parameter-card strong { color:#61dfc5 !important; }
html[data-theme="dark"] .alarm-parameter-card strong.alert { color:#ff8299 !important; }
html[data-theme="dark"] .alarm-history-table .alarm-condition { background:#35171f !important;color:#ff8299 !important;border-color:#74313e !important; }
html[data-theme="dark"] .alarm-banner b { color:#f0faf6 !important; }
html[data-theme="dark"] .alarm-banner p { color:#9eb6ac !important; }
html[data-theme="dark"] .alarm-banner.offline { color:#f0eadb !important; }

/* Status words must remain readable in both modes. */
.meter-status #meterStatus { color:#167b5d !important; }
.meter-status #meterStatus.alert { color:#d62f52 !important; }
html[data-theme="dark"] .meter-status #meterStatus { color:#62dfc5 !important; }
html[data-theme="dark"] .meter-status #meterStatus.alert { color:#ff879c !important; }
html[data-theme="dark"] .meter-status.offline #meterStatus { color:#ffc46b !important; }

/* ESP communication timeout: short missed polls remain visually normal. */
.metric-card.offline { opacity:.92; }

.alarm-history-heading{display:flex;align-items:center;gap:10px}
.alarm-history-heading-icon{width:36px;height:36px;display:grid;place-items:center;border-radius:11px;background:#fff0f3;color:#d62f52;border:1px solid #ffc2cc}
.alarm-history-heading-icon svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
html[data-theme="dark"] .status-emblem{background:linear-gradient(145deg,#17372c,#10251e)!important;border-color:#39705a!important;box-shadow:0 0 22px rgba(76,219,173,.10)!important}
html[data-theme="dark"] .status-emblem.alert{background:linear-gradient(145deg,#35171f,#26141a)!important;border-color:#74313e!important}
html[data-theme="dark"] .status-emblem.offline{background:linear-gradient(145deg,#30240f,#241b0c)!important;border-color:#6e5725!important}
html[data-theme="dark"] .summary-grid em{background:#17352b!important;color:#61dfc5!important;border-radius:10px;padding:5px 8px;width:max-content}
html[data-theme="dark"] .alarm-history-heading-icon{background:#35171f;color:#ff8299;border-color:#74313e}
html[data-theme="dark"] .secondary{background:#172b24!important;color:#d9e8e2!important;border-color:#315448!important}

/* =====================================================
   FINAL V3 VISUAL REFINEMENT — TRIANGLE + BOTH THEMES
   ===================================================== */

/* Power triangle: match the wide reference layout in both modes. */
.power-triangle-layout{display:grid;grid-template-columns:1fr;gap:12px;margin-top:10px}
.power-triangle-visual{
  position:relative;min-height:360px;width:100%;overflow:hidden;padding:10px 12px;
  display:block;border-radius:22px;border:1px solid rgba(0,217,255,.14);
  background:radial-gradient(circle at 48% 48%,rgba(0,217,255,.055),transparent 62%),rgba(255,255,255,.018);
}
.triangle-svg{position:absolute;inset:12px;width:calc(100% - 24px);height:calc(100% - 24px);max-width:none;display:block}
.triangle-line{stroke:#1ea8ff!important;stroke-width:5!important;stroke-linecap:round;stroke-linejoin:round;filter:none!important}
.triangle-fill{fill:url(#triFill)!important;opacity:.78}
.triangle-angle{stroke:#ffd43b!important;stroke-width:3!important;fill:none}
.triangle-tag{
  position:absolute;z-index:3;display:flex;align-items:baseline;gap:7px;
  min-height:42px;padding:10px 14px;border-radius:16px;
  background:rgba(10,25,22,.90);border:1px solid rgba(100,210,180,.20);
  box-shadow:0 8px 22px rgba(0,0,0,.16);backdrop-filter:blur(10px);
  font-family:"Space Grotesk",sans-serif;font-weight:800;white-space:nowrap;
}
.triangle-tag b{font-size:17px;line-height:1}
.triangle-tag span{font-size:17px;line-height:1}
.triangle-tag small{font-family:Manrope,sans-serif;font-size:10px;font-weight:800;color:#a0b3ad}
.triangle-tag-p{left:38%;bottom:14px;transform:translateX(-50%)}
.triangle-tag-q{right:7%;top:26%}
.triangle-tag-s{left:50%;top:7%;transform:translateX(-50%)}
.triangle-tag-pf{left:8%;bottom:24%;}
.triangle-tag.active b,.triangle-tag.active span{color:#59e68b}
.triangle-tag.reactive b,.triangle-tag.reactive span{color:#a76cff}
.triangle-tag.apparent b,.triangle-tag.apparent span{color:#f26ba8}
.triangle-tag-pf b,.triangle-tag-pf span{color:#ffd13f}
.triangle-values{grid-template-columns:repeat(4,1fr);gap:12px}
.triangle-value{min-height:92px;padding:16px 18px;border-radius:16px}
.triangle-value span{font-size:12px}
.triangle-value strong{font-size:21px}

/* Light mode — strong text contrast, matching the reference. */
html[data-theme="light"] .power-triangle-panel{background:#fff!important;border-color:#dce7e2!important}
html[data-theme="light"] .power-triangle-visual{background:linear-gradient(145deg,#fbfefd,#f5faf8)!important;border-color:#dceae5!important}
html[data-theme="light"] .triangle-tag{background:rgba(255,255,255,.96)!important;border-color:#e0e9e5!important;box-shadow:0 8px 22px rgba(36,58,49,.10)!important}
html[data-theme="light"] .triangle-tag small{color:#68766f!important}
html[data-theme="light"] .triangle-tag.active b,html[data-theme="light"] .triangle-tag.active span{color:#43a63c!important}
html[data-theme="light"] .triangle-tag.reactive b,html[data-theme="light"] .triangle-tag.reactive span{color:#7447e8!important}
html[data-theme="light"] .triangle-tag.apparent b,html[data-theme="light"] .triangle-tag.apparent span{color:#d94782!important}
html[data-theme="light"] .triangle-tag-pf b,html[data-theme="light"] .triangle-tag-pf span{color:#c68a00!important}
html[data-theme="light"] .triangle-value{background:#fff!important;border-color:#dce7e2!important}
html[data-theme="light"] .triangle-value span{color:#68766f!important}
html[data-theme="light"] .triangle-value.active strong{color:#51a83f!important}
html[data-theme="light"] .triangle-value.reactive strong{color:#7c4dff!important}
html[data-theme="light"] .triangle-value.apparent strong{color:#e84883!important}
html[data-theme="light"] .triangle-value.pf strong{color:#d39400!important}

/* Health & Demand — readable regardless of theme switching. */
html[data-theme="light"] .v3-overview-panel .panel-title h2,
html[data-theme="light"] .v3-overview-panel .panel-title p,
html[data-theme="light"] .v3-overview-panel .quality-chip b,
html[data-theme="light"] .v3-overview-panel .last-data-card span{color:#53635d!important}
html[data-theme="light"] .v3-overview-panel .quality-chip strong{color:#1b3028!important}
html[data-theme="light"] .v3-overview-panel .peak-card .peak-label{color:#826d48!important}
html[data-theme="light"] .v3-overview-panel .peak-card strong{color:#8d5d00!important}
html[data-theme="light"] .v3-overview-panel .peak-card small{color:#6f7b76!important}
html[data-theme="light"] .v3-overview-panel .last-data-card b{color:#173128!important}

html[data-theme="dark"] .v3-overview-panel .panel-title h2{color:#f2faf7!important}
html[data-theme="dark"] .v3-overview-panel .panel-title p{color:#a7bbb3!important}
html[data-theme="dark"] .v3-overview-panel .peak-card{background:linear-gradient(135deg,#222719,#182019)!important;border-color:#4b4a2a!important}
html[data-theme="dark"] .v3-overview-panel .peak-card .peak-label{color:#d8c98c!important}
html[data-theme="dark"] .v3-overview-panel .peak-card strong{color:#ffd45b!important}
html[data-theme="dark"] .v3-overview-panel .peak-card small{color:#b3beb9!important}
html[data-theme="dark"] .v3-overview-panel .quality-chip{background:#12231d!important;border-color:#315047!important}
html[data-theme="dark"] .v3-overview-panel .quality-chip b{color:#a9bdb5!important}
html[data-theme="dark"] .v3-overview-panel .quality-chip strong{color:#f0faf6!important}
html[data-theme="dark"] .v3-overview-panel .quality-chip.ok strong{color:#62dfc5!important}
html[data-theme="dark"] .v3-overview-panel .quality-chip.bad strong{color:#ff8299!important}
html[data-theme="dark"] .v3-overview-panel .quality-chip.unknown strong{color:#ffd06b!important}
html[data-theme="dark"] .v3-overview-panel .last-data-card>div{background:#12231d!important;border-color:#315047!important}
html[data-theme="dark"] .v3-overview-panel .last-data-card span{color:#9db4aa!important}
html[data-theme="dark"] .v3-overview-panel .last-data-card b{color:#f0faf6!important}

/* Global dark-mode readability: headings, descriptions, cards, controls and metadata. */
html[data-theme="dark"] .page-heading p,
html[data-theme="dark"] .panel-title p,
html[data-theme="dark"] .history-intro p,
html[data-theme="dark"] .history-note p,
html[data-theme="dark"] .about>p,
html[data-theme="dark"] .about-extra p,
html[data-theme="dark"] .setting-row span,
html[data-theme="dark"] .alarm-settings>label,
html[data-theme="dark"] .alarm-settings>label>div,
html[data-theme="dark"] .graph-controls label,
html[data-theme="dark"] .chart-footer,
html[data-theme="dark"] .footer-meta span,
html[data-theme="dark"] footer{color:#a7bbb3!important}
html[data-theme="dark"] .panel-title h2,
html[data-theme="dark"] .history-intro h2,
html[data-theme="dark"] .about h2,
html[data-theme="dark"] .about-extra h3,
html[data-theme="dark"] .setting-row b,
html[data-theme="dark"] .history-note b{color:#f1faf6!important}
html[data-theme="dark"] .graph-controls select,
html[data-theme="dark"] .settings input,
html[data-theme="dark"] .settings select{color:#edf8f4!important;background:#12231d!important;border-color:#315047!important}
html[data-theme="dark"] .summary-grid span,
html[data-theme="dark"] .system-grid span,
html[data-theme="dark"] .about-grid span{color:#a4b8b0!important}
html[data-theme="dark"] .summary-grid b,
html[data-theme="dark"] .system-grid b,
html[data-theme="dark"] .about-grid b{color:#eef8f4!important}
html[data-theme="dark"] .alarm-banner b{color:#f2faf7!important}
html[data-theme="dark"] .alarm-banner p{color:#a7bbb3!important}
html[data-theme="dark"] .alarm-list>div{color:#a6bbb2!important}
html[data-theme="dark"] .alarm-list strong{color:#61dfc5!important}
html[data-theme="dark"] .alarm-list strong.alert{color:#ff8299!important}
html[data-theme="dark"] .history-table th{color:#c0d2cb!important}
html[data-theme="dark"] .history-table td{color:#edf7f3!important}
html[data-theme="dark"] .history-table tbody tr{background:#101f19!important}
html[data-theme="dark"] .history-table tbody tr:nth-child(even){background:#12231d!important}
html[data-theme="dark"] .history-table .history-date{color:#edf7f3!important}
html[data-theme="dark"] .history-table .history-date.today{color:#61dfc5!important}
html[data-theme="dark"] .history-table td strong{color:#f2faf7!important}
html[data-theme="dark"] .v3-badge{background:#172b24!important;border-color:#315047!important;color:#c4d7cf!important}

@media(max-width:800px){
  .power-triangle-visual{min-height:285px}
  .triangle-values{grid-template-columns:repeat(2,1fr)}
  .triangle-tag{padding:8px 10px;gap:5px;min-height:38px}
  .triangle-tag b,.triangle-tag span{font-size:13px}
  .triangle-tag small{font-size:8px}
  .triangle-tag-p{left:38%;bottom:8px}
  .triangle-tag-q{right:3%;top:25%}
  .triangle-tag-s{top:5%}
  .triangle-tag-pf{left:3%;bottom:23%}
}
@media(max-width:430px){
  .power-triangle-visual{min-height:245px;border-radius:18px}
  .triangle-svg{inset:8px;width:calc(100% - 16px);height:calc(100% - 16px)}
  .triangle-tag{padding:6px 8px;border-radius:12px}
  .triangle-tag b,.triangle-tag span{font-size:10px}
  .triangle-tag small{font-size:7px}
  .triangle-tag-p{left:38%;bottom:6px}
  .triangle-tag-q{right:1.5%;top:25%}
  .triangle-tag-s{top:4%}
  .triangle-tag-pf{left:1.5%;bottom:22%}
  .triangle-values{gap:8px}
  .triangle-value{padding:12px!important;min-height:78px}
  .triangle-value strong{font-size:18px!important}
}


/* =====================================================
   FINAL VISUAL PATCH — 23 AUG 2026
   Reference: Energy Meter V3 mockup
   ===================================================== */

/* Transparent status / LIVE / REALTIME badges in both themes. */
.connection-chip,
.v3-badge,
.triangle-live,
.chart-live{
  background:rgba(255,255,255,.025)!important;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}
html[data-theme="light"] .connection-chip,
html[data-theme="light"] .v3-badge,
html[data-theme="light"] .triangle-live,
html[data-theme="light"] .chart-live{
  background:rgba(255,255,255,.42)!important;
}
html[data-theme="dark"] .connection-chip,
html[data-theme="dark"] .v3-badge,
html[data-theme="dark"] .triangle-live,
html[data-theme="dark"] .chart-live{
  background:rgba(5,24,19,.24)!important;
  border-color:rgba(94,211,181,.22)!important;
}

/* Health & Demand: only peak + five quality parameters. */
.v3-overview-panel .quality-grid{margin-top:12px!important}
.v3-overview-panel .quality-chip{
  background:rgba(255,255,255,.025)!important;
  backdrop-filter:blur(8px);
}
html[data-theme="light"] .v3-overview-panel .quality-chip{
  background:rgba(248,252,250,.62)!important;
}
html[data-theme="dark"] .v3-overview-panel .quality-chip{
  background:rgba(11,34,27,.28)!important;
  border-color:rgba(101,197,169,.18)!important;
}
html[data-theme="dark"] .v3-overview-panel .quality-chip b{color:#b8ccc4!important}
html[data-theme="dark"] .v3-overview-panel .quality-chip strong{color:#f4fbf8!important}
html[data-theme="dark"] .v3-overview-panel .peak-card{background:rgba(49,44,18,.38)!important;border-color:rgba(255,210,76,.32)!important}
html[data-theme="dark"] .v3-overview-panel .peak-card .peak-label{color:#ffe18a!important}
html[data-theme="dark"] .v3-overview-panel .peak-card strong{color:#ffd34d!important}
html[data-theme="dark"] .v3-overview-panel .peak-card small{color:#c3cec8!important}

/* Power triangle: centered geometry + labels aligned to the actual vertices/edges. */
.power-triangle-visual{
  min-height:360px!important;
  aspect-ratio:2.55/1;
  display:block!important;
  position:relative!important;
}
.triangle-svg{
  inset:0!important;
  width:100%!important;
  height:100%!important;
}
.triangle-tag-p{left:50%!important;bottom:4%!important;transform:translateX(-50%)!important}
.triangle-tag-s{left:82%!important;top:4%!important;transform:translateX(-50%)!important}
.triangle-tag-q{right:3%!important;top:42%!important}
.triangle-tag-pf{left:10%!important;bottom:19%!important}
html[data-theme="light"] .triangle-tag{
  background:rgba(255,255,255,.58)!important;
  border-color:rgba(83,145,126,.22)!important;
}
html[data-theme="dark"] .triangle-tag{
  background:rgba(5,23,19,.30)!important;
  border-color:rgba(90,204,178,.24)!important;
}

/* Strong readability in dark mode. */
html[data-theme="dark"] .status-main>div:last-child>span{color:#b9cec5!important}
html[data-theme="dark"] .status-main>div:last-child>strong{color:#f4fbf8!important}
html[data-theme="dark"] .status-main>div:last-child>p{color:#a9beb5!important}
html[data-theme="dark"] .connection-chip span{color:#b9cec5!important}
html[data-theme="dark"] .connection-chip small{color:#5fe0a7!important}
html[data-theme="dark"] .page-heading p{color:#a9beb5!important}
html[data-theme="dark"] .history-intro h2,
html[data-theme="dark"] .history-month-panel .history-intro h2{color:#f5fbf8!important}
html[data-theme="dark"] .history-intro p,
html[data-theme="dark"] .history-note p{color:#a9beb5!important}
html[data-theme="dark"] .about{color:#f2faf7!important}
html[data-theme="dark"] .about>p{color:#b0c4bc!important}
html[data-theme="dark"] .about-grid>div,
html[data-theme="dark"] .about-extra>div{background:rgba(13,38,30,.42)!important;border-color:rgba(93,190,160,.18)!important}
html[data-theme="dark"] .about-grid span{color:#a8beb5!important}
html[data-theme="dark"] .about-grid b{color:#f2faf7!important}
html[data-theme="dark"] .about-extra h3{color:#f2faf7!important}
html[data-theme="dark"] .about-extra p{color:#b0c4bc!important}

/* Alarm parameter cards become red only when that parameter is actually alarming. */
.alarm-parameter-card{background:rgba(255,255,255,.025)!important;transition:.2s ease}
.alarm-parameter-card.alert{
  background:rgba(255,71,100,.10)!important;
  border-color:rgba(255,71,100,.42)!important;
  box-shadow:0 8px 24px rgba(255,71,100,.08)!important;
}
.alarm-parameter-card.alert .alarm-param-name{color:#ff9aac!important}
.alarm-parameter-card.alert strong{color:#ff6f88!important}
html[data-theme="light"] .alarm-parameter-card{background:rgba(248,252,250,.52)!important}
html[data-theme="light"] .alarm-parameter-card.alert{background:rgba(255,72,101,.08)!important;border-color:#ffb4c0!important}
html[data-theme="light"] .alarm-parameter-card.alert .alarm-param-name{color:#b92e49!important}
html[data-theme="light"] .alarm-parameter-card.alert strong{color:#d72d55!important}

/* Alarm banner: normal = soft green, active = clear red, both translucent. */
.alarm-banner{background:rgba(71,197,139,.045)!important}
.alarm-banner.alert{background:rgba(255,70,99,.10)!important;border-color:rgba(255,70,99,.45)!important}
html[data-theme="dark"] .alarm-banner{background:rgba(48,170,126,.055)!important}
html[data-theme="dark"] .alarm-banner.alert{background:rgba(255,64,92,.12)!important;border-color:rgba(255,86,112,.46)!important}

/* About page must stay readable and visually structured. */
.about-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
.about-extra{grid-template-columns:1fr 1fr}
@media(max-width:900px){.about-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:560px){.about-grid,.about-extra{grid-template-columns:1fr}}

/* Remove legacy Health & Demand row even if an older cached HTML is loaded. */
.v3-overview-panel .last-data-card{display:none!important}

/* Make table titles/headers robust against theme switching. */
html[data-theme="light"] .history-intro h2{color:#172a22!important}
html[data-theme="light"] .history-intro p{color:#61716a!important}
html[data-theme="light"] .history-table th{color:#4f6159!important}
html[data-theme="light"] .history-table td{color:#24362e!important}
html[data-theme="dark"] .history-table th{color:#d2e1db!important}
html[data-theme="dark"] .history-table td{color:#edf7f3!important}

/* Mobile triangle label placement. */
@media(max-width:800px){
  .power-triangle-visual{min-height:285px!important}
  .triangle-tag-p{left:50%!important;bottom:3%!important}
  .triangle-tag-s{left:82%!important;top:3%!important}
  .triangle-tag-q{right:1.5%!important;top:40%!important}
  .triangle-tag-pf{left:5%!important;bottom:18%!important}
}
@media(max-width:430px){
  .power-triangle-visual{min-height:245px!important}
  .triangle-tag-p{left:50%!important;bottom:2%!important}
  .triangle-tag-s{left:82%!important;top:2%!important}
  .triangle-tag-q{right:1%!important;top:40%!important}
  .triangle-tag-pf{left:2%!important;bottom:18%!important}
}

/* =========================================================
   FINAL FIX - TRANSPARENT DARK STATUS + SVG POWER TRIANGLE
   ========================================================= */

/* ---------- DARK MODE: SERVER / ESP / API / DATA ---------- */
html[data-theme="dark"] .connection-chip {
  background: rgba(40,105,82,.16) !important;
  border-color: rgba(78,231,157,.24) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 4px 18px rgba(0,0,0,.12);
}
html[data-theme="dark"] .connection-chip:hover {
  background: rgba(55,135,105,.20) !important;
  border-color: rgba(78,231,157,.34) !important;
}
html[data-theme="dark"] .connection-chip span { color:#b5c9c2 !important; }
html[data-theme="dark"] .connection-chip small { color:#55e7a0 !important; }
html[data-theme="dark"] .connection-chip i { background:#4ee79d !important; box-shadow:0 0 10px rgba(78,231,157,.65) !important; }
html[data-theme="dark"] .connection-chip i.bad { background:#ff6274 !important; box-shadow:0 0 10px rgba(255,98,116,.65) !important; }
html[data-theme="dark"] .connection-chip i.warn { background:#f2b84b !important; box-shadow:0 0 10px rgba(242,184,75,.65) !important; }

/* ---------- ABOUT / TENTANG ---------- */
html[data-theme="dark"] .about {
  background: rgba(10,31,25,.62) !important;
  border-color: rgba(78,231,157,.20) !important;
}
html[data-theme="dark"] .about-grid > div {
  background: rgba(37,101,79,.15) !important;
  border-color: rgba(78,231,157,.20) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 5px 18px rgba(0,0,0,.10);
}
html[data-theme="dark"] .about-grid > div:hover {
  background: rgba(48,125,96,.20) !important;
  border-color: rgba(78,231,157,.32) !important;
}
html[data-theme="dark"] .about-grid span { color:#9fb7af !important; }
html[data-theme="dark"] .about-grid b { color:#f0f8f5 !important; }
html[data-theme="dark"] .about > h2 { color:#f4faf7 !important; }
html[data-theme="dark"] .about > p { color:#b3c7c0 !important; }
html[data-theme="dark"] .about-extra > div {
  background: rgba(37,101,79,.13) !important;
  border:1px solid rgba(78,231,157,.19) !important;
  border-radius:14px;
}
html[data-theme="dark"] .about-extra h3 { color:#f1f8f5 !important; }
html[data-theme="dark"] .about-extra p { color:#b8cbc4 !important; }

/* ---------- REALTIME BADGES ---------- */
.live-pill,.realtime-badge,.v3-badge,.triangle-live,.chart-live {
  background: rgba(78,231,157,.06) !important;
  backdrop-filter: blur(8px);
}
html[data-theme="dark"] .v3-badge,
html[data-theme="dark"] .triangle-live,
html[data-theme="dark"] .chart-live {
  background: rgba(50,125,97,.13) !important;
  border-color: rgba(78,231,157,.25) !important;
}

/* ---------- POWER TRIANGLE CONTAINER ---------- */
.power-triangle-visual {
  position:relative !important;
  width:100% !important;
  min-height:330px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  overflow:hidden !important;
  background:radial-gradient(circle at 50% 48%,rgba(69,183,255,.035),transparent 62%) !important;
  border:1px solid var(--border) !important;
  border-radius:18px !important;
}
.triangle-svg {
  display:block !important;
  width:min(1000px,100%) !important;
  height:100% !important;
  margin:0 auto !important;
  overflow:visible !important;
}
.triangle-fill { fill:url(#triFill) !important; }
.triangle-line {
  fill:none !important;
  stroke:#45b7ff !important;
  stroke-width:5 !important;
  stroke-linejoin:round !important;
  stroke-linecap:round !important;
}
.triangle-angle {
  fill:none !important;
  stroke:#ffd35a !important;
  stroke-width:3.5 !important;
  stroke-linecap:round !important;
}

/* ---------- SVG LABELS: NO BOX / NO FLOATING POSITION ---------- */
.triangle-svg-text {
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Arial,sans-serif;
  font-size:22px;
  font-weight:900;
  letter-spacing:.1px;
  paint-order:stroke fill;
  stroke-width:3px;
  stroke-linejoin:round;
  filter:drop-shadow(0 2px 5px rgba(0,0,0,.35));
}
.triangle-svg-p { fill:#4ee79d; stroke:rgba(7,18,15,.82); }
.triangle-svg-q { fill:#b78aff; stroke:rgba(7,18,15,.82); }
.triangle-svg-s { fill:#ff79b9; stroke:rgba(7,18,15,.82); }
.triangle-svg-pf { fill:#ffd35a; stroke:rgba(7,18,15,.82); }
html[data-theme="light"] .triangle-svg-p { fill:#15966b; stroke:rgba(255,255,255,.92); }
html[data-theme="light"] .triangle-svg-q { fill:#7444c7; stroke:rgba(255,255,255,.92); }
html[data-theme="light"] .triangle-svg-s { fill:#c63f83; stroke:rgba(255,255,255,.92); }
html[data-theme="light"] .triangle-svg-pf { fill:#c58a00; stroke:rgba(255,255,255,.92); }

/* Old floating labels are no longer used. */
.triangle-tag { display:none !important; }

@media(max-width:800px){
  .power-triangle-visual { min-height:285px !important; }
  .triangle-svg-text { font-size:20px; }
}
@media(max-width:430px){
  .power-triangle-visual { min-height:245px !important; }
  .triangle-svg-text { font-size:18px; }
}
@media(max-width:360px){
  .power-triangle-visual { min-height:225px !important; }
  .triangle-svg-text { font-size:17px; }
}


/* =========================================================
   FINAL PATCH — TENTANG + GLOBAL CONTRAST + HISTORY
   Scope only: requested revisions 1, 2 and 6.
   Do not change realtime/worker/data logic.
   ========================================================= */

/* ---------- ABOUT: icons + explanations ---------- */
.about-hero-logo{
  width:96px;height:96px;margin:0 auto 8px;display:grid;place-items:center;
  border-radius:26px;
  background:rgba(255,255,255,.025);
  border:1px solid rgba(37,200,255,.18);
  box-shadow:0 0 28px rgba(37,200,255,.08);
}
.about-hero-logo img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 0 20px rgba(37,200,255,.20))}
.about-lead{max-width:760px!important;font-size:13px!important;line-height:1.75!important}
.about-grid-explained{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px!important;text-align:left!important}
.about-info-card{
  display:grid;grid-template-columns:46px 1fr;gap:12px;align-items:start;
  min-width:0;padding:15px!important;border-radius:16px!important;
  transition:transform .18s ease,border-color .18s ease,background .18s ease;
}
.about-info-card:hover{transform:translateY(-2px)}
.about-info-icon{
  width:46px;height:46px;display:grid;place-items:center;border-radius:14px;
  border:1px solid currentColor;background:rgba(255,255,255,.045);
}
.about-info-icon svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.about-info-copy{min-width:0}
.about-info-copy span{display:block;font-size:10px;font-weight:800;letter-spacing:.4px}
.about-info-copy b{display:block;margin-top:3px;font-size:13px;line-height:1.35}
.about-info-copy p{margin-top:6px;font-size:10.5px;line-height:1.55}
.about-info-card.controller{color:#18a7c4}.about-info-card.sensor{color:#7c4dff}.about-info-card.monitoring{color:#15966b}.about-info-card.backend{color:#d08a00}.about-info-card.parameter{color:#e84883}.about-info-card.communication{color:#078f8a}.about-info-card.dashboard{color:#368bce}.about-info-card.version{color:#8b5bd6}
.about-extra-explained{grid-template-columns:1fr 1fr!important;gap:12px!important;text-align:left!important}
.about-feature-box{display:grid;grid-template-columns:42px 1fr;gap:11px;align-items:start}
.about-section-icon{width:42px;height:42px;display:grid;place-items:center;border-radius:13px;color:#15966b;background:rgba(21,150,107,.08);border:1px solid rgba(21,150,107,.24)}
.about-section-icon svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.about-feature-box h3{font-size:13px!important}
.about-feature-box p{font-size:10.5px!important;line-height:1.65!important}
.about-feature-box p b{font-weight:800}
.flow-line{font-family:"Space Grotesk",Inter,sans-serif;font-weight:700;word-break:normal}

/* ---------- GLOBAL CONTRAST: LIGHT ---------- */
html[data-theme="light"] body{color:#17231f!important}
html[data-theme="light"] .page-heading p{color:#53645d!important}
html[data-theme="light"] .panel-title h2,
html[data-theme="light"] .history-intro h2,
html[data-theme="light"] .about h2{color:#172a22!important}
html[data-theme="light"] .panel-title p,
html[data-theme="light"] .history-intro p,
html[data-theme="light"] .about>p,
html[data-theme="light"] .about-extra p{color:#5d6e66!important}
html[data-theme="light"] .summary-grid span,
html[data-theme="light"] .system-grid span,
html[data-theme="light"] .metric-content p,
html[data-theme="light"] .graph-controls label,
html[data-theme="light"] .chart-footer{color:#607169!important}
html[data-theme="light"] .summary-grid b,
html[data-theme="light"] .system-grid b,
html[data-theme="light"] .metric-title span,
html[data-theme="light"] .metric-value{color:#17231f!important}

/* ---------- GLOBAL CONTRAST: DARK ---------- */
html[data-theme="dark"] body{color:#f1faf6!important}
html[data-theme="dark"] .page-heading p,
html[data-theme="dark"] .panel-title p,
html[data-theme="dark"] .history-intro p,
html[data-theme="dark"] .history-note p,
html[data-theme="dark"] .about>p,
html[data-theme="dark"] .about-extra p,
html[data-theme="dark"] .setting-row span,
html[data-theme="dark"] .graph-controls label,
html[data-theme="dark"] .chart-footer,
html[data-theme="dark"] footer{color:#b1c6bd!important}
html[data-theme="dark"] .panel-title h2,
html[data-theme="dark"] .history-intro h2,
html[data-theme="dark"] .about h2,
html[data-theme="dark"] .about-feature-box h3{color:#f4fbf8!important}
html[data-theme="dark"] .metric-title span{color:#e7f2ee!important}
html[data-theme="dark"] .metric-content p{color:#a8bdb5!important}
html[data-theme="dark"] .summary-grid span,
html[data-theme="dark"] .system-grid span{color:#a9beb5!important}
html[data-theme="dark"] .summary-grid b,
html[data-theme="dark"] .system-grid b,
html[data-theme="dark"] .metric-value{color:#f2faf7!important}
html[data-theme="dark"] .about-info-copy span{color:#a8beb5!important}
html[data-theme="dark"] .about-info-copy b{color:#f2faf7!important}
html[data-theme="dark"] .about-info-copy p{color:#b2c6be!important}
html[data-theme="dark"] .about-feature-box p{color:#b2c6be!important}
html[data-theme="dark"] .about-feature-box p b{color:#e8f5f0!important}
html[data-theme="dark"] .about-hero-logo{background:rgba(20,72,56,.18);border-color:rgba(78,231,157,.20)}
html[data-theme="dark"] .about-info-card{background:rgba(37,101,79,.14)!important;border-color:rgba(78,231,157,.20)!important}
html[data-theme="dark"] .about-info-card:hover{background:rgba(48,125,96,.20)!important;border-color:rgba(78,231,157,.30)!important}
html[data-theme="dark"] .about-info-icon{background:rgba(78,231,157,.045)!important}
html[data-theme="dark"] .about-extra-explained>div{background:rgba(37,101,79,.13)!important;border-color:rgba(78,231,157,.20)!important}
html[data-theme="dark"] .about-section-icon{background:rgba(78,231,157,.06);border-color:rgba(78,231,157,.22);color:#61dfc5}

/* ---------- HISTORY: readable in both themes ---------- */
.history-intro{min-height:88px}
html[data-theme="light"] .history-intro{background:linear-gradient(110deg,#eef9f6,#faf7ff,#fff8ec)!important;border-color:#d8e5df!important}
html[data-theme="light"] .history-intro h2{color:#172a22!important}
html[data-theme="light"] .history-intro p{color:#5c6d65!important}
html[data-theme="light"] .history-table thead{background:#eaf2ee!important}
html[data-theme="light"] .history-table th{color:#42544c!important;font-weight:900!important}
html[data-theme="light"] .history-table td{color:#24362e!important;font-weight:600!important}
html[data-theme="light"] .history-table tbody tr{background:#fff!important}
html[data-theme="light"] .history-table tbody tr:nth-child(even){background:#f7faf8!important}
html[data-theme="light"] .history-table .history-date{color:#24362e!important}
html[data-theme="light"] .history-table .history-date.today{color:#008f7f!important}

html[data-theme="dark"] .history-intro{background:rgba(14,38,30,.55)!important;border-color:rgba(78,231,157,.18)!important}
html[data-theme="dark"] .history-intro h2{color:#f4fbf8!important}
html[data-theme="dark"] .history-intro p{color:#b1c6bd!important}
html[data-theme="dark"] .history-table thead{background:#182d25!important}
html[data-theme="dark"] .history-table th{color:#c5d8d0!important;font-weight:900!important}
html[data-theme="dark"] .history-table td{color:#edf7f3!important;font-weight:600!important}
html[data-theme="dark"] .history-table tbody tr{background:#101f19!important}
html[data-theme="dark"] .history-table tbody tr:nth-child(even){background:#12231d!important}
html[data-theme="dark"] .history-table .history-date{color:#edf7f3!important}
html[data-theme="dark"] .history-table .history-date.today{color:#61dfc5!important}
html[data-theme="dark"] .history-note{background:rgba(14,38,30,.42)!important;border-color:rgba(78,231,157,.18)!important;color:#b1c6bd!important}
html[data-theme="dark"] .history-note b{color:#f1faf6!important}

/* Keep the history table usable on narrow screens without changing data. */
.table-wrap{scrollbar-color:#8b9c95 transparent;scrollbar-width:thin}
.table-wrap::-webkit-scrollbar{height:7px}.table-wrap::-webkit-scrollbar-track{background:transparent}.table-wrap::-webkit-scrollbar-thumb{background:#8b9c95;border-radius:99px}

@media(max-width:900px){
  .about-grid-explained{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:560px){
  .about-grid-explained,.about-extra-explained{grid-template-columns:1fr!important}
  .about-info-copy p{font-size:10px}
  .about-feature-box p{font-size:10px!important}
}


/* =====================================================
   FINAL FIX — TRANSPARENT HISTORY + ALARM PARAMETER ICONS
   Only the three requested visual fixes are changed.
   ===================================================== */
.history-icon.daily,
.history-icon.month {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
html[data-theme="dark"] .history-icon.daily,
html[data-theme="dark"] .history-icon.month {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
.alarm-param-icon {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
html[data-theme="dark"] .alarm-param-icon {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}


/* =========================================================
   FINAL TRIANGLE-ONLY PATCH
   Scope: Segitiga Daya saja.
   Tidak mengubah data, realtime logic, dashboard lain,
   histori, alarm, pengaturan, atau navigasi.
   ========================================================= */

/* Hilangkan seluruh area/fill di tengah segitiga. */
.power-triangle-panel .triangle-fill {
  display: none !important;
}

/* Ukuran visual sedang dan konsisten di desktop/mobile. */
.power-triangle-panel .power-triangle-visual {
  min-height: 330px !important;
  padding: 8px 10px !important;
  background: transparent !important;
}

.power-triangle-panel .triangle-svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 1000px !important;
  overflow: visible !important;
}

/* Setiap sisi memakai warna kartu nilainya sendiri. */
.power-triangle-panel .triangle-line {
  fill: none !important;
  stroke-width: 5px !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  vector-effect: non-scaling-stroke;
  filter: url(#triGlow) !important;
}

.power-triangle-panel .triangle-line-p {
  stroke: #54ff5e !important;
}

.power-triangle-panel .triangle-line-q {
  stroke: #b45cff !important;
}

.power-triangle-panel .triangle-line-s {
  stroke: #ff3d9a !important;
}

/* Glow lembut tambahan per warna. */
.power-triangle-panel .triangle-line-p {
  filter:
    drop-shadow(0 0 3px rgba(84,255,94,.95))
    drop-shadow(0 0 8px rgba(84,255,94,.55)) !important;
}

.power-triangle-panel .triangle-line-q {
  filter:
    drop-shadow(0 0 3px rgba(180,92,255,.95))
    drop-shadow(0 0 8px rgba(180,92,255,.55)) !important;
}

.power-triangle-panel .triangle-line-s {
  filter:
    drop-shadow(0 0 3px rgba(255,61,154,.95))
    drop-shadow(0 0 8px rgba(255,61,154,.55)) !important;
}

/* Sudut cos phi: tepat di titik kiri bawah. */
.power-triangle-panel .triangle-angle {
  fill: none !important;
  stroke: #ffd23f !important;
  stroke-width: 3.5px !important;
  stroke-linecap: round !important;
  filter:
    drop-shadow(0 0 3px rgba(255,210,63,.9))
    drop-shadow(0 0 7px rgba(255,210,63,.45)) !important;
}

/* Angka di ujung garis: cukup besar, tetapi tidak memenuhi panel. */
.power-triangle-panel .triangle-svg-text {
  font-size: 24px !important;
  font-weight: 900 !important;
  letter-spacing: .1px !important;
  paint-order: stroke fill !important;
  stroke-width: 2.5px !important;
  stroke-linejoin: round !important;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.45)) !important;
}

.power-triangle-panel .triangle-svg-p {
  fill: #54ff5e !important;
  stroke: rgba(5,18,10,.82) !important;
}

.power-triangle-panel .triangle-svg-q {
  fill: #b45cff !important;
  stroke: rgba(12,7,20,.82) !important;
}

.power-triangle-panel .triangle-svg-s {
  fill: #ff3d9a !important;
  stroke: rgba(22,5,14,.82) !important;
}

.power-triangle-panel .triangle-svg-pf {
  fill: #ffd23f !important;
  stroke: rgba(22,17,3,.82) !important;
}

@media (max-width: 800px) {
  .power-triangle-panel .power-triangle-visual {
    min-height: 285px !important;
  }

  .power-triangle-panel .triangle-svg-text {
    font-size: 21px !important;
  }
}

@media (max-width: 430px) {
  .power-triangle-panel .power-triangle-visual {
    min-height: 245px !important;
  }

  .power-triangle-panel .triangle-svg-text {
    font-size: 18px !important;
  }
}
