/* ==========================================================================
   MORROS DIGITAL TWIN & COMMAND CENTER — PSAM (UFPE/FADE) & COMPESA 2025
   High-Craft Glassmorphic SCADA, Geospatial & AI Intelligence Design System
   ========================================================================== */

:root, [data-theme="dark"], [data-theme="light"] {
  /* ==========================================================================
     DEEP NAVY BLUE COMMAND SYSTEM — INSTITUTIONAL PALETTE
     Permanent dark mode with rich oceanic navy blue foundation (Zero AI slop / No purple)
     ========================================================================== */
  --bg-app: #070d19;
  --bg-sidebar: #091326;
  --bg-topbar: rgba(9, 19, 38, 0.94);
  --bg-panel: #0b172e;
  --bg-card: #0e1e3d;
  --bg-card-solid: #0e1e3d;
  --bg-card-hover: #13274e;
  --bg-elevated: #162c57;
  --bg-input: #071021;

  /* Technical Crisp Borders */
  --border-subtle: rgba(56, 189, 248, 0.12);
  --border-medium: rgba(56, 189, 248, 0.22);
  --border-accent: rgba(56, 189, 248, 0.45);
  --border-hover: rgba(56, 189, 248, 0.35);

  /* Precise Elevation Shadows (Tight, High-Contrast, No Murky Neon Slop) */
  --shadow-card: 0 4px 18px -2px rgba(2, 6, 18, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-card-hover: 0 8px 28px -4px rgba(2, 6, 18, 0.8), inset 0 1px 0 rgba(56, 189, 248, 0.2);
  --shadow-popover: 0 18px 48px -6px rgba(0, 0, 0, 0.85);
  --glow-cyan: 0 0 16px rgba(14, 165, 233, 0.25);
  --glow-red: 0 0 16px rgba(239, 68, 68, 0.25);
  --glow-emerald: 0 0 16px rgba(16, 185, 129, 0.22);

  /* High-Contrast Technical Typography */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-highlight: #38bdf8;

  /* Semantic Technical Accents (Strict Anti-Slop: Zero Violet/Purple) */
  --cyan: #0284c7;
  --cyan-light: #38bdf8;
  --blue: #2563eb;
  --blue-light: #60a5fa;
  --emerald: #10b981;
  --emerald-light: #34d399;
  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --orange: #ea580c;
  --crimson: #ef4444;
  --crimson-light: #f87171;

  /* Layout Dimensions */
  --sidebar-w: 270px;
  --topbar-h: 70px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

/* Reset & Scrollbars */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.24);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient Mesh Background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 10%, rgba(14, 165, 233, 0.08), transparent 45%),
    radial-gradient(circle at 86% 12%, rgba(37, 99, 235, 0.06), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(2, 132, 199, 0.05), transparent 45%);
}

.mono {
  font-family: var(--font-mono);
}

/* ==========================================================================
   APP SHELL: SIDEBAR + TOP TELEMETRY BAR + WORKSPACE
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */

/* ==========================================================================
   SIDEBAR & NAVIGATION — HIGH PRECISION DEEP NAVY
   ========================================================================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-brand {
  padding: 1.15rem 1rem 1.05rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #070f20;
}

.brand-emblem {
  width: 82px;
  height: 82px;
  border-radius: 0;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
  flex-shrink: 0;
  position: relative;
  overflow: visible;
  transition: none;
}

.brand-emblem:hover {
  transform: none;
  border-color: transparent;
}

.brand-emblem .brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
  display: block;
  box-shadow: none;
  filter: none;
}

.brand-emblem::after {
  display: none !important;
  content: none !important;
}

.brand-info h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #ffffff;
}

.brand-info span {
  display: block;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--cyan-light);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.brand-status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-transform: uppercase;
  color: #38bdf8;
  background: transparent;
  background-color: transparent;
  padding: 1px 6px;
  border-radius: 99px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  margin-top: 4px;
  box-shadow: none;
}

.brand-status-tag .pulse-dot {
  display: none !important;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.sidebar-nav .nav-item {
  width: 100% !important;
  min-height: 42px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  padding: 0.65rem 0.95rem !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  text-align: left !important;
  line-height: 1.4 !important;
  box-shadow: none !important;
  transform: none !important;
  transition: all 0.18s ease !important;
  position: relative;
}

.sidebar-nav .nav-item svg {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0 !important;
  opacity: 0.75 !important;
  color: inherit !important;
  transition: transform 0.18s ease, opacity 0.18s ease, color 0.18s ease !important;
}

.sidebar-nav .nav-item:hover {
  background: rgba(56, 189, 248, 0.08) !important;
  color: #f8fafc !important;
  border-color: rgba(56, 189, 248, 0.2) !important;
}

.sidebar-nav .nav-item:hover svg {
  opacity: 1 !important;
  color: var(--cyan-light) !important;
  transform: translateX(2px) !important;
}

.sidebar-nav .nav-item.active {
  background: #112347 !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  color: #ffffff !important;
  box-shadow: inset 3px 0 0 #38bdf8, 0 2px 10px rgba(0, 0, 0, 0.35) !important;
}

.sidebar-nav .nav-item.active svg {
  opacity: 1 !important;
  color: var(--cyan-light) !important;
}

.sidebar-footer {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: #060d1b;
  flex-shrink: 0;
}

.sidebar-footer-card {
  background: #0b172e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-meta-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--cyan-light);
}

.footer-meta-title svg {
  width: 14px;
  height: 14px;
  color: var(--cyan-light);
}

.footer-meta-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0;
}

.btn-footer-manual {
  margin-top: 0.2rem;
  width: 100%;
  justify-content: center;
  background: #112347;
  border-color: rgba(56, 189, 248, 0.3);
  color: #f8fafc;
  font-size: 0.74rem;
  padding: 0.38rem 0.6rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: var(--radius-xs);
}

.btn-footer-manual:hover {
  background: #162c57;
  border-color: #38bdf8;
  color: #ffffff;
}
.nav-badge.alert {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.sidebar-footer {
  padding: 0.95rem 1.1rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.14);
  font-size: 0.73rem;
  color: var(--text-muted);
}

.cco-live-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-xs);
  background: rgba(16, 185, 129, 0.09);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--emerald);
  font-weight: 700;
  font-size: 0.74rem;
  margin-bottom: 0.5rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDot 1.6s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}

/* Main Workspace Wrapper */
.workspace-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Telemetry Header */
.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 150;
  background: var(--bg-topbar);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.view-breadcrumb h2 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.view-breadcrumb p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.topbar-telemetry {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.telemetry-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.command-search {
  position: relative;
  width: 310px;
}

.command-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 0.52rem 2.8rem 0.52rem 2.25rem;
  border-radius: 99px;
  font-family: var(--font-sans);
  font-size: 0.81rem;
  transition: all 0.2s ease;
}

