/* ==========================================
   DESIGN SYSTEM & VARIABLES - OPTION 1: TESLA CYBER-SCADA & INDUSTRIAL CLEAN
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700;800&display=swap');

:root {
  /* Dark Mode Palette - Deep Obsidian & Graphite SCADA */
  --bg-color: #07090e;
  --bg-gradient: radial-gradient(ellipse at 50% -15%, #111827 0%, #07090e 75%);
  --panel-bg: rgba(13, 17, 26, 0.92);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-hover: rgba(245, 158, 11, 0.35);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Brand Accents - Technical Solar Amber & SCADA Telemetry */
  --accent-solar: #f59e0b;
  --accent-solar-glow: rgba(245, 158, 11, 0.25);
  --accent-solar-hover: #fbbf24;
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.25);
  --accent-danger: #ef4444;
  --accent-danger-glow: rgba(239, 68, 68, 0.2);
  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  
  /* Layout Constants */
  --font-header: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --border-radius-lg: 10px;
  --border-radius-md: 6px;
  --transition-smooth: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-glow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
  /* Light Mode Palette - Clean Technical SCADA Lab */
  --bg-color: #f1f5f9;
  --bg-gradient: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  --panel-bg: rgba(255, 255, 255, 0.96);
  --panel-border: rgba(15, 23, 42, 0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  /* Brand Accents adjustments for light BG */
  --accent-solar: #d97706;
  --accent-solar-glow: rgba(217, 119, 6, 0.2);
  --accent-solar-hover: #b45309;
  --panel-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 6px 24px rgba(15, 23, 42, 0.08);
}

/* ==========================================
   BASE STYLES & RESET
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-gradient);
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  transition: var(--transition-smooth);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-header);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  text-decoration: none;
  color: inherit;
}

button, input, select {
  font-family: inherit;
  outline: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ==========================================
   COMPONENTS: GLASSMOPHISM & LAYOUTS
   ========================================== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-glow);
  padding: 24px;
  transition: var(--transition-smooth);
  min-width: 0;
  max-width: 100%;
}

.glass-panel:hover {
  border-color: var(--panel-border-hover);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 16px rgba(245, 158, 11, 0.08);
}

/* SCADA Live Telemetry Pulse Dot */
.scada-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-green);
  animation: scadaPulse 2s infinite ease-in-out;
}

@keyframes scadaPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.75); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(var(--bg-color), 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  transition: var(--transition-smooth);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-header);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
}

.logo svg {
  fill: var(--accent-solar);
  filter: drop-shadow(0 0 6px var(--accent-solar-glow));
}

.nav-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Partner Share Quota Widget */
.partner-share-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 3px 8px;
  transition: border-color 0.2s, background 0.2s;
}

.partner-share-box:hover {
  border-color: rgba(245, 158, 11, 0.45);
}

.partner-share-label {
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 0.4px;
}

.partner-share-select {
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--accent-solar);
  font-weight: 800;
  font-size: 11.5px;
  font-family: var(--font-mono);
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.partner-share-select:hover {
  border-color: var(--accent-solar);
}

.partner-share-select option {
  background: #0f172a;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

[data-theme="light"] .partner-share-box {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.14) !important;
}

[data-theme="light"] .partner-share-label {
  color: #475569 !important;
}

[data-theme="light"] .partner-share-select {
  background: #f1f5f9 !important;
  color: #b45309 !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .partner-share-select option {
  background: #ffffff !important;
  color: #0f172a !important;
}

/* Quick Share Selector Pills (Tab Financial / ROI) */
.btn-share-pill {
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 11.5px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-share-pill:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--accent-solar);
}

.btn-share-pill.active {
  background: var(--accent-solar);
  border-color: var(--accent-solar);
  color: #000;
  box-shadow: 0 0 12px var(--accent-solar-glow);
}

[data-theme="light"] .btn-share-pill {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

[data-theme="light"] .btn-share-pill:hover {
  background: #fef3c7;
  color: #b45309;
}

[data-theme="light"] .btn-share-pill.active {
  background: #d97706;
  border-color: #d97706;
  color: #ffffff;
}

.nav-btn {
  padding: 8px 16px;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition-smooth);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
}

.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: var(--text-primary);
  background: rgba(251, 192, 45, 0.1);
  border-color: rgba(251, 192, 45, 0.3);
}

