/* ==========================================================================
   SCADA INDUSTRIAL SYSTEM DESIGN - TELEMETRIA HÍDRICA
   Design System: Alto Contraste, Linhas Industriais, Saneamento / Supervisório
   ========================================================================== */

:root {
  /* Paleta Base SCADA */
  --scada-bg: #f1f5f9;
  --scada-surface: #ffffff;
  --scada-surface-subtle: #f8fafc;
  --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-header: #1e293b;
  --scada-blue: #0284c7;
  /* Azul Saneamento */
  --scada-blue-hover: #0369a1;
  --scada-cyan: #06b6d4;
  --scada-cyan-light: #ecfeff;
  --scada-emerald: #059669;
  /* Verde Operacional */
  --scada-emerald-bg: #ecfdf5;
  --scada-amber: #d97706;
  /* Amarelo Alerta */
  --scada-amber-bg: #fffbeb;
  --scada-rose: #dc2626;
  /* Vermelho Erro */
  --scada-rose-bg: #fef2f2;

  /* Sombras Sutis Industriais */
  --shadow-sm: 0 1px 2px 0 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: 1.5rem 1rem;
  -webkit-font-smoothing: antialiased;
}

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

.hidden {
  display: none !important;
}

/* Container Principal do Supervisório */
.app-container {
  width: 100%;
  max-width: 1100px;
  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 INDUSTRIAL
   ========================================================================== */
.scada-header {
  background: var(--scada-navy);
  color: #ffffff;
  padding: 1.25rem 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.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  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;
}

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

.device-pill {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  overflow: hidden;
}

.device-pill-label {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.4rem 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.device-select {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.65rem;
  color: #38bdf8;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
}

.device-select option {
  background: #0f172a;
  color: #f8fafc;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
}

.device-pill-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  color: #38bdf8;
}

/* Indicadores de Status Operacional */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
}

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

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

.status-online .status-dot {
  background: var(--scada-emerald);
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.6);
}

.status-offline {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.status-offline .status-dot {
  background: #94a3b8;
}

/* ==========================================================================
   CONTEÚDO PRINCIPAL
   ========================================================================== */
.main-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Toast de Pulso */
.pulse-toast {
  background: #0f172a;
  color: #ffffff;
  border-left: 4px solid #38bdf8;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  font-weight: 700;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pulse-toast .pulse-icon {
  font-size: 1.1rem;
}

/* Tela de Espera (Waiting) */
.waiting-container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
}

.waiting-spinner {
  position: relative;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid #e2e8f0;
  border-top-color: var(--scada-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.waiting-icon {
  font-size: 1.2rem;
}

.waiting-container h2 {
  font-size: 1.1rem;
  color: var(--text-heading);
  margin-bottom: 0.25rem;
}

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

.dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ==========================================================================
   2. GRID DE CARDS SUPERIORES SCADA (3 COLUNAS)
   ========================================================================== */
.scada-top-grid {
  display: grid;
  gap: 1.25rem;
}

.scada-top-grid-primary {
  grid-template-columns: repeat(4, 1fr);
}

.scada-top-grid-secondary {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1080px) {
  .scada-top-grid-primary {
    grid-template-columns: repeat(2, 1fr);
  }

  .scada-top-grid-secondary {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .scada-top-grid-primary {
    grid-template-columns: 1fr;
  }

  .scada-top-grid-secondary {
    grid-template-columns: 1fr;
  }
}

.scada-card {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scada-card-header {
  background: var(--scada-navy-header);
  color: #ffffff;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid rgba(2, 132, 199, 0.4);
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header-icon {
  font-size: 1rem;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #f8fafc;
}

.scada-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
}

/* Badges SCADA */
.scada-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-blue {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
  border: 1px solid rgba(103, 232, 249, 0.4);
}

.badge-today {
  background: rgba(6, 182, 212, 0.2);
  color: #38bdf8;
  border: 1px solid #0284c7;
  font-weight: 800;
}

.badge-green,
.badge-closed {
  background: rgba(5, 150, 105, 0.2);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.5);
}

.badge-amber,
.badge-partial {
  background: rgba(217, 119, 6, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(217, 119, 6, 0.5);
}

.badge-purple,
.badge-test {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.5);
}

.badge-slate {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(203, 213, 225, 0.3);
}

.badge-coral,
.badge-red {
  background: rgba(225, 29, 72, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.text-cyan {
  color: #0284c7 !important;
}

/* Valores Numéricos de Alto Destaque */
.scada-value-hero {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--scada-navy);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.scada-value-hero .unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.scada-value-medium {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--scada-navy);
  line-height: 1.2;
}

.scada-value-medium .unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.flow-m3h-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--scada-blue);
}

.scada-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Card 3: Layout Grid Técnico */
.scada-tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 1rem;
}

.tech-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border-light);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
}