.command-search input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.16);
}

.command-search .search-ico {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.command-search .kbd-hint {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.1rem 0.38rem;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  pointer-events: none;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.icon-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan-light);
  transform: translateY(-1px);
}

/* Workspace Content Area */
.workspace-content {
  padding: 1.5rem 1.75rem 3rem;
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
}

.view-section {
  display: none;
  animation: viewEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
  display: block;
}

@keyframes viewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   COMPONENTS: BENTO CARDS, BUTTONS, PILLS & GRIDS
   ========================================================================== */
.bento-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 1.4rem;
}

@media (max-width: 1400px) {
  .bento-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .bento-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .bento-kpi-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-accent);
}

.stat-card.clickable-card {
  cursor: pointer;
}
.stat-card.clickable-card:active {
  transform: translateY(-1px) scale(0.99);
}

.stat-card .stat-glow {
  position: absolute;
  top: -24px;
  right: -24px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0.26;
  pointer-events: none;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 18px;
  height: 18px;
}

.stat-trend {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 700;
  padding: 0.15rem 0.48rem;
  border-radius: 99px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Glass Panels */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.4rem;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.26);
  color: var(--cyan-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.panel-title {
  font-size: 1.04rem;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.panel-subtitle {
  font-size: 0.79rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Grids */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.3rem;
  margin-bottom: 1.4rem;
}
.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-12 { grid-column: span 12; }

@media (max-width: 1150px) {
  .col-8, .col-7, .col-6, .col-5, .col-4, .col-3 { grid-column: span 12; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.52rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-medium);
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:hover {
  border-color: var(--cyan);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.btn-primary {
  background: #0284c7;
  border: 1px solid #38bdf8;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  font-weight: 600;
}

.btn-primary:hover {
  background: #0369a1;
  border-color: #7dd3fc;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5);
  transform: translateY(-1px);
}

.btn-crimson {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-crimson:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: #ef4444;
}

.btn-xs {
  padding: 0.32rem 0.68rem;
  font-size: 0.74rem;
  border-radius: var(--radius-xs);
}

/* Segmented Controls / Pill Tabs */
.segmented-bar {
  display: inline-flex;
  background: var(--bg-input);
  padding: 0.28rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: 0.25rem;
  flex-wrap: wrap;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.18s ease;
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(37, 99, 235, 0.25));
  color: var(--cyan-light);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

/* ==========================================================================
   VIEW 2: GIS MORROS LIVE (LEAFLET GEOSPATIAL DIGITAL TWIN)
   ========================================================================== */
.gis-shell {
  position: relative;
  height: calc(100vh - 140px);
  min-height: 640px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-card);
}

#gisMapCanvas {
  width: 100%;
  height: 100%;
  background: #070d19;
  z-index: 1;
}

/* Zero-API-Key Dark Telemetry Filter on OpenStreetMap Tiles */
.leaflet-tile.tiles-cco-dark {
  filter: invert(100%) hue-rotate(180deg) brightness(90%) contrast(95%) saturate(82%);
}

.gis-floating-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  background: rgba(8, 13, 26, 0.92);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.95rem 1.05rem;
  width: 336px;
  max-width: calc(100% - 32px);
  color: #f8fafc;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
}

.gis-collapse-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gis-collapse-btn:hover {
  border-color: var(--cyan);
  color: #fff;
}

.gis-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}
.gis-preset-grid .btn-xs {
  padding: 0.34rem 0.35rem;
  font-size: 0.7rem;
  justify-content: center;
}

.gis-basemap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.22rem;
  background: rgba(4, 7, 17, 0.85);
  padding: 0.24rem;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148, 163, 184, 0.16);
  margin-bottom: 0.6rem;
}
.gis-basemap-grid .seg-btn {
  padding: 0.36rem 0.2rem;
  font-size: 0.7rem;
  justify-content: center;
  border-radius: 5px;
}

.gis-layer-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.gis-layer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 0.34rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.gis-layer-row:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.25);
}

