/* ============================================================================
   SAMAEG-PLI · Sistema de Design
   Cores PLI: verde #3ec26e, azul #1c3d59, navy #003b5a
   Cores de risco: verde (0), amarelo (1), laranja (2), vermelho (3), roxo (4)
   ============================================================================ */

:root {
  --pli-verde: #3ec26e;
  --pli-verde-escuro: #0f3a1f;
  --pli-azul: #1c3d59;
  --pli-navy: #003b5a;
  --pli-accent: #116593;
  --pli-success: #2aa358;
  --pli-card-bg: #164a6d;
  --pli-card-bg-strong: #1b587f;
  --pli-card-border: rgba(148, 163, 184, 0.5);
  --info-critical: #ef4444;
  --info-success: #3ec26e;
  --info-warning: #f97316;
  --info-critical-bg: rgba(239, 68, 68, 0.14);
  --info-success-bg: rgba(62, 194, 110, 0.14);
  --info-warning-bg: rgba(249, 115, 22, 0.16);

  --rd-0: #2aa358;
  --rd-1: #f1c40f;
  --rd-2: #f39c12;
  --rd-3: #e74c3c;
  --rd-4: #8e44ad;

  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);

  --font: "Inter", system-ui, sans-serif;
  --font-display: "Poppins", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Menlo, monospace;

  --sidebar-width-base: 300px;
  --sidebar-width-min: 300px;
  --sidebar-width-max: 900px;
  --sidebar-width-default: 450px;
  --sidebar-width: var(--sidebar-width-default);
  --sb-inset-x: 0.75rem;
  --sb-space-level-1: 1.05rem;
  --sb-space-level-2: 0.78rem;
  --sb-space-level-3: 0.52rem;
  --sb-space-level-4: 0.34rem;
  --sb-block-gap: var(--sb-space-level-2);
  --sb-stack-gap: var(--sb-space-level-3);
  --sb-card-radius: 0.42rem;
  --sb-sep-primary: rgba(255, 255, 255, 0.34);
  --sb-sep-secondary: rgba(255, 255, 255, 0.22);
  --sb-sep-tertiary: rgba(255, 255, 255, 0.1);
  --map-overlay-inset-x: 1rem;
  --map-overlay-inset-top: 0.75rem;
  --map-panel-min-width: 230px;
  --map-panel-max-width: 300px;
  /* Altura padrao do ecossistema: a mesma do cabecalho da sidebar e do
     cabecalho principal do Smart Router (referencia). */
  --app-header-height: 70px;

  /* Escala da sidebar: cada nivel hierarquico reduz 1pt. */
  --sb-header-subtitle-size: 13pt;
  --sb-section-title-size: 12pt;
  --sb-subsection-title-size: 11pt;
  --sb-welcome-title-size: 14pt;
  --sb-welcome-icon-size: 1.45em;
  --sb-gap-section-after-line: 12pt;
  --sb-gap-subsection-after-line: 8pt;
  --sb-gap-subsubsection-after-line: 6pt;
  --sb-body-size: 9pt;
  --sb-info-size: 8pt;
  --fs-normal: var(--sb-body-size);
  --fs-title: var(--sb-subsection-title-size);
  --fs-note: var(--sb-info-size);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================================
   SIDEBAR (shell redimensionável + colapsável)
   ============================================================================ */

.sidebar-shell {
  position: relative;
  display: flex;
  flex-shrink: 0;
  height: 100vh;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width-min);
  max-width: var(--sidebar-width-max);
  transition:
    width 0.22s ease,
    min-width 0.22s ease;
}

.sidebar-shell.is-resizing {
  transition: none;
}

.sidebar-shell.is-collapsed {
  width: 0 !important;
  min-width: 0;
  max-width: 0;
  overflow: visible;
  transition:
    width 0.22s ease,
    min-width 0.22s ease;
}

.sidebar {
  width: 100%;
  flex: 1;
  min-width: 0;
  height: 100%;
  background: var(--pli-navy);
  color: white;
  font-size: var(--fs-normal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  --sidebar-text: #f7f6f2;
  --sidebar-bege: #ddd4c0;
  --sidebar-bege-dim: #b8ad98;
  --sidebar-muted: var(--sidebar-bege-dim);
}

.sidebar-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  /* Escala global do conteudo scrollavel (-15%). */
  zoom: 0.85;
}

@supports not (zoom: 0.85) {
  .sidebar-main {
    transform: scale(0.85);
    transform-origin: top center;
    width: calc(100% / 0.85);
  }
}

.sidebar-main::-webkit-scrollbar {
  width: 6px;
}
.sidebar-main::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.sidebar-header {
  position: relative;
  flex-shrink: 0;
  z-index: 10;
  container-type: inline-size;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--app-header-height, auto);
  /* Padding simetrico: a marca fica centralizada na largura da sidebar.
     O espaco para o botao de recolher (absoluto, a direita) vem do .logo. */
  height: var(--app-header-height);
  padding: 0.5rem 0.95rem;
  border-bottom: 3px solid var(--sb-sep-primary);
  background: linear-gradient(135deg, var(--pli-navy) 0%, var(--pli-azul) 100%);
}

.sb-resize-handle {
  flex-shrink: 0;
  width: 5px;
  margin: 0 -2px;
  cursor: col-resize;
  background: transparent;
  touch-action: none;
  z-index: 6;
  transition: background 0.15s;
}

.sb-resize-handle:hover,
.sidebar-shell.is-resizing .sb-resize-handle {
  background: rgba(62, 194, 110, 0.4);
}

.sidebar-shell.is-collapsed .sb-resize-handle {
  display: none;
  pointer-events: none;
}

.sb-toggle {
  position: absolute;
  top: 0.78rem;
  right: 0.45rem;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-bege-dim);
  cursor: pointer;
  opacity: 0.65;
  transition:
    opacity 0.15s,
    background 0.15s,
    color 0.15s,
    box-shadow 0.15s;
}

.sb-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-bege);
}

.sb-toggle:focus-visible {
  outline: 2px solid var(--pli-verde);
  outline-offset: 2px;
}

.sb-toggle-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sb-toggle-ico svg {
  display: block;
}

.sb-toggle .ico-expand {
  display: none;
}

.sb-toggle[aria-expanded="false"] .ico-collapse {
  display: none;
}

.sb-toggle[aria-expanded="false"] .ico-expand {
  display: block;
}

.sidebar-shell.is-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.sidebar-shell.is-collapsed .sb-toggle {
  position: fixed;
  left: var(--map-overlay-inset-x);
  top: calc(var(--topbar-height, 4.1rem) + var(--map-overlay-inset-top));
  z-index: 900;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--pli-navy);
  color: var(--sidebar-bege);
  opacity: 1;
  box-shadow: var(--shadow-lg);
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-shell.is-collapsed .sb-toggle .sb-toggle-ico svg {
  display: none;
}

.sidebar-shell.is-collapsed .sb-toggle .sb-toggle-ico::before {
  content: "\25B8";
  font-size: 0.85rem;
  line-height: 1;
}

.sidebar-shell.is-collapsed .sb-toggle:hover {
  background: var(--pli-azul);
  color: var(--sidebar-text);
}

.sidebar-shell.is-collapsed + .main .map-layer-control--floating {
  left: calc(var(--map-overlay-inset-x) + 1.9rem);
}

body.sb-resizing {
  cursor: col-resize !important;
  user-select: none;
}

body.sb-resizing * {
  cursor: col-resize !important;
}

.logo {
  width: 100%;
  padding: 0 1.4rem;
  text-align: center;
  /* Escala da marca: nome = 1em, slogan = 0.49em (proporcao da referencia). */
  font-size: clamp(1.15rem, 6.5cqw, 1.5rem);
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 1em;
  font-weight: 700;
  letter-spacing: -0.3px;
  /* Mesma marca do PLI Hub: icone em verde institucional, nome em branco.
     Antes era o inverso — o nome vinha verde e o icone era um PNG fixo. */
  color: #fff;
  line-height: 1.1;
  white-space: nowrap;
}

.logo-icon {
  flex-shrink: 0;
  width: 1.08em;
  height: 1.08em;
  color: var(--pli-verde);
}

.logo-sub {
  margin: 0.28rem 0 0;
  padding: 0 0.1rem;
  font-size: 0.49em;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================================
   SIDEBAR — ESTRUTURA, SEPARADORES E DESTAQUES
   ============================================================================ */

.sb-block {
  position: relative;
  padding: var(--sb-space-level-2) var(--sb-inset-x);
}

.sb-block + .sb-block {
  margin-top: 0;
  padding-top: var(--sb-gap-section-after-line);
}

.sb-block + .sb-block::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--sb-sep-primary);
}

.sb-block--intro {
  display: flex;
  flex-direction: column;
  gap: var(--sb-space-level-4);
}

.sb-block--sections {
  padding-top: 0;
}

.sb-block--footer {
  margin-top: auto;
  padding-bottom: 0.65rem;
}

.sb-card {
  border-radius: var(--sb-card-radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.sb-section-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-left: 0.8rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--sb-sep-tertiary);
}

.sb-status-card .status-bar {
  margin: 0;
  padding: 0.55rem 0.65rem;
  background: transparent;
  border-bottom: none;
}

.sb-section > .sb-status-card,
.sb-section > .ingest-progress,
.sb-section > .operational-status,
.sb-section > .focal-banner,
.sb-panel-body > .sb-status-card,
.sb-panel-body > .ppdc-status-block,
.sb-panel-body > .ingest-progress,
.sb-panel-body > .operational-status,
.sb-panel-body > .focal-banner {
  margin-bottom: var(--sb-space-level-3);
}

.ppdc-status-block {
  display: grid;
  gap: 0.45rem;
}

.ppdc-status-block > .sb-status-card {
  margin-bottom: 0;
}

.ingest-progress {
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.45rem;
}

.ingest-progress[hidden] {
  display: none !important;
}

.worst-card.empty .trecho-metric-placeholder {
  padding: 0.6rem 0;
}

.trecho-metric-footer {
  margin: 0.35rem 0 0;
  font-size: var(--fs-note);
  line-height: 1.35;
  color: var(--sidebar-muted);
}

#worst-card,
#forecast-card,
#region-card {
  margin-top: 0.15rem;
}

.trecho-metric-card[data-card-mode="forecast"] .worst-level,
.trecho-metric-card[data-card-mode="region"] .worst-level {
  display: none;
}

/* ============================================================================
   STATUS BAR
   ============================================================================ */

.status-bar {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: none;
  cursor: help;
}

.status-level-badge {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.45rem;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.status-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
}

.status-line {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}

.status-detail {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.35rem;
  font-size: var(--fs-note);
  line-height: 1.35;
  color: var(--sidebar-muted);
}

.status-detail-item {
  display: block;
}

.status-detail b {
  color: var(--sidebar-text);
}

#status-card {
  border-left: 3px solid var(--rd-0);
  transition: border-left-color 0.25s ease;
}

.sb-trecho-hint {
  margin-top: 0.15rem;
  margin-bottom: 0;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--rd-0);
  box-shadow: 0 0 0 0 rgba(42, 163, 88, 0.7);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(42, 163, 88, 0.6);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(42, 163, 88, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(42, 163, 88, 0);
  }
}

.status-dot.warn {
  background: var(--rd-2);
  animation-name: pulseWarn;
}
.status-dot.alert {
  background: var(--rd-3);
  animation-name: pulseAlert;
}
.status-dot.max {
  background: var(--rd-4);
  animation-name: pulseMax;
}

