/* ==========================================================================
   SCADA EXECUTIVE SYSTEM DESIGN - MAPA OPERACIONAL DOS PONTOS
   Centro de Supervisão Georreferenciado • Telemetria Hídrica Palmital/SP
   ========================================================================== */

:root {
  /* Paleta Base SCADA Executiva */
  --scada-bg: #f8fafc;
  --scada-surface: #ffffff;
  --scada-surface-subtle: #f1f5f9;
  --scada-border: #cbd5e1;
  --scada-border-light: #e2e8f0;
  --scada-border-focus: #0284c7;

  /* Tipografia & Cores de Texto */
  --text-heading: #0f172a;       /* Navy Escuro */
  --text-body: #334155;          /* Cinza Slate Médio */
  --text-muted: #64748b;         /* Cinza Suave */
  --text-subtle: #94a3b8;

  /* Cores de Destaque SCADA */
  --scada-navy: #0f172a;
  --scada-navy-card: #1e293b;
  --scada-blue: #0284c7;         /* Azul Saneamento */
  --scada-blue-hover: #0369a1;
  --scada-cyan: #06b6d4;
  --scada-cyan-light: #ecfeff;
  --scada-emerald: #10b981;      /* Verde Operacional Online */
  --scada-emerald-bg: #ecfdf5;
  --scada-amber: #f59e0b;        /* Amarelo Alerta / Atenção */
  --scada-amber-bg: #fffbeb;
  --scada-rose: #ef4444;         /* Vermelho Offline */
  --scada-rose-bg: #fef2f2;

  /* Sombras Sutis Industriais */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* Reset & Configurações Globais */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--scada-bg);
  color: var(--text-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1rem;
  -webkit-font-smoothing: antialiased;
}

body.auth-loading .map-app-container {
  visibility: hidden;
  opacity: 0;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace !important;
}

.hidden {
  display: none !important;
}

.text-online {
  color: var(--scada-emerald) !important;
}

.text-offline {
  color: var(--scada-rose) !important;
}

.text-warning {
  color: var(--scada-amber) !important;
}

/* Container Principal */
.map-app-container {
  width: 100%;
  max-width: 1480px;
  background: var(--scada-surface);
  border: 1px solid var(--scada-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. CABEÇALHO SCADA
   ========================================================================== */
.scada-header {
  background: var(--scada-navy);
  color: #ffffff;
  padding: 1.1rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--scada-blue);
  flex-wrap: wrap;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.scada-brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scada-brand-icon svg {
  width: 26px;
  height: 26px;
}

.header-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-title-row h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.scada-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(2, 132, 199, 0.35);
  color: #38bdf8;
  border: 1px solid #0284c7;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.header-sub {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.header-comm-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.07);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.comm-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.status-indicator {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.status-indicator::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-online {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid #059669;
}

.status-online::before {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.status-offline {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid #dc2626;
}

.status-offline::before {
  background: #ef4444;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-tech {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(2, 132, 199, 0.25);
  color: #38bdf8;
  border: 1px solid #0284c7;
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-tech:hover {
  background: var(--scada-blue);
  color: #ffffff;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
  border-color: #ef4444;
}

/* ==========================================================================
   2. GRADE SUPERIOR DE MÉTRICAS EXECUTIVAS
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--scada-surface-subtle);
  border-bottom: 1px solid var(--scada-border-light);
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.metric-card {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border-light);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.metric-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.metric-icon-badge {
  font-size: 0.85rem;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-top: 0.15rem;
}

.metric-denom {
  font-size: 0.95rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.metric-value .unit {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   3. ÁREA PRINCIPAL: MAPA (70%) + LISTA DE PONTOS (30%)
   ========================================================================== */
.main-content-grid {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  min-height: 620px;
}

@media (max-width: 1024px) {
  .main-content-grid {
    grid-template-columns: 1fr;
  }
}

/* Painel do Mapa */
.map-pane {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border-light);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--scada-border-light);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pane-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: 0.02em;
}

.pane-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-online {
  background: #10b981;
  box-shadow: 0 0 4px #10b981;
}

.dot-offline {
  background: #ef4444;
}

.dot-planned {
  background: #94a3b8;
}

.map-wrapper {
  position: relative;
  flex: 1;
  min-height: 520px;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 520px;
  z-index: 1;
}

/* Aviso de Localização Pendente */
.geo-notice {
  position: absolute;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 0.85rem 1.15rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  backdrop-filter: blur(4px);
}

.geo-notice-icon {
  font-size: 1.4rem;
}

.geo-notice-content strong {
  font-size: 0.85rem;
  color: #f59e0b;
  display: block;
}

.geo-notice-content p {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-top: 0.15rem;
}

/* ==========================================================================
   4. PAINEL LATERAL: LISTA DE PONTOS
   ========================================================================== */
.sidebar-pane {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border-light);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.sidebar-header {
  padding: 1rem 1.15rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--scada-border-light);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: 0.02em;
}

.badge-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: var(--text-body);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--scada-border);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
}

.search-box input {
  border: none;
  outline: none;
  font-size: 0.8rem;
  color: var(--text-body);
  width: 100%;
  font-family: inherit;
}

.filter-tabs {
  display: flex;
  gap: 0.35rem;
}

.filter-tab {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--scada-border-light);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab.active {
  background: var(--scada-blue);
  color: #ffffff;
  border-color: var(--scada-blue);
}

.devices-list {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: #fafafa;
}

/* Card do Dispositivo */
.device-item-card {
  background: #ffffff;
  border: 1px solid var(--scada-border);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.device-item-card:hover {
  border-color: var(--scada-blue);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.device-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.device-id-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

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

.device-friendly-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--scada-blue);
}