/* Top-Right Docked Telemetry Inspector (Never overlaps bottom-right FAB) */
.gis-inspector-card {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 500;
  width: 378px;
  max-width: calc(100% - 32px);
  background: rgba(8, 13, 26, 0.93);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 1.05rem 1.15rem;
  color: #f8fafc;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.7), var(--glow-cyan);
  transition: all 0.25s ease;
}

.gis-quick-assets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.28rem;
  margin-bottom: 0.65rem;
}

.gis-asset-chip {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 0.26rem 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.67rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s ease;
}
.gis-asset-chip:hover {
  border-color: var(--cyan);
  color: #fff;
}
.gis-asset-chip.active {
  background: rgba(239, 68, 68, 0.22);
  border-color: #f87171;
  color: #fecaca;
}

.gis-coords-hud {
  position: absolute;
  bottom: 14px;
  left: 58px;
  z-index: 450;
  background: rgba(8, 13, 26, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 99px;
  padding: 0.3rem 0.85rem;
  font-size: 0.69rem;
  color: #cbd5e1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

/* Custom Non-Overlapping Pulsing Map Callout Markers */
.gis-rap-callout-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.gis-marker-rap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ef4444;
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.38), 0 0 18px #ef4444;
  animation: markerPulse 1.8s infinite;
  flex-shrink: 0;
}

.gis-rap-label {
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  border: 1px solid #ef4444;
  border-left: 3px solid #ef4444;
  border-radius: 6px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.75);
}

.gis-unit-callout-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.gis-marker-unit {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  background: #06b6d4;
  border: 2px solid #fff;
  box-shadow: 0 0 12px #06b6d4;
  flex-shrink: 0;
}

.gis-marker-unit.offline {
  background: #ef4444;
  box-shadow: 0 0 14px #ef4444;
  animation: markerPulse 1.5s infinite;
}

.gis-unit-label {
  background: rgba(8, 13, 26, 0.88);
  color: #e2e8f0;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 5px;
  padding: 1px 5px;
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

@media (max-width: 900px) {
  .gis-inspector-card {
    top: auto;
    bottom: 14px;
    right: 14px;
    left: 14px;
    width: auto;
  }
  .gis-coords-hud {
    display: none;
  }
}

@keyframes markerPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   VIEW 3: SALA DE SITUAÇÃO (SCADA RAINFALL CONSOLE & CIRCUIT FLOWCHART)
   ========================================================================== */
.scada-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  background: linear-gradient(180deg, rgba(10, 17, 34, 0.92), rgba(15, 25, 48, 0.95));
  padding: 1.5rem;
  margin-bottom: 1.4rem;
  color: #f8fafc;
  box-shadow: var(--shadow-card);
}

#rainParticleCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
}

.scada-hero-inner {
  position: relative;
  z-index: 1;
}

.gauges-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 1.2rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}

@media (max-width: 1080px) {
  .gauges-row { grid-template-columns: 1fr; }
}

.gauge-panel {
  background: rgba(6, 11, 22, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-svg-wrap {
  width: 190px;
  height: 118px;
  position: relative;
  margin-bottom: 0.5rem;
}

.scada-range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 7px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.2);
  outline: none;
  margin: 0.6rem 0 0.35rem;
}

.scada-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #38bdf8;
  border: 3px solid #fff;
  box-shadow: 0 0 12px #06b6d4;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.scada-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* SCADA Switch Toggle */
.scada-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  margin-top: 0.4rem;
}

.scada-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
  cursor: pointer;
  font-size: 0.8rem;
  transition: border-color 0.2s;
}

.scada-switch-row:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

/* Alert Telemetry Banner */
.telemetry-alert-strip {
  border-radius: var(--radius-md);
  padding: 1.1rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.13);
  transition: all 0.28s ease;
}

.telemetry-alert-strip.level-moderada {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.14);
}

.telemetry-alert-strip.level-forte {
  border-color: rgba(249, 115, 22, 0.6);
  background: rgba(249, 115, 22, 0.16);
}

.telemetry-alert-strip.level-critica {
  border-color: #ef4444;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.24), rgba(153, 27, 27, 0.22));
  box-shadow: var(--glow-red);
}

/* Interactive SCADA Circuit Nodes */
.circuit-pipeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-top: 1.1rem;
}

@media (max-width: 1100px) {
  .circuit-pipeline { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .circuit-pipeline { grid-template-columns: 1fr; }
}

.circuit-node {
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  position: relative;
  transition: all 0.25s ease;
  color: var(--text-primary);
}

.circuit-node.lit-green {
  border-color: var(--emerald);
  box-shadow: inset 0 0 18px rgba(16, 185, 129, 0.12);
}

.circuit-node.lit-amber {
  border-color: var(--amber);
  box-shadow: inset 0 0 18px rgba(245, 158, 11, 0.14);
}

.circuit-node.lit-red {
  border-color: var(--crimson);
  background: rgba(127, 29, 29, 0.28);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
}

/* SCADA Unit Cards Grid */
.scada-units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(315px, 1fr));
  gap: 0.95rem;
}

.scada-unit-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  transition: all 0.2s ease;
}

.scada-unit-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.scada-unit-card.tripped {
  border-color: rgba(239, 68, 68, 0.55);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.09), var(--bg-elevated));
}

/* ==========================================================================
   VIEW 4: GEOTECHNICAL DIGITAL TWIN (SVG CROSS-SECTION & FS SIMULATOR)
   ========================================================================== */