@keyframes pulseWarn {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.6);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(243, 156, 18, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(243, 156, 18, 0);
  }
}
@keyframes pulseAlert {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(231, 76, 60, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}
@keyframes pulseMax {
  0% {
    box-shadow: 0 0 0 0 rgba(142, 68, 173, 0.7);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(142, 68, 173, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(142, 68, 173, 0);
  }
}

.status-text {
  flex: 1;
  min-width: 0;
}

.status-refresh {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
  font: 700 1rem/1 var(--font);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.status-refresh:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.status-refresh:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.sidebar #status-line {
  color: var(--sidebar-text);
}
#status-line {
  font-size: var(--fs-normal);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-time {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
  margin-top: 0.12rem;
  font-feature-settings: "tnum" 1;
}

.focal-banner {
  margin: 0;
  padding: 0.45rem 0.65rem;
  font-size: var(--fs-note);
  line-height: 1.35;
  color: var(--sidebar-bege);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--sb-card-radius);
  border-left: 2px solid rgba(255, 255, 255, 0.2);
}

.focal-banner b {
  color: var(--sidebar-text);
  font-weight: 600;
}

/* ============================================================================
   SIDEBAR — SEÇÕES, ACORDEÃO, FERRAMENTAS
   ============================================================================ */

.sb-section {
  position: relative;
  padding: 0;
  margin: 0;
}

.sb-section + .sb-section {
  margin-top: 0;
  padding-top: var(--sb-gap-section-after-line);
}

.sb-section + .sb-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(-1 * var(--sb-inset-x));
  right: calc(-1 * var(--sb-inset-x));
  height: 1.5px;
  background: var(--sb-sep-secondary);
}

.sb-section-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0 0 0.38rem;
  font-family: var(--font-display);
  font-size: var(--sb-section-title-size);
  font-weight: 800;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--pli-verde);
}

.sb-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1em;
  opacity: 0.9;
  color: var(--pli-verde);
  text-transform: uppercase;
}

.sb-icon-img {
  display: block;
  width: 1em;
  height: 1em;
  object-fit: contain;
  filter: invert(68%) sepia(72%) saturate(474%) hue-rotate(87deg)
    brightness(91%) contrast(90%);
}

.sb-panel {
  position: relative;
}

#actions-panel {
  order: 1;
}

#sb-panel-ua {
  order: 2;
}

#forecast-panel {
  order: 3;
}

#sb-panel-regions {
  order: 4;
}

#timeline-panel {
  order: 5;
}

.timeline-setup {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.timeline-start-btn {
  justify-self: start;
  margin-top: 0.15rem;
}

.timeline-start-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.sb-panel + .sb-panel {
  padding-top: var(--sb-gap-subsection-after-line);
}

.sb-panel + .sb-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(-1 * var(--sb-inset-x));
  right: calc(-1 * var(--sb-inset-x));
  height: 1px;
  background: var(--sb-sep-tertiary);
}

.sb-panel-head {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.54rem 0;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: var(--sb-subsection-title-size);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sb-panel-head:hover {
  background: transparent;
  color: #fff;
}

.sb-panel-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  text-align: center;
  font-size: 1em;
  color: var(--pli-verde);
  opacity: 0.95;
}

.sb-panel-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--sidebar-text);
  text-transform: capitalize;
}

.sb-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.08rem;
  height: 1.08rem;
  border-radius: 50%;
  font-size: 0.64rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  color: var(--sidebar-bege);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: help;
  flex-shrink: 0;
}

.sb-chevron {
  font-size: 0.8rem;
  color: var(--sidebar-muted);
  transition: transform 0.18s ease;
}

.sb-panel.is-open .sb-chevron {
  transform: rotate(0deg);
}

.sb-panel:not(.is-open) .sb-chevron {
  transform: rotate(-90deg);
}

.sb-panel-body {
  padding: 0 0 0.65rem;
}

.sb-panel-intro {
  margin: 0 0 var(--sb-space-level-3);
  color: var(--sidebar-text);
  font-size: var(--sb-body-size);
  line-height: 1.52;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.sb-panel-intro.sb-panel-guide {
  margin-top: 0.35rem;
}

.sb-panel-intro.sb-panel-guide strong,
.sb-welcome-text.sb-panel-guide strong {
  color: var(--pli-verde);
  font-weight: 700;
}

.sb-panel--action .sb-panel-intro {
  margin-top: var(--sb-space-level-4);
  margin-bottom: 0;
}

.sb-panel--action .sb-panel-intro + .sb-panel-intro {
  margin-top: 0.35rem;
}

.sb-panel--action {
  padding: 0;
}

.sb-panel-action {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.54rem 0;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: var(--sb-subsection-title-size);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.sb-panel-action:hover {
  color: #fff;
}

.sb-panel-action b {
  display: block;
  font-size: 1em;
  line-height: 1.2;
  color: var(--sidebar-text);
}

.sb-panel-action small {
  display: block;
  margin-top: 0.08rem;
  color: var(--sidebar-muted);
  font-size: var(--fs-note);
  line-height: 1.25;
}

.sb-panel:not(.is-open) .sb-panel-head {
  opacity: 0.92;
}

.alert-meter--compact .meter-cell {
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto;
  column-gap: 0.5rem;
  padding: 0.28rem 0.5rem;
}

.alert-meter--compact .meter-rd {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.66rem;
  font-weight: 800;
  font-feature-settings: "tnum" 1;
  min-width: 1.1rem;
  text-align: center;
  padding: 0.1rem 0.2rem;
  border-radius: 0.2rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
}

.alert-meter--compact .meter-name {
  grid-column: 2;
  grid-row: 1;
  font-size: var(--fs-note);
}

.alert-meter--compact .meter-cell b {
  grid-column: 3;
  grid-row: 1;
  font-size: 1.08rem;
}

.alert-meter--compact .meter-desc {
  display: none;
}

.operational-status {
  display: grid;
  gap: 0;
}

.hazard-meter {
  padding: 0.55rem;
  border: 1px solid var(--pli-card-border);
  border-radius: var(--sb-card-radius);
  background: rgba(11, 26, 47, 0.92);
}

.hazard-meter-title {
  margin: 0 0 0.42rem;
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--sb-body-size);
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  text-transform: none;
}

.alert-meter--vertical {
  display: grid;
  gap: var(--sb-space-level-4);
}

.alert-meter--vertical .meter-cell {
  --meter-color: var(--rd-0);
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto;
  gap: 0.45rem;
  padding: 0.38rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--meter-color) 70%, transparent);
  border-left: 4px solid var(--meter-color);
  border-right: 4px solid var(--meter-color);
  background: color-mix(in srgb, var(--meter-color) 16%, var(--pli-card-bg));
  color: #fff;
}

.alert-meter--vertical .meter-rd {
  grid-column: 1;
  min-width: 1.35rem;
  padding: 0.12rem 0.24rem;
  border-radius: 0.25rem;
  background: var(--meter-color);
  color: #fff;
}

.alert-meter--vertical .meter-name {
  grid-column: 2;
  color: #fff;
  font-size: var(--sb-info-size);
}

.alert-meter--vertical .meter-cell b {
  grid-column: 3;
  min-width: 1.35rem;
  padding: 0.12rem 0.24rem;
  border-radius: 0.25rem;
  background: var(--meter-color);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
}

.sb-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.sb-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 3.2rem;
  padding: 0.4rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
  font-family: var(--font);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.12s ease;
}

.sb-tool:hover {
  background: rgba(255, 255, 255, 0.11);
  transform: translateY(-1px);
}

.sb-tool:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.sb-tool--primary {
  background: var(--pli-verde);
  border-color: transparent;
  color: #fff;
}

.sb-tool--primary:hover {
  background: var(--pli-success);
}

.sb-tool-ico {
  font-size: 1.08rem;
  line-height: 1;
  font-weight: 700;
}

.sb-tool-lbl {
  letter-spacing: 0.2px;
}

.btn-compact {
  margin-bottom: 0;
  padding: 0.42rem 0.65rem;
  font-size: var(--fs-note);
}

.footer--compact {
  padding-top: 0.55rem;
}

/* Credito padrao do ecossistema, igual nas demais aplicacoes. */
.sidebar-credit {
  margin: 0.4rem 0 0;
  font-size: 10px;
  line-height: 1.5;
  color: var(--sidebar-bege-dim);
  text-align: center;
}

.sb-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.45rem;
}

.sb-chip {
  font-size: 0.64rem;
  font-weight: 600;
  padding: 0.18rem 0.42rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--sidebar-bege);
  white-space: nowrap;
}

.sb-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.35rem;
}

.sb-foot-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--pli-verde);
  text-decoration: none;
}

.sb-foot-link:hover {
  color: var(--sidebar-text);
  text-decoration: underline;
}

.sb-foot-link span {
  font-size: 0.78rem;
  opacity: 0.85;
}

.sb-section--welcome {
  padding-top: 0;
}

.sb-section--welcome .sb-panel-head {
  grid-template-columns: auto 1fr auto;
}

.sb-section--welcome .sb-panel-ico {
  width: calc(var(--sb-welcome-icon-size) + 0.15rem);
}

.sb-section--welcome .sb-panel-ico .sb-icon-img {
  width: var(--sb-welcome-icon-size);
  height: var(--sb-welcome-icon-size);
  filter: brightness(0) invert(1);
}

.sb-section--welcome .sb-panel-label {
  color: var(--pli-verde);
  font-size: var(--sb-welcome-title-size);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sb-section--welcome .sb-welcome-lead {
  margin: 0.15rem 0 0.65rem;
  color: var(--sidebar-text);
  font-size: var(--sb-body-size);
  line-height: 1.52;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.sb-section--welcome .sb-panel:not(.is-open) .sb-welcome-lead {
  margin-bottom: 0.35rem;
}

.sb-section--welcome .sb-panel-body {
  padding-top: 0;
}

.sb-section--welcome .sb-welcome {
  margin-top: 0;
}

.sb-section-lead {
  margin: 0.1rem 0 0.55rem;
  padding-left: 0.05rem;
  color: var(--sidebar-muted);
  font-size: var(--fs-note);
  line-height: 1.42;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.fire-summary {
  display: grid;
  gap: 0.6rem;
}

.fire-summary-loading {
  margin: 0;
  color: var(--sidebar-muted);
  font-size: var(--fs-note);
}

.fire-sum-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.fire-sum-stat {
  display: grid;
  gap: 0.1rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.045);
}

.fire-sum-stat-num {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--sidebar-text);
}

.fire-sum-stat-lbl {
  font-size: var(--fs-note);
  line-height: 1.2;
  color: var(--sidebar-muted);
}

.fire-sum-bars {
  display: grid;
  gap: 0.3rem;
}

.fire-sum-row {
  display: grid;
  grid-template-columns: 5.1rem 1fr auto;
  align-items: center;
  gap: 0.4rem;
}

.fire-sum-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--fs-note);
  color: var(--sidebar-text);
}

.fire-sum-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.fire-sum-track {
  height: 0.55rem;
  border-radius: 0.3rem;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.fire-sum-bar {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 0.3rem;
}

.fire-sum-count {
  font-size: var(--fs-note);
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
}

.fire-sum-count small {
  margin-left: 0.2rem;
  font-weight: 400;
  color: var(--sidebar-muted);
}

.fire-sum-foot {
  margin: 0;
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
}

.risk-module-grid {
  display: grid;
  gap: 0.45rem;
  margin: 0.55rem 0 0.75rem;
}

.risk-module-card {
  position: relative;
  display: grid;
  gap: 0.18rem;
  padding: 0.55rem 0.62rem 0.55rem 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.risk-module-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.22rem;
  background: var(--pli-verde);
}

.risk-module-card--mass::before {
  background: #7b2cbf;
}

.risk-module-card--flood::before {
  background: #2563eb;
}

.risk-module-card--fire::before {
  background: #f97316;
}

.risk-module-card strong {
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: var(--sb-body-size);
  line-height: 1.25;
}

.risk-module-card span {
  color: var(--sidebar-muted);
  font-size: var(--fs-note);
  line-height: 1.35;
}

.sb-panel-lead {
  margin: 0.15rem 0 0.65rem;
  color: var(--sidebar-muted);
  font-size: var(--fs-note);
  line-height: 1.45;
  text-align: justify;
  text-justify: inter-word;
}

.sb-panel:not(.is-open) .sb-panel-lead {
  margin-bottom: 0.35rem;
}

.ppdc-panel-lead {
  margin: 0.15rem 0 0.65rem;
}

.sb-panel:not(.is-open) .ppdc-panel-lead {
  margin-bottom: 0.35rem;
}

.ppdc-panel-lead .ppdc-status-head {
  margin-top: 0.45rem;
}

#ppdc-max-panel .sb-panel-head,
#ppdc-by-level-panel .sb-panel-head {
  grid-template-columns: auto 1fr auto;
}