.tech-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.tech-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
}

.tech-val-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

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

.rssi-quality-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
}

.rssi-excellent {
  background: #dcfce7;
  color: #15803d;
}

.rssi-good {
  background: #e0f2fe;
  color: #0369a1;
}

.rssi-fair {
  background: #fef9c3;
  color: #a16207;
}

.rssi-weak {
  background: #fee2e2;
  color: #b91c1c;
}

/* ==========================================================================
   3. PAINEL CENTRAL DE OPERAÇÃO: TENDÊNCIA VAZÃO (24h)
   ========================================================================== */
.scada-chart-panel {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scada-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--scada-border-light);
}

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

.chart-title-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;
}

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

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

.chart-header-status-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.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;
}

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

.flow-calibration-notice {
  background: var(--scada-amber-bg);
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Container do Gráfico SVG */
.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;
}

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

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

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

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

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

/* ==========================================================================
   4. GAVETAS EM SANFONA SCADA (<details>)
   ========================================================================== */
.scada-accordion-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scada-accordion {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.scada-accordion[open] {
  border-color: #94a3b8;
}

.scada-accordion-summary {
  list-style: none;
  background: var(--scada-surface-subtle);
  padding: 0.9rem 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background 0.15s;
}

.scada-accordion-summary::-webkit-details-marker {
  display: none;
}

.scada-accordion-summary:hover {
  background: #f1f5f9;
}

.scada-accordion[open] .scada-accordion-summary {
  border-bottom-color: var(--scada-border-light);
  background: #f1f5f9;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.summary-icon {
  font-size: 1.1rem;
}

.summary-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-heading);
  display: block;
}

.summary-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}

.summary-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.scada-accordion[open] .summary-arrow {
  transform: rotate(180deg);
}

.scada-accordion-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--scada-surface);
}

/* Gaveta 1: Mini KPIs */
.scada-mini-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.scada-mini-card {
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mini-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.mini-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-heading);
}

.mini-val .unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.mini-val.text-sm {
  font-size: 0.95rem;
}

.mini-val.text-blue {
  color: var(--scada-blue);
}

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

/* Gráficos Secundários */
.scada-secondary-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 800px) {
  .scada-secondary-charts-grid {
    grid-template-columns: 1fr;
  }
}

.scada-subchart-card {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.subchart-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: 0.04em;
}

.subchart-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.subchart-wrapper {
  min-height: 140px;
}

/* Gaveta 2: Sessão de Fluxo Hero */
.scada-session-hero {
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border);
  border-left: 4px solid var(--scada-blue);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scada-session-hero.card-session-hero-closed {
  border-left-color: var(--text-muted);
}

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

.session-hero-badge-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.session-hero-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-heading);
}

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

.session-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--scada-border-light);
}

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

.sm-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sm-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-heading);
}

.text-blue {
  color: var(--scada-blue);
}

.text-cyan {
  color: var(--scada-cyan);
}

/* Gaveta 3: Estatísticas de Histórico */
.scada-history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.stat-box {
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
}

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

.stat-value.text-sm {
  font-size: 0.95rem;
}

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

/* Tabelas SCADA */
.scada-table-container {
  overflow-x: auto;
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  background: var(--scada-surface);
}

.scada-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  text-align: left;
}