.geotech-svg-stage {
  background: linear-gradient(180deg, #070d1c 0%, #0d172e 100%);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.hotspot-pill {
  cursor: pointer;
  transition: filter 0.18s ease;
}
.hotspot-pill:hover {
  filter: brightness(1.25) drop-shadow(0 0 8px rgba(56, 189, 248, 0.8));
}
.hotspot-pill.active-hotspot circle {
  stroke: #fde047;
  stroke-width: 3px;
  filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.95));
}

/* Custom Glassmorphic Leaflet Tooltips & Controls */
.leaflet-container {
  font-family: var(--font-sans) !important;
}
.leaflet-tooltip.gis-glass-tooltip {
  background: rgba(8, 13, 26, 0.92);
  backdrop-filter: blur(10px);
  color: #f8fafc;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.65);
}
.leaflet-tooltip-top.gis-glass-tooltip::before {
  border-top-color: rgba(56, 189, 248, 0.45);
}
.leaflet-control-zoom {
  border: 1px solid var(--border-medium) !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}
.leaflet-control-zoom a {
  background: rgba(10, 16, 31, 0.9) !important;
  color: #f8fafc !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16) !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(6, 182, 212, 0.28) !important;
  color: #38bdf8 !important;
}

/* ==========================================================================
   MODERN DATA TABLES & BADGES
   ========================================================================== */
.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.input-modern, .select-modern {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  transition: border-color 0.18s;
}

.input-modern {
  flex: 1;
  min-width: 240px;
}

.input-modern:focus, .select-modern:focus {
  outline: none;
  border-color: var(--cyan);
}

.modern-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: auto;
  max-height: 560px;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
  text-align: left;
}

.modern-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-card-solid);
  color: var(--text-muted);
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-medium);
  white-space: nowrap;
}

.modern-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.modern-table tbody tr {
  transition: background 0.15s ease;
}

.modern-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.06);
}

/* Pills & Tags */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.58rem;
  border-radius: 99px;
  font-size: 0.71rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-cyan { background: rgba(6, 182, 212, 0.16); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.28); }
.pill-amber { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.28); }
.pill-emerald { background: rgba(16, 185, 129, 0.16); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.28); }
.pill-blue { background: rgba(37, 99, 235, 0.16); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.3); }
.pill-crimson { background: rgba(239, 68, 68, 0.16); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.32); }

/* ==========================================================================
   STRATEGIC CARDS (52 PROPOSITIONS, MODEL 2040, ORG CHART, MANUALS)
   ========================================================================== */
.propositions-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 1rem;
}

.prop-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: all 0.2s ease;
}

.prop-card:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.transform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 1rem;
}

@media (max-width: 600px) {
  .transform-grid { grid-template-columns: 1fr; }
}

.transform-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
}

.transform-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.7rem;
}

.transform-before {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.78rem;
}

.transform-after {
  background: rgba(16, 185, 129, 0.09);
  border: 1px solid rgba(16, 185, 129, 0.26);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.78rem;
}

/* ==========================================================================
   AI COPILOT STUDIO & FLOATING COPILOT DRAWER
   ========================================================================== */
.ai-studio-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1.3rem;
}

@media (max-width: 1080px) {
  .ai-studio-grid { grid-template-columns: 1fr; }
}

.ai-chat-stream {
  height: 500px;
  overflow-y: auto;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.chat-msg {
  max-width: 92%;
  padding: 1rem 1.15rem;
  border-radius: 16px;
  font-size: 0.84rem;
  line-height: 1.6;
  animation: viewEnter 0.22s ease;
}

.chat-msg.user {
  align-self: flex-end;
  background: #0284c7;
  border: 1px solid #38bdf8;
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.chat-msg.bot {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-bottom-left-radius: 4px;
}

.rag-cite-box {
  margin-top: 0.6rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.08);
  border-left: 3px solid var(--cyan);
  font-size: 0.77rem;
}

/* Floating Copilot FAB */
.copilot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  height: 52px;
  padding: 0 1.25rem;
  border-radius: 99px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, #0284c7, #1d4ed8);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(6, 182, 212, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.copilot-fab:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 18px 40px rgba(6, 182, 212, 0.65);
}

/* PDF Modal */
.pdf-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(3, 6, 15, 0.84);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.pdf-modal-backdrop.open {
  display: flex;
}

.pdf-modal-frame {
  width: 96%;
  max-width: 1360px;
  height: 91vh;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8);
}

.pdf-modal-bar {
  padding: 0.85rem 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pdf-modal-frame iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #0f172a;
}

/* Responsive Sidebar Drawer */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .workspace-wrapper {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .command-search {
    width: 210px;
  }
}

@media (max-width: 640px) {
  .topbar-telemetry .telemetry-chip {
    display: none;
  }
  .workspace-content {
    padding: 1rem 1rem 4rem;
  }
}

/* ==========================================================================
   ENHANCED COMPONENTS: POPs, DISPATCH MODAL, MAINTENANCE & PROJECT GUIDES
   ========================================================================== */

/* 10 POPs Interactive Grid */
.pops-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.1rem;
  margin-top: 1rem;
}

.pop-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.pop-card:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 10px 25px rgba(6, 182, 212, 0.12);
}

.pop-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--pop-accent, var(--cyan));
}

.pop-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.pop-code-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.pop-title {
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.45rem;
  color: var(--text-primary);
}

.pop-meta-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pop-objective {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 1rem;
  flex: 1;
}

.pop-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