.nav-btn.btn-primary {
  background: var(--accent-solar);
  color: #000;
  font-weight: 600;
  border-color: var(--accent-solar);
  box-shadow: 0 4px 14px var(--accent-solar-glow);
}

.nav-btn.btn-primary:hover {
  background: var(--accent-solar-hover);
  box-shadow: 0 6px 20px var(--accent-solar-glow);
  transform: translateY(-1px);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ==========================================
   LANDING PAGE & SIMULATOR
   ========================================== */
.view-section {
  display: none;
  padding: 40px 0 80px 0;
  animation: fadeIn 0.4s ease-out forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 60px;
}

.hero-text h1 {
  font-size: 48px;
  line-height: 1.15;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-solar) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-text p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 30px;
  max-width: 520px;
}

.stats-inline {
  display: flex;
  gap: 32px;
  margin-top: 30px;
  border-top: 1px solid var(--panel-border);
  padding-top: 24px;
}

.stat-item-simple h4 {
  font-size: 24px;
  color: var(--text-primary);
}

.stat-item-simple p {
  font-size: 12px;
  color: var(--text-muted);
}

/* Simulator Card style */
.sim-card {
  padding: 32px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-glow);
}

.sim-card h3 {
  font-size: 22px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sim-card h3 svg {
  fill: var(--accent-solar);
}

.sim-card .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper span {
  position: absolute;
  left: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

.input-field {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.input-field:focus {
  border-color: var(--accent-solar);
  box-shadow: 0 0 0 3px var(--accent-solar-glow);
}

/* Results panel */
.sim-results {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px dashed var(--panel-border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.result-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: var(--border-radius-md);
  text-align: center;
  transition: var(--transition-smooth);
}

.result-box.highlight {
  background: rgba(70, 195, 123, 0.05);
  border-color: rgba(70, 195, 123, 0.15);
}

.result-box.highlight .value {
  color: var(--accent-green);
}

.result-box .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.result-box .value {
  font-size: 18px;
  font-family: var(--font-header);
  font-weight: 700;
}

.result-box .desc {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================
   PORTAL DO INVESTIDOR: LOGIN & GATEWAY
   ========================================== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 80px 0;
}

.login-card {
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.login-card h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.login-card .input-field {
  padding-left: 16px;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-solar);
  color: #000;
  border: none;
  border-radius: var(--border-radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 14px var(--accent-solar-glow);
  margin-top: 10px;
}

.login-btn:hover {
  background: var(--accent-solar-hover);
  transform: translateY(-1px);
}

.login-error {
  color: var(--accent-danger);
  font-size: 12px;
  margin-top: 12px;
  display: none;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ==========================================
   DASHBOARD INVESTIDOR (SPE)
   ========================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 100%;
  align-items: start;
}

/* Dashboard Sidebar / Navigation */
.dash-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding-left: 12px;
  margin-bottom: 8px;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  flex-shrink: 0;
  stroke: var(--text-secondary);
  transition: var(--transition-smooth);
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-link:hover svg {
  stroke: var(--text-primary);
}

.sidebar-link.active {
  color: var(--accent-solar);
  background: rgba(251, 192, 45, 0.08);
  border-color: rgba(251, 192, 45, 0.15);
  font-weight: 600;
}

.sidebar-link.active svg {
  stroke: var(--accent-solar);
}

/* Detailed Financial Table Scroll & Expansion */
.financial-table-container {
  max-height: 380px;
  overflow-y: auto;
  overflow-x: hidden !important;
  transition: max-height 0.3s ease;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--panel-border);
}

.financial-table-container.expanded {
  max-height: 750px;
}

/* Dashboard Content */
.dash-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 16px;
}

.dash-header h2 {
  font-size: 26px;
}

.dash-header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Configuration & Capex Panel */
.config-header-panel {
  display: flex;
  align-items: center;
  gap: 16px;
}

.config-mini-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  padding: 6px 12px;
  border-radius: var(--border-radius-md);
  transition: background 0.2s, border-color 0.2s;
}

[data-theme="light"] .config-mini-group {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.display-capex-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  letter-spacing: 0.2px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

[data-theme="light"] .display-capex-val {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.15);
}

/* KPI Summary Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.kpi-card {
  padding: 20px;
}

.kpi-card .header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.kpi-card .title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-card .icon-circle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.2s ease;
}

[data-theme="light"] .kpi-card .icon-circle {
  background: rgba(0, 0, 0, 0.04);
}

.kpi-card .icon-circle svg {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  transition: var(--transition-smooth);
}

.kpi-card.highlight {
  border-color: rgba(251, 192, 45, 0.25);
}

.kpi-card.highlight-green {
  border-color: rgba(16, 185, 129, 0.25);
}

.kpi-card.highlight-green:hover {
  border-color: rgba(16, 185, 129, 0.45);
}

.kpi-card .value {
  font-size: 26px;
  font-family: var(--font-header);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.kpi-category-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-solar);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.kpi-card .footer {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-card .trend-up {
  color: var(--accent-green);
  font-weight: 600;
}

.kpi-card .trend-down {
  color: var(--accent-danger);
  font-weight: 600;
}

/* Payback progress bar inside KPI */
.payback-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.payback-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-solar) 0%, var(--accent-green) 100%);
  width: 0%;
  border-radius: 3px;
  transition: var(--transition-smooth);
}