.scada-table th {
  background: #f1f5f9;
  color: var(--text-heading);
  font-weight: 700;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--scada-border-light);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.scada-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--scada-border-light);
  color: var(--text-body);
  white-space: nowrap;
}

.scada-table tr:hover {
  background: #f8fafc;
}

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

.td-bold {
  font-weight: 700;
  color: var(--text-heading);
}

.table-empty-state {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Badges de Eventos da Tabela */
.badge-event {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
}

.badge-event-pulse {
  background: #e0f2fe;
  color: #0284c7;
}

.badge-event-accumulated {
  background: #fef3c7;
  color: #d97706;
}

.badge-event-reset {
  background: #fee2e2;
  color: #dc2626;
}

.badge-session-open {
  background: #dcfce7;
  color: #16a34a;
}

/* ==========================================================================
   5. TERMINAL DE CALIBRAÇÃO (WIZARD GUIADO + MODO MANUAL)
   ========================================================================== */
.calib-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calib-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--scada-border-light);
}

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

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

.calib-state-box {
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.calib-state-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-heading);
}

.calib-instructions {
  font-size: 0.8rem;
  color: var(--text-body);
  line-height: 1.4;
}

.calib-active-alert {
  background: var(--scada-blue);
  color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.calib-active-alert p {
  font-size: 0.75rem;
  color: #e0f2fe;
}

.calib-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.calib-metric-col {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border-light);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.c-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
}