.device-tech-code {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
}

.status-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.status-pill.status-online {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid #10b981;
}

.status-pill.status-offline {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid #ef4444;
}

/* Grade Executiva de Métricas no Card Lateral */
.device-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  background: #f8fafc;
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.75rem;
}

.device-metric-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cell-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.cell-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
}

.cell-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Informações de Recebimento */
.device-footer-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-top: 1px dashed var(--scada-border-light);
  padding-top: 0.6rem;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
}

.footer-label {
  color: var(--text-muted);
}

.footer-val {
  font-weight: 600;
  color: var(--text-body);
}

/* Seção de Detalhes Técnicos Secundários */
.device-technical-section {
  background: #f1f5f9;
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tech-section-title {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.6rem;
}

.tech-item {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.tech-label {
  font-size: 0.6rem;
  color: var(--text-subtle);
}

.tech-val {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-body);
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  background: #f1f5f9;
  border-top: 1px solid var(--scada-border-light);
  text-align: center;
}

.sidebar-footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================================
   5. BARRA INFERIOR DE STATUS
   ========================================================================== */
.scada-footer-bar {
  background: var(--scada-navy);
  color: #94a3b8;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-status-left,
.footer-status-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-status-right strong {
  color: #ffffff;
}

.separator {
  color: #475569;
}

/* ==========================================================================
   6. ESTILIZAÇÃO DO MARCADOR & POPUP LEAFLET (SCADA EXECUTIVO)
   ========================================================================== */
/* Marcador com Halo Sutil */
.scada-marker-container {
  position: relative;
  width: 24px;
  height: 24px;
}

.scada-marker-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid #ffffff;
  position: absolute;
  top: 4px;
  left: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

.scada-marker-dot.online {
  background-color: #10b981;
}

.scada-marker-dot.offline {
  background-color: #ef4444;
}

.scada-marker-halo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.4;
  z-index: 1;
}

.scada-marker-halo.online {
  background-color: #10b981;
  animation: scada-pulse 2.2s infinite ease-out;
}

.scada-marker-halo.offline {
  display: none;
}

@keyframes scada-pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scada-marker-halo.online {
    animation: none;
    transform: scale(1.2);
    opacity: 0.25;
  }
}

/* Tooltip Customizado */
.leaflet-tooltip.scada-map-tooltip {
  background: var(--scada-navy);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.75rem;
  box-shadow: var(--shadow-md);
}

.leaflet-tooltip.scada-map-tooltip::before {
  border-top-color: var(--scada-navy);
}

/* Popup Leaflet Customizado */
.leaflet-popup-content-wrapper {
  background: #ffffff !important;
  border-radius: 10px !important;
  border: 1px solid var(--scada-border) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}

.popup-executive-card {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  min-width: 260px;
  max-width: 320px;
  color: #1e293b;
}

.popup-header {
  background: var(--scada-navy);
  color: #ffffff;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.popup-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.01em;
}

.popup-tech-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: #94a3b8;
  display: block;
}

.popup-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.popup-badge.online {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid #059669;
}

.popup-badge.offline {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid #dc2626;
}

.popup-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.popup-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.35rem;
}

.popup-metric-label {
  color: #64748b;
  font-weight: 600;
}

.popup-metric-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #0f172a;
}

.popup-tech-footer {
  background: #f8fafc;
  border-top: 1px solid var(--scada-border-light);
  padding: 0.6rem 1rem;
  font-size: 0.68rem;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* ==========================================================================
   Seção Executiva: Comportamento da Vazão (24h)
   ========================================================================== */
.map-flow-section {
  background: var(--scada-surface);
  border-top: 1px solid var(--scada-border);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.map-flow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.map-flow-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.map-flow-icon {
  width: 36px;
  height: 36px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.map-flow-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: 0.02em;
}

.map-flow-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.map-flow-status-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.session-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
}

.session-status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

.session-status-badge.status-online {
  background: var(--scada-emerald-bg);
  color: var(--scada-emerald);
  border: 1px solid #a7f3d0;
}

.session-status-badge.status-offline {
  background: var(--scada-rose-bg);
  color: var(--scada-rose);
  border: 1px solid #fecaca;
}

.map-flow-relative-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.map-flow-chart-wrapper {
  background: #f8fafc;
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.75rem;
  min-height: 260px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: 1.5rem;
}

.map-chart-empty .empty-icon {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.map-chart-empty .empty-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-heading);
}

.map-chart-empty .empty-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 400px;
}

.map-chart-svg {
  width: 100%;
  height: 250px;
  display: block;
}

/* Tooltip Flutuante Interativo do Gráfico do Mapa */
.map-flow-chart-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid #38bdf8;
  color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -100%);
  margin-top: -12px;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.map-flow-chart-tooltip.visible {
  opacity: 1;
}

.map-flow-chart-tooltip .tt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 0.35rem;
  margin-bottom: 0.2rem;
}

.map-flow-chart-tooltip .tt-date {
  font-weight: 800;
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.map-flow-chart-tooltip .tt-status {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.map-flow-chart-tooltip .tt-status.status-flow {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.4);
}

.map-flow-chart-tooltip .tt-status.status-no-flow {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.map-flow-chart-tooltip .tt-status.status-insufficient {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.map-flow-chart-tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
}

.map-flow-chart-tooltip .tt-label {
  color: #94a3b8;
}

.map-flow-chart-tooltip .tt-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: #ffffff;
}

.map-flow-chart-tooltip .tt-hint {
  font-size: 0.65rem;
  color: #64748b;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 0.25rem;
  margin-top: 0.15rem;
}
