:root {
  /* Official SAT Solutions (https://satsolutions.in/) Corporate Palette */
  --primary: #008374;
  --primary-hover: #006d60;
  --primary-dark: #00796b;
  --primary-light: #E6F5F3;
  --secondary: #F85A40;
  --nav-bg: #003831;
  --nav-hover: #005047;
  --nav-active: #008374;
  --background: #F4F9F8;
  --surface: #FFFFFF;
  --surface-alt: #EFF7F6;
  --text-main: #222222;
  --text-muted: #556B67;
  --text-dim: #8BA39F;
  --border: #D1E5E2;
  --border-light: #E8F3F1;
  --success: #008374;
  --success-bg: #E6F5F3;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --error: #E11D48;
  --error-bg: #FEE2E2;
  --accent-gold: #F59E0B;
  --accent-cyan: #008374;
  --accent-coral: #F85A40;
  
  --font-scale: 1;
  --sidebar-width: 248px;
  --header-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 56, 49, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 56, 49, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 56, 49, 0.12);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Grayscale Mode */
body.grayscale-mode {
  filter: grayscale(100%) contrast(105%);
}

body.grayscale-mode .bg-primary,
body.grayscale-mode .badge-demo {
  background-color: #333333 !important;
  color: #FFFFFF !important;
}

/* Dark Mode */
body.dark-mode {
  --background: #091715;
  --surface: #102623;
  --surface-alt: #163632;
  --text-main: #F1F8F6;
  --text-muted: #95B4AE;
  --text-dim: #6B8B85;
  --border: #234E47;
  --border-light: #1A3D37;
  --nav-bg: #06110F;
  --nav-hover: #0C211D;
  --nav-active: #008374;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.7);
  --primary-light: rgba(0, 131, 116, 0.25);
  --success-bg: rgba(0, 131, 116, 0.25);
  --warning-bg: rgba(245, 158, 11, 0.25);
  --error-bg: rgba(225, 29, 72, 0.25);
}

body.dark-mode .app-header {
  background-color: #102623;
  border-bottom-color: #234E47;
}

body.dark-mode .scada-table td {
  border-bottom-color: #1A3D37;
}

body.dark-mode .scada-table tbody tr:hover {
  background-color: #163632;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background-color: #163632 !important;
  color: #F1F8F6 !important;
  border-color: #234E47 !important;
}

/* High Contrast Mode */
body.high-contrast-mode {
  filter: contrast(135%);
}

/* Reduced Motion Mode */
body.reduced-motion * {
  animation: none !important;
  transition: none !important;
}

/* Accessibility Drawer / Panel */
.accessibility-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  background-color: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.25);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.accessibility-panel.active {
  right: 0;
}

.accessibility-header {
  padding: 18px 20px;
  background-color: var(--nav-bg);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.accessibility-body {
  padding: 20px;
  flex: 1;
}

.accessibility-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-light);
}

.accessibility-section:last-child {
  border-bottom: none;
}

.accessibility-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.accessibility-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.acc-choice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.acc-choice-btn:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.acc-choice-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(29, 91, 241, 0.35);
}

.accessibility-btn-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), #1546C4);
  color: #FFFFFF;
  border: none;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(29, 91, 241, 0.3);
  transition: var(--transition);
}

.accessibility-btn-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 91, 241, 0.45);
}

/* Header Thumbnail Icon Buttons */
.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 0;
}

.header-icon-btn:hover {
  background: var(--surface-alt);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

/* Social Media Thumbnail-Only Icon Buttons */
.social-thumb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--primary);
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.social-thumb-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 131, 116, 0.35);
}

body.dark-mode .social-thumb-btn {
  background: #163632;
  border-color: #234E47;
  color: #00A896;
}

body.dark-mode .social-thumb-btn:hover {
  background: #008374;
  border-color: #008374;
  color: #FFFFFF;
}

.header-icon-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background-color: #DC2626;
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  line-height: 17px;
  padding: 0 4px;
  border-radius: 10px;
  text-align: center;
  border: 2px solid var(--nav-bg);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.4);
}

/* Profile Dropdown Menu */
.profile-dropdown-container {
  position: relative;
}

.profile-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
  z-index: 1200;
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.profile-menu-item:hover {
  background: var(--surface-alt);
  color: var(--primary);
}

/* GUI-Based Workstation Logout Button (No wrapping, clean GUI badge) */
.gui-signout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 18px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  color: #DC2626;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.35);
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.12);
  transition: all 0.2s ease;
  flex-shrink: 0;
  line-height: 1.2;
}

.gui-signout-btn:hover {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #DC2626;
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.35);
  transform: translateY(-1px);
}

/* Financial Revenue KPI Card */
.kpi-card.kpi-revenue {
  background: linear-gradient(135deg, var(--surface), var(--surface-alt));
  border: 2px solid #10B981;
}

.kpi-card.kpi-revenue::before {
  background-color: #10B981;
  height: 5px;
}

/* Base & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: calc(15px * var(--font-scale));
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* Layout Shell */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   Aesthetic Modern SCADA Custom Scrollbar System
   ========================================================================== */
/* Global modern thin scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.4) transparent;
}

/* WebKit-based browsers (Chrome, Edge, Safari, Opera, Brave) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-alt); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark, #0369a1); }

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Sidebar Specific Scrollbar (Dark Navy & Neon Accent) */
.app-sidebar::-webkit-scrollbar {
  width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
  background: rgba(13, 26, 54, 0.4);
}

.app-sidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.4) 0%, rgba(29, 91, 241, 0.5) 100%);
  border-radius: 9999px;
}

.app-sidebar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.85) 0%, rgba(29, 91, 241, 0.95) 100%);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* Dark Mode Custom Scrollbar */
body.dark-mode * {
  scrollbar-color: rgba(56, 189, 248, 0.4) transparent;
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.45) 0%, rgba(99, 102, 241, 0.55) 100%);
  border: 2px solid transparent;
  background-clip: content-box;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.9) 0%, rgba(99, 102, 241, 0.95) 100%);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* Table Containers, Overflow Panels & Modals */
.table-container::-webkit-scrollbar,
.custom-scroll::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.table-container::-webkit-scrollbar-thumb,
.custom-scroll::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.4) 0%, rgba(30, 64, 175, 0.55) 100%);
  border-radius: 9999px;
}

.table-container::-webkit-scrollbar-thumb:hover,
.custom-scroll::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.85) 0%, rgba(37, 99, 235, 0.95) 100%);
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--nav-bg);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0,0,0,0.15);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Area */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Full Mode / Sidebar Collapsed (Widescreen Experience) */
body.full-mode .app-sidebar,
body.sidebar-collapsed .app-sidebar {
  transform: translateX(-100%);
  box-shadow: none;
}

body.full-mode .app-main,
body.sidebar-collapsed .app-main {
  margin-left: 0;
}

