/* ParkOps Enterprise v4 — UI refresh 2026-09 (FusionSolar-flavoured control room) */
:root {
  /* ── surfaces ─────────────────────────────── */
  --bg:         #0a0e13;
  --bg2:        #0e131a;
  --panel:      #141a22;
  --panel-2:    #1a222d;
  --panel-3:    #11161d;
  --panel-hi:   #1e2732;
  --line:       rgba(255,255,255,.07);
  --line-s:     rgba(255,255,255,.14);
  --line-hair:  rgba(255,255,255,.045);

  /* ── ink ──────────────────────────────────── */
  --text:       #e7edf4;
  --muted:      #93a3b6;
  --faint:      #5e6e80;

  /* ── brand / accents ──────────────────────── */
  --accent:     #22c3cd;   /* FusionSolar teal */
  --accent-2:   #38a8ff;   /* support blue     */
  --accent-weak:rgba(34,195,205,.14);
  --energy:     #2fc98a;   /* yield / kWh      */
  --violet:     #9d8bf5;

  /* ── status ───────────────────────────────── */
  --ok:         #2fc98a;
  --warn:       #f2b13c;
  --bad:        #f0605f;
  --crit:       #ff4d52;
  --ok-weak:    rgba(47,201,138,.13);
  --warn-weak:  rgba(242,177,60,.13);
  --bad-weak:   rgba(240,96,95,.13);

  /* ── depth ────────────────────────────────── */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.35);
  --shadow:     0 10px 30px rgba(0,0,0,.4);
  --shadow-lg:  0 24px 64px rgba(0,0,0,.5);
  --ring:       0 0 0 3px rgba(34,195,205,.18);

  --radius:     10px;
  --radius-sm:  7px;
  --radius-xs:  5px;
  --sidebar-w:  268px;

  --font-display: 'Sora', 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 460px at 78% -260px, rgba(34,195,205,.06), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.top-space { margin-top: 14px; }
.wide { width: 100%; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
::selection { background: rgba(34,195,205,.28); }

/* thin scrollbars, control-room style */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.24); }

/* ── TOP LOADING BAR ─────────────────────────── */
.top-loader {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(34,195,205,.7);
  z-index: 10000; transition: width .3s ease, opacity .3s ease;
  opacity: 0;
}
.top-loader.active { opacity: 1; }