#ppdc-max-panel .sb-panel-label,
#ppdc-by-level-panel .sb-panel-label {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.25;
  text-transform: none;
}

.sb-subsection {
  margin: 0 0 var(--sb-space-level-3);
}

.sb-subsection-title {
  margin: 0 0 var(--sb-space-level-3);
  font-family: var(--font-display);
  font-size: var(--sb-subsection-title-size);
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--sidebar-text);
}

.sb-subsubsection + .sb-subsubsection,
.operational-status .hazard-meter + .hazard-meter,
.worst-dual .worst-channel + .worst-channel {
  margin-top: 0;
  padding-top: var(--sb-gap-subsubsection-after-line);
  border-top: none;
  position: relative;
}

.sb-subsubsection + .sb-subsubsection::before,
.operational-status .hazard-meter + .hazard-meter::before,
.worst-dual .worst-channel + .worst-channel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--sb-sep-tertiary);
}

.sb-subsubsection-title {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: var(--fs-note);
  font-weight: 700;
  line-height: 1.35;
  color: var(--sidebar-bege);
}

.sb-meta-field {
  margin: 0 0 0.55rem;
  font-size: var(--fs-note);
  line-height: 1.4;
  color: var(--sidebar-muted);
}

.sb-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.sb-meta-row .sb-meta-field {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.sb-meta-row .status-refresh {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.sb-meta-label {
  display: block;
  margin-bottom: 0.12rem;
}

.sb-meta-value {
  display: block;
  color: var(--sidebar-text);
  font-weight: 700;
}

.ppdc-status-head {
  margin: 0;
}

.ppdc-status-display--pending {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--sidebar-muted) !important;
}

.ppdc-status-display--pending .status-level-badge {
  background: rgba(255, 255, 255, 0.12) !important;
  color: var(--sidebar-muted) !important;
}

.ppdc-status-display {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.45rem;
  background: var(--nivel-0, #2aa358);
  color: #fff;
}

.ppdc-status-display .status-level-badge {
  flex: 0 0 auto;
  min-width: 1.75rem;
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.status-level-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.2px;
}

.max-alert-trecho {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}

.max-alert-row {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.45rem;
  align-items: baseline;
}

.max-alert-row dt {
  margin: 0;
  font-size: var(--fs-note);
  font-weight: 600;
  color: var(--sidebar-muted);
}

.max-alert-row dd {
  margin: 0;
  font-size: var(--fs-note);
  font-weight: 600;
  color: var(--sidebar-text);
}

.max-alert-row--rd dd {
  color: var(--pli-verde);
  font-weight: 800;
}

.status-line--aux {
  margin-top: 0.45rem;
  font-size: var(--fs-note);
  color: var(--sidebar-bege);
}

.sb-welcome-text {
  margin: 0 0 0.35rem;
}

.sb-welcome-text:last-child {
  margin-bottom: 0;
}

.sb-k {
  font-weight: 600;
  color: var(--sidebar-bege);
}

.sb-jump {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--pli-verde);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.sb-jump:hover {
  color: var(--sidebar-text);
}

a.sb-jump:visited {
  color: var(--pli-verde);
}

/* Busca avançada — filtro por atributo */
.qf-builder {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.qf-connector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  padding: 0.38rem 0.5rem;
  border: 1px dashed var(--pli-card-border);
  border-radius: var(--sb-card-radius);
  background: rgba(0, 59, 90, 0.12);
}

.qf-connector-label {
  color: var(--sidebar-muted);
  font-size: var(--sb-info-size);
  font-weight: 700;
}

.qf-join-select {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.28rem 0.4rem;
  border: 1px solid var(--pli-card-border);
  border-radius: 4px;
  background: rgba(11, 26, 47, 0.85);
  color: var(--sidebar-text);
  font-size: var(--sb-body-size);
}

.qf-clauses-head {
  margin-top: 0.15rem;
  color: var(--sidebar-muted);
  font-size: var(--sb-info-size);
  font-weight: 700;
}

.qf-conditions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.qf-clause {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  align-items: start;
  padding: 0.5rem;
  border: 1px solid var(--pli-card-border);
  border-radius: var(--sb-card-radius);
  background: rgba(0, 59, 90, 0.22);
}

.qf-clause-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.42rem;
  min-width: 0;
}

.qf-clause .filter-group {
  margin: 0;
}

.qf-clause-val.is-hidden {
  display: none;
}

.qf-inline-label {
  display: block;
}

.qf-value-wrap {
  display: block;
}

.qf-value-wrap .qf-value,
.qf-value-wrap select,
.qf-value-wrap input {
  width: 100%;
  box-sizing: border-box;
}

.qf-clause select,
.qf-clause input {
  font-size: var(--fs-note);
  padding: 0.28rem 0.35rem;
  border-radius: 0.28rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.2);
  color: var(--sidebar-text);
  min-width: 0;
}

.qf-rm {
  width: 1.35rem;
  height: 1.35rem;
  border: none;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-bege);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.qf-expression {
  padding: 0.5rem 0.55rem;
  border: 1px dashed rgba(203, 213, 225, 0.35);
  border-radius: var(--sb-card-radius);
  background: rgba(0, 59, 90, 0.12);
}

.qf-expression-label {
  display: block;
  margin-bottom: 0.22rem;
  color: var(--sidebar-muted);
  font-size: var(--sb-info-size);
  font-weight: 700;
}

.qf-expression-text {
  display: block;
  color: #fff;
  font-family: var(--font-mono);
  font-size: var(--sb-info-size);
  line-height: 1.45;
  word-break: break-word;
}

.qf-actions {
  display: flex;
  gap: 0.35rem;
}

.qf-actions .btn {
  flex: 1;
  margin-bottom: 0;
}

.qf-active {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.qf-active-title {
  margin: 0 0 0.2rem;
  color: var(--pli-verde);
  font-family: var(--font-display);
  font-size: var(--sb-info-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.qf-active-hint {
  margin: 0 0 0.45rem;
  color: var(--sidebar-muted);
  font-size: var(--sb-info-size);
  line-height: 1.4;
}

.qf-active-list {
  list-style: none;
  margin: 0 0 0.45rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.qf-active-empty {
  margin: 0 0 0.45rem;
  color: var(--sidebar-muted);
  font-size: var(--sb-info-size);
  font-style: italic;
}

.qf-active-item {
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--pli-card-border);
  border-radius: var(--sb-card-radius);
  background: var(--pli-card-bg);
}

.qf-active-item-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.28rem;
}

.qf-active-item-head strong {
  flex: 1;
  color: #fff;
  font-size: var(--sb-body-size);
}

.qf-active-expr {
  margin: 0;
  color: var(--gray-300);
  font-family: var(--font-mono);
  font-size: var(--sb-info-size);
  line-height: 1.45;
  word-break: break-word;
}

.qf-active-edit,
.qf-active-rm {
  border: 1px solid rgba(203, 213, 225, 0.35);
  border-radius: 0.28rem;
  background: rgba(0, 59, 90, 0.45);
  color: #fff;
  cursor: pointer;
  font-size: var(--sb-info-size);
  line-height: 1.2;
  padding: 0.15rem 0.38rem;
}

.qf-active-rm {
  width: 1.45rem;
  padding: 0.1rem 0;
  font-size: 0.95rem;
}

.qf-active-edit:hover,
.qf-active-rm:hover {
  border-color: var(--pli-verde);
  color: var(--pli-verde);
}

.qf-clear-all {
  width: 100%;
}

.simple-search-grid {
  display: grid;
  gap: 0.55rem;
}

.simple-search-actions {
  margin-top: 0.55rem;
}

.doc-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.doc-mini-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.45rem;
  align-items: start;
  padding: 0.55rem;
  border: 1px solid var(--pli-card-border);
  border-radius: 0.42rem;
  background: var(--pli-card-bg);
  color: #fff;
  text-decoration: none;
}

.doc-mini-card:hover {
  background: var(--pli-card-bg-strong);
  color: #fff;
}

.doc-mini-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-row: span 2;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 0.32rem;
  background: rgba(0, 59, 90, 0.45);
  color: var(--pli-verde);
  font-size: 0.74rem;
  font-weight: 800;
}

.doc-mini-card strong {
  color: #fff;
  font-size: var(--sb-body-size);
  line-height: 1.15;
}

.doc-mini-card small {
  grid-column: 2;
  color: var(--gray-300);
  font-size: var(--sb-info-size);
  line-height: 1.32;
}

.sb-qbtn {
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
  font-size: 0.95rem;
  cursor: pointer;
}

.sb-qbtn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ============================================================================
   PAINÉIS (legado — modais e outras páginas)
   ============================================================================ */

.panel {
  padding: 1rem 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel + .panel {
  margin-top: 0.25rem;
}

.panel-title {
  font-size: var(--fs-title);
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--pli-verde);
  margin-bottom: 0.55rem;
}

.panel-help {
  font-size: var(--fs-note);
  color: var(--sidebar-bege-dim);
  line-height: 1.4;
  margin-bottom: 0.85rem;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.panel-note {
  font-size: var(--fs-note);
  color: var(--pli-verde);
  line-height: 1.45;
  margin-top: 0.85rem;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--pli-verde);
  border-radius: 0.22rem;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.panel-note code {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.06rem 0.26rem;
  border-radius: 0.18rem;
  color: var(--pli-verde);
}

.panel-note sup {
  font-size: 0.55em;
}

/* Textos explicativos da sidebar — parágrafo justificado */
.sidebar .rd-basis-note,
.sidebar .rd-basis-note small,
.sidebar .actions-empty,
.sidebar .forecast-empty,
.sidebar .acoes-sub,
.sidebar .dl-subtitle,
.sidebar .dl-batch-hint,
.sidebar .dl-activity,
.sidebar .no-data-msg,
.sidebar .worst-empty {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

/* ============================================================================
   DISTRIBUIÇÃO POR NÍVEL OPERACIONAL
   ============================================================================ */

.alert-meter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.meter-cell {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 0.45rem;
  align-items: center;
  padding: 0.35rem 0.55rem;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid;
  transition: all 0.2s ease;
  cursor: help;
}

.meter-cell[data-rd="0"] {
  border-left-color: var(--rd-0);
}
.meter-cell[data-rd="1"] {
  border-left-color: var(--rd-1);
}
.meter-cell[data-rd="2"] {
  border-left-color: var(--rd-2);
}
.meter-cell[data-rd="3"] {
  border-left-color: var(--rd-3);
}
.meter-cell[data-rd="4"] {
  border-left-color: var(--rd-4);
}

.meter-cell .meter-name {
  font-size: var(--fs-normal);
  font-weight: 600;
  grid-column: 1;
  grid-row: 1;
  color: var(--sidebar-text);
}

.meter-cell .meter-desc {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
  grid-column: 1;
  grid-row: 2;
  margin-top: 0.06rem;
}

.meter-cell b {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-weight: 700;
  font-size: 1.05rem;
  font-feature-settings: "tnum" 1;
  color: var(--sidebar-text);
  min-width: 1.4rem;
  text-align: right;
}

.meter-cell.active {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
  box-shadow: -3px 0 0 0 currentColor inset;
}

.meter-cell--blink {
  animation: alertSidebarPulse 1.3s ease-in-out infinite;
}

.meter-cell--blink[data-rd="3"] {
  --alert-glow: rgba(239, 68, 68, 0.55);
}

.meter-cell--blink[data-rd="4"] {
  --alert-glow: rgba(168, 85, 247, 0.55);
}

@keyframes alertSidebarPulse {
  0%,
  100% {
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
  }
  50% {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 0 12px 1px var(--alert-glow, rgba(239, 68, 68, 0.45));
  }
}

/* ============================================================================
   TRECHO MAIS CRÍTICO
   ============================================================================ */

.worst-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.4rem;
  padding: 0.6rem;
  border-left: 3px solid var(--rd-0);
  transition: border-color 0.3s ease;
}

.worst-card.worst-card--blink {
  animation: worstCardPulse 1.3s ease-in-out infinite;
}

@keyframes worstCardPulse {
  0%,
  100% {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
  }
  50% {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 16px 2px rgba(239, 68, 68, 0.35);
  }
}

.worst-level.worst-level--blink {
  animation: worstLevelPulse 1.3s ease-in-out infinite;
}

@keyframes worstLevelPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.2);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
  }
}