.c-val {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.calib-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: 0.02em;
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.scada-input {
  width: 100%;
  background: var(--scada-surface);
  border: 1px solid var(--scada-border);
  padding: 0.55rem 0.75rem;
  padding-right: 3rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  border-radius: 4px;
  color: var(--text-heading);
  outline: none;
  transition: border-color 0.15s;
}

.scada-input:focus {
  border-color: var(--scada-blue);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.input-unit {
  position: absolute;
  right: 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.calib-btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Botões SCADA */
.scada-btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.55rem 1.1rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.scada-btn:active {
  transform: translateY(1px);
}

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

.scada-btn-primary:hover {
  background: var(--scada-blue-hover);
}

.scada-btn-success {
  background: var(--scada-emerald);
  color: #ffffff;
}

.scada-btn-success:hover {
  background: #047857;
}

.scada-btn-danger {
  background: #fee2e2;
  color: var(--scada-rose);
  border: 1px solid #fca5a5;
}

.scada-btn-danger:hover {
  background: #fecaca;
}

.scada-btn-secondary {
  background: #e2e8f0;
  color: var(--text-body);
}

.scada-btn-secondary:hover {
  background: #cbd5e1;
}

/* Caixa de Prévia de Calibração */
.calib-preview-box {
  background: var(--scada-surface);
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 0.9rem;
}

.preview-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--scada-blue);
  margin-bottom: 0.5rem;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.prev-item-highlight {
  grid-column: span 2;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 0.65rem 0.85rem;
  border-radius: 4px;
}

.p-label {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
}

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

.p-val-large {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--scada-blue);
  display: block;
}

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

.calib-error-banner {
  background: var(--scada-rose-bg);
  border: 1px solid #fca5a5;
  color: var(--scada-rose);
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.scada-sub-accordion {
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  overflow: hidden;
}

.scada-sub-accordion-summary {
  padding: 0.65rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-body);
  cursor: pointer;
  user-select: none;
}

.sub-accordion-content {
  padding: 0.75rem 0.9rem;
  background: var(--scada-surface);
  border-top: 1px solid var(--scada-border-light);
}

.manual-calib-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.calib-footer-note {
  font-size: 0.725rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ==========================================================================
   6. RODAPÉ SCADA INSTITUCIONAL
   ========================================================================== */
.scada-footer {
  background: #f8fafc;
  border-top: 1px solid var(--scada-border-light);
  padding: 0.75rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.725rem;
  color: var(--text-muted);
}

.footer-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.pill-bullet {
  width: 6px;
  height: 6px;
  background: var(--scada-emerald);
  border-radius: 50%;
}

.footer-info-items {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-item-highlight {
  font-weight: 700;
  color: var(--text-heading);
}

/* ==========================================================================
   7. OTIMIZAÇÕES MOBILE-FIRST SCADA (SMARTPHONES E TABLETS DE CAMPO)
   ========================================================================== */
@media (max-width: 640px) {
  body {
    padding: 0.5rem 0.25rem;
  }

  .app-container {
    border-radius: 8px;
    border-left: none;
    border-right: none;
  }

  .scada-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .header-brand {
    width: 100%;
  }

  .header-title-row h1 {
    font-size: 1.1rem;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .main-content {
    padding: 0.85rem 0.65rem;
    gap: 1rem;
  }

  .scada-top-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .scada-value-hero {
    font-size: 1.65rem;
  }

  .scada-tech-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .scada-chart-panel {
    padding: 0.85rem 0.65rem;
  }

  .chart-header-status-group {
    width: 100%;
    justify-content: space-between;
  }

  /* Tap targets confortáveis para touch */
  .scada-btn {
    min-height: 46px;
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .calib-btn-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .calib-metrics-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .scada-input {
    min-height: 46px;
    font-size: 1rem;
  }

  .manual-calib-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .scada-accordion-summary {
    padding: 0.85rem 1rem;
    min-height: 48px;
  }

  .scada-footer {
    padding: 0.85rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .footer-info-items {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* ==========================================================================
   5. CONTROLES DE AUTENTICAÇÃO E LOGOUT (AUTH-05)
   ========================================================================== */
.scada-btn-map {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.scada-btn-map:hover {
  background: rgba(2, 132, 199, 0.3);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.scada-btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #fca5a5;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scada-btn-logout:hover {
  background: rgba(220, 38, 38, 0.3);
  border-color: #ef4444;
  color: #ffffff;
}

/* Anti-flash: Oculta painel administrativo antes da validação do JWT */
body.auth-loading .app-container {
  visibility: hidden;
}

/* ==========================================================================
   6. NOVO GRÁFICO DIÁRIO: VOLUME 7 DIAS (DAILY-UX-01)
   ========================================================================== */
.chart-header-legend {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
}

.legend-box {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-closed {
  background: #0284c7;
  border: 1px solid #38bdf8;
}

.legend-partial {
  background: #f59e0b;
  border: 1px solid #fbbf24;
}

.legend-test {
  background: #a855f7;
  border: 1px solid #c084fc;
}

.legend-today {
  background: #06b6d4;
  border: 1px solid #67e8f9;
}

.legend-none {
  background: #334155;
  border: 1px dashed #64748b;
}

.daily-chart-wrapper {
  min-height: 230px;
  position: relative;
  background: #090d16;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 0.75rem;
}

.daily-bar-chart-container {
  width: 100%;
  height: 210px;
  position: relative;
}

.daily-bar-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.daily-bar-item {
  cursor: pointer;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

.daily-bar-item:hover {
  filter: brightness(1.25);
}

/* Tooltip Flutuante Interativo */
.daily-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: 100;
  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;
}

.daily-chart-tooltip.visible {
  opacity: 1;
}

.daily-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;
}

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

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

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

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

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

/* ==========================================================================
   Tooltip Flutuante Interativo do Gráfico de Vazão 24h
   ========================================================================== */
.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: 100;
  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;
}

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

.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;
}

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

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

.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);
}

.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);
}

.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);
}

.flow-chart-tooltip .tt-status.status-unavailable {
  background: rgba(225, 29, 72, 0.2);
  color: #fb7185;
  border: 1px solid rgba(251, 113, 133, 0.4);
}

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

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

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

.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;
}

/* ==========================================================================
   Gaveta: Diagnóstico de Interrupções
   ========================================================================== */
.scada-interruptions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.interruption-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  gap: 1rem;
  transition: background 0.15s, border-color 0.15s;
}

.interruption-row:hover {
  background: #f1f5f9;
  border-color: var(--scada-border);
}

.int-row-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.int-row-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-heading);
}