/* ── TOAST ─────────────────────────────────── */
#toastHost {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.toast {
  padding: 12px 17px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideIn .24s cubic-bezier(.16,1,.3,1);
  max-width: 340px;
  backdrop-filter: blur(12px);
  border: 1px solid var(--line-s);
}
.toast.ok   { background: rgba(16,42,32,.94); border-color: rgba(47,201,138,.4); color: #86efba; }
.toast.err  { background: rgba(48,18,18,.94); border-color: rgba(240,96,95,.4);  color: #ffb1b0; }
.toast.info { background: rgba(12,32,44,.94); border-color: rgba(34,195,205,.34); color: #9fe6ec; }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── MODAL ─────────────────────────────────── */
#modalOverlay, #pwModalOverlay, #twofaModalOverlay {
  display: none; position: fixed; inset: 0; z-index: 8000;
  background: rgba(0,0,0,.68); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
#modalOverlay.open, #pwModalOverlay.open, #twofaModalOverlay.open { display: flex; }
#modalBox, #pwModalBox, #twofaModalBox {
  background: var(--panel-2);
  border: 1px solid var(--line-s); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 24px; width: min(480px, 94vw); display: grid; gap: 13px;
  animation: modalIn .18s cubic-bezier(.16,1,.3,1);
}
@keyframes modalIn { from { transform: scale(.97) translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
#modalBox h3, #pwModalBox h3, #twofaModalBox h3 { margin: 0; font-size: 17px; font-family: var(--font-display); font-weight: 700; }
.twofa-qr-wrap { display: flex; justify-content: center; padding: 10px; background: #fff; border-radius: var(--radius-sm); }
.twofa-qr-wrap img { width: 200px; height: 200px; }
.twofa-secret { text-align: center; font-family: var(--font-mono); letter-spacing: 1px; word-break: break-all; }
#modalBox textarea {
  width: 100%; min-height: 80px; resize: vertical;
  background: var(--panel-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); padding: 11px;
}
#pwModalBox input[type="password"] {
  width: 100%; background: var(--panel-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); padding: 11px;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.restart-btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── LOGIN ─────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #0a1220 0%, #0b1526 52%, #0a1b31 100%);
}
/* sun + photovoltaic-field backdrop (pure CSS, no external assets) */
.login-screen::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(260px 260px at 80% 6%, rgba(255,228,168,.60), rgba(255,204,120,.24) 45%, transparent 72%),
    radial-gradient(820px 560px at 80% 4%, rgba(255,190,96,.28), rgba(255,150,60,.10) 42%, transparent 74%),
    radial-gradient(1100px 200px at 62% 66%, rgba(255,176,102,.16), transparent 72%),
    radial-gradient(1300px 460px at 50% 120%, rgba(46,150,205,.22), transparent 70%);
}
/* receding rows of solar panels along the bottom */
.login-screen::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 50vh; z-index: 0;
  pointer-events: none; opacity: .62;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 42%, #000 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 42%, #000 100%);
  background-repeat: repeat-x;
  background-position: center bottom;
  background-size: 220px 150px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='150' viewBox='0 0 220 150'><defs><linearGradient id='p' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%231e4272'/><stop offset='1' stop-color='%230c1f3d'/></linearGradient></defs><g stroke='%230a1626' stroke-width='1.4'><path d='M6 130 L64 40 L128 40 L82 130 Z' fill='url(%23p)'/><path d='M98 130 L144 40 L208 40 L168 130 Z' fill='url(%23p)'/></g><g stroke='rgba(140,190,240,0.25)' stroke-width='0.9' fill='none'><path d='M27 130 L77 40 M46 130 L90 40 M64 130 L104 40'/><path d='M15 96 L110 96 M36 64 L118 64'/><path d='M116 130 L156 40 M134 130 L169 40 M152 130 L182 40'/><path d='M104 96 L192 96 M124 64 L196 64'/></g><g fill='rgba(165,220,255,0.12)'><path d='M6 130 L64 40 L69 40 L13 130 Z'/><path d='M98 130 L144 40 L149 40 L106 130 Z'/></g></svg>");
}
.login-screen > * { position: relative; z-index: 1; }
.login-panel {
  width: min(1020px, 100%);
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: stretch;
}
.login-hero {
  background:
    radial-gradient(600px 300px at 0% 0%, rgba(34,195,205,.12), transparent 60%),
    var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 40px;
  display: flex; flex-direction: column; justify-content: center;
}
.login-hero h1 { font-family: var(--font-display); font-size: 35px; line-height: 1.14; margin: 12px 0 14px; font-weight: 800; letter-spacing: -.6px; }
.login-hero p  { color: var(--muted); font-size: 14.5px; line-height: 1.7; max-width: 520px; }
.login-bullets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 26px; }
.login-bullets span {
  padding: 6px 13px; border-radius: 7px;
  background: var(--accent-weak); border: 1px solid rgba(34,195,205,.24);
  font-size: 11.5px; color: #9fe0e5; font-weight: 600; letter-spacing: .3px;
}
.login-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px; align-self: center;
  position: relative; overflow: hidden;
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.login-card .panel-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.stack { display: grid; gap: 10px; margin-top: 16px; }
input, select {
  background: var(--panel-3); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; width: 100%;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input:focus, select:focus {
  border-color: var(--accent); background: #0c1219;
  box-shadow: var(--ring);
}
input::placeholder { color: var(--faint); }
button {
  border: none; border-radius: var(--radius-sm); padding: 10px 15px;
  cursor: pointer; font-weight: 600; font-size: 13px;
  transition: transform .12s ease, box-shadow .14s, opacity .14s, background .14s, border-color .14s;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: .4; cursor: not-allowed; }
.primary {
  background: var(--accent); color: #04191b; font-weight: 700;
  box-shadow: 0 6px 16px rgba(34,195,205,.24);
}
.primary:hover:not(:disabled) { background: #33d2db; box-shadow: 0 8px 22px rgba(34,195,205,.34); }
.ghost {
  background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--line);
}
.ghost:hover:not(:disabled) { background: rgba(255,255,255,.08); border-color: var(--line-s); }
button.small { padding: 6px 11px; font-size: 12px; }
.danger  { background: var(--bad-weak); color: var(--bad); border: 1px solid rgba(240,96,95,.3); }
.eyebrow { font-size: 10px; letter-spacing: 2.4px; color: var(--faint); text-transform: uppercase; font-weight: 700; }
.danger-text { color: #f39a9a; font-size: 13px; }
.fault-banner {
  margin-bottom: 14px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  background: var(--bad-weak); color: var(--bad); border: 1px solid rgba(240,96,95,.34);
}

/* ── LANGUAGE SWITCH ────────────────────────── */
.lang-switch { display: flex; gap: 4px; margin: 2px 0 10px; }
.langBtn {
  flex: 1; padding: 5px 0; font-size: 11px; font-weight: 700; letter-spacing: .4px;
  background: rgba(255,255,255,.04); color: var(--faint); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.langBtn:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.langBtn.active { background: var(--accent); color: #04191b; border-color: transparent; }
.lang-switch-login { position: absolute; top: 20px; right: 24px; width: 84px; margin: 0; z-index: 2; }

/* ── APP SHELL ──────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, rgba(20,26,34,.92), rgba(12,16,22,.92));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.15);
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brandbox {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 13px; border-radius: var(--radius);
  background: var(--panel-hi);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: var(--radius-sm); flex-shrink: 0;
  background: linear-gradient(150deg, #123037, #0c1a22);
  border: 1px solid rgba(34,195,205,.28);
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(34,195,205,.16);
}
.brand-mark svg { width: 25px; height: 25px; }
.brand-title { font-family: var(--font-display); font-size: 15.5px; font-weight: 700; line-height: 1.15; letter-spacing: -.2px; }
.nav-caption {
  font-size: 10px; color: var(--faint); text-transform: uppercase;
  letter-spacing: 1.7px; padding: 10px 10px 5px; font-weight: 700;
}
.navbtn {
  width: 100%; background: transparent; color: var(--muted);
  padding: 9px 12px; border: 1px solid transparent;
  border-radius: var(--radius-sm); text-align: left; font-size: 13px; font-weight: 600;
  transition: .14s ease; margin-bottom: 1px;
  display: flex; align-items: center; gap: 10px;
}
.navicon { width: 16px; height: 16px; flex-shrink: 0; color: currentColor; opacity: .8; }
.navbtn:hover { background: rgba(255,255,255,.04); color: var(--text); }
.navbtn:hover .navicon { opacity: 1; }
.navbtn.active {
  background: var(--accent-weak);
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.navbtn.active .navicon { opacity: 1; color: var(--accent); }
#alarmBadge { animation: badgePulse 2.2s ease-in-out infinite; }
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,96,95,.55); }
  50%      { box-shadow: 0 0 0 4px rgba(240,96,95,0); }
}
@media (prefers-reduced-motion: reduce) { #alarmBadge { animation: none; } }
.sidebar-sep { height: 1px; background: var(--line); margin: 8px 4px; }
.livebox {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--panel-3); border: 1px solid var(--line); font-size: 13px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; transition: .3s; }
.live-on  { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-weak); animation: livePulse 2s ease-in-out infinite; }
.live-off { background: #47586b; }
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--ok-weak); }
  50%      { box-shadow: 0 0 0 7px rgba(47,201,138,.05); }
}
.who-block { padding: 10px 12px; font-size: 13px; color: var(--muted); }
.who-row { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 33px; height: 33px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(34,195,205,.3), rgba(56,168,255,.22));
  border: 1px solid rgba(34,195,205,.34);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #d7f4f7;
}
.whoami { font-weight: 700; color: var(--text); margin-top: 2px; }

/* ── MAIN ───────────────────────────────────── */
.main-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOPBAR ─────────────────────────────────── */
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding: 22px 24px 0;
}
.topbar h1 {
  font-family: var(--font-display); margin: 4px 0 5px;
  font-size: 25px; font-weight: 700; letter-spacing: -.4px;
}
.topbar-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: stretch; }
.mini-stat, .rate-box {
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line);
}
.mini-label { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.mini-value { font-family: var(--font-mono); font-size: 20px; font-weight: 600; margin-top: 4px; }
.rate-box { min-width: 196px; }
.rate-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.rate-row input { width: 86px; padding: 7px 9px; font-family: var(--font-mono); }

/* ── FLEET STATUS BAR (persistent) ──────────── */
.fleet-status {
  display: grid; grid-template-columns: minmax(210px, .8fr) 1.6fr; gap: 12px;
  padding: 16px 24px 0;
  animation: kpiIn .4s cubic-bezier(.16,1,.3,1) both;
}
@keyframes kpiIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.fs-hero, .fs-avail {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 18px;
}
.fs-hero { position: relative; overflow: hidden; }
.fs-hero::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.fs-hero-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.fs-hero-value { font-family: var(--font-mono); font-size: 30px; font-weight: 600; letter-spacing: -.6px; margin-top: 6px; color: var(--accent); }
.fs-hero-meta { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.fs-hero-meta b { font-family: var(--font-mono); color: var(--text); font-weight: 600; }
.fs-avail { display: flex; flex-direction: column; justify-content: center; }
.fs-avail-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.fs-avail-title { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.fs-avail-pct { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--ok); }
.fs-avail-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.06); }
.fs-avail-bar .seg { height: 100%; transition: width .5s cubic-bezier(.16,1,.3,1); }
.fs-avail-bar .seg.ok   { background: var(--ok); }
.fs-avail-bar .seg.warn { background: var(--warn); }
.fs-avail-bar .seg.bad  { background: var(--bad); }
.fs-avail-legend { display: flex; gap: 18px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.fsl { display: inline-flex; align-items: center; gap: 6px; }
.fsl i { width: 8px; height: 8px; border-radius: 2px; }
.fsl.ok i   { background: var(--ok); }
.fsl.warn i { background: var(--warn); }
.fsl.bad i  { background: var(--bad); }
.fsl b { font-family: var(--font-mono); color: var(--text); font-weight: 600; margin-left: 2px; }

/* legacy kpi cards (kept harmless) */
.kpi-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 10px; padding: 16px 24px 0; }
.kpi-card { padding: 15px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.kpi-card .label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 700; }
.kpi-card .value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; margin-top: 8px; }

/* ── FLEET TREND PANEL + DONUT ──────────────── */
.fleet-trend-panel { margin-bottom: 14px; }
.donut-wrap { position: relative; height: 168px; margin-top: 4px; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.donut-center b { font-family: var(--font-mono); font-size: 24px; font-weight: 600; color: var(--ok); }
.donut-center span { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; margin-top: 2px; }

/* ── TABS ───────────────────────────────────── */
.tab { display: none; padding: 18px 24px; flex: 1; }
.tab.active { display: block; animation: tabIn .24s cubic-bezier(.16,1,.3,1); }
@keyframes tabIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ── PANELS ─────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm);
}
.subpanel {
  background: var(--panel-3); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px;
}
.panel-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -.1px; }
.small-title  { font-size: 12.5px; font-weight: 700; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 15px; }