.worst-card.empty {
  text-align: center;
  color: var(--sidebar-muted);
  border-left-color: rgba(255, 255, 255, 0.1);
}

.worst-card.worst-card--busy {
  text-align: left;
  min-height: 12rem;
}

.worst-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.worst-card-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.35rem;
  padding: 0.5rem 0.55rem;
  border-left: 3px solid var(--rd-0);
}

.worst-card-item.worst-card--blink {
  animation: worstCardPulse 1.3s ease-in-out infinite;
}

.worst-empty {
  font-size: var(--fs-normal);
  padding: 0.6rem 0;
  font-style: italic;
}

.worst-name {
  font-weight: 700;
  font-size: var(--fs-title);
  margin-bottom: 0.18rem;
  line-height: 1.2;
  color: var(--sidebar-text);
}

.worst-rod {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
  line-height: 1.35;
}

.worst-level {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.28rem;
  font-size: var(--fs-note);
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-top: 0.4rem;
}

.worst-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.32rem;
  margin-top: 0.55rem;
}

.worst-stats--compact {
  margin-top: 0.42rem;
}

.trecho-picker {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.trecho-picker-field {
  margin-bottom: 0;
}

.trecho-picker-field label {
  display: block;
  margin-bottom: 0.28rem;
}

.trecho-picker-field select {
  width: 100%;
}

.ua-picker-wrap,
.trecho-picker {
  margin-bottom: 0.35rem;
}

.ua-metric-note {
  margin: 0.35rem 0 0.15rem;
  font-size: var(--fs-note);
  line-height: 1.35;
  color: var(--sidebar-muted);
  font-style: italic;
}

.worst-dual {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.45rem;
}

.worst-channel {
  padding: 0.45rem 0.5rem;
  border-radius: 0.32rem;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.worst-channel-title {
  margin: 0 0 0.28rem;
  font-size: var(--fs-note);
  font-weight: 700;
  color: var(--sidebar-bege);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.worst-channel-empty {
  margin: 0;
  padding: 0.35rem 0.5rem;
  font-size: var(--fs-note);
  font-style: italic;
  color: var(--sidebar-muted);
}

.worst-stat {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.32rem 0.45rem;
  border-radius: 0.28rem;
  cursor: help;
}

.worst-stat span {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.worst-stat b {
  font-size: var(--fs-normal);
  font-weight: 700;
  font-feature-settings: "tnum" 1;
  display: block;
  margin-top: 0.1rem;
  color: var(--sidebar-text);
}

/* ============================================================================
   REGIÕES METEOROLÓGICAS
   ============================================================================ */

.region-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.region-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0.28rem;
  cursor: help;
  border: 1px solid transparent;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.region-row--active {
  background: rgba(0, 59, 90, 0.35);
  border-color: var(--pli-verde);
}

.region-row--dim {
  opacity: 0.55;
}

.region-ua-banner {
  margin: 0 0 0.45rem;
  padding: 0.38rem 0.45rem;
  font-size: var(--fs-note);
  line-height: 1.35;
  color: var(--sidebar-text);
  background: rgba(0, 59, 90, 0.22);
  border-radius: 0.28rem;
  border-left: 3px solid var(--pli-verde);
}

.region-ua-banner b {
  color: var(--sidebar-bege);
}

.region-info b {
  font-weight: 600;
  font-size: var(--fs-normal);
  display: block;
  line-height: 1.2;
  color: var(--sidebar-text);
}

.region-info small {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
}

.region-k {
  text-align: right;
}

.region-k span {
  display: block;
  font-size: var(--fs-note);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sidebar-muted);
  margin-bottom: 0.06rem;
}

.region-k code {
  font-family: var(--font-mono);
  font-size: var(--fs-normal);
  background: rgba(255, 255, 255, 0.1);
  padding: 0.12rem 0.32rem;
  border-radius: 0.2rem;
  color: var(--sidebar-text);
  font-weight: 600;
}

/* ============================================================================
   CHECKBOXES E BOTÕES
   ============================================================================ */

.ck {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  font-size: var(--fs-note);
  padding: 0.36rem 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  color: var(--sidebar-bege);
  transition: color 0.15s ease;
}

.ck:hover {
  color: var(--sidebar-text);
}
.ck input {
  accent-color: var(--pli-verde);
  cursor: pointer;
}

.ck-group-title {
  margin-top: 0.6rem;
  margin-bottom: 0.2rem;
  font-size: var(--fs-note);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sidebar-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.5rem;
}

.btn {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: none;
  border-radius: 0.32rem;
  background: var(--pli-verde);
  color: white;
  font-family: var(--font);
  font-weight: 600;
  font-size: var(--fs-normal);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 0.45rem;
}

.btn:hover {
  background: var(--pli-success);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.95);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.13);
  transform: translateY(-1px);
}

/* ============================================================================
   FILTROS DA MALHA
   ============================================================================ */

.stats-summary {
  font-size: var(--fs-normal);
  color: var(--sidebar-bege);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.42rem 0.55rem;
  border-radius: 0.3rem;
  border-left: 3px solid var(--pli-verde);
  margin-bottom: 0.6rem;
  line-height: 1.45;
  font-feature-settings: "tnum" 1;
}

.stats-summary b {
  font-weight: 700;
  color: var(--sidebar-text);
}

.filter-group {
  margin-bottom: 0.7rem;
}

.filter-group label {
  display: block;
  font-size: var(--fs-note);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sidebar-muted);
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.filter-group select,
.filter-group input {
  width: 100%;
  padding: 0.36rem 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.3rem;
  color: white;
  font-family: var(--font);
  font-size: var(--fs-normal);
  transition: all 0.15s ease;
}

.filter-group select:hover,
.filter-group input:hover {
  background: rgba(255, 255, 255, 0.12);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--pli-verde);
  box-shadow: 0 0 0 3px rgba(62, 194, 110, 0.15);
}

.filter-group input::placeholder {
  color: var(--sidebar-bege-dim);
}

.filter-group select option {
  background: var(--pli-navy);
  color: white;
}

/* ============================================================================
   SIDEBAR — PADRONIZACAO VISUAL DE TEXTO E CAMPOS
   ============================================================================ */

.sidebar-main {
  color: var(--sidebar-text);
  font-size: var(--sb-body-size);
  line-height: 1.52;
}

.sidebar-main p,
.sidebar-main li,
.sidebar-main .sb-panel-intro,
.sidebar-main .sb-panel-guide,
.sidebar-main .actions-empty,
.sidebar-main .forecast-empty,
.sidebar-main .worst-empty,
.sidebar-main .rd-basis-note,
.sidebar-main .stats-summary {
  color: var(--sidebar-text);
  font-size: var(--sb-body-size);
  line-height: 1.52;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  overflow-wrap: anywhere;
}

.sidebar-main p + p {
  margin-top: 0.5rem;
}

.sidebar-main small,
.sidebar-main .status-time,
.sidebar-main .meter-desc,
.sidebar-main .worst-rod,
.sidebar-main .region-info small,
.sidebar-main .region-k span,
.sidebar-main .dl-subtitle,
.sidebar-main .dl-batch-hint,
.sidebar-main .dl-activity,
.sidebar-main .no-data-msg,
.sidebar-main .panel-note {
  color: var(--sidebar-muted);
  font-size: var(--sb-info-size);
  line-height: 1.45;
}

.sb-welcome {
  color: var(--sidebar-text);
  font-size: var(--sb-body-size);
  margin: 0;
  padding: 0;
}

.sb-welcome-text {
  color: var(--sidebar-text);
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.sb-k {
  color: #fff;
}

.sb-card,
.worst-card,
.worst-card-item,
.meter-cell,
.region-row,
.stats-summary,
.qf-active-item {
  border: 1px solid var(--pli-card-border);
  background: var(--pli-card-bg);
  color: #fff;
}

.sb-card *,
.worst-card *,
.worst-card-item *,
.meter-cell *,
.region-row *,
.stats-summary *,
.qf-active-item * {
  color: inherit;
}

.sb-status-card {
  background: var(--pli-card-bg-strong);
  padding: 0.65rem 0.75rem;
}

.sb-status-card .status-time {
  margin-top: 0.45rem;
  font-size: var(--fs-note);
  color: var(--gray-300);
}

.sb-status-card .status-detail {
  margin-top: 0.35rem;
}

.sb-status-card #status-line,
.sb-status-card .status-line,
.sb-status-card .status-text {
  color: #fff;
}

.sb-status-card .status-detail {
  color: var(--gray-300);
}

.sb-status-card .status-time {
  color: var(--gray-300);
}

.focal-banner {
  background: var(--pli-card-bg);
  border-color: var(--pli-card-border);
  border-left-color: var(--pli-verde);
  color: #fff;
}

.focal-banner b {
  color: #fff;
}

.meter-cell .meter-name,
.meter-cell b,
.worst-name,
.worst-stat b,
.region-info b,
.region-k code,
.stats-summary b {
  color: #fff;
}

.meter-cell .meter-desc,
.worst-rod,
.worst-stat span,
.region-info small,
.region-k span {
  color: var(--gray-300);
}

.worst-stat {
  background: rgba(0, 59, 90, 0.34);
  border: 1px solid rgba(203, 213, 225, 0.22);
}

.info-card,
.info-card--critical,
.info-card--success,
.info-card--warning {
  position: relative;
  border: 1px solid var(--pli-card-border);
  border-left-width: 3px;
  background: var(--pli-card-bg);
  color: #fff;
}

.info-card--critical {
  --info-accent: var(--info-critical);
  --info-accent-bg: var(--info-critical-bg);
  border-left-color: var(--info-critical);
}

.info-card--success {
  --info-accent: var(--info-success);
  --info-accent-bg: var(--info-success-bg);
  border-left-color: var(--info-success);
}

.info-card--warning {
  --info-accent: var(--info-warning);
  --info-accent-bg: var(--info-warning-bg);
  border-left-color: var(--info-warning);
}

.info-card--critical b,
.info-card--critical strong,
.info-card--critical .info-accent,
.info-card--success b,
.info-card--success strong,
.info-card--success .info-accent,
.info-card--warning b,
.info-card--warning strong,
.info-card--warning .info-accent {
  color: var(--info-accent);
}

.info-card--critical::before,
.info-card--success::before,
.info-card--warning::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--info-accent-bg), transparent 48%);
  pointer-events: none;
}