.int-row-dur {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.int-row-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .interruption-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .int-row-right {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ==========================================================================
   PAINEL OPERACIONAL HOME MULTIPONTO (ETAPA 03A)
   ========================================================================== */
.home-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.25rem 0;
}

.home-header-panel {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.home-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.home-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.home-sync-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border-light);
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--scada-emerald);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: pulse-sync 2s infinite ease-in-out;
}

@keyframes pulse-sync {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Barra de Resumo Global Compacto */
.home-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--scada-border-light);
}

.summary-pill {
  background: #f8fafc;
  border: 1px solid var(--scada-border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.summary-pill:hover {
  background: #ffffff;
  border-color: var(--scada-blue);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.35rem;
}

.dot-online { background: var(--scada-emerald); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }
.dot-offline { background: var(--scada-coral); box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.2); }
.dot-flow { background: #0284c7; box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2); }
.dot-noflow { background: #94a3b8; }
.dot-unavailable { background: #f43f5e; }
.dot-insufficient { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }

.pill-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.pill-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.1;
}

/* Barra de Controle da Home: Busca + Filtros + Contador (E03B) */
.home-controls-bar {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.home-search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 200px;
  max-width: 300px;
  min-width: 170px;
}

.search-icon {
  position: absolute;
  left: 0.65rem;
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0.6;
}

.home-search-input {
  width: 100%;
  padding: 0.45rem 1.8rem 0.45rem 2.1rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-heading);
  background: #f8fafc;
  border: 1px solid var(--scada-border);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.home-search-input:focus {
  background: #ffffff;
  border-color: var(--scada-blue);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.btn-clear-search {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-clear-search:hover {
  color: var(--text-heading);
  background: rgba(0, 0, 0, 0.05);
}

.home-filter-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: #f8fafc;
  border: 1px solid var(--scada-border);
  border-radius: 5px;
  padding: 0.35rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
  white-space: nowrap;
}

.filter-btn:hover {
  background: #ffffff;
  border-color: var(--scada-blue);
  color: var(--text-heading);
}

.filter-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.3);
  border-color: var(--scada-blue);
}

.filter-btn.active {
  background: var(--scada-blue);
  border-color: var(--scada-blue);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(2, 132, 199, 0.25);
}

.home-results-counter {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* Estados de Banner / Loading / Empty */
.home-error-banner {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  border-radius: 6px;
  padding: 0.65rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-retry-overview {
  background: #9f1239;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn-retry-overview:hover {
  opacity: 0.9;
}

.home-loading-state,
.home-empty-state {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border);
  border-radius: 8px;
  padding: 3rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

/* Grid Dinâmico de Cards Multiponto */
.home-points-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

@media (min-width: 1400px) {
  .home-points-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  }
}

.home-point-card {
  background: var(--scada-surface);
  border: 1px solid var(--scada-border);
  border-radius: 8px;
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.home-point-card:hover {
  transform: translateY(-2px);
  border-color: var(--scada-blue);
  box-shadow: var(--shadow-md);
}

.point-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.point-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.point-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--scada-cyan-light);
  border: 1px solid rgba(6, 182, 212, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

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

.point-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.point-id {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--scada-blue);
  background: #f0f9ff;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #bae6fd;
  display: inline-block;
  width: fit-content;
}

.point-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.point-signal-tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Corpo do Card: KPIs de Vazão, Volume e Nível */
.point-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.point-kpi-block {
  background: #f8fafc;
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

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

.point-kpi-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.point-kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.point-flow-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.1;
}

.point-flow-val .unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.point-kpi-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
}

.point-kpi-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.point-kpi-mini {
  background: #f8fafc;
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.point-vol-val,
.point-pulse-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.point-vol-val .unit {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Bloco de Nível Futuro */
.point-level-block {
  font-size: 0.75rem;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px dashed var(--scada-border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.point-level-block.no-level {
  font-style: normal;
}

.level-unmonitored-label {
  font-weight: 700;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.level-unmonitored-text {
  font-weight: 500;
  color: #94a3b8;
}

.point-card-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.25rem;
}

.point-btn-open {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  width: 100%;
}

/* Barra de Navegação do Detalhe */
.detail-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--scada-surface-subtle);
  border: 1px solid var(--scada-border-light);
  border-radius: 6px;
  padding: 0.6rem 1rem;
  margin-bottom: 0.75rem;
}

.scada-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--scada-blue);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

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

.detail-nav-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-nav-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.detail-nav-device {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-heading);
  background: #ffffff;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--scada-border);
}

/* ==============================================================================
   INTRO SPLASH OVERLAY (Gota 3D-Like + Impacto Ripple)
   ============================================================================== */
.intro-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, #0d1e3d 0%, #060c18 70%, #03060c 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 48px 24px;
  z-index: 99999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.45s ease;
  pointer-events: all;
}

.intro-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-branding {
  text-align: center;
  opacity: 0;
  transform: translateY(-8px);
  animation: introBrandAppear 0.5s ease 0.1s forwards;
}

.intro-sub {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #38bdf8;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.intro-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff;
}

.intro-title span {
  color: #38bdf8;
}

@keyframes introBrandAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.water-stage {
  position: relative;
  width: 320px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-container {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px) scale(0.6);
  opacity: 0;
  will-change: transform, opacity;
}

.water-drop-svg {
  width: 54px;
  height: 80px;
  filter: drop-shadow(0 8px 16px rgba(0, 150, 255, 0.4));
}

.animating .drop-container {
  animation: dropFall 0.75s cubic-bezier(0.55, 0.05, 0.67, 0.95) 0.15s forwards;
}

@keyframes dropFall {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-40px) scale(0.7, 0.7);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0px) scale(0.9, 1.1);
  }
  75% {
    opacity: 1;
    transform: translateX(-50%) translateY(110px) scale(0.85, 1.2);
  }
  92% {
    opacity: 1;
    transform: translateX(-50%) translateY(145px) scale(0.9, 1.15);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(152px) scale(1.4, 0.35);
  }
}