/* ── TOOLBAR ────────────────────────────────── */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar-compact input { min-width: 220px; flex: 1; }
.toolbar-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.export-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.export-panel {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  margin-bottom: 12px; background: var(--panel-3);
}
.export-panel-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.export-panel-row label {
  display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 700;
}
.export-panel-row input[type="date"] { padding: 6px 8px; color-scheme: dark; }
.export-download-row { margin-bottom: 0; }
.export-download-row button { flex: 1 1 0; min-width: 140px; }
.export-panel .park-picker.inverter-picker { max-height: 220px; margin-bottom: 12px; }

/* ── LAYOUT HELPERS ─────────────────────────── */
.page-grid    { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 14px; }
.stack-side   { display: flex; flex-direction: column; gap: 14px; }
.grid2        { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split-bottom { margin-top: 14px; }
.compact-panel .panel-title { margin-bottom: 10px; }
.listy > div  { margin-bottom: 7px; color: var(--muted); font-size: 13px; }

/* ── QUICK PARK CHIPS ───────────────────────── */
.quick-parks { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.park-chip {
  padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 600;
  background: var(--panel-3); border: 1px solid var(--line); color: var(--text);
  transition: transform .13s cubic-bezier(.16,1,.3,1), background .13s, border-color .13s;
}
.park-chip:hover { background: var(--accent-weak); border-color: rgba(34,195,205,.35); transform: translateY(-1px); }
.park-chip.chip-bad  { border-color: rgba(240,96,95,.3);  color: #f5a1a1; }
.park-chip.chip-warn { border-color: rgba(242,177,60,.3); color: #f6cf88; }
.park-chip.chip-ok   { border-color: rgba(47,201,138,.24); }

/* ── TABLE ──────────────────────────────────── */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; min-width: 800px; }
.table th, .table td {
  padding: 11px 13px; border-bottom: 1px solid var(--line-hair);
  font-size: 13px; text-align: left; vertical-align: middle;
}
.table th {
  position: sticky; top: 0; background: var(--panel-hi);
  color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: .8px; font-weight: 700; z-index: 1;
}
.table tbody tr { transition: background .13s; }
.table tbody tr:hover { background: var(--accent-weak); cursor: pointer; }
.table tbody tr:last-child td { border-bottom: none; }
.table td.mono, .table td .mono { font-family: var(--font-mono); }
.email-edit { display: flex; gap: 6px; align-items: center; }
.email-edit input { min-width: 160px; padding: 6px 8px; font-size: 12px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  border: 1px solid transparent;
}
.badge.online   { background: var(--ok-weak);   color: var(--ok);   border-color: rgba(47,201,138,.26); }
.badge.warning  { background: var(--warn-weak); color: var(--warn); border-color: rgba(242,177,60,.26); }
.badge.offline,
.badge.critical { background: var(--bad-weak);  color: var(--bad);  border-color: rgba(240,96,95,.26); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: middle; flex-shrink: 0; box-shadow: 0 0 6px currentColor; }
.dot.online  { background: var(--ok);   color: var(--ok); }
.dot.warning { background: var(--warn); color: var(--warn); }
.dot.offline { background: var(--bad);  color: var(--bad); }
.dot.critical{ background: var(--bad);  color: var(--bad); position: relative; }
.dot.critical::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid var(--bad); animation: dotPulse 1.8s ease-out infinite;
}
@keyframes dotPulse {
  0%   { transform: scale(.4); opacity: .8; }
  100% { transform: scale(1.9); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dot.critical::after { animation: none; }
  .kpi-card { animation: none; }
}
.row-title { font-weight: 600; }
.row-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }
/* daily-yield column: value + thin bar relative to the biggest producer of the table */
.kwh-cell  { min-width: 86px; }
.kwh-val   { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.kwh-bar   { height: 3px; margin-top: 5px; border-radius: 2px; background: var(--line-hair); overflow: hidden; }
.kwh-bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent, #4aa3ff); opacity: .75; }
.diag      { max-width: 320px; color: #aec4dc; font-size: 12px; }
.hung-tag {
  display: inline-block; padding: 1px 7px; border-radius: 5px; margin-right: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
  background: rgba(56,168,255,.16); color: var(--accent-2);
  border: 1px solid rgba(56,168,255,.32);
}
.dim       { color: var(--muted); }

/* ── INVERTER BRAND LOGOS ───────────────────── */
.ilogo {
  display: inline-flex; align-items: center; gap: 5px;
  height: 19px; padding: 0 8px; border-radius: 5px;
  font-family: var(--font-display); font-weight: 800; font-size: 10.5px;
  letter-spacing: .01em; line-height: 1; white-space: nowrap;
  color: #fff; user-select: none; flex-shrink: 0;
}
.ilogo.lg { height: 25px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.ilogo b { font-weight: 800; }
.ilogo-fronius  { background: #E30016; }
.ilogo-refusol  { background: #10263b; box-shadow: inset 0 0 0 1px rgba(255,255,255,.13); }
.ilogo-refusol b{ color: #37b6e6; }
.ilogo-huawei   { background: #CF0A2C; letter-spacing: .17em; padding-right: 5px; }
.ilogo-abb      { background: #FF000F; letter-spacing: .1em; }
.ilogo-fimer    { background: #1f2f45; box-shadow: inset 0 0 0 1px rgba(255,255,255,.13); color: #e34b3a; letter-spacing: .06em; }
.ilogo-sma      { background: #009EE0; }
.ilogo-shelly   { background: #0aa6b6; }
.ilogo-solaredge{ background: #ED1C24; text-transform: lowercase; letter-spacing: 0; }
.ilogo-sungrow  { background: #0a4fa0; }
.ilogo-goodwe   { background: #e60012; }
.ilogo-growatt  { background: #f39800; color: #1a1200; }
.ilogo-solis    { background: #123f8c; }
.ilogo-generic  { background: var(--panel-hi); color: #c6d3e2; box-shadow: inset 0 0 0 1px var(--line-s); }
.brand-tag { display: inline-flex; align-items: center; gap: 6px; }

/* ── OWNER GROUPS ───────────────────────────── */
.owner-groups { display: flex; flex-direction: column; gap: 9px; }
.owner-group {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-3); overflow: hidden;
  transition: border-color .16s, box-shadow .16s;
}
.owner-group:hover { border-color: var(--line-s); }
.owner-group-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  cursor: pointer; user-select: none; flex-wrap: wrap;
  transition: background .14s;
}
.owner-group-head:hover { background: var(--accent-weak); }
.owner-group-chevron {
  width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s cubic-bezier(.16,1,.3,1); flex-shrink: 0;
}
.owner-group.collapsed .owner-group-chevron { transform: rotate(-45deg); }
.owner-group-name { font-weight: 700; font-size: 14px; margin-right: auto; }
.owner-group-stats { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.owner-group-stats b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.owner-group-power { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--text); min-width: 62px; text-align: right; }
.owner-group-energy { font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--accent); min-width: 84px; text-align: right; }
.owner-group-body {
  border-top: 1px solid var(--line);
  max-height: 9000px; opacity: 1; overflow: hidden;
  transition: max-height .3s cubic-bezier(.16,1,.3,1), opacity .2s ease, border-color .2s;
}
.owner-group.collapsed .owner-group-body { max-height: 0; opacity: 0; border-top-color: transparent; }
/* one collapsible section per park inside a big owner group (the 500 kWp plants) */
.park-subgroup + .park-subgroup { border-top: 1px solid var(--line); }
.park-subgroup-head {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px 9px 26px; cursor: pointer; user-select: none; flex-wrap: wrap;
  background: rgba(255,255,255,.02); transition: background .14s;
}
.park-subgroup-head:hover { background: var(--accent-weak); }
.park-subgroup-name { font-weight: 600; font-size: 13px; margin-right: auto; }
.park-subgroup.collapsed .owner-group-chevron { transform: rotate(-45deg); }
.park-subgroup-body { max-height: 6000px; opacity: 1; overflow: hidden; transition: max-height .3s cubic-bezier(.16,1,.3,1), opacity .2s ease; }
.park-subgroup.collapsed .park-subgroup-body { max-height: 0; opacity: 0; }
.group-controls { display: flex; gap: 8px; margin-bottom: 10px; }
.fleet-summary-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 2px 0 12px;
}
.fleet-summary-line #fleetSummaryText { font-size: 12.5px; }
.fleet-summary-line b { font-family: var(--font-mono); font-weight: 600; }
.owner-health-bar {
  display: flex; width: 96px; height: 6px; border-radius: 4px; overflow: hidden;
  background: rgba(255,255,255,.07); flex-shrink: 0;
}
.owner-health-bar .seg { height: 100%; }
.owner-health-bar .seg.ok   { background: var(--ok); }
.owner-health-bar .seg.warn { background: var(--warn); }
.owner-health-bar .seg.bad  { background: var(--bad); }
.flag {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px;
  font-weight: 700; font-family: var(--font-mono); font-size: 11px;
}
.flag.warn { background: var(--warn-weak); color: var(--warn); }
.flag.bad  { background: var(--bad-weak);  color: var(--bad); }
.flag.ok    { background: var(--ok-weak);  color: var(--ok); }
.flag.muted { background: var(--panel-3);  color: var(--muted); }

/* subscription cell in the Users table */
.sub-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sub-renew { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sub-renew select { max-width: 210px; }
.sub-renew input[type="date"], #newSubDate, #newSubDays {
  background: var(--panel-3); color: var(--text, #e8eef7);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; color-scheme: dark;
}

/* ── ALARM SNAPSHOT MINI CARDS ──────────────── */
.cards.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.cards.mini .card {
  padding: 12px 13px; background: var(--panel-3);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.cards.mini .card .label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.cards.mini .card .value { font-family: var(--font-mono); font-size: 20px; font-weight: 600; margin-top: 5px; }

/* ── METRICS ────────────────────────────────── */
.metric-strip { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 9px; }
.metric { padding: 12px 13px; border: 1px solid var(--line); background: var(--panel-3); border-radius: var(--radius-sm); }
.metric .m-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.metric .m-value { font-family: var(--font-mono); font-size: 19px; font-weight: 600; margin-top: 7px; }
.metric .m-value.m-ok     { color: var(--ok); }
.metric .m-value.m-warn   { color: var(--warn); }
.metric .m-value.m-danger { color: var(--bad); }
.metric .m-value.m-info   { color: var(--accent-2); }  /* notable but not a problem (starting, standby, throttled) */
.metric .m-value.m-dim    { color: var(--faint); }     /* no data */
/* The tile itself takes the tone too, so something wrong stands out before you read a single value:
   ok = faint green edge, info = faint blue edge, warn/danger = tinted tile + coloured left bar. */
.metric.t-ok     { border-color: rgba(47,201,138,.22); }
.metric.t-info   { border-color: rgba(56,168,255,.30); }
.metric.t-warn   { border-color: rgba(242,177,60,.50); background: var(--warn-weak); box-shadow: inset 3px 0 0 var(--warn); }
.metric.t-danger { border-color: rgba(240,96,95,.60); background: var(--bad-weak);  box-shadow: inset 3px 0 0 var(--bad); }
.metric[title] { cursor: help; }
.metric { position: relative; }
.metric .m-ico { position: absolute; top: 11px; right: 11px; width: 18px; height: 18px; color: var(--faint); opacity: .9; }
.metric .m-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.metric.t-ok .m-ico     { color: var(--ok); }
.metric.t-info .m-ico   { color: var(--accent-2); }
.metric.t-warn .m-ico   { color: var(--warn); }
.metric.t-danger .m-ico { color: var(--bad); }
.metric .m-sub { font-size: 11px; color: var(--muted); margin-top: 5px; }
.metric.has-ico .m-label { padding-right: 24px; }   /* long labels must not run under the icon */

/* ── PARK HEADER CARD ───────────────────────── */
.park-head {
  display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: radial-gradient(520px 170px at 100% 0, var(--accent-weak), transparent 70%), var(--panel-3);
}
.park-head-main { flex: 1 1 300px; min-width: 240px; display: flex; flex-direction: column; gap: 11px; }
.park-head-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.park-head-name { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: .3px; color: var(--text); }
.park-head-sub { font-size: 12.5px; color: var(--muted); }
.park-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); background: rgba(255,255,255,.03);
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pill b { font-family: var(--font-mono); font-weight: 700; }
.pill.ok   { color: var(--ok);   background: var(--ok-weak);   border-color: rgba(47,201,138,.28); }
.pill.warn { color: var(--warn); background: var(--warn-weak); border-color: rgba(242,177,60,.30); }
.pill.bad  { color: var(--bad);  background: var(--bad-weak);  border-color: rgba(240,96,95,.32); }
.pill.dim  { opacity: .5; }
.health-strip { display: flex; gap: 4px; height: 8px; max-width: 420px; }
.health-strip .hs { flex: 1 1 0; border-radius: 3px; background: var(--ok); box-shadow: 0 0 8px rgba(47,201,138,.25); }
.health-strip .hs.warning { background: var(--warn); box-shadow: 0 0 8px rgba(242,177,60,.3); }
.health-strip .hs.offline { background: var(--bad);  box-shadow: 0 0 8px rgba(240,96,95,.3); }
.park-head-gauge { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.ring { --p: 0; width: 100px; height: 100px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--energy) calc(var(--p) * 1%), rgba(255,255,255,.08) 0); }
.ring-in { width: 78px; height: 78px; border-radius: 50%; background: var(--panel-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring-in b { font-family: var(--font-mono); font-size: 18px; font-weight: 700; }
.ring-in span { font-size: 10.5px; color: var(--muted); letter-spacing: .6px; }
.ring-cap { font-size: 11px; color: var(--muted); }
.metric-strip-tech .metric { padding: 10px 12px; }
.metric-strip-tech .m-value { font-size: 16px; }
td.m-ok     { color: var(--ok); }
td.m-warn   { color: var(--warn); font-weight: 600; }
td.m-danger { color: var(--bad); font-weight: 700; }

/* ── CHARTS ─────────────────────────────────── */
.chartpanel {
  background: var(--panel-3); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  position: relative; min-height: 280px;
}
.chartpanel.tall { min-height: 320px; }
.day-nav {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 8px;
}
.day-nav button { padding: 4px 10px; line-height: 1; }
.day-nav button:disabled { opacity: .35; cursor: default; }
#invDayLabel { min-width: 110px; text-align: center; font-weight: 600; }

/* ── POLLER STATUS ──────────────────────────── */
.poller-status {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12.5px;
}
.poller-status-icon { width: 15px; height: 15px; flex-shrink: 0; color: var(--accent); }
.poller-status.is-polling .poller-status-icon { animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.poller-status-text { color: var(--text); font-weight: 600; margin-right: auto; }
.poller-status-sub { color: var(--muted); font-family: var(--font-mono); }
.poller-status-bar { width: 130px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.09); overflow: hidden; flex-shrink: 0; }
.poller-status-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 3px; transition: width .4s cubic-bezier(.16,1,.3,1); }
@media (prefers-reduced-motion: reduce) { .poller-status.is-polling .poller-status-icon { animation: none; } }

/* ── FLEET TREND CHART ──────────────────────── */
.fleet-chart-wrap { margin-bottom: 16px; }
.fleet-chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.fleet-chart-title { font-family: var(--font-display); font-weight: 700; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; }
.fleet-chartpanel { min-height: 240px; padding: 12px 14px; }

/* ── BRAND ICONS (legacy hook, kept for safety) ─ */
.brand-icon { width: 15px; height: 15px; flex-shrink: 0; opacity: .9; }
.brand-icon svg { width: 100%; height: 100%; }
.prebox {
  white-space: pre-wrap; max-height: 340px; overflow: auto;
  background: #070c12; padding: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); margin: 0; font-size: 12px;
  color: #9ab8d8; font-family: var(--font-mono);
}

/* ── MIMIC / SINGLE-LINE DIAGRAM ─────────────── */
#mimicView { margin-top: 14px; }
.sld {
  padding: 20px 16px 10px; background: var(--panel-3);
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto; text-align: center;
}
.sld-grid {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 auto;
  padding: 9px 14px; border: 1px solid var(--line-s); border-radius: var(--radius-sm);
  background: var(--panel-hi); text-align: left;
}
.sld-grid-ico { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; background: var(--accent-weak); color: var(--accent); flex-shrink: 0; }
.sld-grid-ico svg { width: 16px; height: 16px; }
.sld-grid-name { font-size: 9.5px; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.sld-grid-kw { font-family: var(--font-mono); font-weight: 600; font-size: 15px; margin-top: 1px; }
.sld-drop { width: 2px; height: 24px; margin: 0 auto; background: rgba(150,185,220,.32); position: relative; overflow: hidden; }
.sld-bus { height: 3px; border-radius: 2px; margin: 0 4% 0; background: linear-gradient(90deg, transparent, rgba(150,185,220,.32) 5%, rgba(150,185,220,.32) 95%, transparent); }
.sld-feeders { display: flex; gap: 12px; justify-content: center; padding-top: 0; min-width: min-content; }
.sld-feeder { display: flex; flex-direction: column; align-items: stretch; flex: 1 1 156px; min-width: 156px; max-width: 220px; }
.sld-riser { width: 2px; min-height: 22px; align-self: center; background: rgba(150,185,220,.32); position: relative; overflow: hidden; }
.sld-inv {
  border: 1px solid var(--line); border-top-width: 2px; border-radius: var(--radius-sm);
  background: var(--panel); padding: 10px 12px 11px; text-align: left;
  transition: transform .13s, border-color .13s, background .13s;
}
.sld-inv[data-key] { cursor: pointer; }
.sld-inv[data-key]:hover { transform: translateY(-2px); border-color: var(--line-s); background: var(--panel-2); }
.sld-inv.online  { border-top-color: var(--ok); }
.sld-inv.warning { border-top-color: var(--warn); }
.sld-inv.offline { border-top-color: var(--bad); }
.sld-inv-name { font-size: 12px; font-weight: 700; margin-top: 8px; display: flex; align-items: center; }
.sld-inv-kw { font-family: var(--font-mono); font-size: 16px; font-weight: 600; margin-top: 3px; }
.sld-inv.offline .sld-inv-kw { color: var(--muted); }
.sld-inv-meter { height: 4px; border-radius: 3px; background: rgba(255,255,255,.07); margin-top: 8px; overflow: hidden; }
.sld-inv-meter i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--energy)); transition: width .5s cubic-bezier(.16,1,.3,1); }
.sld-inv-sub { font-size: 11px; color: var(--muted); margin-top: 7px; font-family: var(--font-mono); }
.sld-flow {
  position: absolute; left: -2px; right: -2px; top: 0; height: 45%;
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  animation: sldFlow 1.15s linear infinite;
}
@keyframes sldFlow { from { transform: translateY(-130%); } to { transform: translateY(330%); } }
@media (prefers-reduced-motion: reduce) { .sld-flow { animation: none; opacity: .45; } }
/* feeder cards: status ribbon, size relative to nameplate, siblings tick, tinted by how the inverter compares */
.sld-feeder { flex: 1 1 168px; min-width: 168px; max-width: 232px; }
/* big parks (the 500 kWp plants have 25 inverters): wrap the feeders into rows that fit the page instead of one 4000 px row
   that needs sideways scrolling */
.sld-feeders.many { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px 12px; min-width: 0; justify-content: stretch; }
.sld-feeders.many .sld-feeder { min-width: 0; max-width: none; }
.sld-riser.warning { background: rgba(242,177,60,.55); }
.sld-riser.warning .sld-flow { background: linear-gradient(180deg, transparent, var(--warn), transparent); }
.sld-riser.offline { background: repeating-linear-gradient(180deg, rgba(240,96,95,.6) 0 4px, transparent 4px 8px); }
.sld-inv { border-top-width: 3px; padding: 11px 13px 12px; }
.sld-inv.tone-ok     { background: linear-gradient(180deg, rgba(47,201,138,.07), var(--panel) 55%); }
.sld-inv.warning     { background: linear-gradient(180deg, rgba(242,177,60,.10), var(--panel) 60%); }
.sld-inv.tone-warn   { background: linear-gradient(180deg, rgba(242,177,60,.13), var(--panel) 60%); border-color: rgba(242,177,60,.38); }
.sld-inv.tone-danger { background: linear-gradient(180deg, rgba(240,96,95,.15), var(--panel) 60%); border-color: rgba(240,96,95,.5); }
.sld-inv.offline {
  background: repeating-linear-gradient(135deg, rgba(240,96,95,.07) 0 9px, transparent 9px 18px), var(--panel);
  border-color: rgba(240,96,95,.32); border-top-color: var(--bad);
}
.sld-inv-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sld-state { font-size: 9.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.sld-state.online  { color: var(--ok);   background: var(--ok-weak); }
.sld-state.warning { color: var(--warn); background: var(--warn-weak); }
.sld-state.offline { color: var(--bad);  background: var(--bad-weak); }
.sld-inv-name { margin-top: 9px; font-size: 13px; }
.sld-inv-of { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; color: var(--faint); margin-left: 5px; }
.sld-inv-meter { position: relative; height: 6px; overflow: visible; margin-top: 10px; }
.sld-inv-meter i { border-radius: 3px; }
.sld-inv-meter.tone-ok i     { background: linear-gradient(90deg, #1fa874, var(--ok)); }
.sld-inv-meter.tone-warn i   { background: linear-gradient(90deg, #d99a2a, var(--warn)); }
.sld-inv-meter.tone-danger i { background: linear-gradient(90deg, #d8483f, var(--bad)); }
.sld-inv-meter .tick { position: absolute; top: -3px; width: 2px; height: 12px; border-radius: 1px;
  background: rgba(255,255,255,.8); transform: translateX(-1px); box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.sld-inv-meta { display: flex; gap: 12px; margin-top: 10px; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.sld-inv-meta .c-ok     { color: var(--ok); }
.sld-inv-meta .c-warn   { color: var(--warn); }
.sld-inv-meta .c-danger { color: var(--bad); }
.sld-inv-foot { margin-top: 6px; font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.sld-inv-diag { margin-top: 8px; display: inline-block; max-width: 100%; overflow-wrap: anywhere; font-size: 10.5px;
  font-family: var(--font-mono); color: #f5a1a1; background: var(--bad-weak); border-radius: 4px; padding: 2px 7px; }
.sld-legend { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 9px; font-size: 11px; color: var(--muted); text-align: left; }
.sld-legend .tick { flex: none; width: 2px; height: 12px; border-radius: 1px; background: rgba(255,255,255,.8); box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
/* legacy bay cards (kept as fallback) */
.bay {
  background: var(--panel-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px; min-height: 100px; transition: .18s;
}
.bay.online  { border-color: rgba(47,201,138,.3); }
.bay.warning { border-color: rgba(242,177,60,.3); }
.bay.offline { border-color: rgba(240,96,95,.3); }
.bay .row-title { font-size: 13px; font-weight: 700; }
.bay .small { margin-top: 5px; font-size: 12px; color: var(--muted); }

/* ── ALARMS ─────────────────────────────────── */
.alarm-list { display: flex; flex-direction: column; gap: 9px; }
.alarm {
  padding: 13px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-3);
  border-left: 3px solid var(--line-s); transition: transform .14s, border-color .14s;
}
.alarm:hover { transform: translateX(2px); }
.alarm.critical { border-color: rgba(240,96,95,.3);  border-left-color: var(--bad); background: rgba(44,16,16,.55); }
.alarm.warning  { border-color: rgba(242,177,60,.26); border-left-color: var(--warn); background: rgba(44,34,10,.42); }
.alarm.fa-dim { opacity: .7; }
.alarm details summary { cursor: pointer; }
.alarm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alarm-head .row-title { flex: 1; }
.alarm-time { font-size: 11px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions button { padding: 6px 11px; font-size: 12px; }
.bulk-bar {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--accent-weak); border: 1px solid rgba(34,195,205,.24);
  margin-bottom: 12px;
}
.checkline { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }

/* ── PARK PICKER (user creation) ─────────────── */
.park-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.park-picker-actions { display: flex; gap: 10px; }
.linklike {
  background: none; border: none; padding: 0; color: var(--accent);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.linklike:hover { text-decoration: underline; }
.park-picker {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 10px;
  max-height: 220px; overflow-y: auto;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-3);
}
.park-check {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text); cursor: pointer;
  padding: 3px 0;
}
.park-check input { accent-color: var(--accent); cursor: pointer; }
.park-picker-search { width: 100%; margin: 8px 0 6px; padding: 7px 10px; font-size: 12.5px; }
.inverter-picker { grid-template-columns: 1fr; max-height: 200px; }
.inverter-group-label {
  grid-column: 1 / -1;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 7px 0 2px; border-top: 1px solid var(--line); margin-top: 3px;
}
.inverter-group-label:first-child { border-top: none; margin-top: 0; }
.park-check.inv-hidden { display: none; }

/* ── PER-INVERTER RATE BOX ───────────────────── */
.inverter-rate-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-top: 12px;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.inverter-rate-box input { width: 100px; }

/* ── MAP ─────────────────────────────────────── */
.map-wrap { position: relative; }
#map {
  height: 66vh; min-height: 440px;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
}
.leaflet-container { background: #0a121a !important; }
.leaflet-popup-content-wrapper {
  background: var(--panel) !important; color: var(--text) !important;
  border: 1px solid var(--line-s) !important; border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow) !important;
}
.leaflet-popup-tip { background: var(--panel) !important; }

/* Custom marker: colored circular badge with an inline PV-panel glyph */
.park-marker-wrap { background: transparent !important; border: none !important; }
.park-marker {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  cursor: pointer;
  transition: transform .15s ease;
}
.park-marker:hover { transform: scale(1.14); z-index: 1000 !important; }

/* Hover popup: park total + one row per inverter */
.leaflet-popup-content { margin: 10px 13px; }
.map-popup { min-width: 168px; }
.map-popup-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 13px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--line-s);
}
.map-popup-head span { font-family: var(--font-mono); color: var(--accent); font-weight: 600; }
.map-popup-list { display: flex; flex-direction: column; gap: 3px; max-height: 180px; overflow-y: auto; }
.map-popup-row { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.map-popup-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.map-popup-row b { font-family: var(--font-mono); font-weight: 600; opacity: .85; }

/* Fleet-wide totals overlaid on the map */
.map-stats {
  position: absolute; top: 14px; right: 14px; z-index: 500;
  background: var(--panel); border: 1px solid var(--line-s); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 12px 16px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12.5px; min-width: 168px;
}
.map-stats .ms-title {
  font-weight: 700; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .05em; opacity: .65; margin-bottom: 2px;
}
.map-stats .ms-power { font-family: var(--font-mono); font-size: 21px; font-weight: 700; color: var(--accent); line-height: 1.15; }
.map-stats .ms-sub { opacity: .7; margin-bottom: 4px; }
.map-stats .ms-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.map-stats .ms-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; flex: none; }

/* ── SKELETON LOADER ─────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px; height: 14px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.skeleton.h32 { height: 32px; }
.skeleton.w60 { width: 60%; }
.skeleton.w80 { width: 80%; }

/* ── LOADING SPINNER ─────────────────────────── */
.spinner-wrap { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 18px 0; font-size: 13px; }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line-s);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; flex-shrink: 0;
}

/* ── PARK SUMMARY ────────────────────────────── */
.park-summary { font-size: 13px; line-height: 1.6; color: var(--muted); }

/* ── USERS TABLE ─────────────────────────────── */
#usersTable .table { min-width: 400px; }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 1320px) {
  .kpi-grid { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 960px) {
  .fleet-status { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 100%; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row;
    flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--line);
  }
  .brandbox { flex: 0 0 auto; }
  .nav-section { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; flex: 1; }
  .nav-caption { display: none; }
  .navbtn { width: auto; }
  .sidepanel { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .who-block { padding: 4px 8px; }
  .page-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { flex-direction: column; padding: 12px 14px 0; }
  .topbar h1 { font-size: 21px; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); padding: 10px 14px 0; }
  .tab { padding: 12px 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2,1fr); }
  .cards.mini { grid-template-columns: repeat(2,1fr); }
  .login-panel { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-card { padding: 24px; }
  .map-stats { min-width: 132px; padding: 9px 12px; font-size: 11.5px; }
  .map-stats .ms-power { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══ MOTION LAYER (2026-10-08) ═══ driven by ui/motion.js; all of it is GPU-friendly (transform/opacity) */

/* master switch: "Animations OFF" (or the OS reduce-motion setting) freezes every animation and transition */
html[data-anim="off"] *, html[data-anim="off"] *::before, html[data-anim="off"] *::after {
  animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; transition-delay: 0s !important;
}
.animToggle, .animSpeed { font-size: 12px; }
.animToggle::before { content: '○'; margin-right: 7px; color: var(--faint); }
.animToggle.is-on::before { content: '●'; color: var(--ok); }

.mnum { font-variant-numeric: tabular-nums; }

/* value-changed flash: green when it went up, red when it went down (tile, feeder card or table row) */
/* very soft and slow: ~20 % rise, then a long fade (7 s in all); peak is a faint tint, not a flash */
@keyframes fxUp   { 0% { box-shadow: inset 0 0 0 999px rgba(47,201,138,0), 0 0 0 1px rgba(47,201,138,0); }
                    20% { box-shadow: inset 0 0 0 999px rgba(47,201,138,.085), 0 0 0 1px rgba(47,201,138,.22); }
                    55% { box-shadow: inset 0 0 0 999px rgba(47,201,138,.05), 0 0 0 1px rgba(47,201,138,.12); }
                    100% { box-shadow: inset 0 0 0 999px rgba(47,201,138,0), 0 0 0 1px rgba(47,201,138,0); } }
@keyframes fxDown { 0% { box-shadow: inset 0 0 0 999px rgba(240,96,95,0), 0 0 0 1px rgba(240,96,95,0); }
                    20% { box-shadow: inset 0 0 0 999px rgba(240,96,95,.085), 0 0 0 1px rgba(240,96,95,.22); }
                    55% { box-shadow: inset 0 0 0 999px rgba(240,96,95,.05), 0 0 0 1px rgba(240,96,95,.12); }
                    100% { box-shadow: inset 0 0 0 999px rgba(240,96,95,0), 0 0 0 1px rgba(240,96,95,0); } }
@keyframes fxRowUp   { 0% { background-color: rgba(47,201,138,0); } 20% { background-color: rgba(47,201,138,.09); }
                       55% { background-color: rgba(47,201,138,.05); } 100% { background-color: rgba(47,201,138,0); } }
@keyframes fxRowDown { 0% { background-color: rgba(240,96,95,0); } 20% { background-color: rgba(240,96,95,.09); }
                       55% { background-color: rgba(240,96,95,.05); } 100% { background-color: rgba(240,96,95,0); } }
[data-mflash].fx-up   { animation: fxUp 7s ease-in-out; }
[data-mflash].fx-down { animation: fxDown 7s ease-in-out; }
tr[data-mflash].fx-up   { animation: none; }
tr[data-mflash].fx-down { animation: none; }
tr[data-mflash].fx-up > td   { animation: fxRowUp 7s ease-in-out; }
tr[data-mflash].fx-down > td { animation: fxRowDown 7s ease-in-out; }

/* rings: glow while producing, small variant for the inverter flow diagram */
.ring { position: relative; }
.ring.live::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 16px 2px var(--energy); opacity: .12; animation: ringGlow 3.2s ease-in-out infinite;
}
@keyframes ringGlow { 0%, 100% { opacity: .10; } 50% { opacity: .5; } }
.ring.sm { width: 78px; height: 78px; }
.ring.sm .ring-in { width: 60px; height: 60px; }
.ring.sm .ring-in b { font-size: 14px; }
.ring.sm .ring-in span { font-size: 9.5px; }
.ring.tone-warn   { background: conic-gradient(var(--warn) calc(var(--p) * 1%), rgba(255,255,255,.08) 0); }
.ring.tone-danger { background: conic-gradient(var(--bad) calc(var(--p) * 1%), rgba(255,255,255,.08) 0); }

/* feeder flow: speed follows the load (--flow-dur set per feeder); energy runs from the inverter UP to the grid */
.sld-riser .sld-flow, .sld-drop .sld-flow { animation-duration: var(--flow-dur, 1.15s); animation-direction: reverse; }

/* map markers: halo pulses faster the more the park produces; amber/red ripple for warnings/offline */
.park-marker { position: relative; }
.park-marker .halo {
  position: absolute; inset: -3px; border-radius: 50%; pointer-events: none;
  border: 2px solid var(--halo, var(--ok)); opacity: 0;
  animation: haloPulse var(--halo-dur, 3s) ease-out infinite;
}
.park-marker .halo.h2 { animation-delay: calc(var(--halo-dur, 3s) / 2); }
.park-marker.is-warn .halo { --halo: var(--warn); }
.park-marker.is-bad  .halo { --halo: var(--crit); border-width: 3px; }
@keyframes haloPulse { 0% { transform: scale(.85); opacity: .7; } 100% { transform: scale(2.4); opacity: 0; } }

/* inverter page: sun -> panels -> inverter (gauge) -> grid */
.inv-flow {
  display: flex; align-items: center; gap: 0; padding: 14px 18px; margin: 12px 0 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.if-node { flex: 0 0 auto; min-width: 104px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.if-ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; position: relative; overflow: hidden;
  background: var(--panel-3); border: 1px solid var(--line-s); color: var(--muted);
}
.if-ico svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.if-node.on .if-ico { color: var(--energy); border-color: rgba(47,201,138,.45); }
.if-node.bad .if-ico { color: var(--bad); border-color: rgba(240,96,95,.5); }
.if-val { font-family: var(--font-mono); font-size: 16px; font-weight: 600; }
.if-lab { font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.if-sub { font-size: 10.5px; color: var(--faint); font-family: var(--font-mono); }
.if-line { flex: 1 1 44px; min-width: 28px; height: 3px; border-radius: 2px; background: rgba(150,185,220,.22); position: relative; overflow: hidden; }
.if-line.on::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 38%;
  background: linear-gradient(90deg, transparent, var(--energy), transparent);
  animation: ifFlow var(--flow-dur, 1.6s) linear infinite;
}
.if-line.dim { background: repeating-linear-gradient(90deg, rgba(150,185,220,.28) 0 5px, transparent 5px 10px); }
@keyframes ifFlow { from { transform: translateX(-120%); } to { transform: translateX(300%); } }
.if-sun .rays { transform-box: fill-box; transform-origin: center; animation: sunSpin 24s linear infinite; }
@keyframes sunSpin { to { transform: rotate(360deg); } }
.if-sun.on .ico-sun { filter: drop-shadow(0 0 5px rgba(242,177,60,.6)); }
.if-sun .ico-sun { color: var(--warn); }
.if-panel.on .if-ico::after {
  content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%);
  transform: translateX(-120%); animation: panelShine 3.6s ease-in-out infinite;
}
@keyframes panelShine { 0%, 45% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.if-inv-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
@media (max-width: 680px) {
  .inv-flow { flex-direction: column; padding: 12px; }
  .if-line { flex: none; width: 3px; height: 28px; min-width: 0; }
  .if-line.on::after { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 38%;
    background: linear-gradient(180deg, transparent, var(--energy), transparent); animation-name: ifFlowV; }
  .if-line.dim { background: repeating-linear-gradient(180deg, rgba(150,185,220,.28) 0 5px, transparent 5px 10px); }
}
@keyframes ifFlowV { from { transform: translateY(-120%); } to { transform: translateY(300%); } }
.inv-flow[hidden] { display: none; }

/* ═══ MOTION LAYER, BATCH 2 (2026-10-08) ═══ */

/* live "now" dot at the end of a curve (positioned by the Chart.js liveTip plugin) */
.chartpanel { position: relative; }
.live-tip {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; pointer-events: none;
  background: var(--ok); box-shadow: 0 0 0 2px rgba(20,26,34,.9); z-index: 3;
}
.live-tip::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--ok);
  animation: tipPulse 1.9s ease-out infinite;
}
@keyframes tipPulse { 0% { transform: scale(.8); opacity: .8; } 100% { transform: scale(3); opacity: 0; } }

/* day arc: sunrise -> sunset with the sun's position; moon + "poller paused" at night */
.fleet-status { grid-template-columns: minmax(210px, .8fr) 1.6fr minmax(200px, .8fr); }
.fs-sun { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 10px; display: flex; flex-direction: column; justify-content: center; }
.fs-sun-title { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.fs-sun svg { width: 100%; height: auto; max-height: 86px; display: block; margin-top: 4px; overflow: visible; }
.fs-sun .arc-bg { fill: none; stroke: rgba(150,185,220,.2); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 6; }
.fs-sun .arc-fg { fill: none; stroke: url(#sunGrad); stroke-width: 3.4; stroke-linecap: round; transition: stroke-dashoffset 1.6s cubic-bezier(.16,1,.3,1); }
.fs-sun .horizon { stroke: rgba(150,185,220,.28); stroke-width: 1; }
.fs-sun .orb { transition: transform 1.8s cubic-bezier(.16,1,.3,1); }
.fs-sun .orb-core { fill: var(--warn); }
.fs-sun .orb-halo { fill: var(--warn); opacity: .28; transform-box: fill-box; transform-origin: center; animation: orbPulse 3.4s ease-in-out infinite; }
.fs-sun .orb-rays { stroke: var(--warn); stroke-width: 1.6; stroke-linecap: round; transform-box: fill-box; transform-origin: center; animation: sunSpin 30s linear infinite; }
.fs-sun.is-night .orb-core { fill: #b9c7da; }
.fs-sun.is-night .orb-halo { fill: #b9c7da; opacity: .18; }
.fs-sun.is-night .orb-rays { display: none; }
@keyframes orbPulse { 0%, 100% { transform: scale(.85); opacity: .18; } 50% { transform: scale(1.35); opacity: .38; } }
.fs-sun-times { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.fs-sun-note { font-size: 11px; color: var(--faint); margin-top: 3px; min-height: 14px; }
@media (max-width: 1100px) { .fleet-status { grid-template-columns: 1fr; } }

/* alarms: a critical alarm and an offline feeder breathe slowly; a brand-new alarm slides in with a glow */
.sld-inv { position: relative; }
.sld-inv.offline::after, .alarm.critical::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(240,96,95,.6), 0 0 16px rgba(240,96,95,.38); opacity: 0;
  animation: breathe 3.8s ease-in-out infinite;
}
.alarm { position: relative; }
@keyframes breathe { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.alarm.alarm-new { animation: alarmIn .7s cubic-bezier(.16,1,.3,1) both; }
@keyframes alarmIn { 0% { transform: translateX(-26px); opacity: 0; box-shadow: 0 0 0 0 rgba(240,96,95,.7); }
                     60% { opacity: 1; box-shadow: 0 0 0 8px rgba(240,96,95,0); } 100% { transform: none; } }

/* restart progress (inverter page) */
.rp { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--line-s); }
.rp[hidden] { display: none; }
.rp-ring { width: 46px; height: 46px; flex: none; position: relative; }
.rp-ring svg { width: 46px; height: 46px; transform: rotate(-90deg); overflow: visible; }
.rp-ring .trk { fill: none; stroke: rgba(150,185,220,.2); stroke-width: 4; }
.rp-ring .bar { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 113.1; transition: stroke-dashoffset .9s linear; }
.rp.sending .bar { stroke-dasharray: 30 83.1; animation: rpSpin 1.1s linear infinite; transform-origin: center; }
@keyframes rpSpin { to { transform: rotate(360deg); } }
.rp.done .bar { stroke: var(--ok); stroke-dashoffset: 0 !important; }
.rp.late .bar { stroke: var(--warn); animation: rpLate 1.6s ease-in-out infinite; }
@keyframes rpLate { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.rp.failed .bar { stroke: var(--bad); stroke-dashoffset: 0 !important; }
.rp-check { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; }
.rp-check svg { width: 22px; height: 22px; transform: none; fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 26; stroke-dashoffset: 26; }
.rp.done .rp-check { opacity: 1; }
.rp.done .rp-check svg { animation: rpCheck .6s .15s ease-out forwards; }
@keyframes rpCheck { to { stroke-dashoffset: 0; } }
.rp.done .rp-ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ok); animation: tipPulse 1.1s ease-out 2; }
.rp-body { flex: 1; min-width: 0; }
.rp-title { font-size: 13px; font-weight: 700; }
.rp-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rp-x { flex: none; }

/* feeder sparklines */
.sld-spark { margin-top: 9px; }
.sld-spark svg { width: 100%; height: auto; display: block; overflow: visible; }
.sld-spark .sp-line { fill: none; stroke: var(--accent); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }
.sld-spark .sp-area { fill: url(#spGrad); opacity: .9; stroke: none; }
.sld-spark.draw .sp-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: sparkDraw 1.3s ease-out forwards; }
.sld-spark.draw .sp-area { animation: sparkFade 1.3s ease-out both; }
@keyframes sparkDraw { to { stroke-dashoffset: 0; } }
@keyframes sparkFade { from { opacity: 0; } to { opacity: .9; } }
.sld-spark .sp-dot { fill: var(--accent); }
.sld-spark .sp-ping { fill: none; stroke: var(--accent); stroke-width: .8; transform-box: fill-box; transform-origin: center; animation: spPing 2.2s ease-out infinite; }
@keyframes spPing { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(3.2); opacity: 0; } }
.sld-inv.offline .sld-spark { opacity: .45; }

/* ═══ SLOWER FLASHES & PULSES (2026-10-09) ═══ every blinking / pulsing / flashing effect runs about 2x slower.
   Flows (sldFlow, ifFlow), spinners and the skeleton shimmer are movement, not flashing, so they are left alone. */
[data-mflash].fx-up   { animation-duration: 10s; }
[data-mflash].fx-down { animation-duration: 10s; }
tr[data-mflash].fx-up > td   { animation-duration: 10s; }
tr[data-mflash].fx-down > td { animation-duration: 10s; }
#alarmBadge { animation-duration: 4.8s; }
.live-on { animation-duration: 4.4s; }
.dot.critical::after { animation-duration: 4s; }
.ring.live::after { animation-duration: 6.8s; }
.park-marker .halo { animation-duration: calc(var(--halo-dur, 3s) * 2); }
.park-marker .halo.h2 { animation-delay: var(--halo-dur, 3s); }
.live-tip::after { animation-duration: 4s; }
.fs-sun .orb-halo { animation-duration: 7s; }
.sld-inv.offline::after, .alarm.critical::after { animation-duration: 8s; }
.rp.late .bar { animation-duration: 3.4s; }
.sld-spark .sp-ping { animation-duration: 4.6s; }
.if-panel.on .if-ico::after { animation-duration: 7.6s; }

/* ═══ SPEED MULTIPLIER (2026-10-09) ═══ --mspeed is set by the "Speed" button in the sidebar (ui/motion.js):
   1 = normal, 2 = slow (default), 3.5 = very slow. It multiplies EVERY animation duration below, flashes, pulses,
   energy flows and decorative spinners alike. This block comes last on purpose: it overrides the earlier values. */
:root { --mspeed: 2; }
[data-mflash].fx-up, [data-mflash].fx-down, tr[data-mflash].fx-up > td, tr[data-mflash].fx-down > td { animation-duration: calc(7s * var(--mspeed, 2)); }
#alarmBadge { animation-duration: calc(4.8s * var(--mspeed, 2)); }
.live-on { animation-duration: calc(4.4s * var(--mspeed, 2)); }
.dot.critical::after { animation-duration: calc(4s * var(--mspeed, 2)); }
.ring.live::after { animation-duration: calc(6.8s * var(--mspeed, 2)); }
.park-marker .halo { animation-duration: calc(var(--halo-dur, 3s) * 2 * var(--mspeed, 2)); }
.park-marker .halo.h2 { animation-delay: calc(var(--halo-dur, 3s) * var(--mspeed, 2)); }
.live-tip::after { animation-duration: calc(4s * var(--mspeed, 2)); }
.fs-sun .orb-halo { animation-duration: calc(7s * var(--mspeed, 2)); }
.sld-inv.offline::after, .alarm.critical::after { animation-duration: calc(8s * var(--mspeed, 2)); }
.rp.late .bar { animation-duration: calc(3.4s * var(--mspeed, 2)); }
.sld-spark .sp-ping { animation-duration: calc(4.6s * var(--mspeed, 2)); }
.if-panel.on .if-ico::after { animation-duration: calc(7.6s * var(--mspeed, 2)); }
/* energy flow lights: 2.5x slower than the original load-based speed, then times the multiplier */
.sld-riser .sld-flow, .sld-drop .sld-flow { animation-duration: calc(var(--flow-dur, 1.15s) * 2.5 * var(--mspeed, 2)); }
.if-line.on::after { animation-duration: calc(var(--flow-dur, 1.6s) * 2.5 * var(--mspeed, 2)); }
/* decorative spinners / shimmer (the small loading spinner is left alone: it signals "busy") */
.poller-status.is-polling .poller-status-icon { animation-duration: calc(1.6s * 2 * var(--mspeed, 2)); }
.skeleton { animation-duration: calc(1.4s * 2 * var(--mspeed, 2)); }
.if-sun .rays, .fs-sun .orb-rays { animation-duration: calc(30s * var(--mspeed, 2)); }