/* Dispatch / Contingency Report Modal */
.dispatch-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(4, 9, 20, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.dispatch-modal-backdrop.open {
  display: flex;
}

.dispatch-modal-frame {
  width: 96%;
  max-width: 980px;
  max-height: 92vh;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85);
}

.dispatch-modal-bar {
  padding: 0.85rem 1.4rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dispatch-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  font-family: var(--font-sans);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Dispatch Document Styling (Clean Government Document Look) */
.dispatch-paper {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  position: relative;
}

.dispatch-header {
  border-bottom: 2px solid var(--border-accent);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.dispatch-title-block h3 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
}

.dispatch-title-block p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dispatch-grid-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.dispatch-kv-item {
  background: var(--bg-elevated);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.dispatch-kv-label {
  font-size: 0.69rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.dispatch-kv-val {
  font-size: 0.88rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.dispatch-section-h {
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cyan-light);
  margin-bottom: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.dispatch-units-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: 180px;
  overflow-y: auto;
  font-family: var(--font-mono);
}

.dispatch-notice-box {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--crimson);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.83rem;
  line-height: 1.45;
}

/* Maintenance Pillars & Project Cards */
.maintenance-pilar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.maintenance-tool-tag {
  display: inline-block;
  font-size: 0.73rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  margin: 0.2rem 0.2rem 0.2rem 0;
  color: var(--text-secondary);
}

/* ==========================================================================
   EXPANDED MODULES: ANCHORAGE CALCULATOR, PRODUCER SYSTEMS & 7-STAGE FLOW
   ========================================================================== */

/* Anchorage Calculator (Produto 11) */
.anchorage-calc-box {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.anchorage-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calc-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.calc-field-group label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.calc-result-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.calc-kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.calc-kpi-card:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.calc-kpi-card .kpi-num {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--cyan-light);
  line-height: 1.2;
}

.calc-kpi-card .kpi-lbl {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.anchorage-memorial {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Official 7-Stage Flowchart (Anexo I & PPTX) */
.flowchart-stage-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  margin-top: 1rem;
}

.flowchart-stage-node {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-left: 4px solid var(--cyan);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: all 0.25s ease;
  position: relative;
}

.flowchart-stage-node.active-stage {
  border-color: var(--cyan-light);
  border-left-color: var(--cyan);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.25);
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.08), var(--bg-card));
}

.flowchart-stage-node.stage-crimson {
  border-left-color: var(--crimson);
}

.flowchart-stage-node.stage-crimson.active-stage {
  border-color: var(--crimson);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.28);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.09), var(--bg-card));
}

.flowchart-stage-node.stage-amber {
  border-left-color: var(--amber);
}

.flowchart-stage-node.stage-emerald {
  border-left-color: var(--emerald);
}

.flow-step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Producer Systems Cards (Jenipapo & Alto do Céu) */
.producer-system-card {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.producer-system-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.pump-station-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.76rem;
}

/* Half-Hill Pipes Diagnosis Card */
.half-hill-panel {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  margin-bottom: 1.25rem;
}

/* Interactive Checklist Modal (10 POPs) */
.pop-checklist-box {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.pop-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 0.83rem;
  line-height: 1.45;
}

.pop-checklist-item:hover {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.06);
}

.pop-checklist-item.checked {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--text-primary);
}

/* Print Specifics */
@media print {
  body * {
    visibility: hidden;
  }
  .dispatch-paper, .dispatch-paper * {
    visibility: visible;
  }
  .dispatch-paper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
  }
  .dispatch-modal-backdrop {
    position: static;
    background: none;
  }
}



/* ==========================================================================
   TOP TELEMETRY HEADER & CONTROLS
   ========================================================================== */
.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 150;
  background: rgba(9, 19, 38, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
  flex: 1;
}

.view-breadcrumb {
  min-width: 0;
}

.view-breadcrumb h2 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.3;
  margin: 0;
}

.view-breadcrumb p {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.topbar-telemetry {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.85rem;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #0b172e;
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.telemetry-pill:hover {
  background: #112347;
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.telemetry-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

.btn-telemetry-map {
  background: #0e1e3d;
  color: var(--cyan-light);
  border-color: rgba(56, 189, 248, 0.35);
}

.btn-telemetry-map svg {
  width: 14px;
  height: 14px;
  color: var(--cyan-light);
}

.portal-global-search {
  display: flex;
  align-items: center;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 99px;
  background: #071021;
  width: 270px;
  height: 38px;
  padding: 0 0.5rem 0 0.85rem;
  transition: all 0.2s ease;
  position: relative;
}

.portal-global-search:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.portal-global-search input {
  min-width: 0;
  width: 100%;
  padding: 0.4rem 0.5rem;
  color: #f8fafc;
  background: transparent;
  border: 0;
  font-size: 0.78rem;
  font-family: var(--font-sans);
  outline: none;
}

.portal-global-search button {
  padding: 0.4rem;
  border: 0;
  background: transparent;
  color: var(--cyan-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-global-search button svg {
  width: 15px;
  height: 15px;
}

.night-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: #0b172e;
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--cyan-light);
  white-space: nowrap;
}

.night-badge svg {
  width: 13px;
  height: 13px;
  color: var(--amber);
}

/* ==========================================================================
   SEGMENTED CONTROLS & PILL TABS
   ========================================================================== */
.segmented-bar {
  display: inline-flex;
  background: #071021;
  padding: 0.32rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.18);
  gap: 0.35rem;
  flex-wrap: wrap;
}

.seg-btn {
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  padding: 0.48rem 0.95rem !important;
  border-radius: 6px !important;
  font-family: var(--font-sans) !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  transition: all 0.18s ease !important;
  white-space: nowrap !important;
  box-shadow: none !important;
}

.seg-btn svg {
  width: 15px !important;
  height: 15px !important;
  color: inherit !important;
  opacity: 0.85 !important;
}

.seg-btn:hover {
  color: #f8fafc !important;
  background: rgba(56, 189, 248, 0.08) !important;
}

.seg-btn.active {
  background: #162c57 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
}

.seg-btn.active svg {
  opacity: 1 !important;
  color: #38bdf8 !important;
}

/* ==========================================================================
   ENHANCED MODERN COMPONENTS: STRATEGY NAV, LIBRARY TOOLBAR,
   HYDRAULIC PARAMS, MATERIALS COMPARISON & ENGINEERING SUB-TABS
   ========================================================================== */

/* 1. Strategy Navigation Grid (Balanced 5 columns, zero lonely wrap) */
.strategy-segmented-bar {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 0.45rem !important;
  background: rgba(6, 13, 26, 0.75) !important;
  padding: 0.35rem !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-subtle) !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.strategy-segmented-bar .seg-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.45rem !important;
  padding: 0.65rem 0.6rem !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  border-radius: var(--radius-sm) !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-secondary) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  min-height: 40px !important;
}