.impact-zone {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 40px;
  pointer-events: none;
}

.impact-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, #ffffff 0%, #00f2fe 50%, rgba(0, 210, 255, 0) 70%);
  border-radius: 50%;
  opacity: 0;
}

.animating .impact-glow {
  animation: glowFlash 0.55s ease-out 0.88s forwards;
}

@keyframes glowFlash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(2.4);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(4);
  }
}

.ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  border: 2px solid #00d2ff;
  opacity: 0;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.45);
}

.animating .ripple-1 {
  animation: rippleExpand 0.75s cubic-bezier(0.1, 0.4, 0.2, 1) 0.9s forwards;
}

.animating .ripple-2 {
  animation: rippleExpand 0.85s cubic-bezier(0.1, 0.4, 0.2, 1) 1.02s forwards;
}

.animating .ripple-3 {
  animation: rippleExpand 0.95s cubic-bezier(0.1, 0.4, 0.2, 1) 1.14s forwards;
}

@keyframes rippleExpand {
  0% {
    width: 10px;
    height: 6px;
    opacity: 0.95;
    border-width: 2.5px;
    transform: translate(-50%, -50%) scale(0.5);
  }
  60% {
    opacity: 0.6;
    border-width: 1.8px;
  }
  100% {
    width: 240px;
    height: 70px;
    opacity: 0;
    border-width: 0.8px;
    transform: translate(-50%, -50%) scale(1);
  }
}

.splash-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}

.animating .splash-ring {
  animation: splashRingPop 0.45s cubic-bezier(0.2, 0.8, 0.3, 1) 0.89s forwards;
}

@keyframes splashRingPop {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
  }
}

.intro-footer {
  opacity: 0;
  animation: introBrandAppear 0.5s ease 0.2s forwards;
}

.intro-status-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #64748b;
}

@media (prefers-reduced-motion: reduce) {
  .intro-overlay {
    transition: opacity 0.2s ease;
  }
  .drop-container,
  .impact-glow,
  .ripple,
  .splash-ring {
    animation: none !important;
  }
}