/* Menu Toggle Button Styling */
.btn-menu-toggle {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-menu-toggle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

body.full-mode .btn-menu-toggle,
body.sidebar-collapsed .btn-menu-toggle {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 0 10px rgba(29, 91, 241, 0.4);
}

.sidebar-brand {
  height: var(--header-height);
  min-height: 70px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  margin: 0 auto;
  text-align: center;
}

.sidebar-brand img, .sidebar-brand svg, .sidebar-brand-logo-img {
  height: 52px;
  max-height: 54px;
  max-width: 210px;
  width: auto;
  object-fit: contain;
  margin: 0 auto;
  display: block;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-brand-link:hover .sidebar-brand-logo-img,
.sidebar-brand-link:hover img {
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  color: #CBD5E1;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 3px;
  transition: var(--transition);
}

.nav-item:hover {
  background-color: var(--nav-hover);
  color: #FFFFFF;
  transform: translateX(3px);
}

.nav-item.active {
  background-color: var(--primary);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(29, 91, 241, 0.4);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Sidebar Dashboard Toggle Accordion & Subitems */
.nav-accordion-group {
  margin-bottom: 4px;
}

.nav-accordion-btn {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  outline: none;
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 20px;
  margin-top: 2px;
  margin-bottom: 6px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  margin-left: 14px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-submenu.collapsed {
  display: none !important;
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  color: #CBD5E1;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-subitem:hover {
  background-color: var(--nav-hover);
  color: #FFFFFF;
  transform: translateX(3px);
}

.nav-subitem.active {
  background-color: var(--primary);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 131, 116, 0.4);
}

.subitem-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

/* Main Area */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header */
.app-header {
  height: var(--header-height);
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.plant-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-demo {
  display: none !important;
}

@keyframes pulse-gentle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.88; transform: scale(0.98); }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* HCI Accessibility Controls */
.hci-controls {
  display: flex;
  align-items: center;
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 3px 6px;
  gap: 2px;
}

.hci-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 20px;
  transition: var(--transition);
}

.hci-btn:hover {
  background-color: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.hci-btn.active {
  background-color: var(--primary);
  color: #FFFFFF;
}

.mode-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.mode-toggle-btn:hover {
  background-color: #E2E8F0;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  background-color: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
}

.user-profile-badge:hover {
  background-color: var(--border-light);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Content Area */
.app-content {
  padding: 24px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Card Components */
.card {
  background-color: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: var(--transition);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* KPI Grids */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  background-color: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 18px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: var(--primary);
}

.kpi-card.kpi-gold::before { background-color: var(--accent-gold); }
.kpi-card.kpi-green::before { background-color: var(--success); }
.kpi-card.kpi-cyan::before { background-color: var(--accent-cyan); }

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.kpi-unit {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Tables */
.table-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: block;
  position: relative;
}

.table-container::-webkit-scrollbar {
  height: 6px;
}

.table-container::-webkit-scrollbar-track {
  background: var(--surface-alt);
  border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

.scada-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
  white-space: nowrap;
}

.scada-table th {
  background-color: var(--nav-bg);
  color: #FFFFFF;
  padding: 10px 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.scada-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

.scada-table tbody tr:hover {
  background-color: var(--surface-alt);
}

/* Action Toolbar (6 Output contract: Copy | Excel | CSV | PDF | Print | Email) */
.export-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.export-btn:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.export-btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.export-btn-primary:hover {
  background-color: var(--primary-hover);
  color: #FFFFFF;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-dialog {
  background-color: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: modal-pop 0.25s ease-out;
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  background-color: var(--surface-alt);
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  background-color: var(--surface-alt);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-badge.online {
  background-color: var(--success-bg);
  color: var(--success);
}

.status-badge.stale {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.status-badge.offline {
  background-color: var(--error-bg);
  color: var(--error);
}

/* Toast Alerts - Always Forefront & Sharp (Never blurred by modal backdrops) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999 !important;
  pointer-events: none;
}

.toast {
  background-color: #003831;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 131, 116, 0.5);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  margin-top: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease-out;
  pointer-events: auto;
  backdrop-filter: none !important;
  filter: none !important;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-sidebar {
    width: 70px;
  }
  .app-sidebar .sidebar-brand span,
  .app-sidebar .nav-section-title,
  .app-sidebar .nav-item span,
  .app-sidebar .sidebar-footer {
    display: none;
  }
  .app-main {
    margin-left: 70px;
  }
}

/* ==========================================================================
   Utility & Modal Hiding Classes
   ========================================================================== */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Emergency Critical Alarm & Blinking Red Screen Strobe System
   ========================================================================== */
.alert-strobe-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  animation: alertStrobeAnim 0.75s ease-in-out infinite alternate;
}

.alert-strobe-overlay.hidden {
  display: none !important;
}

@keyframes alertStrobeAnim {
  0% {
    background-color: rgba(220, 38, 38, 0.28);
    box-shadow: inset 0 0 120px rgba(220, 38, 38, 0.95);
  }
  50% {
    background-color: rgba(239, 68, 68, 0.15);
    box-shadow: inset 0 0 60px rgba(220, 38, 38, 0.6);
  }
  100% {
    background-color: rgba(185, 28, 28, 0.05);
    box-shadow: inset 0 0 20px rgba(185, 28, 28, 0.25);
  }
}

.emergency-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(11, 19, 43, 0.85);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.emergency-modal-backdrop.hidden {
  display: none !important;
}

.emergency-modal {
  background-color: var(--surface);
  border: 3px solid #DC2626;
  border-radius: var(--radius-lg);
  max-width: 580px;
  width: 100%;
  box-shadow: 0 0 45px rgba(220, 38, 38, 0.7), var(--shadow-lg);
  overflow: hidden;
  animation: alertModalPulse 1.2s infinite alternate ease-in-out;
}

@keyframes alertModalPulse {
  0% { transform: scale(1); box-shadow: 0 0 30px rgba(220, 38, 38, 0.6); }
  100% { transform: scale(1.015); box-shadow: 0 0 55px rgba(220, 38, 38, 0.95); }
}

.emergency-modal-header {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  color: #FFFFFF;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.emergency-modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

.emergency-modal-body {
  padding: 24px;
  color: var(--text-main);
}

.emergency-alarm-banner {
  background-color: rgba(220, 38, 38, 0.1);
  border-left: 4px solid #DC2626;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.emergency-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.emergency-kv {
  background-color: var(--surface-alt);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.emergency-kv .label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.emergency-kv .val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.emergency-modal-footer {
  padding: 16px 24px;
  background-color: var(--surface-alt);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-alert-cancel {
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.btn-alert-cancel:hover {
  background-color: #E2E8F0;
  color: #DC2626;
  border-color: #DC2626;
}

.btn-alert-go {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  color: #FFFFFF;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-alert-go:hover {
  background: linear-gradient(135deg, #B91C1C 0%, #991B1B 100%);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.6);
  transform: translateY(-1px);
}

/* ==========================================================================
   Share on WhatsApp & ZIP Export Toolbar Extensions
   ========================================================================== */
.btn-whatsapp {
  background-color: #25D366 !important;
  color: #FFFFFF !important;
  border: 1px solid #1EBE5D !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.btn-whatsapp:hover {
  background-color: #1EBE5D !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.btn-zip {
  background-color: #475569 !important;
  color: #FFFFFF !important;
  border: 1px solid #334155 !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.btn-zip:hover {
  background-color: #334155 !important;
  box-shadow: 0 4px 12px rgba(71, 85, 105, 0.35);
}

/* ==========================================================================
   Universal Interactive Table Header Sorting
   ========================================================================== */
th.sortable-th {
  cursor: pointer !important;
  user-select: none;
  position: relative;
  transition: background-color 0.15s ease;
}

th.sortable-th:hover {
  background-color: rgba(30, 58, 138, 0.12) !important;
}

.dark-mode th.sortable-th:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

.sort-indicator {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.78rem;
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

th.sortable-th:hover .sort-indicator {
  opacity: 0.9;
}

th.sort-asc .sort-indicator {
  opacity: 1;
  color: var(--primary);
  content: '▲';
}

th.sort-desc .sort-indicator {
  opacity: 1;
  color: var(--primary);
  content: '▼';
}

/* Notification Banners matching Screenshots */
.banner-info-otp {
  background: linear-gradient(90deg, #1E3A8A 0%, #2563EB 100%);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.banner-warning-email {
  background: linear-gradient(90deg, #D97706 0%, #B45309 100%);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Version v2: Floating Back-to-Top Circular Button
   ========================================================================== */
.btn-back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1D5BF1 0%, #1E40AF 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(29, 91, 241, 0.45);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.25);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.85);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.btn-back-to-top:hover {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  box-shadow: 0 6px 24px rgba(29, 91, 241, 0.65);
  transform: translateY(-3px) scale(1.08);
}

/* ==========================================================================
   Version v2: Segmented Dashboard Switcher (Technical vs Analytical)
   ========================================================================== */
.dashboard-segmented-toggle {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 4px;
  gap: 4px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dashboard-segmented-btn {
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 7px;
}

.dashboard-segmented-btn:hover {
  color: var(--text-main);
}

.dashboard-segmented-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(29, 91, 241, 0.35);
}

/* ==========================================================================
   Version v2: Expiring Share Link Modal & Granular Privacy Masking
   ========================================================================== */
.share-token-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: monospace;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  word-break: break-all;
  margin: 12px 0;
  color: var(--text-main);
}

.privacy-mask-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.privacy-mask-item:hover {
  background: var(--surface-alt);
  border-color: var(--primary);
}

.privacy-mask-item input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Role Based Access & Sensitive Masking */
.viewer-mode .sensitive-admin-only {
  display: none !important;
}

.viewer-mode .sensitive-financial {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.viewer-mode-badge {
  background: #F59E0B;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.5px;
}

/* Speedometer & Dynamic Visualization Switcher */
.chart-type-picker {
  display: flex;
  gap: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.chart-type-btn {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}

.chart-type-btn:hover {
  color: var(--text-main);
}

.chart-type-btn.active {
  background: var(--primary);
  color: #FFFFFF;
}

/* ==========================================================================
   Plant Performance Health Score Gauge (Pure CSS)
   ========================================================================== */
.health-score-gauge {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(#10B981 0% 87.4%, var(--surface-alt) 87.4% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
  flex-shrink: 0;
}

.health-score-inner {
  width: 92px;
  height: 92px;
  background: var(--surface);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}



/* ==========================================================================
   Responsive Grid & Form Helpers (Preserves full desktop width while reflowing smoothly)
   ========================================================================== */
.grid-2col-responsive {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.grid-2col-dynamic {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.grid-4col-responsive {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.filter-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: flex-end;
}

/* Mobile Sidebar Close Button */
.btn-close-mobile-sidebar {
  display: none;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 1.6rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
  z-index: 10;
}

.btn-close-mobile-sidebar:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Mobile & Tablet Backdrop Overlay */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1290;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Mobile items in profile menu */
.mobile-only-menu-item {
  display: none;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
}

/* ==========================================================================
   SATs SCADA — RESPONSIVE SYSTEM: TABLET & MOBILE
   Ensures 100% full desktop width is NEVER artificially reduced.
   Seamless off-canvas drawer navigation, responsive grids, and touch UX.
   ========================================================================== */

/* Tablet (Portrait & Landscape: 769px to 1024px) */
@media (max-width: 1024px) {
  :root {
    --header-height: 64px;
    --sidebar-width: 0px;
  }

  /* Full screen width for tablet content - no random reduction! */
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 270px !important;
    max-width: 82vw;
    height: 100vh;
    height: 100dvh;
    z-index: 1300;
    transform: translateX(-100%);
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.4);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .btn-close-mobile-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .app-content {
    padding: 18px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .grid-2col-dynamic {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
  }

  .plant-title span:first-child {
    font-size: 1rem;
  }

  #btn-toggle-fullscreen {
    display: none;
  }

  .table-container,
  .table-responsive-wrap,
  .inverter-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Mobile Devices (<= 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 58px;
    --sidebar-width: 0px;
  }

  /* Prevent horizontal body blowout */
  html, body {
    overflow-x: hidden;
  }

  .app-container {
    overflow-x: hidden;
  }

  .app-content {
    padding: 12px;
    padding-bottom: 74px !important; /* Clears bottom navigation bar */
    width: 100%;
    box-sizing: border-box;
  }

  /* Header on Mobile */
  .app-header {
    padding: 0 12px;
    gap: 8px;
  }

  .header-left {
    gap: 10px;
    min-width: 0;
    flex: 1;
  }

  .plant-title {
    min-width: 0;
  }

  .plant-title span:first-child {
    font-size: 0.92rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 175px;
  }

  .plant-title span:nth-child(2) {
    display: none; /* Hide large capacity tag in phone header */
  }

  /* Hide secondary actions from crowded top header - accessible in Profile Menu */
  #btn-open-plant-notes,
  #btn-open-share-modal,
  #btn-toggle-role {
    display: none;
  }

  .mobile-only-menu-item {
    display: flex;
  }

  .header-icon-btn {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
  }

  /* KPI Grid */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 12px 14px;
  }

  .kpi-value {
    font-size: 1.35rem !important;
  }

  .kpi-label {
    font-size: 0.72rem;
  }

  .kpi-sub {
    font-size: 0.68rem;
  }

  /* Reflow Grids into 1-column on mobile */
  .grid-2col-responsive {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 18px;
  }

  .grid-2col-dynamic {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 18px;
  }

  .grid-4col-responsive {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .form-grid-2col {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card {
    padding: 14px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card-title {
    font-size: 0.98rem;
  }

  /* Segmented Navigation Switch */
  .dashboard-segmented-toggle {
    width: 100%;
    display: flex;
    flex-direction: row;
  }

  .dashboard-segmented-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 6px;
    font-size: 0.76rem;
  }

  /* Summary & Alarm Filter Form */
  .filter-form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .filter-form-grid > div:last-child {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
  }

  .filter-form-grid > div:last-child .export-btn {
    flex: 1;
    justify-content: center;
  }

  /* Charts scale appropriately */
  [id*="chart"],
  [id*="power-irradiance"] {
    height: 290px !important;
  }

  /* Modals: Clean Touch-Friendly Responsive Sizing */
  .modal-overlay {
    padding: 10px;
    box-sizing: border-box;
  }

  .modal-dialog {
    max-width: 100%;
    width: 100%;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: var(--radius-md);
  }

  .modal-body {
    padding: 16px;
  }

  .emergency-modal {
    max-width: 100%;
    width: 100%;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: var(--radius-md);
  }

  .emergency-modal-body {
    padding: 16px;
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .emergency-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .emergency-modal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px;
  }

  .emergency-modal-footer > div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .btn-alert-cancel,
  .btn-alert-go {
    width: 100%;
    justify-content: center;
  }

  /* Table Containers Touch Scrolling */
  .table-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    border-radius: var(--radius-sm);
    display: block !important;
  }

  .scada-table {
    min-width: 580px !important;
    width: 100% !important;
  }

  .scada-table th,
  .scada-table td {
    padding: 8px 10px;
    font-size: 0.8rem;
    white-space: nowrap !important;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 1200;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
  }

  body.dark-mode .mobile-bottom-nav {
    background: var(--surface);
    border-top-color: var(--border);
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    min-width: 48px;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1.1;
    font-family: inherit;
  }

  .mobile-bottom-nav a svg,
  .mobile-bottom-nav button svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  .mobile-bottom-nav a.active {
    color: var(--primary);
    background: var(--primary-light);
  }

  .mobile-bottom-nav a:active,
  .mobile-bottom-nav button:active {
    transform: scale(0.95);
  }

  /* Back to Top Floating Button above bottom nav */
  .btn-back-to-top {
    bottom: 70px !important;
    right: 14px !important;
    width: 42px !important;
    height: 42px !important;
  }

  /* Interactive Elements Touch Target Sizes */
  button, select, input[type="text"], input[type="number"], input[type="date"], input[type="password"] {
    min-height: 38px;
  }

  .export-btn {
    min-height: 36px;
    padding: 6px 12px;
  }

  .accessibility-panel {
    width: 320px;
    max-width: 86vw;
  }
}

/* Small Smartphone Screen (< 480px) */
@media (max-width: 480px) {
  .plant-title span:first-child {
    max-width: 140px;
  }

  .gui-signout-btn span {
    display: none; /* Icon-only signout on small phones */
  }

  .gui-signout-btn {
    padding: 6px 8px;
  }

  .kpi-value {
    font-size: 1.22rem !important;
  }

  .app-header {
    padding: 0 8px;
  }

  .header-left {
    gap: 8px;
  }

  .header-right {
    gap: 4px;
  }

  [id*="chart"],
  [id*="power-irradiance"] {
    height: 250px !important;
  }

  .app-footer {
    font-size: 0.72rem;
    padding: 8px 12px;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
}

@media print {
  .app-sidebar, .app-header, .mobile-bottom-nav, .btn-back-to-top,
  .export-btn, .alert-strobe-overlay, .emergency-modal-backdrop, .mobile-sidebar-overlay, .scada-slideshow-backdrop {
    display: none !important;
  }
  .app-main { margin-left: 0 !important; }
  .app-content { padding: 0 !important; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* ====================================================================== */
/* SCADA LIVE KIOSK SLIDESHOW PRESENTATION MODE STYLES                    */
/* ====================================================================== */

.scada-slideshow-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999999;
  width: 100vw;
  height: 100vh;
  background: #060911;
  color: #F8FAFC;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Outer Cyber Industrial SCADA Bezel Frame */
.scada-slideshow-frame {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 10px 14px 8px;
  background: radial-gradient(circle at 50% 12%, #0F172A 0%, #060911 88%);
  border: 2px solid rgba(14, 165, 233, 0.45);
  border-radius: 12px;
  box-shadow: 
    0 0 0 1px rgba(14, 165, 233, 0.15),
    inset 0 0 35px rgba(14, 165, 233, 0.08),
    0 12px 48px rgba(0, 0, 0, 0.85),
    0 0 30px rgba(2, 132, 199, 0.22);
  overflow: hidden;
}

/* 4 Glowing Corner Technical Brackets */
.frame-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
  z-index: 20;
}

.frame-corner-tl {
  top: -2px;
  left: -2px;
  border-top: 3px solid #38BDF8;
  border-left: 3px solid #38BDF8;
  border-top-left-radius: 12px;
  filter: drop-shadow(0 0 6px #0EA5E9);
}

.frame-corner-tr {
  top: -2px;
  right: -2px;
  border-top: 3px solid #38BDF8;
  border-right: 3px solid #38BDF8;
  border-top-right-radius: 12px;
  filter: drop-shadow(0 0 6px #0EA5E9);
}

.frame-corner-bl {
  bottom: -2px;
  left: -2px;
  border-bottom: 3px solid #38BDF8;
  border-left: 3px solid #38BDF8;
  border-bottom-left-radius: 12px;
  filter: drop-shadow(0 0 6px #0EA5E9);
}

.frame-corner-br {
  bottom: -2px;
  right: -2px;
  border-bottom: 3px solid #38BDF8;
  border-right: 3px solid #38BDF8;
  border-bottom-right-radius: 12px;
  filter: drop-shadow(0 0 6px #0EA5E9);
}

/* Frame Header */
.slideshow-header {
  height: 56px;
  min-height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 15;
  gap: 12px;
}

.slideshow-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.slideshow-brand-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.slideshow-brand-logo {
  height: 32px;
  max-width: 130px;
  width: auto;
  object-fit: contain;
}

.slideshow-plant-meta {
  display: flex;
  flex-direction: column;
}

.slideshow-plant-title {
  font-weight: 800;
  font-size: 0.96rem;
  color: #FFFFFF;
  letter-spacing: 0.3px;
}

.slideshow-plant-subtitle {
  font-size: 0.72rem;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  animation: beaconPulse 1.8s infinite;
}

.live-pulse-text {
  font-weight: 800;
  color: #10B981;
  letter-spacing: 0.5px;
}

.meta-sep {
  color: rgba(255, 255, 255, 0.2);
}

/* Category Badge in Center */
.slideshow-header-center {
  display: flex;
  align-items: center;
}

.slideshow-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: #38BDF8;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* Header Controls Right */
.slideshow-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slideshow-control-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94A3B8;
}

.slideshow-select {
  background: transparent;
  border: none;
  color: #F1F5F9;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.slideshow-select option {
  background: #0F172A;
  color: #F1F5F9;
}

.slideshow-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #F1F5F9;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.slideshow-btn:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: #38BDF8;
  color: #FFFFFF;
}

.slideshow-btn.paused {
  background: rgba(245, 158, 11, 0.2);
  border-color: #F59E0B;
  color: #FCD34D;
}

.slideshow-btn-close {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
  font-size: 1.15rem;
  line-height: 1;
  padding: 4px 10px;
}

.slideshow-btn-close:hover {
  background: #DC2626;
  color: #FFFFFF;
  border-color: #EF4444;
}

.slideshow-clock-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slideshow-clock-time {
  font-family: monospace;
  font-weight: 800;
  font-size: 0.82rem;
  color: #38BDF8;
  letter-spacing: 0.5px;
}

.slideshow-clock-date {
  font-size: 0.65rem;
  color: #94A3B8;
  letter-spacing: 0.5px;
}

/* Slideshow Canvas & Individual Slides */
.slideshow-canvas {
  position: relative;
  flex: 1;
  overflow: hidden;
  perspective: 1200px;
}

.scada-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  overflow-y: auto;
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  background: transparent;
}

.scada-slide.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 5;
  transform: none !important;
}

.slide-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 100%;
  justify-content: space-between;
}

/* Slide Headlines */
.slide-headline-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.slide-pretitle {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #38BDF8;
}

.slide-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: #FFFFFF;
  margin: 2px 0 0;
  letter-spacing: -0.3px;
}

.slide-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #CBD5E1;
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
}

/* Slide 1: KPI Hero Grid */
.slide-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  flex: 1;
}

.slide-kpi-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.slide-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
}

.slide-kpi-card.highlight-cyan::before { background: linear-gradient(90deg, #0EA5E9, #38BDF8); }
.slide-kpi-card.highlight-emerald::before { background: linear-gradient(90deg, #10B981, #34D399); }
.slide-kpi-card.highlight-indigo::before { background: linear-gradient(90deg, #6366F1, #818CF8); }
.slide-kpi-card.highlight-amber::before { background: linear-gradient(90deg, #F59E0B, #FBBF24); }

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-card-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #94A3B8;
}

.kpi-card-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
}

.kpi-card-badge.online { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.kpi-card-badge.ppa { background: rgba(245, 158, 11, 0.2); color: #FBBF24; }

.kpi-card-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 10px 0 6px;
}

.kpi-giant-val {
  font-size: 2.25rem;
  font-weight: 900;
  color: #FFFFFF;
  letter-spacing: -0.5px;
  line-height: 1;
}

.kpi-val-unit {
  font-size: 1rem;
  font-weight: 700;
  color: #94A3B8;
}

.kpi-progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.kpi-progress-fill {
  height: 100%;
  background: #38BDF8;
  border-radius: 3px;
}

.kpi-progress-fill.green { background: #10B981; }
.kpi-progress-fill.indigo { background: #6366F1; }
.kpi-progress-fill.amber { background: #F59E0B; }

.kpi-card-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: #94A3B8;
}

/* Slide 1: Telemetry Ribbon */
.slide-ribbon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 14px;
}

.ribbon-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ribbon-icon {
  font-size: 1.3rem;
}

.ribbon-label {
  font-size: 0.7rem;
  color: #94A3B8;
}

.ribbon-value {
  font-size: 0.9rem;
  font-weight: 800;
  color: #F8FAFC;
}

.badge-mini-warn {
  font-size: 0.65rem;
  background: rgba(245, 158, 11, 0.25);
  color: #FBBF24;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}

/* Slide 2: Split Chart & Gauge Layout */
.slide-split-layout {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
  gap: 16px;
  flex: 1;
}

.slide-card-glass {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.chart-panel-wrapper {
  display: flex;
  flex-direction: column;
}

.chart-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-panel-title {
  font-weight: 800;
  font-size: 0.88rem;
  color: #F8FAFC;
}

.chart-legend-pills {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
}

.legend-pill.act { color: #38BDF8; }
.legend-pill.clr { color: #F59E0B; }
.legend-pill.fct { color: #8B5CF6; }

.svg-chart-container {
  flex: 1;
  width: 100%;
  min-height: 240px;
  display: flex;
}

.scada-diurnal-svg {
  width: 100%;
  height: 100%;
}

.svg-axis-text {
  fill: #64748B;
  font-size: 11px;
  font-family: monospace;
}

.svg-cursor-text {
  fill: #38BDF8;
  font-size: 11px;
  font-weight: 800;
  font-family: monospace;
}

.slide-gauges-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slide-metric-tile {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tile-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: #94A3B8;
  letter-spacing: 0.5px;
}

.tile-val-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 4px 0 2px;
}

.tile-num {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

.tile-unit {
  font-size: 0.82rem;
  color: #94A3B8;
  font-weight: 700;
}

.tile-sub {
  font-size: 0.7rem;
  color: #94A3B8;
}

/* Slide 3: Inverter Fleet Matrix */
.fleet-summary-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}

.fleet-count-pill {
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 800;
}

.fleet-count-pill.green { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.fleet-count-pill.amber { background: rgba(245, 158, 11, 0.25); color: #FBBF24; }
.fleet-count-pill.gray { background: rgba(255, 255, 255, 0.1); color: #94A3B8; }

.fleet-total-power {
  margin-left: 8px;
  color: #F8FAFC;
}

.inverter-slideshow-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  flex: 1;
}

.inv-slide-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.inv-slide-card:hover {
  transform: translateY(-2px);
  border-color: #38BDF8;
}

.inv-slide-card.alarm-highlight {
  border-color: #F59E0B;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.25);
}

.inv-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inv-id {
  font-size: 0.75rem;
  font-weight: 800;
  color: #FFFFFF;
}

.inv-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.inv-status-dot.online { background: #10B981; box-shadow: 0 0 6px #10B981; }
.inv-status-dot.warning { background: #F59E0B; box-shadow: 0 0 6px #F59E0B; animation: beaconPulse 1s infinite; }

.inv-kw {
  font-size: 1.15rem;
  font-weight: 900;
  color: #38BDF8;
  margin: 4px 0;
}

.inv-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 4px;
  font-size: 0.65rem;
  color: #94A3B8;
}

.inv-meta-grid strong {
  color: #F1F5F9;
}

.inv-alert-tag {
  font-size: 0.62rem;
  font-weight: 800;
  color: #F59E0B;
  background: rgba(245, 158, 11, 0.2);
  padding: 2px 4px;
  border-radius: 3px;
  margin-top: 4px;
  text-align: center;
}

/* Slide 4: Substation & MFM */
.substation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
}

.sub-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sub-block-title {
  font-size: 0.84rem;
  font-weight: 800;
  color: #F8FAFC;
  margin-bottom: 8px;
}

.three-phase-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.phase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 4px solid #64748B;
}

.phase-row.phase-r { border-left-color: #EF4444; }
.phase-row.phase-y { border-left-color: #F59E0B; }
.phase-row.phase-b { border-left-color: #3B82F6; }

.phase-badge {
  font-size: 0.76rem;
  font-weight: 700;
  color: #CBD5E1;
}

.phase-value {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 900;
  color: #FFFFFF;
}

.phase-status {
  font-size: 0.68rem;
  color: #34D399;
  font-weight: 700;
}

.sub-block-note {
  font-size: 0.72rem;
  color: #94A3B8;
  margin-top: 6px;
}

.energy-meters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meter-cell {
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 6px;
}

.meter-lbl {
  font-size: 0.68rem;
  font-weight: 800;
  color: #94A3B8;
  text-transform: uppercase;
}

.meter-val {
  font-size: 1.18rem;
  font-weight: 900;
  margin-top: 4px;
}

.health-checks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chk-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #E2E8F0;
}

/* Slide 5: WMS Grid */
.wms-slideshow-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  flex: 1;
}

.wms-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.wms-icon-box {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.wms-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: #94A3B8;
  text-transform: uppercase;
}

.wms-val-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 6px 0;
}

.wms-giant {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
}

.wms-unit {
  font-size: 1rem;
  color: #94A3B8;
  font-weight: 700;
}

.wms-sub {
  font-size: 0.72rem;
  color: #94A3B8;
}

/* Slide 6: Safety & Diagnostics */
.safety-layout-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  flex: 1;
}

.spotlight-alarm-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-color: rgba(245, 158, 11, 0.4);
}

.spotlight-badge-bar {
  display: flex;
  gap: 8px;
}

.badge-active-alarm {
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(239, 68, 68, 0.25);
  color: #FCA5A5;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-sev-warning {
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.25);
  color: #FBBF24;
  padding: 2px 8px;
  border-radius: 4px;
}

.alarm-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 10px 0;
}

.alarm-details-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: #CBD5E1;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.alarm-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #94A3B8;
  margin-top: 10px;
}

.alarm-status-pill {
  color: #34D399;
  font-weight: 700;
}

.comms-diag-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.diag-header {
  font-size: 0.84rem;
  font-weight: 800;
  color: #F8FAFC;
  margin-bottom: 8px;
}

.gateway-diag-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gw-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.gw-name {
  font-size: 0.74rem;
  color: #E2E8F0;
}

.gw-badge.online {
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  padding: 2px 6px;
  border-radius: 4px;
}

.emergency-readiness-strip {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #94A3B8;
  margin-top: 8px;
}

/* Slide 7: ESG & Commercial */
.esg-split-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
  flex: 1;
}

.esg-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.esg-col-header {
  font-size: 0.88rem;
  font-weight: 800;
  color: #F8FAFC;
  margin: 0 0 10px;
}

.financial-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fin-card {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.fin-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: #94A3B8;
  text-transform: uppercase;
}

.fin-val {
  font-size: 1.5rem;
  font-weight: 900;
  margin: 4px 0 2px;
}

.fin-sub {
  font-size: 0.72rem;
  color: #94A3B8;
}

.esg-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.esg-tile {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.esg-tile-icon {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.esg-tile-num {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.esg-tile-desc {
  font-size: 0.72rem;
  color: #94A3B8;
  margin-top: 4px;
}

/* Common Color Accents */
.text-cyan { color: #38BDF8 !important; }
.text-emerald { color: #34D399 !important; }
.text-amber { color: #FBBF24 !important; }
.text-indigo { color: #818CF8 !important; }

/* Frame Footer */
.slideshow-footer {
  height: 52px;
  min-height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 15;
  gap: 14px;
}

.slideshow-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slide-counter-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 10px;
  border-radius: 6px;
  font-family: monospace;
}

.counter-label {
  font-size: 0.65rem;
  color: #94A3B8;
  font-weight: 700;
  margin-right: 2px;
}

.counter-current {
  font-size: 1.05rem;
  font-weight: 900;
  color: #38BDF8;
}

.counter-slash {
  color: #64748B;
  font-size: 0.85rem;
}

.counter-total {
  font-size: 0.85rem;
  color: #94A3B8;
  font-weight: 700;
}

.slide-current-title-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: #CBD5E1;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ====================================================================== */
/* "DOT HITS" INTERACTIVE PAGINATION                                      */
/* ====================================================================== */
.slideshow-footer-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideshow-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slide-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  padding: 0;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.slide-dot:hover {
  transform: scale(1.4);
  background: #38BDF8;
  box-shadow: 0 0 10px #38BDF8;
}

.slide-dot.active {
  background: #0EA5E9;
  border-color: #FFFFFF;
  transform: scale(1.35);
  box-shadow: 0 0 14px #0EA5E9;
}

/* Dot Preview Tooltip on Hover */
.dot-preview {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #0F172A;
  color: #F8FAFC;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  border: 1px solid rgba(14, 165, 233, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
}

.slide-dot:hover .dot-preview {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.slideshow-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.next-slide-hint {
  font-size: 0.72rem;
  color: #94A3B8;
  font-style: italic;
}

.slideshow-nav-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.slideshow-step-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #F1F5F9;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.slideshow-step-btn:hover {
  background: rgba(14, 165, 233, 0.3);
  border-color: #38BDF8;
  color: #FFFFFF;
}

/* Linear Countdown Progress Track */
.slideshow-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

.slideshow-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0EA5E9, #10B981, #F59E0B);
  box-shadow: 0 0 8px #0EA5E9;
  transition: width 0.1s linear;
}

/* ====================================================================== */
/* CREATIVE TRANSITION ANIMATIONS                                         */
/* ====================================================================== */

/* 1. LASER SWEEP TRANSITION (anim-sweep) */
.scada-slide.anim-sweep-in {
  animation: laserSweepIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 6;
}

.scada-slide.anim-sweep-out {
  animation: laserSweepOut 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 4;
}

@keyframes laserSweepIn {
  0% {
    opacity: 0;
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    filter: brightness(1.6);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    filter: brightness(1);
  }
}

@keyframes laserSweepOut {
  0% {
    opacity: 1;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
  }
}

/* 2. 3D CUBE FLIP (anim-cube) */
.scada-slide.anim-cube-in {
  animation: cubeRotateIn 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: 100% 50%;
  z-index: 6;
}

.scada-slide.anim-cube-out {
  animation: cubeRotateOut 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: 0% 50%;
  z-index: 4;
}

@keyframes cubeRotateIn {
  0% {
    opacity: 0;
    transform: perspective(1200px) rotateY(90deg) scale(0.85);
  }
  100% {
    opacity: 1;
    transform: perspective(1200px) rotateY(0deg) scale(1);
  }
}

@keyframes cubeRotateOut {
  0% {
    opacity: 1;
    transform: perspective(1200px) rotateY(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: perspective(1200px) rotateY(-90deg) scale(0.85);
  }
}

/* 3. FLUID SLIDE (anim-slide) */
.scada-slide.anim-slide-in {
  animation: fluidSlideIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 6;
}

.scada-slide.anim-slide-out {
  animation: fluidSlideOut 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 4;
}

@keyframes fluidSlideIn {
  0% {
    opacity: 0;
    transform: translateX(100%);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fluidSlideOut {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-100%);
  }
}

/* 4. GLASS ZOOM (anim-zoom) */
.scada-slide.anim-zoom-in {
  animation: glassZoomIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 6;
}

.scada-slide.anim-zoom-out {
  animation: glassZoomOut 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 4;
}

@keyframes glassZoomIn {
  0% {
    opacity: 0;
    transform: scale(0.92);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes glassZoomOut {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
    filter: blur(6px);
  }
}

/* 5. IRIS REVEAL (anim-shutter) */
.scada-slide.anim-shutter-in {
  animation: irisRevealIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 6;
}

.scada-slide.anim-shutter-out {
  animation: irisRevealOut 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 4;
}

@keyframes irisRevealIn {
  0% {
    opacity: 0;
    clip-path: circle(0% at 50% 50%);
  }
  10% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    clip-path: circle(120% at 50% 50%);
  }
}

@keyframes irisRevealOut {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Live Telemetry Value Flash Animation */
.telemetry-pulse {
  animation: telemetryFlash 0.75s ease;
}

@keyframes telemetryFlash {
  0% { color: #34D399; text-shadow: 0 0 10px #10B981; }
  100% { text-shadow: none; }
}

/* Refresh Bar Live Dot Pulse */
@keyframes scadaPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

@keyframes beaconPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

/* Responsive Adaptations for Slideshow on Tablets and Laptops */
@media (max-width: 1200px) {
  .slide-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .inverter-slideshow-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .wms-slideshow-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .slide-split-layout, .substation-grid, .safety-layout-grid, .esg-split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .scada-slideshow-frame {
    margin: 4px;
    border-radius: 8px;
  }
  .slideshow-header {
    height: auto;
    padding: 8px 10px;
    flex-wrap: wrap;
  }
  .slideshow-header-center, .slideshow-clock-box {
    display: none;
  }
  .slide-kpi-grid {
    grid-template-columns: 1fr;
  }
  .slide-ribbon-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .inverter-slideshow-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .slideshow-footer {
    height: auto;
    padding: 8px 10px;
    flex-wrap: wrap;
  }
  .next-slide-hint, .slide-current-title-badge {
    display: none;
  }
}


/* =====================================================================
   POLISH LAYER — compact spacing, entrance motion, Visualizer styles
   (keep last so it overrides earlier rules; motion is disabled by
   body.reduced-motion and prefers-reduced-motion)
   ===================================================================== */

/* --- Compact, professional density ------------------------------------ */
.card { padding: 14px 16px; margin-bottom: 14px; border-radius: 12px; }
.card-header { margin-bottom: 10px; padding-bottom: 8px; }
.card-title { font-size: 0.98rem; letter-spacing: -0.005em; }

.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-card { padding: 11px 14px 12px; border-radius: 12px; }
.kpi-card::before { height: 3px; }
.kpi-label { font-size: 0.7rem; letter-spacing: 0.06em; margin-bottom: 3px; }
.kpi-value { font-size: 1.5rem; letter-spacing: -0.02em; }
.kpi-unit { font-size: 0.82rem; }
.kpi-sub { font-size: 0.72rem; margin-top: 3px; line-height: 1.3; }

.scada-table { font-size: 0.82rem; }
.scada-table th { padding: 7px 12px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; }
.scada-table td { padding: 6px 12px; }
.scada-table tbody tr:nth-child(even) { background-color: color-mix(in srgb, var(--surface-alt) 55%, transparent); }
.scada-table tbody tr { transition: background-color .15s ease; }

.app-main h1 { letter-spacing: -0.015em; line-height: 1.2; margin: 0; }
.page-head { margin-bottom: 12px !important; }
.grid-2col-responsive, .grid-2col-dynamic { gap: 12px; }

/* --- Entrance animation (staggered) ----------------------------------- */
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes softPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.78); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }

.app-main .card, .app-main .kpi-card, .app-main .viz-kpi {
  animation: riseIn .45s cubic-bezier(.22,.8,.3,1) both;
}
.kpi-grid > :nth-child(1), .viz-kpis > :nth-child(1) { animation-delay: .02s; }
.kpi-grid > :nth-child(2), .viz-kpis > :nth-child(2) { animation-delay: .07s; }
.kpi-grid > :nth-child(3), .viz-kpis > :nth-child(3) { animation-delay: .12s; }
.kpi-grid > :nth-child(4), .viz-kpis > :nth-child(4) { animation-delay: .17s; }
.kpi-grid > :nth-child(5) { animation-delay: .22s; }
.kpi-grid > :nth-child(6) { animation-delay: .27s; }
.kpi-grid > :nth-child(n+7) { animation-delay: .32s; }
.app-main > .card:nth-of-type(2), .grid-2col-responsive > :nth-child(2) { animation-delay: .1s; }

.kpi-card { transition: transform .2s ease, box-shadow .2s ease; }
.kpi-card:hover { transform: translateY(-2px); }
.kpi-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.18) 50%, transparent 70%);
  background-size: 200% 100%; transition: opacity .2s ease;
}
.kpi-card:hover::after { opacity: 1; animation: shimmer 1.1s linear; }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10B981;
  box-shadow: 0 0 0 0 rgba(16,185,129,.55); animation: softPulse 1.6s ease-in-out infinite; vertical-align: middle; }

body.reduced-motion .app-main .card, body.reduced-motion .app-main .kpi-card,
body.reduced-motion .app-main .viz-kpi, body.reduced-motion .live-dot { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .app-main .card, .app-main .kpi-card, .app-main .viz-kpi, .live-dot, .kpi-card::after { animation: none !important; }
}

/* --- Visualizer / Data mode (inverter generation) --------------------- */
.mode-toggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 999px; }
.mode-btn { border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; cursor: pointer;
  font-size: 0.82rem; font-weight: 700; color: var(--text-muted); transition: all .2s ease; }
.mode-btn:hover { color: var(--text-main); }
.mode-btn.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(29,91,241,.35); }

.viz-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.viz-kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; overflow: hidden; }
.viz-kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--primary)); }
.viz-kpi-label { flex-basis: 100%; font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.viz-kpi-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text-main); font-variant-numeric: tabular-nums; }
.viz-kpi-small { font-size: 1rem; }
.viz-kpi-unit { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

.viz-card { padding: 12px 14px 10px; }
.viz-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.viz-title { font-size: 0.95rem; font-weight: 800; color: var(--text-main); }
.viz-sub { font-size: 0.74rem; font-weight: 600; color: var(--text-muted); margin-left: 6px; }
.viz-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.viz-controls select { padding: 5px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.8rem;
  font-weight: 600; color: var(--text-main); background: var(--surface); }
.viz-live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; color: var(--text-main); cursor: pointer; }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.viz-note { margin-top: 6px; padding: 6px 10px; border-radius: 8px; font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); background: var(--surface-alt); border: 1px dashed var(--border); }
.viz-plot { width: 100%; }

/* page body: tighter gutters on desktop */
@media (min-width: 900px) { .app-content { padding: 14px 20px 18px; } }

.stale-banner { margin: 0 0 10px; padding: 7px 12px; border-radius: 10px; font-size: 0.8rem; font-weight: 600;
  color: #92400E; background: #FEF3C7; border: 1px solid #FCD34D; animation: riseIn .4s ease both; }
body.dark-mode .stale-banner { color: #FDE68A; background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.4); }

/* ---------- Weather prediction button + popup ---------- */
.wx-btn { border: 1px solid #F59E0B; background: linear-gradient(135deg, #FFF7E6, #FFEFD0); color: #B45309; font-weight: 700;
  font-size: 0.74rem; padding: 3px 10px; border-radius: 999px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.wx-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(245,158,11,.35); }
body.dark-mode .wx-btn { background: rgba(245,158,11,.14); color: #FCD34D; }
.wx-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(8,15,35,.55); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 18px; animation: wxFade .2s ease both; }
@keyframes wxFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wxPop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.wx-panel { width: min(1040px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: var(--surface); color: var(--text-main);
  border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(0,0,0,.35); padding: 16px 18px 14px; animation: wxPop .3s cubic-bezier(.22,.8,.3,1) both; }
.wx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.wx-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; }
.wx-sub { font-size: .78rem; color: var(--text-muted); margin-top: 1px; }
.wx-head-actions { display: flex; gap: 6px; }
.wx-icon-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-alt); cursor: pointer; font-size: .95rem; color: var(--text-main); transition: transform .2s ease; }
.wx-icon-btn:hover { transform: rotate(90deg); }
.wx-state { padding: 26px; text-align: center; color: var(--text-muted); font-weight: 600; }
.wx-section { margin-bottom: 10px; }
.wx-section h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 0 0 6px; }
.wx-loc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.wx-field { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; display: flex; flex-direction: column; gap: 1px; }
.wx-field span { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.wx-field b { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.wx-field small { font-size: .7rem; color: var(--text-muted); }
.wx-loc-actions { display: flex; gap: 14px; margin-top: 6px; }
.wx-link { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 700; font-size: .78rem; cursor: pointer; text-decoration: none; }
.wx-link:hover { text-decoration: underline; }
.wx-now-grid { display: grid; grid-template-columns: minmax(280px, 1.1fr) 1.4fr; gap: 10px; }
@media (max-width: 760px) { .wx-now-grid { grid-template-columns: 1fr; } }
.wx-now { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(29,91,241,.08), rgba(245,158,11,.1)); }
.wx-now-icon { font-size: 2.6rem; line-height: 1; animation: wxFloat 3.2s ease-in-out infinite; }
@keyframes wxFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.wx-now-temp { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.wx-now-temp small { font-size: .95rem; font-weight: 700; color: var(--text-muted); margin-left: 2px; }
.wx-now-label { font-weight: 700; font-size: .9rem; margin-top: 2px; }
.wx-now-meta { font-size: .74rem; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }
.wx-sun { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wx-sun div { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; }
.wx-sun span { font-size: .68rem; font-weight: 700; color: var(--text-muted); }
.wx-sun b { font-size: .95rem; font-variant-numeric: tabular-nums; }
.wx-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px; margin: 4px 0 8px; }
.wx-tab { border: 0; background: transparent; padding: 5px 14px; border-radius: 999px; font-size: .8rem; font-weight: 700; color: var(--text-muted); cursor: pointer; transition: all .2s ease; }
.wx-tab.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(29,91,241,.35); }
.wx-chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px; margin-top: 6px; }
.wx-table-wrap { max-height: 300px; overflow: auto; margin-top: 8px; }
.wx-table td, .wx-table th { white-space: nowrap; }
.wx-foot { margin-top: 8px; font-size: .72rem; color: var(--text-muted); line-height: 1.4; }
body.reduced-motion .wx-overlay, body.reduced-motion .wx-panel, body.reduced-motion .wx-now-icon { animation: none !important; }

/* Unified plant settings: keep fields and the gallery accessible on short screens. */
#modal-plant-metadata-backdrop {
  padding: 16px;
  box-sizing: border-box;
}
#modal-plant-metadata-backdrop .modal-dialog {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
}
#modal-plant-metadata-backdrop .modal-header {
  flex-shrink: 0;
}
#modal-plant-metadata-backdrop .modal-body {
  min-height: 0;
  overflow-y: auto;
}

/* Generation report workspace */
.report-page { max-width: 1700px; margin: 0 auto; }
.report-page-heading, .report-data-heading, .report-pagination { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:20px; }
.report-page h1 { font-size:1.6rem; font-weight:800; margin:4px 0 7px; }
.report-eyebrow { font-size:.72rem; color:var(--primary); text-transform:uppercase; letter-spacing:.08em; font-weight:700; }
.report-muted { font-size:.82rem; line-height:1.55; color:var(--text-muted); }
.report-filter-card { padding:18px; margin-bottom:12px; }
.report-filter-form { display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; }
.report-filter-form label, .report-data-heading label { display:flex; flex-direction:column; gap:5px; font-size:.76rem; color:var(--text-muted); font-weight:700; }
.report-filter-form select, .report-filter-form input, .report-data-heading select, .report-chart-controls select { padding:8px 10px; border:1px solid var(--border); border-radius:6px; background:var(--surface); color:var(--text-main); font-size:.83rem; }
.report-context-strip { display:flex; flex-wrap:wrap; gap:10px 22px; padding:12px 2px; color:var(--text-muted); font-size:.79rem; }
.report-mode-label { color:var(--primary); font-weight:700; }
.report-output-card { padding:14px 18px; margin-bottom:20px; }
.report-export-note { margin:9px 0 0; }
.report-export-status { align-self:center; font-size:.8rem; color:var(--primary); }
.report-chart-help { display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px 20px; font-size:.79rem; color:var(--text-muted); margin-bottom:12px; }
.report-chart-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; margin-bottom:24px; }
.report-chart-card { padding:16px; border:1px solid var(--border); background:var(--surface); border-radius:var(--radius-md); min-width:0; }
.report-chart-card:first-child { grid-column:1 / -1; }
.report-chart-controls { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.report-chart-controls h2 { font-size:.98rem; font-weight:750; margin:0; }
.report-chart-controls div { display:flex; gap:8px; }
.report-chart { width:100%; height:360px; min-width:0; }
.report-empty { padding:20px; border:1px dashed var(--border); border-radius:var(--radius-md); color:var(--text-muted); margin:14px 0; }
.report-data-heading h2 { font-size:1.1rem; margin:0; }
.report-pagination { font-size:.8rem; color:var(--text-muted); margin-top:14px; }
.report-pagination nav { display:flex; gap:6px; }
.report-quality-note { padding-top:15px; border-top:1px solid var(--border); margin-top:20px; }
@media(max-width:900px) { .report-chart-grid { grid-template-columns:1fr; } .report-chart { height:330px; } .report-filter-form label { flex:1 1 135px; } }

/* Uploaded facility photos; presets are never used as an empty-state image. */
.plant-gallery-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:8px; }
.plant-gallery-heading h4 { margin:0; font-size:.95rem; }
#plant-gallery-count { color:var(--text-muted); font-size:.77rem; font-weight:600; }
.plant-gallery-help { font-size:.78rem; color:var(--text-muted); line-height:1.5; margin:6px 0 12px; }
.plant-photo-stage { position:relative; width:100%; height:clamp(180px,28vh,290px); background:var(--surface-alt); border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; }
.plant-photo-stage-settings { height:240px; }
.plant-photo-stage .plant-facility-photo { width:100%; height:100%; display:block; object-fit:contain; }
.plant-photo-stage [hidden] { display:none !important; }
.plant-photo-empty { display:flex; height:100%; align-items:center; justify-content:center; flex-direction:column; gap:10px; padding:16px; box-sizing:border-box; color:var(--text-muted); text-align:center; }
.plant-photo-empty strong { color:var(--text-main); font-size:.98rem; }
.plant-photo-empty span { font-size:.8rem; }
.plant-photo-caption { position:absolute; bottom:0; left:0; right:0; padding:14px 16px 10px; background:linear-gradient(transparent,rgba(15,23,42,.88)); color:white; font-size:.83rem; font-weight:700; overflow-wrap:anywhere; pointer-events:none; }
.plant-slideshow-controls { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:10px 0 14px; }
.plant-photo-position { font-size:.79rem; min-width:55px; text-align:center; color:var(--text-muted); }
#plant-photo-pause { margin-left:auto; }
.plant-upload-controls { padding:12px; background:var(--surface-alt); border:1px solid var(--border); border-radius:var(--radius-sm); }
.plant-upload-controls .plant-gallery-help { margin-bottom:0; }
.plant-upload-controls label { cursor:pointer; }
.plant-upload-controls label.is-disabled { opacity:.5; cursor:not-allowed; }
.plant-gallery-status { margin:10px 0; min-height:1.4em; font-size:.8rem; color:var(--text-muted); line-height:1.5; }
.plant-gallery-status.plant-gallery-error { color:var(--error,#b91c1c); font-weight:600; }
.plant-gallery-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(112px,1fr)); gap:10px; }
.plant-gallery-card { min-width:0; display:flex; flex-direction:column; align-items:stretch; gap:5px; }
.plant-gallery-photo { display:flex; flex-direction:column; gap:6px; width:100%; padding:5px; border:2px solid var(--border); border-radius:var(--radius-sm); background:var(--surface); color:var(--text-main); cursor:pointer; text-align:left; }
.plant-gallery-photo.is-current { border-color:var(--primary); }
.plant-gallery-photo img { width:100%; height:76px; border-radius:3px; object-fit:cover; }
.plant-gallery-photo span { overflow-wrap:anywhere; font-size:.72rem; line-height:1.35; padding:0 2px 3px; }
.plant-gallery-primary { font-size:.67rem; font-weight:700; color:var(--primary); padding-left:4px; }
.plant-gallery-remove { border:1px solid var(--border); background:var(--surface); color:var(--error,#b91c1c); border-radius:var(--radius-sm); padding:5px 8px; font-size:.72rem; cursor:pointer; }
.plant-gallery-photo:focus-visible, .plant-gallery-remove:focus-visible, .plant-slideshow-controls button:focus-visible { outline:3px solid var(--primary); outline-offset:2px; }
.plant-gallery-photo:disabled, .plant-gallery-remove:disabled, .plant-slideshow-controls button:disabled { opacity:.55; cursor:not-allowed; }
@media(max-width:480px) { .plant-gallery-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } #plant-photo-pause { margin-left:0; } }

/* ---- Day-over-day production ticker ---- */
.dod-card{background:var(--card-bg,#fff);border:1px solid var(--border,#e2e8f0);border-radius:14px;padding:16px 18px;margin:0 0 18px;box-shadow:0 2px 10px rgba(15,23,42,.06)}
.dod-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.dod-title{font-weight:800;font-size:1.05rem;display:block}
.dod-basis{font-size:.78rem;color:var(--text-muted,#64748b)}
.dod-pill{font-weight:800;font-size:1.25rem;padding:6px 16px;border-radius:999px;font-variant-numeric:tabular-nums;transition:background .4s,color .4s}
.dod-up{color:#059669}.dod-down{color:#dc2626}.dod-flat{color:#d97706}.dod-na{color:#64748b}
.dod-pill.dod-up{background:rgba(16,185,129,.14)}.dod-pill.dod-down{background:rgba(239,68,68,.14)}
.dod-pill.dod-flat{background:rgba(245,158,11,.14)}.dod-pill.dod-na{background:rgba(100,116,139,.12)}
.dod-body{display:flex;gap:20px;flex-wrap:wrap;margin-top:10px;align-items:stretch}
.dod-main{flex:1 1 300px}
.dod-big{font-size:2.1rem;font-weight:800;font-variant-numeric:tabular-nums}.dod-big small{font-size:.85rem;font-weight:600;color:var(--text-muted,#64748b)}
.dod-delta{font-weight:700;font-size:1rem}.dod-sub{font-size:.8rem;color:var(--text-muted,#64748b);margin-top:4px}
.dod-note{font-size:.78rem;color:#b45309;margin-top:6px}
.dod-chips{flex:2 1 420px;display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.dod-chip{border:1px solid var(--border,#e2e8f0);border-radius:10px;padding:8px 12px;display:flex;flex-direction:column;gap:2px}
.dod-chip span{font-size:.72rem;text-transform:uppercase;letter-spacing:.04em;color:var(--text-muted,#64748b)}
.dod-chip b{font-size:1.15rem;font-variant-numeric:tabular-nums}.dod-chip i{font-style:normal;font-size:.72rem;color:var(--text-muted,#64748b)}
.dod-chart{height:230px;margin-top:10px}
.dod-movers{margin-top:6px;font-size:.82rem}.dod-movers summary{cursor:pointer;font-weight:700}
.dod-table{width:100%;border-collapse:collapse;margin-top:6px}.dod-table th,.dod-table td{text-align:right;padding:4px 8px;border-bottom:1px solid var(--border,#e2e8f0)}
.dod-table th:first-child,.dod-table td:first-child{text-align:left}

/* ---- Live body updates: value flash like a market ticker ---- */
@keyframes liveUp{0%{background:rgba(16,185,129,.45)}100%{background:transparent}}
@keyframes liveDown{0%{background:rgba(239,68,68,.45)}100%{background:transparent}}
@keyframes liveSame{0%{background:rgba(2,132,199,.25)}100%{background:transparent}}
.live-flash-up{animation:liveUp 1.3s ease-out;border-radius:4px}
.live-flash-down{animation:liveDown 1.3s ease-out;border-radius:4px}
.live-flash{animation:liveSame 1.3s ease-out;border-radius:4px}
@media (prefers-reduced-motion:reduce){.live-flash-up,.live-flash-down,.live-flash{animation:none}}

/* ---- No-overlap layer: let grid/flex children shrink, wrap long text, scroll wide tables ---- */
.grid-2col-responsive > *, .grid-2col-dynamic > *, .kpi-grid > *, .card, .kpi-card { min-width: 0; }
.table-container { overflow-x: auto; max-width: 100%; }
.card-header { flex-wrap: wrap; gap: 8px 12px; }
.card-title, .kpi-label, .kpi-sub, .page-title { overflow-wrap: anywhere; }
.kpi-sub { line-height: 1.35; }
.scada-table td, .scada-table th { overflow-wrap: anywhere; vertical-align: middle; }
canvas { max-width: 100%; }
@media (max-width: 640px) { .card-header { flex-direction: column; align-items: flex-start; } }
.scada-table td span, .scada-table td .status-badge { white-space: normal; text-align: left; }
.scada-table td { min-width: 0; }