/* Dashboard Tabs / Layout Sections */
.tab-section {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.tab-section.active {
  display: block;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  margin-bottom: 24px;
}

.charts-grid.single-col {
  grid-template-columns: 1fr;
}

.chart-card {
  padding: 24px;
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-card-header h3 {
  font-size: 16px;
}

.chart-legend-custom {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Tabular reports / DRE */
.dre-table-container {
  width: 100%;
  max-width: 100%;
  margin-top: 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.2);
  transition: max-height 0.35s ease;
  overflow-x: hidden !important; /* Zero horizontal scrollbar */
}

.dre-table-container:not(.expanded) {
  max-height: none;
  overflow-y: visible;
}

.dre-table-container.expanded {
  max-height: 420px;
  overflow-y: auto;
}

/* Overview DRE table: 7 columns fit neatly without horizontal scrollbar */
#table-overview-summary {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse;
}

#table-overview-summary th,
#table-overview-summary td {
  padding: 10px 6px !important;
  font-size: 11px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#table-overview-summary th:nth-child(1), #table-overview-summary td:nth-child(1) { width: 11%; }
#table-overview-summary th:nth-child(2), #table-overview-summary td:nth-child(2) { width: 13%; }
#table-overview-summary th:nth-child(3), #table-overview-summary td:nth-child(3) { width: 15%; text-align: right; }
#table-overview-summary th:nth-child(4), #table-overview-summary td:nth-child(4) { width: 15%; text-align: right; }
#table-overview-summary th:nth-child(5), #table-overview-summary td:nth-child(5) { width: 15%; text-align: right; }
#table-overview-summary th:nth-child(6), #table-overview-summary td:nth-child(6) { width: 15.5%; text-align: right; }
#table-overview-summary th:nth-child(7), #table-overview-summary td:nth-child(7) { width: 15.5%; text-align: right; }

/* Dedicated table scroll container for wide tables (Subscribers, Maintenance) */
.table-scroll-container {
  width: 100%;
  max-width: 100%;
  margin-top: 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.2);
  overflow-x: auto;
  overflow-y: auto;
  max-height: 520px;
  -webkit-overflow-scrolling: touch;
}

/* SCADA Tech Toggle Button */
.btn-tech-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--accent-solar);
  border-radius: var(--border-radius-md);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-tech-toggle:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: var(--accent-solar);
  box-shadow: 0 0 14px var(--accent-solar-glow);
  transform: translateY(-1px);
}