.strategy-segmented-bar .seg-btn:hover {
  background: rgba(56, 189, 248, 0.08) !important;
  color: var(--text-primary) !important;
  border-color: rgba(56, 189, 248, 0.2) !important;
}

.strategy-segmented-bar .seg-btn.active {
  background: #162c57 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 2px 12px rgba(14, 165, 233, 0.2) !important;
}

.strategy-segmented-bar .seg-badge {
  font-family: var(--font-mono) !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  padding: 0.12rem 0.45rem !important;
  border-radius: var(--radius-pill) !important;
  background: rgba(56, 189, 248, 0.12) !important;
  color: var(--cyan-light) !important;
  border: 1px solid rgba(56, 189, 248, 0.25) !important;
  flex-shrink: 0 !important;
}

.strategy-segmented-bar .seg-btn.active .seg-badge {
  background: rgba(56, 189, 248, 0.28) !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
}

@media (max-width: 1200px) {
  .strategy-segmented-bar {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  }
}

/* 2. Library Toolbar Card (Clean single-border toolbar, unified button heights) */
.library-toolbar-card {
  background: rgba(9, 19, 38, 0.85) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  padding: 0.5rem 0.75rem !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

.library-toolbar-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 0.75rem !important;
  flex-wrap: wrap !important;
}

.library-tabs-group {
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  flex-wrap: wrap !important;
}

.library-tabs-group .seg-btn {
  height: 38px !important;
  padding: 0 0.95rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  border-radius: var(--radius-sm) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  white-space: nowrap !important;
}

.library-actions-group {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.lib-action-btn {
  height: 38px !important;
  padding: 0 0.85rem !important;
  font-size: 0.76rem !important;
  font-family: var(--font-mono) !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  border-radius: var(--radius-sm) !important;
  background: rgba(14, 30, 61, 0.6) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-secondary) !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}

.lib-action-btn:hover {
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: var(--cyan-light) !important;
  color: var(--text-primary) !important;
  transform: translateY(-1px) !important;
}

/* 3. Hydraulic Parameters Grid (High density 3x2 parameter cards, zero empty void) */
.hydraulic-params-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 1rem !important;
  margin-bottom: 1.5rem !important;
}

@media (max-width: 1080px) {
  .hydraulic-params-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 680px) {
  .hydraulic-params-grid {
    grid-template-columns: 1fr !important;
  }
}

.hydraulic-param-card {
  background: rgba(9, 19, 38, 0.75) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  padding: 1rem 1.15rem !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  gap: 0.75rem !important;
  transition: all 0.25s ease !important;
  position: relative !important;
  overflow: hidden !important;
}

.hydraulic-param-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan-light), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.hydraulic-param-card:hover {
  border-color: rgba(56, 189, 248, 0.4) !important;
  background: rgba(14, 30, 61, 0.85) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
}

.hydraulic-param-card:hover::before {
  opacity: 1;
}

.hydraulic-card-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.hydraulic-card-title-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.hydraulic-card-icon {
  width: 28px !important;
  height: 28px !important;
  border-radius: var(--radius-xs) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(56, 189, 248, 0.12) !important;
  color: var(--cyan-light) !important;
  flex-shrink: 0 !important;
}

.hydraulic-card-icon svg {
  width: 15px !important;
  height: 15px !important;
}

.hydraulic-card-title {
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  color: var(--text-primary) !important;
}

.hydraulic-card-badge {
  font-family: var(--font-mono) !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  padding: 0.15rem 0.45rem !important;
  border-radius: var(--radius-pill) !important;
  background: rgba(14, 165, 233, 0.12) !important;
  color: var(--cyan-light) !important;
  border: 1px solid rgba(14, 165, 233, 0.25) !important;
}

.hydraulic-card-value-strip {
  background: rgba(6, 13, 26, 0.6) !important;
  border: 1px solid rgba(56, 189, 248, 0.15) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.6rem 0.75rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.5rem !important;
}

.hydraulic-value-text {
  font-family: var(--font-mono) !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
}

.hydraulic-card-notes {
  font-size: 0.78rem !important;
  color: var(--text-secondary) !important;
  line-height: 1.5 !important;
  margin: 0 !important;
}