.info-card--critical > *,
.info-card--success > *,
.info-card--warning > * {
  position: relative;
}

.rd-basis-note.rd-basis-ok,
.actions-empty--normal {
  border-left-color: var(--info-success);
}

.rd-basis-note.rd-basis-ok b,
.actions-empty--normal b {
  color: var(--info-success);
}

.rd-basis-note.rd-basis-warn,
.forecast-empty.waiting,
.actions-empty.waiting {
  border-left-color: var(--info-warning);
}

.rd-basis-note.rd-basis-warn b,
.forecast-empty.waiting b,
.actions-empty.waiting b {
  color: var(--info-warning);
}

.worst-card--blink,
.worst-card-item.worst-card--blink {
  border-left-color: var(--info-critical);
}

.worst-card--blink .worst-name,
.worst-card-item.worst-card--blink .worst-name {
  color: var(--info-critical);
}

.stats-summary {
  border-left: 3px solid var(--info-success);
  background:
    linear-gradient(90deg, var(--info-success-bg), transparent 48%),
    var(--pli-card-bg);
}

.forecast-empty.waiting,
.actions-empty.waiting {
  padding: 0.45rem 0.55rem;
  border-left: 3px solid var(--info-warning);
  border-radius: var(--sb-card-radius);
  background:
    linear-gradient(90deg, var(--info-warning-bg), transparent 48%),
    var(--pli-card-bg);
}

.actions-empty--normal {
  padding: 0.45rem 0.55rem;
  border-left: 3px solid var(--info-success);
  border-radius: var(--sb-card-radius);
  background:
    linear-gradient(90deg, var(--info-success-bg), transparent 48%),
    var(--pli-card-bg);
}

.status-refresh,
.btn {
  border: 1px solid #fff;
  background: var(--pli-verde);
  color: var(--pli-navy);
}

.status-refresh:hover,
.btn:hover {
  background: var(--pli-success);
  color: var(--pli-navy);
}

.btn-secondary,
.sb-qbtn,
.qf-rm {
  border: 1px solid var(--gray-500);
  background: var(--pli-navy);
  color: #fff;
}

.btn-secondary:hover,
.sb-qbtn:hover,
.qf-rm:hover {
  background: var(--pli-azul);
  color: #fff;
}

.sb-toggle {
  color: #fff;
}

.map-view-btn {
  border-color: var(--gray-300);
  background: #fff;
  color: var(--pli-navy);
}

.filter-group select,
.filter-group input,
.qf-clause select,
.qf-clause input,
.time-travel-input {
  background: rgba(0, 59, 90, 0.78);
  border: 1px solid rgba(203, 213, 225, 0.45);
  color: #fff;
  font-family: var(--font);
  font-size: var(--sb-body-size);
}

.filter-group select:hover,
.filter-group input:hover,
.qf-clause select:hover,
.qf-clause input:hover {
  background: rgba(0, 59, 90, 0.9);
}

.filter-group select:focus,
.filter-group input:focus,
.qf-clause select:focus,
.qf-clause input:focus {
  background: rgba(0, 59, 90, 0.96);
  border-color: var(--pli-verde);
  box-shadow: 0 0 0 3px rgba(62, 194, 110, 0.18);
}

.filter-group label,
.ck-group-title,
.qf-active-title,
.qf-clauses-head,
.qf-inline-label {
  color: var(--sidebar-muted);
  font-size: var(--sb-info-size);
}

.ck {
  color: var(--sidebar-text);
  font-size: var(--sb-body-size);
}

.ck:hover {
  color: #fff;
}

.sidebar-main .focal-banner,
.sidebar-main .stats-summary,
.sidebar-main .qf-active-item {
  color: #fff;
}

.sidebar-main .worst-card .worst-empty,
.sidebar-main .qf-active-expr {
  color: var(--gray-300);
}

.operational-status .alert-meter--vertical .meter-cell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto;
  column-gap: 0.45rem;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--meter-color) 70%, transparent);
  border-left: 4px solid var(--meter-color);
  border-right: 4px solid var(--meter-color);
  background: color-mix(in srgb, var(--meter-color) 16%, var(--pli-card-bg));
  color: #fff;
}

.operational-status .alert-meter--vertical .meter-rd {
  grid-column: 1;
  grid-row: 1;
  background: var(--meter-color);
  color: #fff;
}

.operational-status .alert-meter--vertical .meter-name {
  grid-column: 2;
  grid-row: 1;
  color: #fff;
}

.operational-status .alert-meter--vertical .meter-cell b {
  grid-column: 3;
  grid-row: 1;
  min-width: 1.35rem;
  padding: 0.12rem 0.24rem;
  border-radius: 0.25rem;
  background: var(--meter-color);
  color: #fff;
  text-align: center;
}

.alert-meter--vertical .meter-cell.active,
.operational-status .alert-meter--vertical .meter-cell.active {
  background: color-mix(in srgb, var(--meter-color) 24%, var(--pli-card-bg));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--meter-color) 55%, transparent);
  transform: none;
}

.alert-meter--vertical .meter-cell--blink,
.operational-status .alert-meter--vertical .meter-cell--blink {
  animation: alertMeterPulse 1.3s ease-in-out infinite;
}

@keyframes alertMeterPulse {
  0%,
  100% {
    background: color-mix(in srgb, var(--meter-color) 16%, var(--pli-card-bg));
    box-shadow: none;
  }
  50% {
    background: color-mix(in srgb, var(--meter-color) 28%, var(--pli-card-bg));
    box-shadow: 0 0 12px 1px var(--alert-glow, rgba(239, 68, 68, 0.45));
  }
}

.sidebar-main .hazard-meter {
  background: rgba(11, 26, 47, 0.92);
}

.sidebar-main .hazard-meter-title {
  color: #fff;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
  margin-top: auto;
  padding: 0;
  font-size: var(--fs-note);
  color: var(--sidebar-bege-dim);
  border: none;
  background: transparent;
  line-height: 1.45;
}

.footer-line {
  margin-bottom: 0.16rem;
}
.footer div {
  margin-bottom: 0.16rem;
}
.footer-k {
  color: var(--pli-verde);
  font-weight: 600;
}
.footer-v {
  color: var(--sidebar-text);
  font-weight: 700;
}
.footer b {
  color: var(--sidebar-text);
  font-weight: 700;
}
.footer .ver {
  margin-top: 0.35rem;
  color: var(--sidebar-bege);
  font-weight: 600;
}

/* ============================================================================
   ÁREA PRINCIPAL
   ============================================================================ */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.topbar {
  background: var(--pli-verde-escuro);
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  height: var(--app-header-height);
  min-height: var(--app-header-height, auto);
  padding: 0.5rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  z-index: 1100;
  gap: 1rem;
  position: relative;
  overflow: visible;
}

.topbar-title-block {
  grid-column: 1 / -1;
  grid-row: 1;
  text-align: center;
  pointer-events: none;
}

.topbar-actions {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  z-index: 2;
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  overflow: visible;
}

.topbar-admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--pli-navy);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.topbar-admin-btn:hover {
  background: var(--pli-azul);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow-sm);
}

.topbar-admin-btn:focus-visible {
  outline: 2px solid var(--pli-verde);
  outline-offset: 2px;
}

.topbar-admin-ico {
  font-size: 0.9rem;
  line-height: 1;
}

.topbar h1 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

.topbar-sub {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.88);
  margin-top: 0.22rem;
  font-weight: 400;
  line-height: 1.35;
  text-wrap: balance;
}

.badge {
  font-size: 0.7rem;
  padding: 0.32rem 0.75rem;
  border-radius: 1rem;
  background: var(--pli-navy);
  color: white;
  font-weight: 600;
  letter-spacing: 0.3px;
  font-feature-settings: "tnum" 1;
  cursor: help;
}

#badge-source {
  background: var(--pli-accent);
}

.badge.badge-historical {
  background: #7c4a03;
  color: #fff7ed;
  animation: none;
}

.badge-time-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.history-search-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.history-search-subtitle {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-note);
  font-weight: 700;
  color: var(--sidebar-text);
}

.history-search-hint {
  margin: 0;
  font-size: var(--fs-note);
  line-height: 1.35;
  color: var(--sidebar-muted);
}

.history-search-label {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--fs-note);
  font-weight: 600;
  color: var(--sidebar-bege);
}

.history-search-input {
  width: 100%;
  box-sizing: border-box;
  font-size: var(--fs-note);
  padding: 0.4rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.22);
  color: var(--sidebar-text);
}

.history-search-input:focus {
  outline: 2px solid rgba(62, 194, 110, 0.45);
  border-color: var(--pli-verde);
}

.history-search-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

#history-search-panel .history-hints {
  max-height: 10rem;
  margin-bottom: 0.15rem;
}

#history-search-panel .history-hints-loading {
  color: var(--sidebar-muted);
}

#history-search-panel .history-hint-btn {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text);
}

#history-search-panel .history-hint-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(62, 194, 110, 0.45);
}

#history-search-panel .history-hint-text small {
  color: var(--sidebar-muted);
}

.badge-time-btn {
  cursor: default;
}
.badge-time-btn:hover {
  filter: none;
}

.time-travel-wrap {
  position: relative;
  display: inline-block;
  z-index: 1200;
}
.time-travel-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 1201;
  width: min(22rem, 92vw);
  padding: 0.75rem 0.85rem;
  background: #fff;
  color: var(--pli-navy);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(0, 59, 90, 0.12);
}
.time-travel-title {
  font-weight: 700;
  font-size: 0.82rem;
  margin: 0 0 0.35rem;
}
.time-travel-help {
  font-size: 0.72rem;
  line-height: 1.4;
  color: #475569;
  margin: 0 0 0.55rem;
}
.time-travel-hints-title {
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--pli-navy);
}
.time-travel-hints-help {
  font-size: 0.68rem;
  line-height: 1.35;
  color: #64748b;
  margin: 0 0 0.4rem;
}
.history-hints {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  max-height: 9.5rem;
  overflow-y: auto;
}
.history-hints-loading {
  font-size: 0.68rem;
  color: #94a3b8;
}
.history-hint-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.45rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.35rem;
  background: #f8fafc;
  cursor: pointer;
  font: inherit;
  color: var(--pli-navy);
  transition:
    background 0.15s,
    border-color 0.15s;
}
.history-hint-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.history-hint-level {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  margin-top: 0.2rem;
}
.history-hint-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.history-hint-text strong {
  font-size: 0.72rem;
  font-weight: 700;
}
.history-hint-text small {
  font-size: 0.65rem;
  line-height: 1.3;
  color: #64748b;
}
.time-travel-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.time-travel-input {
  width: 100%;
  font-size: 0.78rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.35rem;
  margin-bottom: 0.55rem;
}
.time-travel-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.btn-sm {
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
}

#badge-update {
  background: var(--pli-verde);
}

/* Estados de qualidade do dado (sobrescrevem badges acima) */
.badge.badge-ok {
  background: var(--pli-verde);
}
.badge.badge-degraded {
  background: #f39c12;
  color: #1c1207;
}
.badge.badge-no-data {
  background: #b3261e;
  color: #fff;
  animation: pulse-bg 2s ease-in-out infinite;
}
.badge.badge-mock {
  background: #475569;
  color: #cbd5e1;
  border: 1px dashed #94a3b8;
}
.badge.badge-loading {
  background: #1c3d59;
  color: #cbd5e1;
  animation: pulse-bg-blue 1.6s ease-in-out infinite;
}

@keyframes pulse-bg {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(179, 38, 30, 0.55);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(179, 38, 30, 0);
  }
}

@keyframes pulse-bg-blue {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(28, 61, 89, 0.55);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(28, 61, 89, 0);
  }
}