.btn-tech-toggle svg {
  stroke: var(--accent-solar);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.custom-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #090e17;
  padding: 12px 14px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  border-bottom: 2px solid var(--panel-border);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

[data-theme="light"] .custom-table th {
  background: #f8fafc;
  color: #334155;
  border-bottom: 2px solid #cbd5e1;
}

[data-theme="light"] .custom-table td {
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .custom-table tr:hover td {
  background: #f1f5f9;
}

[data-theme="light"] .dre-table-container,
[data-theme="light"] .table-scroll-container {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  box-shadow: none !important;
}

[data-theme="light"] .dre-table-container table thead th {
  background: #f8fafc !important;
  color: #334155 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

[data-theme="light"] .custom-table tr.total-row td {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-theme="light"] .custom-table tr.row-current-month td {
  background: #fef3c7 !important;
  border-top: 1.5px solid #f59e0b !important;
  border-bottom: 1.5px solid #f59e0b !important;
  color: #92400e !important;
}

[data-theme="light"] .custom-table tr.row-current-month td:first-child {
  border-left: 3px solid #f59e0b !important;
  color: #b45309 !important;
}

[data-theme="light"] .search-field,
[data-theme="light"] .filter-select {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

[data-theme="light"] .cftv-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

[data-theme="light"] .cftv-footer-info {
  border-top-color: #e2e8f0 !important;
}

[data-theme="light"] .technical-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .cftv-card.offline {
  background: #f8fafc !important;
}

.custom-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-weight: 500;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#table-subscribers-list td:nth-child(2) {
  white-space: normal;
  font-family: var(--font-sans);
  max-width: 280px;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.sortable-th:hover {
  color: var(--accent-solar);
  background-color: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .sortable-th:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.sortable-th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 9px;
  opacity: 0.35;
  vertical-align: baseline;
}

.sortable-th.active-sort {
  color: var(--accent-solar);
}

.sortable-th.active-sort .sort-icon {
  opacity: 1;
  color: var(--accent-solar);
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================
   PRINTABLE EXECUTIVE REPORT A4 STYLES
   ========================================== */
#printable-executive-report {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 18mm 14mm 14mm 14mm;
  }
  
  html, body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 11px !important;
    line-height: 1.4 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body > *:not(#printable-executive-report) {
    display: none !important;
  }

  #printable-executive-report {
    display: block !important;
    width: 100% !important;
    max-width: 182mm !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  .report-page {
    width: 100% !important;
    max-width: 182mm !important;
    min-height: 248mm !important;
    max-height: 256mm !important;
    margin: 0 auto !important;
    padding-top: 6mm !important;
    padding-bottom: 4mm !important;
    box-sizing: border-box !important;
    page-break-after: always;
    break-after: page;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
    break-after: page;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .report-page:last-child {
    page-break-after: avoid;
    break-after: avoid;
  }

  .report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }

  .report-brand .report-logo {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.3px;
  }

  .report-brand .report-tagline {
    font-size: 10.5px;
    margin-top: 2px;
  }

  .report-meta {
    text-align: right;
    font-size: 10px;
    line-height: 1.5;
  }

  .report-section-title {
    font-size: 12px;
    font-weight: 700;
    border-left-width: 3px;
    border-left-style: solid;
    padding-left: 8px;
    margin: 12px 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .report-subsection-title {
    font-size: 10.5px;
    font-weight: 700;
    margin: 10px 0 6px 0;
  }

  .report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  .report-kpi-box {
    border-width: 1px;
    border-style: solid;
    border-radius: 6px;
    padding: 8px 10px;
  }

  .report-kpi-label {
    font-size: 8.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .report-kpi-val {
    font-size: 13.5px;
    font-weight: 800;
    margin: 3px 0 1px 0;
    font-family: 'JetBrains Mono', monospace;
  }

  .report-kpi-sub {
    font-size: 8.5px;
  }

  .report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5px;
    margin-bottom: 8px;
  }

  .report-table th {
    border-width: 1px;
    border-style: solid;
    padding: 5px 7px;
    font-weight: 700;
    text-align: left;
    font-size: 8.5px;
    text-transform: uppercase;
  }

  .report-table td {
    border-width: 1px;
    border-style: solid;
    padding: 5px 7px;
    font-family: 'JetBrains Mono', monospace;
  }

  .report-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .report-badge.real {
    background: #dcfce7 !important;
    color: #15803d !important;
  }

  .report-badge.proj {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
  }

  .report-energy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
  }

  .report-energy-card {
    border-width: 1px;
    border-style: solid;
    border-radius: 6px;
    padding: 10px 12px;
  }

  .report-energy-card .label {
    font-size: 9.5px;
    font-weight: 700;
  }

  .report-energy-card .val {
    font-size: 15px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    margin: 3px 0;
  }

  .report-energy-card .desc {
    font-size: 8.5px;
  }

  .report-tech-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  .report-tech-card {
    border-width: 1px;
    border-style: solid;
    border-radius: 6px;
    padding: 8px 10px;
  }

  .report-tech-card .title {
    font-weight: 700;
    font-size: 10.5px;
  }

  .report-tech-card .spec {
    font-size: 9.5px;
    font-family: 'JetBrains Mono', monospace;
    margin: 2px 0 4px 0;
  }

  .report-tech-card .status {
    font-size: 8.5px;
    font-weight: 600;
  }

  .report-cftv-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
  }

  .report-cftv-box {
    border-width: 1px;
    border-style: solid;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
  }

  .report-cftv-box img {
    width: 100%;
    height: 85px;
    object-fit: cover;
    display: block;
  }

  .report-cftv-box .caption {
    padding: 4px 6px;
    font-size: 8px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .report-notes {
    font-size: 8.5px;
    border-left-width: 2px;
    border-left-style: solid;
    padding-left: 8px;
    margin-top: 6px;
  }

  .report-signature-area {
    margin-top: 14px;
    padding: 10px 14px;
    border-width: 1px;
    border-style: solid;
    border-radius: 6px;
  }

  .report-footer {
    display: flex;
    justify-content: space-between;
    font-size: 8.5px;
    border-top-width: 1px;
    border-top-style: solid;
    padding-top: 5px;
    margin-top: 10px;
  }

  /* -------------------------------------------
     THEME: LIGHT (WHITE PAPER)
     ------------------------------------------- */
  body[data-theme="light"] {
    background: #ffffff !important;
    color: #0f172a !important;
  }
  body[data-theme="light"] #printable-executive-report,
  body[data-theme="light"] .report-page {
    background: #ffffff !important;
    color: #0f172a !important;
  }
  body[data-theme="light"] .report-header {
    border-bottom: 2px solid #d97706 !important;
  }
  body[data-theme="light"] .report-brand .report-logo {
    color: #0f172a !important;
  }
  body[data-theme="light"] .report-brand .report-tagline,
  body[data-theme="light"] .report-meta {
    color: #475569 !important;
  }
  body[data-theme="light"] .report-section-title {
    color: #0f172a !important;
    border-left-color: #d97706 !important;
  }
  body[data-theme="light"] .report-subsection-title {
    color: #334155 !important;
  }
  body[data-theme="light"] .report-kpi-box {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
  }
  body[data-theme="light"] .report-kpi-label,
  body[data-theme="light"] .report-kpi-sub {
    color: #64748b !important;
  }
  body[data-theme="light"] .report-kpi-val {
    color: #0f172a !important;
  }
  body[data-theme="light"] .report-kpi-val.highlight {
    color: #b45309 !important;
  }
  body[data-theme="light"] .report-kpi-val.green {
    color: #047857 !important;
  }
  body[data-theme="light"] .report-table th {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
  }
  body[data-theme="light"] .report-table td {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
  }
  body[data-theme="light"] .report-table tr:nth-child(even) td {
    background: #f8fafc !important;
  }
  body[data-theme="light"] .report-highlight-row td {
    background: #fef3c7 !important;
    border-top: 1.5px solid #d97706 !important;
    border-bottom: 1.5px solid #d97706 !important;
  }
  body[data-theme="light"] .report-total-row td {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
  }
  body[data-theme="light"] .report-energy-card {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
  }
  body[data-theme="light"] .report-energy-card.highlight {
    background: #fffbeb !important;
    border-color: #fcd34d !important;
  }
  body[data-theme="light"] .report-energy-card .label,
  body[data-theme="light"] .report-energy-card .desc {
    color: #475569 !important;
  }
  body[data-theme="light"] .report-energy-card .val {
    color: #0f172a !important;
  }
  body[data-theme="light"] .report-energy-card.highlight .val {
    color: #b45309 !important;
  }
  body[data-theme="light"] .report-tech-card {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
  }
  body[data-theme="light"] .report-tech-card .title {
    color: #0f172a !important;
  }
  body[data-theme="light"] .report-tech-card .spec {
    color: #475569 !important;
  }
  body[data-theme="light"] .report-tech-card .status.online {
    color: #047857 !important;
  }
  body[data-theme="light"] .report-cftv-box {
    border-color: #cbd5e1 !important;
  }
  body[data-theme="light"] .report-cftv-box .caption {
    background: #f8fafc !important;
    color: #334155 !important;
    border-top: 1px solid #e2e8f0 !important;
  }
  body[data-theme="light"] .report-notes {
    color: #64748b !important;
    border-left-color: #cbd5e1 !important;
  }
  body[data-theme="light"] .report-signature-area {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
  }
  body[data-theme="light"] .report-footer {
    border-top-color: #e2e8f0 !important;
    color: #94a3b8 !important;
  }

  /* -------------------------------------------
     THEME: DARK (CYBER SCADA REPORT)
     ------------------------------------------- */
  body[data-theme="dark"] {
    background: #090e17 !important;
    color: #f8fafc !important;
  }
  body[data-theme="dark"] #printable-executive-report,
  body[data-theme="dark"] .report-page {
    background: #090e17 !important;
    color: #f8fafc !important;
  }
  body[data-theme="dark"] .report-header {
    border-bottom: 2px solid #f59e0b !important;
  }
  body[data-theme="dark"] .report-brand .report-logo {
    color: #ffffff !important;
  }
  body[data-theme="dark"] .report-brand .report-tagline,
  body[data-theme="dark"] .report-meta {
    color: #94a3b8 !important;
  }
  body[data-theme="dark"] .report-section-title {
    color: #f8fafc !important;
    border-left-color: #f59e0b !important;
  }
  body[data-theme="dark"] .report-subsection-title {
    color: #cbd5e1 !important;
  }
  body[data-theme="dark"] .report-kpi-box {
    background: #111a2e !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
  }
  body[data-theme="dark"] .report-kpi-label,
  body[data-theme="dark"] .report-kpi-sub {
    color: #94a3b8 !important;
  }
  body[data-theme="dark"] .report-kpi-val {
    color: #ffffff !important;
  }
  body[data-theme="dark"] .report-kpi-val.highlight {
    color: #fbbf24 !important;
  }
  body[data-theme="dark"] .report-kpi-val.green {
    color: #34d399 !important;
  }
  body[data-theme="dark"] .report-table th {
    background: #162238 !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #e2e8f0 !important;
  }
  body[data-theme="dark"] .report-table td {
    background: #0d1524 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
  }
  body[data-theme="dark"] .report-table tr:nth-child(even) td {
    background: #111a2e !important;
  }
  body[data-theme="dark"] .report-highlight-row td {
    background: rgba(245, 158, 11, 0.2) !important;
    border-top: 1.5px solid #f59e0b !important;
    border-bottom: 1.5px solid #f59e0b !important;
  }
  body[data-theme="dark"] .report-total-row td {
    background: #1e293b !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
  }
  body[data-theme="dark"] .report-energy-card {
    background: #111a2e !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
  }
  body[data-theme="dark"] .report-energy-card.highlight {
    background: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
  }
  body[data-theme="dark"] .report-energy-card .label,
  body[data-theme="dark"] .report-energy-card .desc {
    color: #94a3b8 !important;
  }
  body[data-theme="dark"] .report-energy-card .val {
    color: #ffffff !important;
  }
  body[data-theme="dark"] .report-energy-card.highlight .val {
    color: #fbbf24 !important;
  }
  body[data-theme="dark"] .report-tech-card {
    background: #111a2e !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
  }
  body[data-theme="dark"] .report-tech-card .title {
    color: #ffffff !important;
  }
  body[data-theme="dark"] .report-tech-card .spec {
    color: #cbd5e1 !important;
  }
  body[data-theme="dark"] .report-tech-card .status.online {
    color: #34d399 !important;
  }
  body[data-theme="dark"] .report-cftv-box {
    border-color: rgba(255, 255, 255, 0.15) !important;
  }
  body[data-theme="dark"] .report-cftv-box .caption {
    background: #111a2e !important;
    color: #e2e8f0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  }
  body[data-theme="dark"] .report-notes {
    color: #94a3b8 !important;
    border-left-color: #f59e0b !important;
  }
  body[data-theme="dark"] .report-signature-area {
    background: #111a2e !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
  }
  body[data-theme="dark"] .report-signature-area p {
    color: #94a3b8 !important;
  }
  body[data-theme="dark"] .report-signature-area div div {
    color: #ffffff !important;
  }
  body[data-theme="dark"] .report-footer {
    border-top-color: rgba(255, 255, 255, 0.1) !important;
    color: #64748b !important;
  }
}

.spin-animation {
  animation: spin 0.8s linear infinite;
}

/* ==========================================
   CFTV HIK-CONNECT SURVEILLANCE STYLES
   ========================================== */
.cftv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.cftv-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.cftv-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-solar);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.cftv-card.offline {
  opacity: 0.65;
  border-style: dashed;
}

.cftv-thumb-container {
  position: relative;
  width: 100%;
  height: 148px;
  background: #06090e;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cftv-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  filter: contrast(1.05) brightness(0.95);
}

.cftv-card:hover .cftv-thumb {
  transform: scale(1.05);
}

.cftv-live-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: var(--accent-green);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.cftv-live-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
}

.cftv-timestamp {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

.cftv-zoom-hint {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
}

.cftv-thumb-container:hover .cftv-zoom-hint {
  opacity: 1;
}

.cftv-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.cftv-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.cftv-cam-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-solar);
  font-size: 11px;
}

.cftv-cam-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.cftv-footer-info {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Modal CFTV Viewer */
.cftv-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cftv-modal-overlay.active {
  display: flex;
}

.cftv-modal-content {
  background: #0f172a;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.cftv-modal-header {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
}

.cftv-modal-body {
  padding: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 480px;
}

.cftv-modal-body img {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.cftv-modal-footer {
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--panel-border);
}
.custom-table tr.row-current-month td {
  background: rgba(245, 158, 11, 0.08) !important;
  border-top: 1px solid rgba(245, 158, 11, 0.35);
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  font-weight: 700;
  color: #fff;
}

.custom-table tr.row-current-month td:first-child {
  border-left: 3px solid var(--accent-solar);
  color: var(--accent-solar);
}

.custom-table tr.total-row td {
  font-weight: 700;
  border-top: 2px solid var(--panel-border);
  border-bottom: 2px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  border: 1px solid transparent;
}

.status-badge.status-real {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-badge.status-current {
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-solar);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.status-badge.status-projected {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-blue);
  border-color: rgba(56, 189, 248, 0.3);
}

.status-badge.status-paid {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-badge.status-pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-solar);
  border-color: rgba(245, 158, 11, 0.3);
}

.status-badge.status-churn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Search and filters in subscribers tab */
.table-filter-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.search-input-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  fill: var(--text-secondary);
}