.hydraulic-card-footer {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding-top: 0.5rem !important;
  border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* 4. Materials Comparative Grid (NO horizontal pill blowout, structured cards) */
.materials-compare-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 1.15rem !important;
  margin-bottom: 1.5rem !important;
}

@media (max-width: 980px) {
  .materials-compare-grid {
    grid-template-columns: 1fr !important;
  }
}

.material-card {
  background: rgba(9, 19, 38, 0.85) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  padding: 1.15rem 1.25rem !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  gap: 0.9rem !important;
  position: relative !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  overflow: hidden !important;
}

.material-card:hover {
  border-color: rgba(56, 189, 248, 0.45) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(14, 165, 233, 0.12) !important;
  transform: translateY(-2px) !important;
}

.material-card-header {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.45rem !important;
}

.material-header-top {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.material-badge {
  font-family: var(--font-mono) !important;
  font-size: 0.67rem !important;
  font-weight: 700 !important;
  padding: 0.18rem 0.55rem !important;
  border-radius: var(--radius-pill) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

.material-badge-primary {
  background: rgba(16, 185, 129, 0.15) !important;
  color: var(--emerald-light) !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.material-badge-info {
  background: rgba(56, 189, 248, 0.15) !important;
  color: var(--cyan-light) !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

.material-badge-metal {
  background: rgba(96, 165, 250, 0.15) !important;
  color: var(--blue-light) !important;
  border: 1px solid rgba(96, 165, 250, 0.3) !important;
}

.material-norm-tag {
  font-size: 0.68rem !important;
  font-family: var(--font-mono) !important;
  color: var(--text-muted) !important;
  font-weight: 600 !important;
}

.material-card-title {
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  margin: 0 !important;
  line-height: 1.3 !important;
}

/* FIX CRITICAL OVERFLOW BUG: white-space: normal !important */
.material-app-box {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.5rem !important;
  padding: 0.6rem 0.75rem !important;
  background: rgba(14, 165, 233, 0.08) !important;
  border: 1px solid rgba(14, 165, 233, 0.22) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--cyan-light) !important;
  font-size: 0.78rem !important;
  line-height: 1.45 !important;
  white-space: normal !important;
  word-break: normal !important;
}

.material-app-box svg {
  width: 15px !important;
  height: 15px !important;
  flex-shrink: 0 !important;
  margin-top: 2px !important;
}

.material-section {
  padding: 0.65rem 0.8rem !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.79rem !important;
  line-height: 1.45 !important;
}

.material-advantages {
  background: rgba(16, 185, 129, 0.06) !important;
  border-left: 3px solid var(--emerald) !important;
  border-top: 1px solid rgba(16, 185, 129, 0.12) !important;
  border-right: 1px solid rgba(16, 185, 129, 0.12) !important;
  border-bottom: 1px solid rgba(16, 185, 129, 0.12) !important;
  color: var(--text-primary) !important;
}

.material-advantages .sec-header {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  color: var(--emerald-light) !important;
  font-weight: 700 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase !important;
  margin-bottom: 0.25rem !important;
}

.material-warnings {
  background: rgba(245, 158, 11, 0.06) !important;
  border-left: 3px solid var(--amber) !important;
  border-top: 1px solid rgba(245, 158, 11, 0.12) !important;
  border-right: 1px solid rgba(245, 158, 11, 0.12) !important;
  border-bottom: 1px solid rgba(245, 158, 11, 0.12) !important;
  color: var(--text-secondary) !important;
}

.material-warnings .sec-header {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  color: var(--amber-light) !important;
  font-weight: 700 !important;
  font-size: 0.75rem !important;
  text-transform: uppercase !important;
  margin-bottom: 0.25rem !important;
}

/* 5. Engineering Tabs Bar (Balanced 4 columns, clear technical titles) */
.engineering-tabs-bar {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.45rem !important;
  background: rgba(6, 13, 26, 0.75) !important;
  padding: 0.35rem !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-subtle) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-bottom: 1.25rem !important;
}

@media (max-width: 1024px) {
  .engineering-tabs-bar {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 600px) {
  .engineering-tabs-bar {
    grid-template-columns: 1fr !important;
  }
}

.engineering-tabs-bar .seg-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.45rem !important;
  padding: 0.65rem 0.65rem !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  border-radius: var(--radius-sm) !important;
  min-height: 40px !important;
}

.engineering-tabs-bar .eng-tab-badge {
  font-family: var(--font-mono) !important;
  font-size: 0.64rem !important;
  font-weight: 700 !important;
  padding: 0.1rem 0.4rem !important;
  border-radius: var(--radius-pill) !important;
  background: rgba(56, 189, 248, 0.12) !important;
  color: var(--cyan-light) !important;
  border: 1px solid rgba(56, 189, 248, 0.25) !important;
  flex-shrink: 0 !important;
}

.engineering-tabs-bar .seg-btn.active .eng-tab-badge {
  background: rgba(56, 189, 248, 0.28) !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
}

/* Aerial Guide Details Cards */
.aerial-detail-card {
  background: rgba(9, 19, 38, 0.8) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.8rem 1rem !important;
  transition: all 0.2s ease !important;
}

.aerial-detail-card:hover {
  background: rgba(14, 30, 61, 0.9) !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
}

.aerial-detail-card .detail-head {
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  font-size: 0.74rem !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  margin-bottom: 0.35rem !important;
}

.aerial-detail-card .detail-body {
  font-size: 0.8rem !important;
  color: var(--text-secondary) !important;
  line-height: 1.5 !important;
  margin: 0 !important;
}


/* ==========================================================================
   REFERO / ORYZO AI DESIGN SYSTEM: UNDERLINE TABS & DENSITY SWITCHERS
   (Clean baseline, borderless tabs, animated floating glow indicator, soft pills)
   ========================================================================== */

/* 1. Universal Refero Modern Tab Strip (Underline Variant) */
.refero-tab-strip {
  display: flex !important;
  align-items: center !important;
  gap: 1.5rem !important;
  border-bottom: 1px solid rgba(56, 189, 248, 0.15) !important;
  position: relative !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: auto !important;
  scrollbar-width: none !important;
  padding: 0 0.25rem !important;
}

.refero-tab-strip::-webkit-scrollbar {
  display: none !important;
}

.refero-tab-btn {
  background: transparent !important;
  border: none !important;
  padding: 0.85rem 0.25rem 0.95rem !important;
  color: var(--text-secondary) !important;
  font-family: var(--font-sans) !important;
  font-size: 0.84rem !important;
  font-weight: 500 !important;
  letter-spacing: -0.01em !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  position: relative !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  outline: none !important;
  box-shadow: none !important;
  transition: color 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.refero-tab-btn svg {
  width: 16px !important;
  height: 16px !important;
  opacity: 0.7 !important;
  transition: opacity 0.18s ease, color 0.18s ease !important;
}

.refero-tab-btn:hover {
  color: #f8fafc !important;
}

.refero-tab-btn:hover svg {
  opacity: 1 !important;
  color: var(--cyan-light) !important;
}

.refero-tab-btn.active {
  color: #ffffff !important;
  font-weight: 700 !important;
}

.refero-tab-btn.active svg {
  opacity: 1 !important;
  color: var(--cyan-light) !important;
}

/* Floating Rounded Glow Underline (exact Refero style) */
.refero-tab-btn::after {
  content: '' !important;
  position: absolute !important;
  bottom: -1px !important;
  left: 0 !important;
  right: 0 !important;
  height: 2px !important;
  background: var(--cyan-light) !important;
  border-radius: 99px !important;
  opacity: 0 !important;
  transform: scaleX(0.4) !important;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease !important;
}

.refero-tab-btn.active::after {
  opacity: 1 !important;
  transform: scaleX(1) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7) !important;
}

/* Micro Count / Product Chip */
.refero-tab-btn .tab-chip {
  font-family: var(--font-mono) !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  padding: 0.12rem 0.45rem !important;
  border-radius: 99px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-muted) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  transition: all 0.18s ease !important;
  line-height: 1 !important;
}

.refero-tab-btn:hover .tab-chip {
  color: var(--text-secondary) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

.refero-tab-btn.active .tab-chip {
  background: rgba(56, 189, 248, 0.15) !important;
  color: var(--cyan-light) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}

/* 2. Refero Density Toggle Switch (Compact vs Extended - Image 2 style) */
.refero-density-switch {
  display: inline-flex !important;
  align-items: center !important;
  padding: 3px !important;
  border-radius: 8px !important;
  background: rgba(6, 13, 26, 0.75) !important;
  border: 1px solid rgba(56, 189, 248, 0.2) !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4) !important;
  gap: 2px !important;
}

.refero-density-btn {
  height: 28px !important;
  padding: 0 11px !important;
  font-family: var(--font-sans) !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  border-radius: 6px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--text-muted) !important;
  cursor: pointer !important;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  white-space: nowrap !important;
  outline: none !important;
}

