:root {
  --bg-deep: #030407;
  --bg-surface: #0a0c12;
  --bg-card: rgba(16, 20, 28, 0.45);
  --border-soft: rgba(255, 255, 255, 0.04);
  --border-bright: rgba(255, 255, 255, 0.1);
  
  /* Premium Palette */
  --gold: #d4af37;
  --emerald: #10b981;
  --soc-green: #10b93b;
  --sapphire: #3b82f6;
  --ruby: #ef4444;
  --amber: #f59e0b;
  --violet: #a78bfa;
  
  --text-main: #e2e8f0;
  --text-muted: #8e96aa;
  --text-dim: #525a6c;
  
  --font-serif: 'Instrument Serif', serif;
  --font-sans: 'Geist', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
}

/* Mesh Gradient Background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.04) 0%, transparent 35%),
    radial-gradient(circle at 85% 85%, rgba(212, 175, 55, 0.04) 0%, transparent 35%),
    linear-gradient(rgba(255,255,255,0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.01) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  z-index: -1;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: 260px;
  height: 100vh;
  position: sticky;
  top: 0;
  border-right: 1px solid var(--border-soft);
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  background: rgba(3, 4, 7, 0.6);
  backdrop-filter: blur(20px);
}

.brand {
  padding: 0 12px 48px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand_logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--gold), #f97316);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 22px;
  color: var(--bg-deep);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.brand_name {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: -0.5px;
}

.nav_group { margin-bottom: 32px; }
.nav_label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  padding: 0 12px 12px;
}

.nav_item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  color: var(--text-muted);
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
  cursor: pointer;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 13px;
}

.nav_item:hover { color: var(--text-main); background: rgba(255,255,255,0.03); }
.nav_item.active { color: var(--gold); background: rgba(212, 175, 55, 0.08); box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.15); }

.nav_item .count { font-size: 9px; padding: 2px 6px; background: var(--border-bright); border-radius: 100px; color: var(--text-dim); }
.nav_item.active .count { background: var(--gold); color: var(--bg-deep); }
.nav_item .count_alert { background: var(--ruby); color: #fff; }

/* ============ MAIN CONTENT ============ */
.main {
  flex: 1;
  min-width: 0;
  padding: 0 48px 80px;
}