.rd-basis-note {
  font-size: 0.82em;
  line-height: 1.45;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.55rem;
  border: 1px solid var(--pli-card-border);
  border-left: 3px solid var(--info-success);
  background: var(--pli-card-bg);
  color: #fff;
}
.rd-basis-note.rd-basis-warn {
  border-left-color: var(--info-warning);
  background:
    linear-gradient(90deg, var(--info-warning-bg), transparent 48%),
    var(--pli-card-bg);
  color: #fff;
}
.rd-basis-note.rd-basis-ok {
  border-left-color: var(--info-success);
  background:
    linear-gradient(90deg, var(--info-success-bg), transparent 48%),
    var(--pli-card-bg);
  color: #fff;
}
.rd-basis-note small {
  display: block;
  margin-top: 0.25rem;
  opacity: 0.9;
}

/* Card "sem dado" no painel "Trecho Mais Crítico" */
.worst-empty.no-data {
  padding: 0.8rem 0.5rem;
}
.worst-empty.no-data .no-data-title {
  color: #b3261e;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.worst-empty.no-data .no-data-title::before {
  content: "⚠";
  font-size: 1rem;
}
.worst-empty.no-data .no-data-msg {
  color: var(--sidebar-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* Card "carregando" - primeiro ciclo */
.worst-empty.loading {
  padding: 0.9rem 0.5rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.worst-empty.loading .loading-title {
  color: var(--pli-navy);
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.worst-empty.loading .loading-msg {
  color: var(--gray-500);
  font-size: 0.76rem;
  line-height: 1.45;
}
.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(28, 61, 89, 0.18);
  border-top-color: var(--pli-verde);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

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

/* Progresso de download dos GRIBs (primeiro ciclo).
   Fundo escuro com todas as fontes brancas, conforme solicitado. */
.dl-box {
  background: rgba(11, 26, 47, 0.92);
  border-radius: 0.5rem;
  padding: 0.7rem 0.75rem;
  font-style: normal;
}
.dl-box.dl-box--processing {
  padding: 0.75rem 0.8rem 0.85rem;
}
.worst-empty.loading.dl-box .loading-title {
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.worst-empty.loading.dl-box .loading-spinner {
  display: inline-block;
  flex-shrink: 0;
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--pli-verde);
}
.dl-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  max-height: 11rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}
.dl-list-hint {
  color: var(--sidebar-muted);
  font-size: 0.62rem;
  line-height: 1.4;
  margin-top: 0.42rem;
  min-height: 0.9rem;
  white-space: normal;
  word-break: break-word;
  text-align: center;
}
.dl-row {
  display: block;
  padding: 0.22rem 0;
}
.dl-row.dl-ok .dl-bar-fill {
  background: #4ade80;
}
.dl-row.dl-fail .dl-bar-fill {
  background: #ff6b6b;
}
.dl-row.dl-active .dl-name {
  color: #ffffff;
  font-weight: 600;
}
.dl-row.dl-decoding .dl-name {
  color: #c4b5fd;
  font-weight: 600;
}
.dl-row.dl-decoding .dl-bar-fill {
  background: linear-gradient(90deg, #7c5cff 0%, #a78bfa 100%);
}
.dl-row.dl-pending .dl-name {
  opacity: 0.65;
}
.dl-row.dl-pending .dl-bar-fill {
  background: rgba(255, 255, 255, 0.28);
}
.dl-row.dl-empty {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  padding: 0.35rem 0;
}
.dl-cache {
  margin: 0.65rem 0 0.45rem;
}
.dl-bar-cache .dl-bar-fill {
  background: linear-gradient(90deg, #0ea5e9 0%, #4ade80 100%);
  transition: width 0.12s linear;
}
.dl-batch-hint {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}
.dl-subtitle {
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--sidebar-muted);
  margin: 0.35rem 0 0.55rem;
  font-weight: 400;
}
.dl-box--processing .dl-subtitle {
  margin-bottom: 0.65rem;
}
.dl-name {
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  line-height: 1.35;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
  margin-bottom: 0.18rem;
}
.dl-line {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
.dl-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.dl-bar-fill {
  height: 100%;
  width: 0;
  background: var(--pli-verde);
  border-radius: 3px;
  transition: width 0.15s linear;
}
.dl-bar-fill.dl-bar-indeterminate {
  width: 35% !important;
  animation: dl-indeterminate 1.1s ease-in-out infinite;
}
@keyframes dl-indeterminate {
  0% {
    margin-left: 0;
  }
  50% {
    margin-left: 65%;
  }
  100% {
    margin-left: 0;
  }
}
.dl-pct {
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  line-height: 1.2;
  min-width: 4.6rem;
  flex-shrink: 0;
  text-align: right;
  white-space: normal;
}
.dl-row.dl-fail .dl-bar-fill {
  background: #ff6b6b;
}
.dl-overall {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}
.dl-overall-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.dl-bar-lg {
  height: 9px;
  border-radius: 4.5px;
}
.dl-bar-lg .dl-bar-fill {
  border-radius: 4.5px;
  transition: width 0.12s linear;
}

/* Mensagens de espera (paineis dependentes durante o carregamento) */
.actions-empty,
.forecast-empty {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
}

.actions-empty--normal {
  color: var(--sidebar-bege);
}

.actions-empty.waiting,
.forecast-empty.waiting {
  font-style: italic;
}

.forecast-panel {
  font-size: var(--fs-normal);
  line-height: 1.4;
  color: var(--sidebar-text);
}

.forecast-dual {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.35rem 0 0.5rem;
}

.forecast-channel {
  padding: 0.42rem 0.5rem;
  border-radius: 0.32rem;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.forecast-channel-title {
  margin: 0 0 0.2rem;
  font-size: var(--fs-note);
  font-weight: 700;
  color: var(--sidebar-bege);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.forecast-channel-val {
  margin: 0;
  font-size: var(--fs-normal);
  color: var(--sidebar-text);
}

.forecast-channel-val b {
  font-size: 1.05rem;
}

.forecast-channel-val small {
  color: var(--sidebar-muted);
}
.forecast-source {
  margin-bottom: 0.35rem;
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
}
.forecast-meta {
  font-size: var(--fs-normal);
  color: var(--sidebar-muted);
  margin-bottom: 0.5rem;
}
.forecast-list {
  max-height: 120px;
  overflow-y: auto;
  border-top: 1px solid rgba(221, 212, 192, 0.35);
  padding-top: 0.35rem;
}
.forecast-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-normal);
  padding: 0.12rem 0;
  gap: 0.5rem;
}
.forecast-more {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
  text-align: center;
}
.worst-spark {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(221, 212, 192, 0.35);
}
.worst-spark-label {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
  margin-bottom: 0.25rem;
}

/* Etapas pos-download: minicards com texto em ate 2 linhas */
.pr-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}
.pr-card {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.42rem 0.52rem;
  border-radius: 0.38rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
}
.pr-ic {
  width: 1rem;
  margin-top: 0.12rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.pr-label {
  flex: 1;
  white-space: normal;
  line-height: 1.38;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
  font-size: 0.68rem;
}
.pr-card.pr-done {
  color: #ffffff;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}
.pr-card.pr-done .pr-ic {
  color: var(--sidebar-text);
}
.pr-card.pr-active {
  color: #ffffff;
  border-color: rgba(42, 163, 88, 0.55);
  background: rgba(42, 163, 88, 0.12);
}
.pr-card.pr-pending {
  opacity: 0.72;
}
.pr-spin {
  width: 13px;
  height: 13px;
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--pli-verde);
}

#map {
  flex: 1;
  background: var(--gray-100);
  position: relative;
  z-index: 1;
  min-height: 0;
}

.map-stage {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-history-banner {
  position: absolute;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 650;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.45rem 1.1rem;
  border-radius: 0.45rem;
  background: rgba(124, 74, 3, 0.92);
  color: #fff7ed;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 247, 237, 0.22);
  pointer-events: none;
  text-align: center;
  max-width: min(92vw, 28rem);
}
.map-history-banner[hidden] {
  display: none !important;
}
.map-history-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.88;
}
.map-history-date {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
  font-feature-settings: "tnum" 1;
}
.map-history-banner.is-loading .map-history-date {
  font-size: 0.78rem;
  font-weight: 600;
  font-style: italic;
}

/* ============================================================================
   LEGENDA DO MAPA
   ============================================================================ */

.legend {
  position: absolute;
  bottom: 1rem;
  left: var(--map-overlay-inset-x);
  right: var(--map-overlay-inset-x);
  z-index: 600;
  pointer-events: none;
}

.legend-stack {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

.legend-block {
  pointer-events: auto;
  background: white;
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: var(--legend-panel-w, max-content);
  min-width: max-content;
  max-width: 100%;
  overflow: hidden;
  transition:
    max-width 0.28s ease,
    width 0.28s ease;
}

.legend-block.collapsed {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: none;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.62rem 0.82rem;
  background: var(--pli-navy);
  color: #fff;
  cursor: default;
  user-select: none;
  min-height: 2.15rem;
}

.legend-block.collapsed .legend-head {
  background: transparent;
  padding: 0;
  border: none;
  min-height: 0;
  justify-content: flex-start;
}

.legend-block.collapsed .legend-title,
.legend-block.collapsed .legend-body {
  display: none;
}

.legend-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0;
  border: none;
  padding: 0;
  padding-right: 0.15rem;
}

.legend-title-risk {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
}

.legend-title-sub {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.82);
  text-transform: none;
  white-space: nowrap;
}

.legend-toggle {
  flex: 0 0 auto;
  order: 2;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    background 0.15s ease,
    transform 0.18s ease;
}

.legend-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.legend-block.collapsed .legend-toggle {
  background: var(--pli-navy);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg);
}

.legend-block.collapsed .legend-toggle:hover {
  background: var(--pli-azul);
}

.legend-body {
  flex: 1 1 auto;
  padding: 0.55rem 0.75rem 0.65rem;
}

.legend-rows {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.74rem;
  color: var(--gray-700);
  font-weight: 500;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.rd-0 {
  background: var(--rd-0);
}
.dot.rd-1 {
  background: var(--rd-1);
}
.dot.rd-2 {
  background: var(--rd-2);
}
.dot.rd-3 {
  background: var(--rd-3);
}
.dot.rd-4 {
  background: var(--rd-4);
}
.dot.rd-nd {
  background: #64748b;
}

.line {
  display: inline-block;
  width: 26px;
  height: 0;
  margin-right: 6px;
  vertical-align: middle;
}

/* Linhas da malha por nivel operacional (mesmas cores das linhas no mapa) */
.line-rd-0 {
  border-top: 3px solid #3ec26e;
}
.line-rd-1 {
  border-top: 3.5px solid #a3d977;
}
.line-rd-2 {
  border-top: 4px solid #f7b73a;
}
.line-rd-3 {
  border-top: 4.5px solid #f37527;
}
.line-rd-4 {
  border-top: 5px solid #e02825;
}
.line-rd-nd {
  border-top: 2px dashed #5b6b7d;
}
.line-out {
  border-top: 1.8px solid #5b6b7d;
}

/* ============================================================================
   POPUP DE TRECHO RODOVIARIO
   ============================================================================ */

.popup-monitor {
  margin: 0.6rem 0 0.55rem;
  padding: 0.5rem 0.6rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  font-size: 0.82rem;
}
.popup-monitor-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
  gap: 0.5rem;
}
.popup-monitor-row:last-child {
  margin-bottom: 0;
}
.popup-monitor-label {
  color: #64748b;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.popup-monitor-haz {
  flex-direction: column;
  align-items: stretch;
}
.popup-monitor-haz ul {
  margin: 0.25rem 0 0 0;
  padding-left: 1.1rem;
  color: #334155;
}
.popup-monitor-haz li {
  margin: 0.15rem 0;
  line-height: 1.35;
}
.popup-monitor-off {
  color: #475569;
  background: #f1f5f9;
  font-size: 0.78rem;
  line-height: 1.45;
}

.rd-pill {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 0.85rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}
.rd-pill.rd-0 {
  background: #3ec26e;
}
.rd-pill.rd-1 {
  background: #a3d977;
  color: #1f2937;
}
.rd-pill.rd-2 {
  background: #f7b73a;
  color: #1f2937;
}
.rd-pill.rd-3 {
  background: #f37527;
}
.rd-pill.rd-4 {
  background: #e02825;
}
.rd-pill.rd-nd {
  background: #94a3b8;
}

/* Legenda dinamica: tres paineis na mesma linha (sobrescreve legado) */
#hazard-legend.legend-stack {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.35rem;
}

/* ============================================================================
   PAINEL FLUTUANTE - CAMADAS DO MAPA (canto superior esquerdo do mapa)
   ============================================================================ */

.map-layer-control {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  font-family: var(--font);
  width: auto;
  min-width: var(--map-panel-min-width);
  max-width: var(--map-panel-max-width);
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* sobrepoe o ::after default da .leaflet-bar (linha divisoria) */
  --leaflet-bar-bg: #fff;
}

.map-layer-control--floating {
  position: absolute;
  top: var(--map-overlay-inset-top);
  left: var(--map-overlay-inset-x);
  z-index: 560;
  pointer-events: auto;
  width: var(--map-panel-max-width);
}

.map-view-tools {
  position: absolute;
  top: var(--map-overlay-inset-top);
  right: var(--map-overlay-inset-x);
  z-index: 560;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  pointer-events: auto;
}

.map-view-tools-group {
  display: flex;
  gap: 0.35rem;
}

.map-view-tools-group--zoom {
  flex-direction: column;
  gap: 0;
}

.map-view-tools-group--zoom .map-view-btn--zoom:first-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.map-view-tools-group--zoom .map-view-btn--zoom:last-child {
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.map-view-btn {
  min-width: 2.35rem;
  height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid var(--gray-200);
  border-radius: 0.35rem;
  background: #fff;
  color: var(--pli-navy);
  box-shadow: var(--shadow-md);
  font: 800 0.74rem/1 var(--font);
  cursor: pointer;
}

.map-view-btn:hover {
  background: var(--gray-50);
}

.map-layer-control.leaflet-bar {
  box-shadow: var(--shadow-lg);
}

.map-layer-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.62rem 0.82rem;
  background: var(--pli-navy);
  color: #fff;
  cursor: default;
  user-select: none;
  min-height: 2.15rem;
}

.map-layer-control-title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.map-layer-control-toggle {
  flex: 0 0 auto;
  order: 2;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition:
    background 0.15s ease,
    transform 0.18s ease;
}
.map-layer-control-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.map-layer-control.collapsed .map-layer-control-toggle {
  background: var(--pli-navy);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg);
}