.refero-density-btn svg {
  width: 13px !important;
  height: 13px !important;
  opacity: 0.7 !important;
}

.refero-density-btn:hover {
  color: var(--text-primary) !important;
  background: rgba(56, 189, 248, 0.08) !important;
}

.refero-density-btn.active {
  background: #162c57 !important;
  color: #ffffff !important;
  border-color: rgba(56, 189, 248, 0.45) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 8px rgba(56, 189, 248, 0.25) !important;
}

.refero-density-btn.active svg {
  opacity: 1 !important;
  color: var(--cyan-light) !important;
}

/* 3. Toolbar Row with Left Tabs and Right Actions/Density */
.refero-nav-toolbar {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 1.25rem !important;
  border-bottom: 1px solid rgba(56, 189, 248, 0.15) !important;
  margin-bottom: 1.5rem !important;
  padding-bottom: 0 !important;
  flex-wrap: wrap !important;
}

.refero-nav-toolbar .refero-tab-strip {
  border-bottom: none !important;
  padding: 0 !important;
  flex: 1 !important;
}

.refero-toolbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  padding-bottom: 0.5rem !important;
}

/* Density Modifier Helpers */
.density-compact .density-extended-only {
  display: none !important;
}
.density-extended .density-compact-only {
  display: none !important;
}

/* Refero POP Card & Density Layout Extensions */
.pop-card.pop-card-extended {
  grid-column: span 2;
  border-color: rgba(56, 189, 248, 0.35) !important;
  background: linear-gradient(180deg, rgba(14, 30, 61, 0.95) 0%, rgba(9, 19, 38, 0.98) 100%) !important;
}

@media (max-width: 900px) {
  .pop-card.pop-card-extended {
    grid-column: span 1;
  }
}

.pop-extended-body {
  animation: referoFadeIn 0.22s ease-out;
}

@keyframes referoFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