.top_bar {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.view_header h1 {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.5px;
}

.view_header p {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* TOU Legend Styles */
.tou_header_flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tou_legend {
  display: flex;
  gap: 10px;
}

.legend_pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid transparent;
  line-height: 1;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.legend_pill.peak {
  color: #FF4444;
  background: rgba(255, 68, 68, 0.1);
  border-color: rgba(255, 68, 68, 0.4);
}

.legend_pill.std {
  color: #8e96aa;
  background: #181D2A;
  border-color: rgba(255, 255, 255, 0.1);
}

.legend_pill.off {
  color: #2DD4BF;
  background: rgba(45, 212, 191, 0.1);
  border-color: rgba(45, 212, 191, 0.4);
}

/* ============ DASHBOARD CARDS ============ */
.view { display: none; }
.view.active { display: block; animation: viewIn 0.5s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.stat_grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi_label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.kpi_dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.kpi_value { font-family: var(--font-serif); font-size: 32px; line-height: 1; margin-bottom: 6px; }
.kpi_unit { font-family: var(--font-sans); font-size: 13px; color: var(--text-dim); margin-left: 4px; }
.kpi_trend { font-size: 10px; font-family: var(--font-mono); }

/* ============ SECTION HEADERS ============ */
.block_head { padding: 8px 12px 0; }
.block_head h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.25px;
}
.block_head p {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 2px;
}
.block_head_inline { padding: 0; }

/* ============ ENERGY FLOW HERO ============ */
.flow_container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  min-width: 0;
  overflow: visible;
  background: radial-gradient(circle at center, rgba(212, 175, 55, 0.03) 0%, transparent 70%);
}

.flow_container > * {
  min-width: 0;
}

.Live_Energey_Diagarm {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.Live_Energey_Diagarm .flow_svg {
  width: 100%;
  height: auto;
  max-width: 600px;
  margin: 0 auto;
  aspect-ratio: 580 / 380;
  display: block;
}

.flow_node_label { font-family: var(--font-serif); font-style: italic; font-size: 18px; fill: var(--text-main); transition: fill 0.2s; }
.flow_node_sub { font-family: var(--font-mono); font-size: 11px; fill: var(--text-dim); text-transform: uppercase; transition: fill 0.2s; }
.flow_node_bg { fill: var(--bg-surface); stroke: var(--border-bright); stroke-width: 1px; transition: stroke 0.2s; }
.flow_line { fill: none; stroke: var(--border-soft); stroke-width: 2.5; }
.flow_line_active { fill: none; stroke-width: 3.5; stroke-dasharray: 4 8; animation: flowMove 15s linear infinite; }
.flow_line_solar { animation-duration: 3.5s; }
.flow_line_batt { animation-duration: 6s; }
.flow_line_load { animation-duration: 2.5s; }

/* Reverse animation for charging direction */
.flow_line_reverse {
  animation: flowMoveReverse 15s linear infinite;
}

@keyframes flowMove { to { stroke-dashoffset: -100; } }
@keyframes flowMoveReverse { to { stroke-dashoffset: 100; } }

/* Eskom Back-Feeding Warning pulsing styles */
@keyframes pulse_alert {
  0% { opacity: 0.4; }
  50% { opacity: 1; fill: var(--ruby); stroke: var(--ruby); }
  100% { opacity: 0.4; }
}

.anti_export_alert {
  animation: pulse_alert 1s infinite;
  fill: var(--ruby) !important;
}

.anti_export_line {
  stroke: var(--ruby) !important;
  stroke-width: 3px !important;
  animation: flowMove 1.5s linear infinite !important;
}

/* ============ TOU TIMELINE ============ */
.tou_timeline {
  container-type: inline-size;
  position: relative;
  padding: 0;
  flex-shrink: 0;
  width: 100%;
}

.tou_bar {
  container-type: inline-size;
  position: relative;
  margin-top: 28px;
  height: 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  display: flex;
  border: 1px solid var(--border-soft);
}

.tou_seg {
  container-type: inline-size;
  height: 100%;
  min-width: 0;
  position: relative;
  transition: opacity 0.2s;
}

.tou_seg:first-child { border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
.tou_seg:nth-last-child(2) { border-top-right-radius: 5px; border-bottom-right-radius: 5px; }

@container (max-width: 28px) {
  .tou_seg .seg_rate { display: none; }
}

.tou_seg.peak { background: #FF4444; }
.tou_seg.std { background: #181D2A; }
.tou_seg.off { background: #2DD4BF; }

.tou_seg .seg_rate {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.tou_strategy {
  margin-top: 10px;
  display: flex;
  gap: 3px;
}

.strat_seg {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
}

.strat_seg.charge { background: var(--emerald); opacity: 0.65; }
.strat_seg.discharge { background: var(--gold); opacity: 0.8; }
.strat_seg.idle { background: rgba(255, 255, 255, 0.06); }

.tou_now {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #fbf7f5;
  border-radius: 2px;
  z-index: 2;
  transform: translateX(-50%);
  pointer-events: none;
}

.tou_hours {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: clamp(10px, 0.8cqi, 9px);
  color: var(--text-dim);
  gap: 6px;
  flex-wrap: wrap;
}

/* BESS mode cards */
.bess_mode_card {
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.bess_mode_card.active {
  border-color: var(--gold) !important;
  background: rgba(212, 175, 55, 0.05) !important;
}

.bess_mode_card.active .mode_title { color: var(--gold); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1400px) {
  .stat_grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1100px) {
  .main { padding: 0 24px 48px; }
  .stat_grid { grid-template-columns: repeat(2, 1fr); }
  .grid_4col { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }
  .main { padding: 0 16px 40px; }
  .top_bar { height: auto; padding: 16px 0; flex-wrap: wrap; gap: 16px; }
  .stat_grid { grid-template-columns: 1fr; }
  .grid_4col { grid-template-columns: 1fr; }
  .block_head h2 { font-size: clamp(17px, 4vw, 20px); }
}

/* ============ TELEMETRY PANELS ============ */
.grid_2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid_3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.grid_4col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }

.tel_row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: 12px; }
.tel_row:last-child { border-bottom: none; }
.tel_lbl { color: var(--text-muted); }
.tel_val { font-family: var(--font-mono); color: var(--text-main); font-weight: 500; }

/* ============ LEDGER STYLE TABLES ============ */
.ledger_table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.ledger_table th { text-align: left; padding: 12px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); border-bottom: 1px solid var(--border-bright); }
.ledger_table td { padding: 16px 12px; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.ledger_table tr:hover td { background: rgba(255,255,255,0.01); }

/* ============ UI COMPONENTS ============ */
.btn_push { 
  background: linear-gradient(135deg, var(--gold), #f97316); 
  color: var(--bg-deep); border: none; padding: 10px 20px; 
  border-radius: 8px; font-weight: 600; cursor: pointer; 
  font-family: inherit; font-size: 12px; box-shadow: 0 4px 15px rgba(212,175,55,0.3);
}
.btn_push_lg { font-size: 13px; padding: 10px 20px; }
.btn_push_xl { font-size: 15px; padding: 18px; box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4); }

.pill { padding: 4px 10px; border-radius: 100px; font-size: 10px; font-weight: 600; text-transform: uppercase; background: var(--border-bright); }
.pill_peak { background: rgba(255, 68, 68, 0.1); color: #FF4444; border: 1px solid rgba(255, 68, 68, 0.2); }
.pill_std { background: #181D2A; color: #8e96aa; border: 1px solid rgba(255, 255, 255, 0.1); }
.pill_off { background: rgba(45, 212, 191, 0.1); color: #2DD4BF; border: 1px solid rgba(45, 212, 191, 0.2); }
.pill_pending { color: var(--gold); border-color: rgba(212, 175, 55, 0.3); background: rgba(212, 175, 55, 0.1); padding: 8px 16px; font-size: 11px; }
.pill_index { background: rgba(255,255,255,0.05); }
.pill_bess_charge { background: rgba(45, 212, 191, 0.15); color: #2DD4BF; }
.pill_bess_discharge { background: rgba(212, 175, 55, 0.15); color: var(--gold); }
.pill_bess_idle { background: rgba(255, 255, 255, 0.05); color: var(--text-dim); }
.pill_bess_auto { background: rgba(167, 139, 250, 0.15); color: var(--violet); }

/* ============ CHART OVERLAYS ============ */
.chart_wrap { height: 280px; margin-top: 20px; position: relative; }
.chart_wrap_h220 { height: 220px; margin-top: 0; }
.chart_wrap_h240 { height: 240px; margin-top: 0; }
.chart_wrap_h250 { height: 250px; margin-top: 0; }
.chart_wrap_h320 { height: 320px; margin-top: 0; }
.chart_wrap_interactive { height: 320px; cursor: crosshair; position: relative; margin-top: 0; }
.chart_tou_zones { position: absolute; inset: 0; display: flex; opacity: 0.03; pointer-events: none; }

/* Range Sliders */
input[type=range] { width: 100%; accent-color: var(--gold); background: transparent; }

/* ============ EXTRACTED UTILITY CLASSES ============ */
.brand_italic { font-style: italic; opacity: 0.7; }
.mt_auto { margin-top: auto; }
.card_sidebar { padding: 16px; background: rgba(255,255,255,0.02); }
.card_subtle { padding: 16px; background: rgba(255,255,255,0.02); }
.card_status { padding: 32px 24px; }
.text_10 { font-size: 10px; }
.text_11 { font-size: 11px; }
.text_13 { font-size: 13px; }
.text_14 { font-size: 14px; }
.text_16_emerald_italic { font-size: 16px; color: var(--emerald); font-style: italic; margin-top: 12px; }
.text_72_serif { font-family: var(--font-serif); font-size: 72px; line-height: 1; color: var(--text-main); }
.text_dim { color: var(--text-dim); fill: var(--text-dim); }
.text_muted { color: var(--text-muted); }
.text_main { color: var(--text-main); }
.text_ruby { color: var(--ruby); }
.text_emerald { color: var(--emerald); }
.text_gold { color: var(--gold); }
.text_amber { color: var(--amber); }
.text_sapphire { color: var(--sapphire); }
.text_right { text-align: right; }
.text_center { text-align: center; }
.mb_4 { margin-bottom: 4px; }
.mb_8 { margin-bottom: 8px; }
.mb_12 { margin-bottom: 12px; }
.mb_16 { margin-bottom: 16px; }
.mb_20 { margin-bottom: 20px; }
.mb_24 { margin-bottom: 24px; }
.mb_32 { margin-bottom: 32px; }
.mt_4 { margin-top: 4px; }
.mt_8 { margin-top: 8px; }
.mt_12 { margin-top: 12px; }
.mt_16 { margin-top: 16px; }
.mt_24 { margin-top: 24px; }
.mt_32 { margin-top: 32px; }
.pt_32 { padding-top: 32px; }
.py_32 { padding: 32px 0; }
.fw_600 { font-weight: 600; }
.fw_700 { font-weight: 700; }
.flex { display: flex; }
.flex_col { flex-direction: column; }
.flex_center { display: flex; align-items: center; }
.flex_between { display: flex; justify-content: space-between; }
.flex_between_center { display: flex; justify-content: space-between; align-items: center; }
.flex_between_baseline { display: flex; justify-content: space-between; align-items: baseline; }
.justify_center { justify-content: center; }
.gap_8 { gap: 8px; }
.gap_12 { gap: 12px; }
.gap_16 { gap: 16px; }
.gap_20 { gap: 20px; }
.gap_32 { gap: 32px; }
.divider_v { width: 1px; height: 40px; background: var(--border-soft); }
.divider_h { flex: 1; margin: 0 16px; height: 1px; background: var(--border-soft); }
.uppercase_label { letter-spacing: 2px; text-transform: uppercase; }
.uppercase_label_sm { letter-spacing: 1.5px; text-transform: uppercase; }
.avatar_circle { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(var(--gold), var(--amber)); display: flex; align-items: center; justify-content: center; color: var(--bg-deep); font-weight: 800; font-size: 12px; }
.w_25 { width: 25%; }
.w_4_17 { width: 4.17%; }
.w_12_5 { width: 12.5%; }
.w_33_3 { width: 33.3%; }
.w_8_33 { width: 8.33%; }
.h2_serif { font-family: var(--font-serif); font-size: 24px; font-style: italic; }
.flex_1 { flex: 1; }
.flex_2 { flex: 2; }
.flex_3 { flex: 3; }
.flex_4 { flex: 4; }
.flex_6 { flex: 6; }
.flex_8 { flex: 8; }
.bg_emerald { background: var(--emerald); }
.bg_amber { background: var(--amber); }
.bg_ruby { background: var(--ruby); }
.h_100 { height: 100%; }
.card_revenue { padding: 48px; border-left: 4px solid var(--emerald); background: linear-gradient(90deg, rgba(16, 185, 129, 0.05) 0%, transparent 100%); margin-bottom: 24px; }
.btn_secondary { padding: 6px 12px; background: var(--border-bright); color: var(--text-main); box-shadow: none; border: none; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 11px; font-weight: 600; letter-spacing: 1px; }
.btn_secondary_lg { padding: 0 24px; font-size: 13px; border-radius: 8px; }
.btn_add { border-radius: 6px; font-size: 10px; font-weight: 600; padding: 8px 12px; letter-spacing: 1px; }
.grid_2_1 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.grid_4_gap_12 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.grid_2_gap_32 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.status_circle { width: 80px; height: 80px; border-radius: 50%; border: 2px solid var(--emerald); margin: 0 auto; display: flex; align-items: center; justify-content: center; color: var(--emerald); font-size: 24px; }
.fill_gold { fill: var(--gold); }
.fill_main { fill: var(--text-main); }
.fill_emerald { fill: var(--emerald); }
.fill_amber { fill: var(--amber); }
.fill_ruby { fill: var(--ruby); }
.fill_sapphire { fill: var(--sapphire); }
.stroke_gold { stroke: var(--gold); }
.stroke_emerald { stroke: var(--emerald); }
.stroke_amber { stroke: var(--amber); }
.stroke_main { stroke: #e2e8f0; }
.svg_chart { width: 100%; height: 100%; overflow: visible; }
.chart_path_gold { fill: rgba(212,175,55,0.05); stroke: var(--gold); stroke-width: 2.5; }
.chart_path_dashed { fill: none; stroke: var(--text-dim); stroke-width: 1.5; stroke-dasharray: 6 6; }
.chart_path_emerald { fill: none; stroke: var(--emerald); stroke-width: 2.5; }

/* Radiation Panel Utilities */
.progress_track { width: 100%; height: 4px; background: var(--border-soft); border-radius: 2px; overflow: hidden; }
.progress_track_thin { height: 3px; background: rgba(255,255,255,0.05); }
.progress_fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.progress_fill_sapphire { background: #0ea5e9; }
.mx_16 { margin-left: 16px; margin-right: 16px; }
.flex_wrap { flex-wrap: wrap; }
.min_w_200 { min-width: 200px; }
.gauge_wrap { position: relative; width: 220px; margin: 0 auto; }
.gauge_value { margin: 0; }
.gauge_label_flex { justify-content: center; margin: 0; }
.gauge_stats { margin-top: -7px; display: flex; flex-direction: column; gap: 8px; }

/* Interactive Chart Utilities */
.bg_gold { background: var(--gold); }
.bg_sapphire { background: var(--sapphire); }

.time_chip { padding: 4px 12px; border-radius: 6px; font-size: 11px; font-weight: 500; cursor: pointer; color: var(--text-dim); border: 1px solid transparent; transition: color 0.2s, background 0.2s, border-color 0.2s; }
.time_chip:hover { color: var(--text-main); }
.time_chip.active { color: var(--text-main); background: rgba(255,255,255,0.04); border-color: var(--border-soft); box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.time_chip_outline { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.time_chip_ghost { background: rgba(255,255,255,0.02); border: 1px solid transparent; }

.chart_legend { display: flex; gap: 20px; font-size: 11px; color: var(--text-dim); margin-bottom: 20px; }
.chart_legend_inline { margin-bottom: 0; }
.legend_item { display: flex; align-items: center; gap: 8px; cursor: pointer; transition: color 0.2s, opacity 0.2s; user-select: none; }
.legend_item:hover { color: var(--text-main); }
.legend_item.dimmed { opacity: 0.3; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }

.chart_path { transition: opacity 0.3s ease; }
.chart_path.dimmed { opacity: 0.05 !important; }

.chart_vline { position: absolute; top: 0; bottom: 0; width: 1px; border-left: 1px dashed rgba(255,255,255,0.3); pointer-events: none; opacity: 0; z-index: 5; transition: opacity 0.2s; }
.chart_tooltip { position: absolute; pointer-events: none; top: 50%; background: rgba(10, 12, 18, 0.85); border: 1px solid var(--border-bright); backdrop-filter: blur(12px); border-radius: 8px; padding: 12px; font-family: var(--font-mono); font-size: 10px; color: var(--text-main); opacity: 0; transform: translate(-50%, -50%); z-index: 10; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.6); transition: opacity 0.2s; white-space: nowrap; }
.tooltip_header { margin-bottom: 6px; border-bottom: 1px solid var(--border-soft); padding-bottom: 6px; }
.tooltip_time { color: var(--text-muted); font-weight: 600; font-family: var(--font-sans); letter-spacing: 1px; }
.tooltip_tou { font-size: 8px; padding: 2px 6px; }
.tooltip_soc_row { border-top: 1px solid var(--border-soft); margin-top: 4px; padding-top: 4px; }
.tooltip_dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ============ PERFORMANCE GAUGE CARDS ============ */
.perf_gauge { position: relative; width: 140px; height: 140px; margin: 0 auto 20px; }
.perf_gauge_svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.perf_gauge_inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.perf_gauge_value { font-family: var(--font-serif); font-size: 28px; line-height: 1; margin-bottom: 6px; }
.perf_gauge_label { font-size: 8px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim); line-height: 1.3; }

/* ============ SECTION HEADER WITH BAR ============ */
.section_header_bar { width: 4px; height: 16px; border-radius: 2px; }
.section_header_bar.gold { background: var(--gold); }
.section_header_bar.teal { background: #2dd4bf; }
.section_header_bar.sapphire { background: #38bdf8; }
.section_header_bar.violet { background: var(--violet); }
.section_header_bar.salmon { background: #fb7185; }
.section_header_title { font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-main); }
.section_header_title_lg { font-size: 13px; }
.section_header_subtitle { text-transform: none; font-style: italic; font-weight: 400; font-family: var(--font-serif); font-size: 14px; margin-left: 8px; }

/* ============ MODULE DEGRADATION ============ */
.degr_row { border: none; padding: 6px 0; }
.degr_lbl { font-size: 11px; width: 140px; }
.degr_val { width: 44px; font-size: 11px; }
.degr_lbl_main { color: var(--text-main); }

/* ============ TELEMETRY ROWS (BESS) ============ */
.tel_row_compact { border-bottom: 1px solid var(--border-soft); padding: 10px 0; }
.tel_row_compact.no_border { border: none; }
.tel_lbl_sm { font-size: 11px; }
.tel_lbl_w140 { font-size: 11px; width: 140px; }
.tel_val_sm { font-size: 13px; }
.tel_val_w70 { font-size: 13px; width: 70px; }
.tel_val_teal { color: #2dd4bf; }
.tel_val_blue { color: #38bdf8; }
.tel_eol_row { padding: 10px 0; margin-top: 10px; border: none; }
.tel_eol_label { font-size: 11px; font-weight: 700; color: var(--text-main); }
.tel_val_right { text-align: right; }
.tel_eol_value { font-size: 13px; }

/* ============ DOD CHART CAPTION ============ */
.dod_caption { font-family: var(--font-mono); font-size: 9px; margin-top: 6px; }

/* ============ BESS BANNER ============ */
.header_banner { padding: 16px 24px; border-color: rgba(255,255,255,0.08); }
.banner_status_dot { width: 10px; height: 10px; background: var(--emerald); border-radius: 50%; box-shadow: 0 0 10px var(--emerald); }
.banner_div { height: 32px; }
.font_mono { font-family: var(--font-mono); }
.banner_label { letter-spacing: 1.5px; }

/* ============ BESS SETTINGS CARDS ============ */
.slider_gold { width: 100%; accent-color: var(--gold); background: transparent; }
.bess_setting_block { margin-bottom: 24px; }

/* ============ TOGGLE SWITCH ============ */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle_slider { position: absolute; cursor: pointer; inset: 0; background-color: rgba(255,255,255,0.1); border-radius: 22px; transition: background 0.2s; }
.toggle_slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: var(--text-main); border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked + .toggle_slider { background-color: var(--gold); }
.toggle input:checked + .toggle_slider:before { transform: translateX(18px); background-color: var(--bg-deep); }

/* ============ TOU PROGRAM BAR ============ */
.tou_prog_bar { display: flex; height: 32px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border-soft); }
.tou_prog_seg { display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: var(--bg-deep); white-space: nowrap; overflow: hidden; }
.bg_tou_charge { background: #2dd4bf; }
.bg_tou_idle { background: rgba(255,255,255,0.04); color: var(--text-dim); }
.bg_tou_discharge { background: var(--gold); }
.bg_tou_auto { background: var(--violet); }

/* ============ TOU TABLE ============ */
.tou_table { font-size: 12px; }

/* ============ DIFF / PENDING CHANGES ============ */
.diff_item { padding: 12px 16px; background: rgba(212, 175, 55, 0.04); border: 1px solid rgba(212, 175, 55, 0.15); border-radius: 8px; }
.diff_strike { text-decoration: line-through; }

/* ============ ACTIONS ROW ============ */
.actions_row { margin-top: 24px; }
.banner_spacer { flex: 1; }

/* ============ KPI TREND BADGE ============ */
.kpi_badge_emerald { background: rgba(16, 185, 129, 0.15); padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.kpi_badge_emerald_lg { background: rgba(16, 185, 129, 0.15); padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ============ REVENUE BIG NUMBER ============ */
.rev_currency { font-style: italic; margin-right: 4px; }
.rev_subtext { font-family: var(--font-serif); font-size: 18px; color: var(--text-muted); }
.rev_subtext_italic { font-style: italic; }
.rev_subtext_strong { font-family: var(--font-sans); color: var(--text-main); font-weight: 700; }
.rev_subtext_emerald { font-family: var(--font-sans); color: var(--emerald); font-weight: 700; }
.rev_mini_value { font-size: 20px; font-family: var(--font-mono); }

/* ============ MISC ============ */
.history_list p { line-height: 1.6; }
.full_height_col { flex-direction: column; }
.justify_between { justify-content: space-between; }

/* ============ ADDITIONAL UTILITIES ============ */
.soc_span_label { font-size: 14px; font-style: normal; font-family: var(--font-sans); margin-left: 8px; }
.mb_0 { margin-bottom: 0; }
.tou_prog_hours { font-size: 9px; padding: 0 4px; }
.table_scroll { overflow-x: auto; }
.th_idx { width: 40px; text-align: center; }
.push_history { border-top: 1px solid var(--border-soft); }

/* Vertical Accent Rule matching platform Emerald standard */
.section_header_bar.emerald { 
  background: var(--emerald); 
}

/* ============ PROJECT ECONOMICS CARDS ============ */
.econ_val {
  font-family: var(--font-serif);
  font-size: 38px;
  line-height: 1;
  font-weight: 400;
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  margin-top: 4px;
}

.econ_unit {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
  margin-left: 4px;
}

/* Maintain active dynamic state colors for text units */
.econ_val.text_emerald .econ_unit {
  color: var(--emerald);
}

.mb_32 {
  margin-bottom: 32px;
}

/* ============ LIGHT THEME OVERRIDES ============ */
[data-theme="light"] {
  --bg-deep: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.75);
  --border-soft: rgba(15, 23, 42, 0.06);
  --border-bright: rgba(15, 23, 42, 0.12);

  --gold: #b45309;
  --emerald: #059669;
  --soc-green: #059669;
  --sapphire: #1d4ed8;
  --ruby: #be123c;
  --amber: #b45309;
  --violet: #6d28d9;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
}

[data-theme="light"]::before {
  background: 
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.03) 0%, transparent 35%),
    radial-gradient(circle at 85% 85%, rgba(180, 83, 9, 0.03) 0%, transparent 35%),
    linear-gradient(rgba(15, 23, 42, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.02) 1px, transparent 1px);
}

[data-theme="light"] .sidebar {
  background: rgba(248, 250, 252, 0.65);
}

[data-theme="light"] .nav_item:hover {
  background: rgba(15, 23, 42, 0.03);
}

[data-theme="light"] .nav_item.active {
  background: rgba(180, 83, 9, 0.08);
  box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.15);
}

[data-theme="light"] .card_sidebar,
[data-theme="light"] .card_subtle {
  background: rgba(15, 23, 42, 0.02);
}

[data-theme="light"] .tou_bar {
  background: rgba(15, 23, 42, 0.02);
}

[data-theme="light"] .tou_seg.std {
  background: #e2e8f0;
}

[data-theme="light"] .legend_pill.std {
  background: #e2e8f0;
  color: #64748b;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .pill_std {
  background: #e2e8f0;
  color: #475569;
  border-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .strat_seg.idle {
  background: rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .tou_now {
  background: #0f172a;
}

[data-theme="light"] .chart_tooltip {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--border-bright);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .chart_vline {
  border-left-color: rgba(15, 23, 42, 0.3);
}

[data-theme="light"] .toggle_slider {
  background-color: rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .tou_prog_seg.bg_tou_idle {
  background: rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .ledger_table tr:hover td {
  background: rgba(15, 23, 42, 0.01);
}

[data-theme="light"] .diff_item {
  background: rgba(180, 83, 9, 0.04);
  border-color: rgba(180, 83, 9, 0.15);
}

/* ============ PPA CLIENTS & PORTAL ============ */
.client_row {
  display: grid;
  grid-template-columns: 42px 2fr 1fr 1fr 1.2fr 100px 90px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.15s;
}

.client_row:hover { background: rgba(255, 255, 255, 0.02); }
.client_avatar { 
  width: 38px; 
  height: 38px; 
  border-radius: 8px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-family: var(--font-serif); 
  font-size: 20px; 
  color: #fff; 
}

.client_portal_banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 12px;
}

/* ============ CAMERA GRID ============ */
.cam_grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.cam_tile {
  aspect-ratio: 16/9;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s;
}

.cam_tile:hover { border-color: var(--border-bright); }

.cam_live {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ruby);
  display: flex;
  align-items: center;
  gap: 4px;
}

.cam_live::before {
  content: ''; 
  width: 6px; 
  height: 6px; 
  border-radius: 50%; 
  background: var(--ruby); 
  animation: pulse_alert 1.5s infinite;
}