.map-layer-control.collapsed .map-layer-control-toggle:hover {
  background: var(--pli-azul);
}

.map-layer-control-body {
  padding: 0.72rem 0.9rem 0.9rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Override do estilo .ck (que era para sidebar escura) para fundo branco */
.map-layer-control .ck {
  color: var(--gray-900);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.34rem 0;
  white-space: nowrap;
  overflow: visible;
}
.map-layer-control .ck:hover {
  color: var(--pli-navy);
}
.map-layer-control .ck--sub {
  align-items: center;
  color: var(--gray-600);
  display: flex;
  gap: 0.45rem;
  padding-left: 1.25rem;
}
.map-layer-control .ck--sub-select {
  display: block;
  margin: 0 0 0.35rem 1.25rem;
  width: calc(100% - 1.25rem);
}
.map-layer-control .layer-mini-select {
  border: 1px solid var(--gray-200);
  border-radius: 0.45rem;
  color: var(--gray-800);
  font-size: 0.72rem;
  padding: 0.16rem 0.35rem;
}
.map-layer-control .ck-empty {
  color: var(--gray-400);
  font-style: italic;
  cursor: default;
}
.map-layer-control .ck-empty:hover {
  color: var(--gray-400);
}

.map-layer-control .ck--risk-layer {
  align-items: flex-start;
  gap: 0.45rem;
}

.ck-risk-text {
  display: grid;
  gap: 0.08rem;
  line-height: 1.25;
}

.ck-risk-alias {
  font-weight: 600;
  color: var(--gray-800);
}

.ck-risk-tech {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--gray-500);
  text-transform: none;
}

.map-layer-control .ck-group-title {
  color: var(--gray-800);
  border-top: 1px solid var(--gray-200);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-transform: uppercase;
  hyphens: auto;
}

/* Estado recolhido: esconde titulo e corpo; so o botao permanece visivel */
.map-layer-control.collapsed {
  width: auto;
  min-width: 0;
  max-width: none;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.map-layer-control.collapsed .map-layer-control-head {
  background: transparent;
  padding: 0;
  border: none;
  min-height: 0;
  justify-content: flex-start;
}

.map-layer-control.collapsed .map-layer-control-title {
  display: none;
}

.map-layer-control.collapsed .map-layer-control-body {
  display: none;
}

@media (max-width: 600px) {
  .map-layer-control,
  .legend-stack,
  .legend-block {
    width: calc(100% - 24px);
    min-width: 0;
    max-width: calc(100% - 24px);
  }

  .legend-stack {
    flex-direction: column;
  }

  #hazard-legend.legend-stack {
    flex-direction: column;
  }
}

/* ============================================================================
   LEAFLET CUSTOM
   ============================================================================ */

.leaflet-container {
  font-family: var(--font);
}

.leaflet-container.leaflet-grab {
  cursor: default;
}

.leaflet-container.leaflet-grab .leaflet-interactive {
  cursor: pointer;
}

.leaflet-container.leaflet-dragging.leaflet-grab,
.leaflet-container.leaflet-dragging.leaflet-grab .leaflet-interactive {
  cursor: grabbing;
}

.leaflet-interactive.ua-trecho-focus {
  filter: drop-shadow(0 0 3px rgba(253, 224, 71, 0.95));
}

/* Halo ciano pulsante aplicado ao vetor de uma UA clicada no mapa.
   E uma camada Leaflet INDEPENDENTE (nao interativa, renderizada atras
   do marker original via bringToBack), entao mantemos a cor da RD
   visivel enquanto destacamos o contorno. */
.leaflet-interactive.ua-click-halo {
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.85));
  animation: uaClickHaloPulse 1.6s ease-in-out infinite;
}

@keyframes uaClickHaloPulse {
  0%,
  100% {
    stroke-opacity: 0.35;
  }
  50% {
    stroke-opacity: 0.85;
  }
}

.leaflet-interactive.ua-alert-blink {
  animation: uaMapPulse 1.3s ease-in-out infinite;
}

@keyframes uaMapPulse {
  0%,
  100% {
    stroke-opacity: 0.72;
    fill-opacity: 0.42;
  }
  50% {
    stroke-opacity: 1;
    fill-opacity: 0.78;
    filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.65));
  }
}

.point-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  font-weight: 700;
  font-size: 0.78rem;
  color: white;
  font-family: var(--font);
}

.point-marker.rd-0 {
  background: var(--rd-0);
}
.point-marker.rd-1 {
  background: var(--rd-1);
  color: var(--gray-900);
}
.point-marker.rd-2 {
  background: var(--rd-2);
}
.point-marker.rd-3 {
  background: var(--rd-3);
  animation: pulse-marker 1.5s infinite;
}
.point-marker.rd-4 {
  background: var(--rd-4);
  animation: pulse-marker 1.2s infinite;
}
.point-marker.rd-nd {
  background: #64748b;
  color: #f1f5f9;
  opacity: 0.9;
}

@keyframes pulse-marker {
  0% {
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.3),
      0 0 0 0 currentColor;
  }
  70% {
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.3),
      0 0 0 14px transparent;
  }
  100% {
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.3),
      0 0 0 0 transparent;
  }
}

.popup-content {
  font-size: 0.85rem;
  min-width: 230px;
}

.popup-content h4 {
  margin: 0 0 0.45rem 0;
  color: var(--pli-navy);
  font-size: 0.95rem;
}

.popup-content h4 small {
  font-weight: 400;
  color: var(--gray-500);
  font-size: 0.72rem;
  margin-left: 0.3rem;
}

.popup-content .popup-rod {
  color: var(--gray-500);
  font-size: 0.74rem;
  margin-bottom: 0.15rem;
}

.popup-content table {
  width: 100%;
  font-size: 0.74rem;
  margin-top: 0.5rem;
  border-collapse: collapse;
}

.popup-content td {
  padding: 0.2rem 0.3rem;
  border-bottom: 1px solid var(--gray-100);
}

.popup-content tr:last-child td {
  border-bottom: none;
}

.popup-content td:first-child {
  color: var(--gray-500);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.popup-content td:last-child {
  font-weight: 600;
  text-align: right;
  font-feature-settings: "tnum" 1;
}

.popup-level {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border-radius: 0.35rem;
  font-weight: 700;
  font-size: 0.72rem;
  margin-top: 0.55rem;
}

.popup-source {
  font-size: 0.65rem;
  color: var(--gray-400);
  margin-top: 0.45rem;
  font-style: italic;
}

/* Popup UA — mesmo padrão visual do modal "Como ler o mapa" */
.leaflet-popup.ua-popup-wrap .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 0.55rem;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
}

.leaflet-popup.ua-popup-wrap .leaflet-popup-content {
  margin: 0;
  width: 460px !important;
  max-width: min(500px, calc(100vw - 2rem));
  line-height: 1.24;
}

.leaflet-popup.ua-popup-wrap .leaflet-popup-tip {
  box-shadow: var(--shadow-md);
}

.ua-popup-header {
  background: var(--popup-risk-color, var(--pli-navy));
  color: #fff;
  padding: 0.6rem 0.85rem 0.62rem;
}

.ua-popup-header h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
}

.ua-popup-region {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.18;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.02em;
}

.ua-popup-risk {
  margin-top: 0.14rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.18;
  color: #fff;
}

.ua-popup-risk-tech {
  margin-top: 0.12rem;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.72);
}

.ua-popup-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 0.16rem;
}

.ua-popup-trecho {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.18;
  color: rgba(255, 255, 255, 0.96);
}

.ua-popup-ra {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.18;
  color: rgba(255, 255, 255, 0.9);
  text-align: right;
  flex-shrink: 0;
}

.ua-popup-id {
  margin-top: 0.16rem;
  font-size: 0.68rem;
  opacity: 0.72;
  letter-spacing: 0.2px;
}

.ua-popup-sub {
  margin-top: 0.14rem;
  font-size: 0.72rem;
  opacity: 0.88;
  line-height: 1.18;
}

.ua-popup-body {
  padding: 0.62rem 0.82rem 0.72rem;
  background: var(--popup-risk-bg, #fff);
  color: var(--gray-800);
}

.ua-popup-section {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pli-navy);
  margin: 0.42rem 0 0.28rem;
}

.ua-popup-section:first-child {
  margin-top: 0;
}

.ua-popup-table {
  margin: 0.2rem 0 0.42rem !important;
  font-size: 0.75rem !important;
  line-height: 1.18 !important;
}

.ua-popup-table th {
  white-space: normal !important;
  line-height: 1.12 !important;
  width: 62%;
  font-size: 0.7rem !important;
  padding: 0.18rem 0.35rem !important;
}

.ua-popup-table th .coef-label {
  display: inline;
}

.ua-popup-table td {
  width: 38%;
  padding: 0.18rem 0.35rem !important;
}