.search-field {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 13px;
  transition: var(--transition-smooth);
}

.search-field:focus {
  border-color: var(--accent-solar);
}

.filter-group {
  display: flex;
  gap: 10px;
}

.filter-select {
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-select option {
  background: var(--bg-color);
  color: var(--text-primary);
}

/* O&M Tab styles */
.technical-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 100%;
}

.technical-card {
  padding: 10px 12px;
  text-align: center;
  border-radius: var(--border-radius-md);
  transition: all 0.2s ease;
}

.technical-card.inactive,
.technical-card.alarm {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.2) !important;
}

.technical-card .status-indicator {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green-glow);
  margin-right: 6px;
}

.technical-card .status-indicator.danger,
.technical-card .status-indicator.standby,
.technical-card .status-indicator.alarm {
  background: #ef4444 !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8) !important;
}

.technical-card .status-indicator.warning {
  background: var(--accent-solar);
  box-shadow: 0 0 6px var(--accent-solar-glow);
}

.skid-group {
  margin-bottom: 16px;
}

.skid-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-md);
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.inverter-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-secondary);
  border-top: 1px solid var(--panel-border);
  padding-top: 4px;
  margin-top: 6px;
  font-family: var(--font-mono);
}

.inverter-status-label {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.tech-value {
  font-size: 20px;
  font-family: var(--font-header);
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0 2px 0;
}

.tech-subtitle {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==========================================
   RESPONSIVE MEDIA QUERIES
   ========================================== */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 40px;
  }
  .hero-text h1 {
    font-size: 38px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dash-sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .sidebar-menu {
    flex-direction: row;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .technical-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .header-container {
    flex-direction: column;
    height: auto;
    padding: 16px 0;
    gap: 12px;
  }
  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .technical-grid {
    grid-template-columns: 1fr;
  }
  .table-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrapper {
    max-width: 100%;
  }
  .sim-results {
    grid-template-columns: 1fr;
  }
}

/* Styling for forecast/previsão rows to show they are projections (less highlighted) */
.row-forecast {
  opacity: 0.55 !important;
  font-style: italic;
  background: rgba(255, 255, 255, 0.01) !important;
}

.row-forecast td {
  color: var(--text-secondary) !important;
}