.ua-popup-meta {
  font-size: 0.74rem;
  color: var(--gray-500);
  margin: 0.18rem 0 0.22rem;
  line-height: 1.18;
}

.ua-popup-note {
  background: rgba(243, 156, 18, 0.08);
  border-left: 3px solid var(--rd-2);
  padding: 0.42rem 0.58rem;
  border-radius: 0.35rem;
  font-size: 0.74rem;
  color: var(--gray-700);
  margin: 0.32rem 0;
  line-height: 1.22;
}

.ua-popup-level {
  display: inline-block;
  padding: 0.28rem 0.58rem;
  border-radius: 0.35rem;
  font-weight: 700;
  font-size: 0.76rem;
  margin-top: 0.32rem;
  letter-spacing: 0.2px;
}

.ua-popup-level--nd {
  background: #64748b;
  color: #fff;
}

.ua-popup-foot {
  font-size: 0.68rem;
  color: var(--gray-400);
  margin: 0.28rem 0 0;
  font-style: italic;
  line-height: 1.18;
}

.ua-popup-all-layers {
  align-items: center;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  color: var(--gray-600);
  cursor: pointer;
  display: inline-flex;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  margin-top: 0.42rem;
  padding: 0.22rem 0.5rem;
}

.ua-popup-all-layers:hover {
  border-color: var(--pli-azul);
  color: var(--pli-navy);
}

.leaflet-popup.unified-popup-wrap .leaflet-popup-content {
  width: 560px !important;
  max-width: min(620px, calc(100vw - 2rem));
}

.leaflet-popup.unified-popup-wrap .ua-popup-body {
  max-height: min(62vh, 620px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.unified-popup-item {
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
}

.unified-popup-item:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.unified-popup-title {
  color: var(--pli-navy);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.28rem;
}

.unified-popup-item > .ua-popup {
  border: 1px solid var(--gray-100);
  border-radius: 0.45rem;
  overflow: hidden;
}

.unified-popup-item > .ua-popup .ua-popup-header {
  padding: 0.45rem 0.62rem;
}

.unified-popup-item > .ua-popup .ua-popup-body {
  padding: 0.45rem 0.62rem;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1024px) {
  .legend-stack {
    flex-wrap: wrap;
    max-width: calc(100vw - 2rem);
  }

  .legend-block {
    max-width: calc(100vw - 2rem);
  }

  .map-layer-control {
    min-width: min(var(--map-panel-min-width), calc(100vw - 2rem));
    max-width: min(var(--map-panel-max-width), calc(100vw - 2rem));
  }
}

@media (max-width: 900px) {
  body {
    flex-direction: column;
  }
  .sidebar-shell {
    width: 100% !important;
    min-width: 0;
    max-width: none;
    max-height: 50vh;
  }
  .sidebar-main {
    width: 100%;
    max-height: 50vh;
    zoom: 0.85;
  }
  .main {
    height: 50vh;
  }
  .legend-stack {
    flex-direction: column;
    flex-wrap: nowrap;
    width: fit-content;
    max-width: calc(100vw - 2rem);
  }

  #hazard-legend.legend-stack {
    flex-direction: column;
  }

  .legend-block {
    width: var(--legend-panel-w, max-content);
    max-width: calc(100vw - 2rem);
  }
  .topbar h1 {
    font-size: 0.9rem;
  }
  .topbar-sub {
    display: none;
  }
}

/* ============================================================================
   FOOTER LINKS
   ============================================================================ */

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.4rem 0;
}

.footer-links a {
  color: var(--sidebar-bege);
  font-size: 0.6rem;
  text-decoration: none;
  border-bottom: 1px dashed rgba(221, 212, 192, 0.45);
  padding-bottom: 1px;
  transition: all 0.15s ease;
}

.footer-links a:hover {
  color: var(--sidebar-text);
  border-bottom-color: var(--sidebar-text);
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 30, 60, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 2rem 1rem;
  animation: fade-in 0.2s ease;
}

.modal-backdrop[hidden] {
  display: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: white;
  color: var(--gray-800);
  border-radius: 0.7rem;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slide-up 0.25s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.4rem;
  background: linear-gradient(135deg, var(--pli-navy) 0%, var(--pli-azul) 100%);
  color: white;
  border-radius: 0.7rem 0.7rem 0 0;
  flex-shrink: 0;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.6rem;
  font-weight: 300;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.modal-body {
  padding: 1.5rem 1.6rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.modal-intro {
  background: rgba(62, 194, 110, 0.08);
  border-left: 3px solid var(--pli-verde);
  padding: 0.75rem 0.95rem;
  border-radius: 0.35rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--gray-700);
  margin-bottom: 1.4rem;
}

.modal-body h3 {
  color: var(--pli-navy);
  font-size: 0.92rem;
  margin: 1.2rem 0 0.4rem 0;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--gray-200);
}

.modal-body h3:first-of-type {
  margin-top: 0;
}

.modal-body p {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--gray-700);
  margin-bottom: 0.65rem;
}

.modal-body p b {
  color: var(--pli-navy);
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1rem 0;
  font-size: 0.82rem;
}

.modal-table th {
  text-align: left;
  padding: 0.45rem 0.65rem;
  background: var(--gray-50);
  color: var(--pli-navy);
  font-weight: 600;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  vertical-align: top;
  width: 30%;
}

.modal-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  line-height: 1.45;
}

.modal-table tr:last-child th,
.modal-table tr:last-child td {
  border-bottom: none;
}

.formula {
  background: var(--gray-50);
  padding: 0.7rem 0.95rem;
  border-radius: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem !important;
  text-align: center;
  color: var(--pli-navy);
  font-weight: 600;
  margin: 0.7rem 0 !important;
  border: 1px solid var(--gray-200);
}

.modal-note {
  background: rgba(243, 156, 18, 0.08);
  border-left: 3px solid var(--rd-2);
  padding: 0.75rem 0.95rem;
  border-radius: 0.35rem;
  font-size: 0.82rem !important;
  line-height: 1.55;
  color: var(--gray-700);
}

.modal-example {
  background: var(--gray-50);
  padding: 0.95rem 1.1rem;
  border-radius: 0.45rem;
  border-left: 3px solid var(--pli-accent);
  margin-top: 0.5rem;
}

.modal-example p {
  font-size: 0.82rem !important;
  margin-bottom: 0.5rem;
}
.modal-example p:last-child {
  margin-bottom: 0;
}
.modal-example p b {
  color: var(--pli-accent);
}

.modal-glossary {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.modal-glossary dt {
  font-weight: 700;
  color: var(--pli-navy);
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
}

.modal-glossary dd {
  font-size: 0.84rem;
  color: var(--gray-700);
  line-height: 1.55;
  padding-left: 0.85rem;
  border-left: 2px solid var(--gray-200);
  margin-left: 0;
}

.modal-glossary dd b {
  color: var(--pli-navy);
}

.modal-glossary dd code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--gray-100);
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  color: var(--pli-accent);
}

.modal-wide {
  max-width: min(720px, calc(100vw - 2rem));
}

.modal-code-block {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.45;
  word-break: break-all;
  background: var(--gray-100);
  padding: 0.45rem 0.55rem;
  border-radius: 0.35rem;
  color: var(--pli-navy);
}

.modal-code-line {
  margin: 0.35rem 0 0.65rem;
}

.modal-pre {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.5;
  background: var(--gray-100);
  color: var(--pli-navy);
  padding: 0.65rem 0.75rem;
  border-radius: 0.35rem;
  overflow-x: auto;
  margin: 0.35rem 0 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-table code {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--pli-accent);
}

/* ============================================================================
   LINHA DO TEMPO (animacao 96h)
   ============================================================================ */

.timeline {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 2rem));
  background: rgba(0, 59, 90, 0.94);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.55rem;
  box-shadow: var(--shadow-xl);
  padding: 0.6rem 0.75rem 0.7rem;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.timeline[hidden] {
  display: none;
}

.timeline-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.tl-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 0.3rem;
  width: 1.9rem;
  height: 1.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.tl-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.tl-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tl-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--pli-verde);
  min-width: 7.5rem;
  text-align: center;
}

.tl-step-label {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tl-step-label select {
  background: var(--pli-navy);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.25rem;
  font-size: 0.62rem;
  padding: 0.1rem 0.2rem;
}

.tl-status {
  flex: 1;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.75);
  text-align: right;
  min-width: 0;
}

.tl-close {
  margin-left: auto;
}

.tl-range {
  width: 100%;
  accent-color: var(--pli-verde);
  cursor: pointer;
}

.tl-channel {
  font-size: 0.68rem;
  line-height: 1.45;
  color: #fde68a;
  margin: 0.35rem 0 0.15rem;
  font-weight: 600;
}

.tl-hint {
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* ============================================================================
   ACOES OPERACIONAIS - botao "Acoes necessarias" (sidebar)
   ============================================================================ */

.acoes-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  background: var(--acao-cor, #ef4444);
  color: #fff;
  border-radius: 0.42rem;
  padding: 0.6rem 0.7rem;
  transition:
    filter 0.15s ease,
    transform 0.15s ease;
}

.acoes-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.acoes-btn-main {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.acoes-btn-main b {
  font-size: var(--fs-title);
  font-weight: 700;
}
.acoes-btn-main small {
  font-size: var(--fs-note);
  opacity: 0.92;
}

.acoes-btn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  animation: acoesDot 1.3s ease-in-out infinite;
}

.acoes-btn.blink {
  animation: acoesPulse 1.3s ease-in-out infinite;
}

@keyframes acoesPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 14px 2px var(--acao-cor, #ef4444);
    filter: brightness(1.13);
  }
}

@keyframes acoesDot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.acoes-sub {
  font-size: var(--fs-note);
  color: var(--sidebar-muted);
  margin-top: 0.45rem;
  line-height: 1.45;
}

.acoes-btn-secondary {
  display: block;
  text-align: center;
  margin-top: 0.5rem;
  text-decoration: none;
  font-size: var(--fs-note);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.35rem;
  padding: 0.45rem;
  transition: background 0.15s ease;
}

.acoes-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

@media (prefers-reduced-motion: reduce) {
  .acoes-btn.blink,
  .acoes-btn-dot {
    animation: none;
  }
  .meter-cell--blink,
  .worst-card--blink,
  .worst-level--blink {
    animation: none;
  }
  .leaflet-interactive.ua-alert-blink {
    animation: none;
  }
  .legend-block {
    transition: none;
  }
}

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* ============================================================================
   MARCA NAS SIDEBARS — layout em grade: icone a esquerda ocupando a altura das
   duas linhas; nome e complemento em coluna, alinhados a esquerda e comecando
   no mesmo ponto (referencia: logo do SICARD). O cabecalho da marca vira
   display: contents para que icone, nome e complemento entrem na mesma grade.
   ============================================================================ */

.sidebar-header .logo {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.45em;
  row-gap: 0.1em;
  align-items: center;
  align-content: center;
  justify-content: start;
  text-align: left;
}
.sidebar-header .logo-mark { display: contents; }
.sidebar-header .logo-icon { grid-column: 1; grid-row: 1 / span 2; width: 1.8em; height: 1.8em; align-self: center; }
.sidebar-header .logo-mark > span { grid-column: 2; grid-row: 1; align-self: end; }
.sidebar-header .logo-sub { grid-column: 2; grid-row: 2; align-self: start; margin: 0; padding: 0; text-align: left; }

.sidebar-header .logo { column-gap: 0.35em; }
.sidebar-header .logo-icon { width: 1.6em; height: 1.6em; }

.sidebar-header .logo-icon { width: auto; height: 100%; aspect-ratio: 1 / 1; align-self: stretch; }

.sidebar-header .logo-icon { width: 1.79em; height: 1.79em; aspect-ratio: auto; align-self: center; }
